summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-02-17 01:20:24 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-02-19 00:05:51 +0200
commit53343bc708339b95f18804e11d6a130b542e0c5b (patch)
treeaac2a6c429e1d8a863dce80d2bc1f9562440520a /indra
parent59092d052f5c8532a5a072ebbafaad038b017640 (diff)
SL-14797 Normalize right-click - favorites panel, part #4
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfavoritesbar.cpp44
-rw-r--r--indra/newview/llfavoritesbar.h1
-rw-r--r--indra/newview/llpanellandmarks.cpp33
-rw-r--r--indra/newview/llpanellandmarks.h6
-rw-r--r--indra/newview/llpanelplaces.cpp16
-rw-r--r--indra/newview/skins/default/xui/en/menu_favorites.xml23
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml25
7 files changed, 130 insertions, 18 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 347997a69a..2394a763ee 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -38,6 +38,7 @@
#include "lltooltip.h"
#include "llagent.h"
+#include "llagentpicksinfo.h"
#include "llavatarnamecache.h"
#include "llclipboard.h"
#include "llinventorybridge.h"
@@ -1194,6 +1195,10 @@ bool LLFavoritesBarCtrl::enableSelected(const LLSD& userdata)
{
return isClipboardPasteable();
}
+ else if (param == "create_pick")
+ {
+ return !LLAgentPicksInfo::getInstance()->isPickLimitReached();
+ }
return false;
}
@@ -1242,6 +1247,13 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
LLFloaterReg::showInstance("world_map", "center");
}
}
+ else if (action == "create_pick")
+ {
+ LLSD args;
+ args["type"] = "create_pick";
+ args["item_id"] = item->getUUID();
+ LLFloaterSidePanelContainer::showPanel("places", args);
+ }
else if (action == "cut")
{
}
@@ -1257,6 +1269,16 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
{
gInventory.removeItem(mSelectedItemID);
}
+ else if (action == "rename")
+ {
+ LLSD args;
+ args["NAME"] = item->getName();
+
+ LLSD payload;
+ payload["id"] = mSelectedItemID;
+
+ LLNotificationsUtil::add("RenameLandmark", args, payload, boost::bind(onRenameCommit, _1, _2));
+ }
// Pop-up the overflow menu again (it gets hidden whenever the user clicks a context menu item).
// See EXT-4217 and STORM-207.
@@ -1269,6 +1291,28 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
}
}
+bool LLFavoritesBarCtrl::onRenameCommit(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LLUUID id = notification["payload"]["id"].asUUID();
+ LLInventoryItem *item = gInventory.getItem(id);
+ std::string landmark_name = response["new_name"].asString();
+ LLStringUtil::trim(landmark_name);
+
+ if (!landmark_name.empty() && item && item->getName() != landmark_name)
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(landmark_name);
+ new_item->updateServer(FALSE);
+ gInventory.updateItem(new_item);
+ }
+ }
+
+ return false;
+}
+
BOOL LLFavoritesBarCtrl::isClipboardPasteable() const
{
if (!LLClipboard::instance().hasContents())
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index 571208aa31..147308c0ba 100644
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -91,6 +91,7 @@ protected:
bool enableSelected(const LLSD& userdata);
void doToSelected(const LLSD& userdata);
+ static bool onRenameCommit(const LLSD& notification, const LLSD& response);
BOOL isClipboardPasteable() const;
void pasteFromClipboard() const;
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 6e8eac19fc..7eda9c1aa7 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -512,14 +512,20 @@ void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
{
//this function will be called after user will try to create a pick for selected landmark.
// We have to make request to sever to get parcel_id and snaption_id.
- if(isLandmarkSelected())
+ if(mCreatePickItemId.notNull())
{
- LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
- if (!cur_item) return;
- LLUUID id = cur_item->getUUID();
- LLInventoryItem* inv_item = mCurrentSelectedList->getModel()->getItem(id);
- doActionOnCurSelectedLandmark(boost::bind(
- &LLLandmarksPanel::doProcessParcelInfo, this, _1, getCurSelectedItem(), inv_item, parcel_data));
+ LLInventoryItem* inv_item = gInventory.getItem(mCreatePickItemId);
+
+ if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ {
+ // we are processing response for doCreatePick, landmark should be already loaded
+ LLLandmark* landmark = LLLandmarkActions::getLandmark(inv_item->getUUID());
+ if (landmark)
+ {
+ doProcessParcelInfo(landmark, inv_item, parcel_data);
+ }
+ }
+ mCreatePickItemId.setNull();
}
}
@@ -1124,7 +1130,11 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
}
else if ("create_pick" == command_name)
{
- doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doCreatePick, this, _1));
+ LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
+ if (cur_item)
+ {
+ doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doCreatePick, this, _1, cur_item->getUUID()));
+ }
}
else if ("share" == command_name && mCurrentSelectedList)
{
@@ -1344,7 +1354,6 @@ void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark)
}
void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
- LLFolderViewItem* cur_item,
LLInventoryItem* inv_item,
const LLParcelData& parcel_data)
{
@@ -1373,7 +1382,7 @@ void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
LLPickData data;
data.pos_global = landmark_global_pos;
- data.name = cur_item->getName();
+ data.name = inv_item->getName();
data.desc = inv_item->getDescription();
data.snapshot_id = parcel_data.snapshot_id;
data.parcel_id = parcel_data.parcel_id;
@@ -1393,11 +1402,13 @@ void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
panel_pick, panel_places,params));
}
-void LLLandmarksPanel::doCreatePick(LLLandmark* landmark)
+void LLLandmarksPanel::doCreatePick(LLLandmark* landmark, const LLUUID &item_id)
{
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
+ mCreatePickItemId = item_id;
+
LLGlobalVec pos_global;
LLUUID region_id;
landmark->getGlobalPos(pos_global);
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index c11cbe05ae..e8fb62e0e8 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -82,6 +82,8 @@ public:
void updateMenuVisibility(LLUICtrl* menu);
+ void doCreatePick(LLLandmark* landmark, const LLUUID &item_id );
+
protected:
/**
* @return true - if current selected panel is not null and selected item is a landmark
@@ -160,10 +162,8 @@ private:
*/
void doShowOnMap(LLLandmark* landmark);
void doProcessParcelInfo(LLLandmark* landmark,
- LLFolderViewItem* cur_item,
LLInventoryItem* inv_item,
const LLParcelData& parcel_data);
- void doCreatePick(LLLandmark* landmark);
private:
LLPlacesInventoryPanel* mFavoritesInventoryPanel;
@@ -183,6 +183,8 @@ private:
accordion_tabs_t mAccordionTabs;
LLAccordionCtrlTab* mMyLandmarksAccordionTab;
+
+ LLUUID mCreatePickItemId; // item we requested a pick for
};
#endif //LL_LLPANELLANDMARKS_H
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index c038207628..427b3fbf57 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -79,6 +79,7 @@
static const F32 PLACE_INFO_UPDATE_INTERVAL = 3.0;
static const std::string AGENT_INFO_TYPE = "agent";
static const std::string CREATE_LANDMARK_INFO_TYPE = "create_landmark";
+static const std::string CREATE_PICK_TYPE = "create_pick";
static const std::string LANDMARK_INFO_TYPE = "landmark";
static const std::string REMOTE_PLACE_INFO_TYPE = "remote_place";
static const std::string TELEPORT_HISTORY_INFO_TYPE = "teleport_history";
@@ -388,6 +389,21 @@ void LLPanelPlaces::onOpen(const LLSD& key)
// Update the buttons at the bottom of the panel
updateVerbs();
}
+ else if (key_type == CREATE_PICK_TYPE)
+ {
+ LLUUID item_id = key["item_id"];
+
+ LLLandmarksPanel* landmarks_panel =
+ dynamic_cast<LLLandmarksPanel*>(mTabContainer->getPanelByName("Landmarks"));
+ if (landmarks_panel && item_id.notNull())
+ {
+ LLLandmark* landmark = LLLandmarkActions::getLandmark(item_id, boost::bind(&LLLandmarksPanel::doCreatePick, landmarks_panel, _1, item_id));
+ if (landmark)
+ {
+ landmarks_panel->doCreatePick(landmark, item_id);
+ }
+ }
+ }
else // "create_landmark"
{
mFilterEditor->clear();
diff --git a/indra/newview/skins/default/xui/en/menu_favorites.xml b/indra/newview/skins/default/xui/en/menu_favorites.xml
index 082f2f9670..6c28032e3f 100644
--- a/indra/newview/skins/default/xui/en/menu_favorites.xml
+++ b/indra/newview/skins/default/xui/en/menu_favorites.xml
@@ -36,6 +36,17 @@
function="Favorites.DoToSelected"
parameter="copy_slurl" />
</menu_item_call>
+ <menu_item_call
+ label="Create Pick"
+ layout="topleft"
+ name="create_pick">
+ <menu_item_call.on_click
+ function="Favorites.DoToSelected"
+ parameter="create_pick" />
+ <menu_item_call.on_enable
+ function="Favorites.EnableSelected"
+ parameter="create_pick" />
+ </menu_item_call>
<menu_item_separator
layout="topleft" />
@@ -59,10 +70,14 @@
function="Favorites.EnableSelected"
parameter="can_paste" />
</menu_item_call>
-
- <menu_item_separator
- layout="topleft" />
-
+ <menu_item_call
+ label="Rename"
+ layout="topleft"
+ name="rename">
+ <menu_item_call.on_click
+ function="Favorites.DoToSelected"
+ parameter="rename" />
+ </menu_item_call>
<menu_item_call
label="Delete"
layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index fd243d8b19..23bf3191ae 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3141,7 +3141,30 @@ See https://wiki.secondlife.com/wiki/Adding_Spelling_Dictionaries
text="Cancel"/>
</form>
</notification>
-
+
+ <notification
+ icon="alertmodal.tga"
+ label="Rename Landmark"
+ name="RenameLandmark"
+ type="alertmodal">
+ Choose a new name for [NAME]
+ <tag>confirm</tag>
+ <form name="form">
+ <input name="new_name" type="text" width="300">
+ [NAME]
+ </input>
+ <button
+ default="true"
+ index="0"
+ name="OK"
+ text="OK"/>
+ <button
+ index="1"
+ name="Cancel"
+ text="Cancel"/>
+ </form>
+ </notification>
+
<notification
icon="alertmodal.tga"
name="RemoveFromFriends"