summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2011-06-21 15:18:05 -0700
committerLeyla Farazha <leyla@lindenlab.com>2011-06-21 15:18:05 -0700
commite2f9276a083f5883e250b0edcc5c68273985be8b (patch)
tree091801db6fbcdb1c83fb1713b5d017f621726cea /indra/newview
parent917e2d18973bd17929d589ee58b3f47a09c7157b (diff)
EXP-877 Profile button not active when selecting items in Marketplace inbox
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llavataractions.cpp64
-rw-r--r--indra/newview/llavataractions.h3
-rw-r--r--indra/newview/llsidepanelinventory.cpp80
3 files changed, 92 insertions, 55 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index cbbdcb2983..eeb4ec8458 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -69,6 +69,7 @@
#include "lltrans.h"
#include "llcallingcard.h"
#include "llslurl.h" // IDEVO
+#include "llsidepanelinventory.h"
// static
void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name)
@@ -444,8 +445,6 @@ void LLAvatarActions::share(const LLUUID& id)
namespace action_give_inventory
{
- typedef std::set<LLUUID> uuid_set_t;
-
/**
* Returns a pointer to 'Add More' inventory panel of Edit Outfit SP.
*/
@@ -475,18 +474,16 @@ namespace action_give_inventory
/**
* Checks My Inventory visibility.
*/
+
static bool is_give_inventory_acceptable()
{
- LLInventoryPanel* active_panel = get_active_inventory_panel();
- if (!active_panel) return false;
-
// check selection in the panel
- const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
+ const std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
if (inventory_selected_uuids.empty()) return false; // nothing selected
bool acceptable = false;
- uuid_set_t::const_iterator it = inventory_selected_uuids.begin();
- const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end();
+ std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
+ const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
for (; it != it_end; ++it)
{
LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
@@ -529,12 +526,12 @@ namespace action_give_inventory
}
}
- static void build_items_string(const uuid_set_t& inventory_selected_uuids , std::string& items_string)
+ static void build_items_string(const std::set<LLUUID>& inventory_selected_uuids , std::string& items_string)
{
llassert(inventory_selected_uuids.size() > 0);
const std::string& separator = LLTrans::getString("words_separator");
- for (uuid_set_t::const_iterator it = inventory_selected_uuids.begin(); ; )
+ for (std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin(); ; )
{
LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
if (NULL != inv_cat)
@@ -570,10 +567,7 @@ namespace action_give_inventory
return;
}
- LLInventoryPanel* active_panel = get_active_inventory_panel();
- if (!active_panel) return;
-
- const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
+ const std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
if (inventory_selected_uuids.empty())
{
return;
@@ -590,8 +584,8 @@ namespace action_give_inventory
// We souldn't open IM session, just calculate session ID for logging purpose. See EXT-6710
const LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, avatar_uuid);
- uuid_set_t::const_iterator it = inventory_selected_uuids.begin();
- const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end();
+ std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
+ const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
const std::string& separator = LLTrans::getString("words_separator");
std::string noncopy_item_names;
@@ -654,10 +648,7 @@ namespace action_give_inventory
{
llassert(avatar_names.size() == avatar_uuids.size());
- LLInventoryPanel* active_panel = get_active_inventory_panel();
- if (!active_panel) return;
-
- const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
+ const std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
if (inventory_selected_uuids.empty())
{
return;
@@ -678,6 +669,33 @@ namespace action_give_inventory
}
}
+
+
+//static
+std::set<LLUUID> LLAvatarActions::getInventorySelectedUUIDs()
+{
+ std::set<LLUUID> inventory_selected_uuids;
+
+ LLInventoryPanel* active_panel = action_give_inventory::get_active_inventory_panel();
+ if (active_panel)
+ {
+ inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
+ }
+
+ if (inventory_selected_uuids.empty())
+ {
+ LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory");
+ LLInventoryPanel * inbox = sidepanel_inventory->findChild<LLInventoryPanel>("inventory_inbox");
+ if (inbox)
+ {
+ inventory_selected_uuids = inbox->getRootFolder()->getSelectionList();
+ }
+
+ }
+
+ return inventory_selected_uuids;
+}
+
//static
void LLAvatarActions::shareWithAvatars()
{
@@ -705,12 +723,12 @@ bool LLAvatarActions::canShareSelectedItems(LLInventoryPanel* inv_panel /* = NUL
// check selection in the panel
LLFolderView* root_folder = inv_panel->getRootFolder();
- const uuid_set_t inventory_selected_uuids = root_folder->getSelectionList();
+ const std::set<LLUUID> inventory_selected_uuids = root_folder->getSelectionList();
if (inventory_selected_uuids.empty()) return false; // nothing selected
bool can_share = true;
- uuid_set_t::const_iterator it = inventory_selected_uuids.begin();
- const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end();
+ std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
+ const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
for (; it != it_end; ++it)
{
LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index 956fed7461..fbfd815f41 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -36,6 +36,7 @@
class LLInventoryPanel;
+
/**
* Friend-related actions (add, remove, offer teleport, etc)
*/
@@ -196,6 +197,8 @@ public:
*/
static bool canShareSelectedItems(LLInventoryPanel* inv_panel = NULL);
+ static std::set<LLUUID> getInventorySelectedUUIDs();
+
private:
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
static bool handleRemove(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 864637d744..79d68de289 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -246,11 +246,11 @@ void LLSidepanelInventory::handleLoginComplete()
url += "api/1/users/";
url += gAgent.getID().getString();
url += "/user_status";
-
- LLSD headers = LLSD::emptyMap();
- headers["Accept"] = "*/*";
- headers["Cookie"] = LLViewerMedia::getOpenIDCookie();
- headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent();
+
+ LLSD headers = LLSD::emptyMap();
+ headers["Accept"] = "*/*";
+ headers["Cookie"] = LLViewerMedia::getOpenIDCookie();
+ headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent();
LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this), headers);
@@ -423,22 +423,24 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action)
LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
- return;
+ LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
+ if (inbox)
+ {
+ current_item = inbox->getRootFolder()->getCurSelectedItem();
+ if (!current_item)
+ {
+ return;
+ }
+ }
}
+
current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getModel(), action);
}
void LLSidepanelInventory::onWearButtonClicked()
{
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
- if (!panel_main_inventory)
- {
- llassert(panel_main_inventory != NULL);
- return;
- }
-
// Get selected items set.
- const std::set<LLUUID> selected_uuids_set = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
+ const std::set<LLUUID> selected_uuids_set = LLAvatarActions::getInventorySelectedUUIDs();
if (selected_uuids_set.empty()) return; // nothing selected
// Convert the set to a vector.
@@ -574,34 +576,29 @@ void LLSidepanelInventory::updateVerbs()
bool LLSidepanelInventory::canShare()
{
+ bool can_share = false;
+
LLPanelMainInventory* panel_main_inventory =
mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
- if (!panel_main_inventory)
- {
- llwarns << "Failed to get the main inventory panel" << llendl;
- return false;
- }
+ LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- LLInventoryPanel* active_panel = panel_main_inventory->getActivePanel();
+ return ( (panel_main_inventory ? LLAvatarActions::canShareSelectedItems(panel_main_inventory->getActivePanel()) : false)
+ || (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) );
+
// Avoid flicker in the Recent tab while inventory is being loaded.
- if (!active_panel->getRootFolder()->hasVisibleChildren()) return false;
-
- return LLAvatarActions::canShareSelectedItems(active_panel);
+ //if (!active_panel->getRootFolder()->hasVisibleChildren()) return false;
}
+
bool LLSidepanelInventory::canWearSelected()
{
- LLPanelMainInventory* panel_main_inventory =
- mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
- if (!panel_main_inventory)
- {
- llassert(panel_main_inventory != NULL);
+ std::set<LLUUID> selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
+
+ if (selected_uuids.empty())
return false;
- }
- std::set<LLUUID> selected_uuids = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
for (std::set<LLUUID>::const_iterator it = selected_uuids.begin();
it != selected_uuids.end();
++it)
@@ -618,7 +615,15 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
- return NULL;
+ LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
+ if (inbox)
+ {
+ current_item = inbox->getRootFolder()->getCurSelectedItem();
+ if (!current_item)
+ {
+ return NULL;
+ }
+ }
}
const LLUUID &item_id = current_item->getListener()->getUUID();
LLInventoryItem *item = gInventory.getItem(item_id);
@@ -627,9 +632,20 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
U32 LLSidepanelInventory::getSelectedCount()
{
+ int count = 0;
+
LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
- return selection_list.size();
+ count += selection_list.size();
+
+ LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
+ if (inbox)
+ {
+ selection_list = inbox->getRootFolder()->getSelectionList();
+ count += selection_list.size();
+ }
+
+ return count;
}
LLInventoryPanel *LLSidepanelInventory::getActivePanel()