summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rw-r--r--indra/newview/llviewermessage.cpp166
1 files changed, 93 insertions, 73 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3d107555bf..d81fa5ee1c 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -702,7 +702,7 @@ static void highlight_inventory_items_in_panel(const std::vector<LLUUID>& items,
++item_iter)
{
const LLUUID& item_id = (*item_iter);
- if(!highlight_offered_item(item_id))
+ if(!highlight_offered_object(item_id))
{
continue;
}
@@ -753,6 +753,18 @@ public:
const std::string& from_name) :
LLInventoryFetchItemsObserver(object_id),
mFromName(from_name) {}
+ /*virtual*/ void startFetch()
+ {
+ for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+ if (cat)
+ {
+ mComplete.push_back((*it));
+ }
+ }
+ LLInventoryFetchItemsObserver::startFetch();
+ }
/*virtual*/ void done()
{
open_inventory_offer(mComplete, mFromName);
@@ -1065,111 +1077,119 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
}
}
-void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name)
+void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name)
{
- for (uuid_vec_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
+ for (uuid_vec_t::const_iterator obj_iter = objects.begin();
+ obj_iter != objects.end();
+ ++obj_iter)
{
- const LLUUID& item_id = (*item_iter);
- if(!highlight_offered_item(item_id))
+ const LLUUID& obj_id = (*obj_iter);
+ if(!highlight_offered_object(obj_id))
{
continue;
}
- LLInventoryItem* item = gInventory.getItem(item_id);
- llassert(item);
- if (!item) {
+ const LLInventoryObject *obj = gInventory.getObject(obj_id);
+ if (!obj)
+ {
+ llwarns << "Cannot find object [ itemID:" << obj_id << " ] to open." << llendl;
continue;
}
- ////////////////////////////////////////////////////////////////////////////////
- // Special handling for various types.
- const LLAssetType::EType asset_type = item->getActualType();
- if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
- {
- LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL;
- // If we opened this ourselves, focus it
- const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
- switch(asset_type)
+ const LLAssetType::EType asset_type = obj->getActualType();
+
+ // Either an inventory item or a category.
+ const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
+ if (item)
+ {
+ ////////////////////////////////////////////////////////////////////////////////
+ // Special handling for various types.
+ if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
{
- case LLAssetType::AT_NOTECARD:
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(item_id), take_focus);
- break;
- }
- case LLAssetType::AT_LANDMARK:
- {
- LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
- if ("inventory_handler" == from_name)
+ LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL;
+ // If we opened this ourselves, focus it
+ const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_NOTECARD:
{
- //we have to filter inventory_handler messages to avoid notification displaying
- LLSideTray::getInstance()->showPanel("panel_places",
- LLSD().with("type", "landmark").with("id", item->getUUID()));
+ LLFloaterReg::showInstance("preview_notecard", LLSD(obj_id), take_focus);
+ break;
}
- else if("group_offer" == from_name)
+ case LLAssetType::AT_LANDMARK:
{
- // "group_offer" is passed by LLOpenTaskGroupOffer
- // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done().
- LLSD args;
- args["type"] = "landmark";
- args["id"] = item_id;
- LLSideTray::getInstance()->showPanel("panel_places", args);
-
- continue;
+ LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
+ if ("inventory_handler" == from_name)
+ {
+ //we have to filter inventory_handler messages to avoid notification displaying
+ LLSideTray::getInstance()->showPanel("panel_places",
+ LLSD().with("type", "landmark").with("id", item->getUUID()));
+ }
+ else if("group_offer" == from_name)
+ {
+ // "group_offer" is passed by LLOpenTaskGroupOffer
+ // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done().
+ LLSD args;
+ args["type"] = "landmark";
+ args["id"] = obj_id;
+ LLSideTray::getInstance()->showPanel("panel_places", args);
+
+ continue;
+ }
+ else if(from_name.empty())
+ {
+ // we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
+ LLSD args;
+ args["LANDMARK_NAME"] = item->getName();
+ args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown");
+ LLNotificationsUtil::add("LandmarkCreated", args);
+ }
}
- else if(from_name.empty())
+ break;
+ case LLAssetType::AT_TEXTURE:
{
- // we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
- LLSD args;
- args["LANDMARK_NAME"] = item->getName();
- args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown");
- LLNotificationsUtil::add("LandmarkCreated", args);
+ LLFloaterReg::showInstance("preview_texture", LLSD(obj_id), take_focus);
+ break;
}
+ case LLAssetType::AT_ANIMATION:
+ LLFloaterReg::showInstance("preview_anim", LLSD(obj_id), take_focus);
+ break;
+ case LLAssetType::AT_SCRIPT:
+ LLFloaterReg::showInstance("preview_script", LLSD(obj_id), take_focus);
+ break;
+ case LLAssetType::AT_SOUND:
+ LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
+ break;
+ default:
+ break;
}
- break;
- case LLAssetType::AT_TEXTURE:
- {
- LLFloaterReg::showInstance("preview_texture", LLSD(item_id), take_focus);
- break;
- }
- case LLAssetType::AT_ANIMATION:
- LLFloaterReg::showInstance("preview_anim", LLSD(item_id), take_focus);
- break;
- case LLAssetType::AT_SCRIPT:
- LLFloaterReg::showInstance("preview_script", LLSD(item_id), take_focus);
- break;
- case LLAssetType::AT_SOUND:
- LLFloaterReg::showInstance("preview_sound", LLSD(item_id), take_focus);
- break;
- default:
- break;
}
}
-
+
////////////////////////////////////////////////////////////////////////////////
// Highlight item if it's not in the trash, lost+found, or COF
- const BOOL auto_open = gSavedSettings.getBOOL("ShowInInventory") &&
+ const BOOL auto_open =
+ gSavedSettings.getBOOL("ShowInInventory") &&
(asset_type != LLAssetType::AT_CALLINGCARD) &&
- (item->getInventoryType() != LLInventoryType::IT_ATTACHMENT) &&
+ !(item && item->getInventoryType() != LLInventoryType::IT_ATTACHMENT) &&
!from_name.empty();
LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
if(active_panel)
{
- LL_DEBUGS("Messaging") << "Highlighting" << item_id << LL_ENDL;
+ LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL;
LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
- active_panel->setSelection(item_id, TAKE_FOCUS_NO);
+ active_panel->setSelection(obj_id, TAKE_FOCUS_NO);
gFocusMgr.setKeyboardFocus(focus_ctrl);
}
}
}
-bool highlight_offered_item(const LLUUID& item_id)
+bool highlight_offered_object(const LLUUID& obj_id)
{
- LLInventoryItem* item = gInventory.getItem(item_id);
- if(!item)
+ const LLInventoryObject* obj = gInventory.getObject(obj_id);
+ if(!obj)
{
- LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL;
+ LL_WARNS("Messaging") << "Unable to show inventory item: " << obj_id << LL_ENDL;
return false;
}
@@ -1178,7 +1198,7 @@ bool highlight_offered_item(const LLUUID& item_id)
// notification (e.g. trash, cof, lost-and-found).
if(!gAgent.getAFK())
{
- const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id);
+ const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
if (parent)
{
const LLFolderType::EType parent_type = parent->getPreferredType();