EXT-2410 : Accepting an offered item should open the inventorySP
Added a new "Quiet" query for folder types, so I don't have to special case all the folders where we don't want UI notifications from inventory offers. Fixed a bug where a sidepanel was considered active even if the sidetray was closed. --HG-- branch : avatar-pipelinemeow-7.2.2
parent
e23d517007
commit
202d86b155
|
|
@ -211,6 +211,25 @@ BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(const LLUUID& obj_id) const
|
||||
{
|
||||
const LLInventoryObject* obj = getObject(obj_id);
|
||||
const LLUUID& parent_id = obj->getParentUUID();
|
||||
while (!parent_id.isNull())
|
||||
{
|
||||
const LLViewerInventoryCategory *cat = getCategory(parent_id);
|
||||
if (!cat) break;
|
||||
const LLFolderType::EType folder_type = cat->getPreferredType();
|
||||
if (folder_type != LLFolderType::FT_NONE &&
|
||||
folder_type != LLFolderType::FT_ROOT_INVENTORY &&
|
||||
!LLFolderType::lookupIsEnsembleType(folder_type))
|
||||
{
|
||||
return cat;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the object by id. Returns NULL if not found.
|
||||
LLInventoryObject* LLInventoryModel::getObject(const LLUUID& id) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,10 +108,12 @@ public:
|
|||
// Accessors
|
||||
//
|
||||
|
||||
// This is a convenience function to check if one object has a
|
||||
// parent chain up to the category specified by UUID.
|
||||
// Check if one object has a parent chain up to the category specified by UUID.
|
||||
BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
|
||||
|
||||
// Get whatever special folder this object is a child of, if any.
|
||||
const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
|
||||
|
||||
// Get the object by id. Returns NULL if not found.
|
||||
// * WARNING: use the pointer returned for read operations - do
|
||||
// not modify the object values in place or you will break stuff.
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ LLPanel* LLSideTray::getPanel (const std::string& panel_name)
|
|||
|
||||
LLPanel* LLSideTray::getActivePanel()
|
||||
{
|
||||
if (mActiveTab)
|
||||
if (mActiveTab && !mCollapsed)
|
||||
{
|
||||
return mActiveTab->getPanel();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,12 +43,14 @@ struct ViewerFolderEntry : public LLDictionaryEntry
|
|||
{
|
||||
// Constructor for non-ensembles
|
||||
ViewerFolderEntry(const std::string &new_category_name, // default name when creating a new category of this type
|
||||
const std::string &icon_name // name of the folder icon
|
||||
const std::string &icon_name, // name of the folder icon
|
||||
BOOL is_quiet // folder doesn't need a UI update when changed
|
||||
)
|
||||
:
|
||||
LLDictionaryEntry(empty_string), // no reverse lookup needed on non-ensembles, so just leave this blank
|
||||
mIconName(icon_name),
|
||||
mNewCategoryName(new_category_name)
|
||||
mNewCategoryName(new_category_name),
|
||||
mIsQuiet(is_quiet)
|
||||
{
|
||||
mAllowedNames.clear();
|
||||
}
|
||||
|
|
@ -62,7 +64,8 @@ struct ViewerFolderEntry : public LLDictionaryEntry
|
|||
:
|
||||
LLDictionaryEntry(xui_name),
|
||||
mIconName(icon_name),
|
||||
mNewCategoryName(new_category_name)
|
||||
mNewCategoryName(new_category_name),
|
||||
mIsQuiet(FALSE)
|
||||
{
|
||||
const std::string delims (",");
|
||||
LLStringUtilBase<char>::getTokens(allowed_names, mAllowedNames, delims);
|
||||
|
|
@ -85,6 +88,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry
|
|||
const std::string mNewCategoryName;
|
||||
typedef std::vector<std::string> name_vec_t;
|
||||
name_vec_t mAllowedNames;
|
||||
BOOL mIsQuiet;
|
||||
};
|
||||
|
||||
class LLViewerFolderDictionary : public LLSingleton<LLViewerFolderDictionary>,
|
||||
|
|
@ -100,31 +104,31 @@ LLViewerFolderDictionary::LLViewerFolderDictionary()
|
|||
{
|
||||
initEnsemblesFromFile();
|
||||
|
||||
// NEW CATEGORY NAME FOLDER ICON NAME
|
||||
// |-------------------------|---------------------------|
|
||||
addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "inv_folder_texture.tga"));
|
||||
addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "inv_folder_sound.tga"));
|
||||
addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "inv_folder_callingcard.tga"));
|
||||
addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "inv_folder_landmark.tga"));
|
||||
addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "inv_folder_clothing.tga"));
|
||||
addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "inv_folder_object.tga"));
|
||||
addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "inv_folder_notecard.tga"));
|
||||
addEntry(LLFolderType::FT_ROOT_INVENTORY, new ViewerFolderEntry("My Inventory", ""));
|
||||
addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "inv_folder_script.tga"));
|
||||
addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "inv_folder_bodypart.tga"));
|
||||
addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "inv_folder_trash.tga"));
|
||||
addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "inv_folder_snapshot.tga"));
|
||||
addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "inv_folder_lostandfound.tga"));
|
||||
addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "inv_folder_animation.tga"));
|
||||
addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "inv_folder_gesture.tga"));
|
||||
addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorite", "inv_folder_plain_closed.tga"));
|
||||
// NEW CATEGORY NAME FOLDER ICON NAME QUIET?
|
||||
// |-------------------------|-------------------------------|-----------|
|
||||
addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "inv_folder_texture.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "inv_folder_sound.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "inv_folder_callingcard.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "inv_folder_landmark.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "inv_folder_clothing.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "inv_folder_object.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "inv_folder_notecard.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_ROOT_INVENTORY, new ViewerFolderEntry("My Inventory", "", FALSE));
|
||||
addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "inv_folder_script.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "inv_folder_bodypart.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "inv_folder_trash.tga", TRUE));
|
||||
addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "inv_folder_snapshot.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "inv_folder_lostandfound.tga", TRUE));
|
||||
addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "inv_folder_animation.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "inv_folder_gesture.tga", FALSE));
|
||||
addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorite", "inv_folder_plain_closed.tga", FALSE));
|
||||
|
||||
addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "inv_folder_current_outfit.tga"));
|
||||
addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "inv_folder_outfit.tga"));
|
||||
addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "inv_folder_my_outfits.tga"));
|
||||
addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Inbox", "inv_folder_inbox.tga"));
|
||||
addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "inv_folder_current_outfit.tga",TRUE));
|
||||
addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "inv_folder_outfit.tga", TRUE));
|
||||
addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "inv_folder_my_outfits.tga", TRUE));
|
||||
addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Inbox", "inv_folder_inbox.tga", FALSE));
|
||||
|
||||
addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "inv_folder_plain_closed.tga"));
|
||||
addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "inv_folder_plain_closed.tga", FALSE));
|
||||
}
|
||||
|
||||
bool LLViewerFolderDictionary::initEnsemblesFromFile()
|
||||
|
|
@ -219,6 +223,17 @@ const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder
|
|||
return badLookup();
|
||||
}
|
||||
|
||||
BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type)
|
||||
{
|
||||
const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
|
||||
if (entry)
|
||||
{
|
||||
return entry->mIsQuiet;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
const std::string &LLViewerFolderType::lookupNewCategoryName(LLFolderType::EType folder_type)
|
||||
{
|
||||
const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
|
||||
|
|
|
|||
|
|
@ -44,11 +44,13 @@ public:
|
|||
static const std::string& lookupXUIName(EType folder_type); // name used by the UI
|
||||
static LLFolderType::EType lookupTypeFromXUIName(const std::string& name);
|
||||
|
||||
static const std::string& lookupIconName(EType asset_type); // folder icon name
|
||||
static const std::string& lookupIconName(EType folder_type); // folder icon name
|
||||
static BOOL lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured
|
||||
static const std::string& lookupNewCategoryName(EType folder_type); // default name when creating new category
|
||||
static LLFolderType::EType lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category
|
||||
|
||||
static U64 lookupValidFolderTypes(const std::string& item_name); // which folders allow an item of this type?
|
||||
|
||||
protected:
|
||||
LLViewerFolderType() {}
|
||||
~LLViewerFolderType() {}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include "lltransactionflags.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llappearancemgr.h"
|
||||
#include "llcallingcard.h"
|
||||
#include "llfirstuse.h"
|
||||
#include "llfloaterbuycurrency.h"
|
||||
|
|
@ -74,6 +73,7 @@
|
|||
#include "llstatusbar.h"
|
||||
#include "llimview.h"
|
||||
#include "lltrans.h"
|
||||
#include "llviewerfoldertype.h"
|
||||
#include "llviewergenericmessage.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
|
|
@ -825,11 +825,6 @@ 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)
|
||||
{
|
||||
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
|
||||
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)
|
||||
|
|
@ -841,14 +836,28 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
|
|||
LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL;
|
||||
continue;
|
||||
}
|
||||
if(gInventory.isObjectDescendentOf(item_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if we are throttled, don't display them
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Special handling for various types.
|
||||
const LLAssetType::EType asset_type = item->getType();
|
||||
if (check_offer_throttle(from_name, false))
|
||||
if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
|
||||
{
|
||||
// If we opened this ourselves, focus it
|
||||
const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
|
||||
|
|
@ -894,17 +903,6 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
|
|||
LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
|
||||
if(active_panel)
|
||||
{
|
||||
// Don't select lost and found items if the user is active
|
||||
if (gInventory.isObjectDescendentOf(item_id, lost_and_found_id) &&
|
||||
!user_is_away)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (gInventory.isObjectDescendentOf(item_id, cof_id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LL_DEBUGS("Messaging") << "Highlighting" << item_id << LL_ENDL;
|
||||
LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
|
||||
active_panel->setSelection(item_id, TAKE_FOCUS_NO);
|
||||
|
|
|
|||
Loading…
Reference in New Issue