summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDenis Serdjuk <dserduk@productengine.com>2009-12-07 19:42:11 +0200
committerDenis Serdjuk <dserduk@productengine.com>2009-12-07 19:42:11 +0200
commitda8de2b6742cad3fadad84c9f0640b69a9690f66 (patch)
tree3182000cd24ad0d5bb84cff84c8985e93074f9b3 /indra/newview
parent0a88e412cc5b6b27bddc90b905214dceca65e5e1 (diff)
implemented Task EXT-2304 Offer Notifications should include a link that highlights the landmark or item in the appropriate side panel
Changes: 1.highlighting of landmarks was broken by LLInventoryPanel::getActiveInventoryPanel(). 2. escaping of urls --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewerinventory.cpp3
-rw-r--r--indra/newview/llviewermessage.cpp94
2 files changed, 39 insertions, 58 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 5bdcbc79bd..839e035272 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -85,7 +85,8 @@ public:
{
std::vector<LLUUID> items_to_open;
items_to_open.push_back(inventory_id);
- open_inventory_offer(items_to_open, "");
+ //inventory_handler is just a stub, because we don't know from who this offer
+ open_inventory_offer(items_to_open, "inventory_handler");
return true;
}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 558382b0a7..d6b57dfced 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 "lluri.h"
#include "llviewergenericmessage.h"
#include "llviewermenu.h"
#include "llviewerobjectlist.h"
@@ -827,6 +828,8 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
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);
+ const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ BOOL user_is_away = gAwayTimer.getStarted();
LLInventoryItem* item;
for(; it != end; ++it)
{
@@ -837,7 +840,10 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
LL_WARNS("Messaging") << "Unable to show inventory item: " << id << LL_ENDL;
continue;
}
- if(gInventory.isObjectDescendentOf(id, trash_id))
+ // don't select trash or lost and found items if the user is active
+ if(gInventory.isObjectDescendentOf(id, trash_id) ||
+ (gInventory.isObjectDescendentOf(item->getUUID(), lost_and_found_id)
+ && !user_is_away) )
{
continue;
}
@@ -846,6 +852,7 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
//if we are throttled, don't display them
if (check_offer_throttle(from_name, false))
{
+ LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL;
// If we opened this ourselves, focus it
BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
switch(asset_type)
@@ -856,71 +863,44 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
case LLAssetType::AT_LANDMARK:
{
LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
- LLSD args;
- args["LANDMARK_NAME"] = item->getName();
- args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown");
- 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)
+ if ("inventory_handler" == from_name)
{
- panel->setItem(item);
+ //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(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);
+ // Created landmark is passed to Places panel to allow its editing. In fact panel should be already displayed.
+ //TODO*:: dserduk(7/12/09) remove LLPanelPlaces dependency from here
+ LLPanelPlaces *panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", LLSD()));
+ if (panel)
+ {
+ panel->setItem(item);
+ }
+ }
+ }
break;
case LLAssetType::AT_TEXTURE:
LLFloaterReg::showInstance("preview_texture", LLSD(id), take_focus);
break;
default:
+ if(gSavedSettings.getBOOL("ShowInInventory") &&
+ asset_type != LLAssetType::AT_CALLINGCARD &&
+ item->getInventoryType() != LLInventoryType::IT_ATTACHMENT &&
+ !from_name.empty())
+ {
+ LLSideTray::getInstance()->showPanel("sidepanel_inventory",
+ LLSD().with("select", item->getUUID()));
+ }
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();
- 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
-
- LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
- active_panel->setSelection(item->getUUID(), TAKE_FOCUS_NO);
- gFocusMgr.setKeyboardFocus(focus_ctrl);
- }
}
}
@@ -1461,7 +1441,7 @@ void inventory_offer_handler(LLOfferInfo* info)
args["OBJECTFROMNAME"] = info->mFromName;
args["NAME"] = info->mFromName;
args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
- std::string verb = "select?name=" + msg;
+ std::string verb = "select?name=" + LLURI::escape(msg);
args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
LLNotification::Params p("ObjectGiveItem");