diff options
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rw-r--r-- | indra/newview/llviewermessage.cpp | 109 |
1 files changed, 48 insertions, 61 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 85b6051502..507e34348b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -73,6 +73,7 @@ #include "llstatusbar.h" #include "llimview.h" #include "lltrans.h" +#include "llviewerfoldertype.h" #include "llviewergenericmessage.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" @@ -824,35 +825,49 @@ 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& id = *it; - item = gInventory.getItem(id); + for (std::vector<LLUUID>::const_iterator item_iter = items.begin(); + item_iter != items.end(); + ++item_iter) + { + 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)) + + //////////////////////////////////////////////////////////////////////////////// + // Don't highlight if it's in certain "quiet" folders which don't need UI + // notification (e.g. trash, cof, lost-and-found). + const BOOL user_is_away = gAwayTimer.getStarted(); + if(!user_is_away) { - continue; + const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id); + if (parent) + { + const LLFolderType::EType parent_type = parent->getPreferredType(); + if (LLViewerFolderType::lookupIsQuietType(parent_type)) + { + continue; + } + } } - LLAssetType::EType asset_type = item->getType(); - //if we are throttled, don't display them - if (check_offer_throttle(from_name, false)) + //////////////////////////////////////////////////////////////////////////////// + // Special handling for various types. + const LLAssetType::EType asset_type = item->getType(); + if (check_offer_throttle(from_name, false)) // If we are throttled, don't display { // 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 +877,35 @@ 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)) - { - return; - } - 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) - { - return; - } - - //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); } } |