diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 68 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinboxinventory.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.h | 6 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 9 |
6 files changed, 96 insertions, 23 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 18c3f76826..f4e6d32510 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1128,19 +1128,71 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) { // Make sure the floater is not minimized (STORM-438). if (active_inv_floaterp && active_inv_floaterp->isMinimized()) + { active_inv_floaterp->setMinimized(FALSE); + } + } + else if (auto_open) + { + floater_inventory->openFloater(); - return res; + res = sidepanel_inventory->getActivePanel(); } + + return res; +} + +//static +void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id) +{ + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open); + + if (active_panel) + { + LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL; - // C. If no panels are open and we don't want to force open a panel, then just abort out. - if (!auto_open) return NULL; - - // D. Open the inventory side panel floater and use that. - floater_inventory->openFloater(); - return sidepanel_inventory->getActivePanel(); + LLViewerInventoryItem * item = gInventory.getItem(obj_id); + + bool item_in_inbox = false; + bool item_in_outbox = false; + + if (item) + { + LLViewerInventoryCategory * cat = gInventory.getCategory(item->getParentUUID()); + + if (cat) + { + item_in_inbox = (LLFolderType::FT_INBOX == cat->getPreferredType()); + item_in_outbox = (LLFolderType::FT_OUTBOX == cat->getPreferredType()); + } + } + + if (item_in_inbox || item_in_outbox) + { + LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); + LLInventoryPanel * inventory_panel = NULL; + + if (item_in_inbox) + { + sidepanel_inventory->openInbox(); + inventory_panel = sidepanel_inventory->getInboxPanel(); + } + else + { + sidepanel_inventory->openOutbox(); + inventory_panel = sidepanel_inventory->getOutboxPanel(); + } - return NULL; + if (inventory_panel) + { + inventory_panel->setSelection(obj_id, TAKE_FOCUS_YES); + } + } + else + { + active_panel->setSelection(obj_id, TAKE_FOCUS_YES); + } + } } void LLInventoryPanel::addHideFolderType(LLFolderType::EType folder_type) diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 8635ebc5c8..2a24327115 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -175,6 +175,8 @@ public: // Find whichever inventory panel is active / on top. // "Auto_open" determines if we open an inventory panel if none are open. static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE); + + static void openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id); protected: void openStartFolderOrMyInventory(); // open the first level of inventory diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index df89adb8da..678e4f2843 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -189,16 +189,16 @@ void LLInboxFolderViewFolder::draw() void LLInboxFolderViewFolder::selectItem() { - LLFolderViewFolder::selectItem(); - deFreshify(); + + LLFolderViewFolder::selectItem(); } void LLInboxFolderViewFolder::toggleOpen() { - LLFolderViewFolder::toggleOpen(); - deFreshify(); + + LLFolderViewFolder::toggleOpen(); } void LLInboxFolderViewFolder::computeFreshness() @@ -270,7 +270,9 @@ BOOL LLInboxFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) { - return TRUE; + deFreshify(); + + return LLFolderViewItem::handleDoubleClick(x, y, mask); } // virtual @@ -290,9 +292,9 @@ void LLInboxFolderViewItem::draw() void LLInboxFolderViewItem::selectItem() { - LLFolderViewItem::selectItem(); - deFreshify(); + + LLFolderViewItem::selectItem(); } void LLInboxFolderViewItem::computeFreshness() diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 91f8035556..9d069c3996 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -450,6 +450,24 @@ void LLSidepanelInventory::enableOutbox(bool enabled) } } +void LLSidepanelInventory::openInbox() +{ + if (mInboxEnabled) + { + getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); + onToggleInboxBtn(); + } +} + +void LLSidepanelInventory::openOutbox() +{ + if (mOutboxEnabled) + { + getChild<LLButton>(OUTBOX_BUTTON_NAME)->setToggleState(true); + onToggleOutboxBtn(); + } +} + void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) { // Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 4e34926a4b..2c6f807013 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -58,6 +58,9 @@ public: /*virtual*/ void onOpen(const LLSD& key); LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any. + LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox; } + LLInventoryPanel* getOutboxPanel() const { return mInventoryPanelOutbox; } + LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; } BOOL isMainInventoryPanelActive() const; @@ -77,6 +80,9 @@ public: void enableInbox(bool enabled); void enableOutbox(bool enabled); + void openInbox(); + void openOutbox(); + bool isInboxEnabled() const { return mInboxEnabled; } bool isOutboxEnabled() const { return mOutboxEnabled; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a9ca70fd26..68dd07877b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1256,14 +1256,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam const BOOL auto_open = gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false !from_name.empty(); // don't open if it's not from anyone. - LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open); - if(active_panel) - { - LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL; - LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); - active_panel->setSelection(obj_id, TAKE_FOCUS_NO); - gFocusMgr.setKeyboardFocus(focus_ctrl); - } + LLInventoryPanel::openInventoryPanelAndSetSelection(auto_open, obj_id); } } |