summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-12-03 11:18:59 -0500
committerLoren Shih <seraph@lindenlab.com>2009-12-03 11:18:59 -0500
commit2adf9d6b0490f7692998f0ed73c981238d5860fe (patch)
treee9971d2fa83f962c7196badbc5a6d51ab3db0c7d /indra/newview
parent99179a0195db1b434dced9b26f3f8b97b773c073 (diff)
EXT-2410 : Accepting an offered notecard should open the inventorySP
Preliminary checkin to improve this infrastructure. --HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorypanel.h3
-rw-r--r--indra/newview/llsidepanelinventory.cpp4
-rw-r--r--indra/newview/llviewermessage.cpp91
3 files changed, 42 insertions, 56 deletions
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index d65fe53812..02e6041a38 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -163,7 +163,8 @@ public:
static void onIdle(void* user_data);
// Find whichever inventory panel is active / on top.
- static LLInventoryPanel *getActiveInventoryPanel();
+ // "Auto_open" determines if we open an inventory panel if none are open.
+ static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE);
protected:
void defaultOpenInventory(); // open the first level of inventory
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 9ab459080e..5f27a21bb5 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -128,10 +128,6 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
mTaskPanel->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
showTaskInfoPanel();
}
- if (key.has("select"))
- {
- mPanelMainInventory->getPanel()->setSelection(key["select"].asUUID(), TAKE_FOCUS_NO);
- }
}
void LLSidepanelInventory::onInfoButtonClicked()
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 4d26f6294c..c0be9115a9 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -42,6 +42,7 @@
#include "lltransactionflags.h"
#include "llagent.h"
+#include "llappearancemgr.h"
#include "llcallingcard.h"
#include "llfirstuse.h"
#include "llfloaterbuycurrency.h"
@@ -824,35 +825,40 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name)
{
- std::vector<LLUUID>::const_iterator it = items.begin();
- std::vector<LLUUID>::const_iterator end = items.end();
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLInventoryItem* item;
- for(; it != end; ++it)
+ const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ const LLUUID cof_id = LLAppearanceManager::instance().getCOF();
+ const BOOL user_is_away = gAwayTimer.getStarted();
+
+ for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
{
- const LLUUID& id = *it;
- item = gInventory.getItem(id);
+ const LLUUID& item_id = (*item_iter);
+ LLInventoryItem* item = gInventory.getItem(item_id);
if(!item)
{
- LL_WARNS("Messaging") << "Unable to show inventory item: " << id << LL_ENDL;
+ LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL;
continue;
}
- if(gInventory.isObjectDescendentOf(id, trash_id))
+ if(gInventory.isObjectDescendentOf(item_id, trash_id))
{
continue;
}
- LLAssetType::EType asset_type = item->getType();
//if we are throttled, don't display them
+ const LLAssetType::EType asset_type = item->getType();
if (check_offer_throttle(from_name, false))
{
// If we opened this ourselves, focus it
- BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
+ const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
switch(asset_type)
{
case LLAssetType::AT_NOTECARD:
- LLFloaterReg::showInstance("preview_notecard", LLSD(id), take_focus);
- break;
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(item_id), take_focus);
+ break;
+ }
case LLAssetType::AT_LANDMARK:
{
LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
@@ -862,63 +868,46 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
LLNotificationsUtil::add("LandmarkCreated", args);
// Created landmark is passed to Places panel to allow its editing.
- LLPanelPlaces *panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", LLSD()));
- if (panel)
+ LLPanelPlaces *places_panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", LLSD()));
+ if (places_panel)
{
- panel->setItem(item);
+ places_panel->setItem(item);
}
}
break;
case LLAssetType::AT_TEXTURE:
- LLFloaterReg::showInstance("preview_texture", LLSD(id), take_focus);
- break;
+ {
+ LLFloaterReg::showInstance("preview_texture", LLSD(item_id), take_focus);
+ break;
+ }
default:
break;
}
}
- //highlight item, if it's not in the trash or lost+found
- // Don't auto-open the inventory floater
- if(gSavedSettings.getBOOL("ShowInInventory") &&
- asset_type != LLAssetType::AT_CALLINGCARD &&
- item->getInventoryType() != LLInventoryType::IT_ATTACHMENT &&
- !from_name.empty())
- {
- //TODO:this should be moved to the end of method after all the checks,
- //but first decide what to do with active inventory if any (EK)
- LLSD key;
- key["select"] = item->getUUID();
- LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
- }
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+ ////////////////////////////////////////////////////////////////////////////////
+ // Highlight item if it's not in the trash, lost+found, or COF
+ const BOOL auto_open = gSavedSettings.getBOOL("ShowInInventory") &&
+ (asset_type != LLAssetType::AT_CALLINGCARD) &&
+ (item->getInventoryType() != LLInventoryType::IT_ATTACHMENT) &&
+ !from_name.empty();
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
if(active_panel)
{
- //Trash Check
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ // Don't select lost and found items if the user is active
+ if (gInventory.isObjectDescendentOf(item_id, lost_and_found_id) &&
+ !user_is_away)
{
- return;
+ continue;
}
- const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- //BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view);
- BOOL user_is_away = gAwayTimer.getStarted();
-
- // don't select lost and found items if the user is active
- if (gInventory.isObjectDescendentOf(item->getUUID(), lost_and_found_id)
- && !user_is_away)
+ if (gInventory.isObjectDescendentOf(item_id, cof_id))
{
- return;
+ continue;
}
- //Not sure about this check. Could make it easy to miss incoming items.
- //don't dick with highlight while the user is working
- //if(inventory_has_focus && !user_is_away)
- // break;
- LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID() << LL_ENDL;
- //highlight item
-
+ LL_DEBUGS("Messaging") << "Highlighting" << item_id << LL_ENDL;
LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
- active_panel->setSelection(item->getUUID(), TAKE_FOCUS_NO);
+ active_panel->setSelection(item_id, TAKE_FOCUS_NO);
gFocusMgr.setKeyboardFocus(focus_ctrl);
}
}