summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2021-03-30 15:53:22 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2021-03-30 15:53:22 +0300
commit89b4611fc00a17d923c06d510da6842002113199 (patch)
tree183c19006270aa995f6c923599751ebf05bc4d9f
parent309fb9e892beb724a442c85bcfd07d6f3f7c9c07 (diff)
SL-15036 Add actions to move landmarks between tabs in the Places floater
-rw-r--r--indra/newview/llfavoritesbar.cpp4
-rw-r--r--indra/newview/llinventoryfunctions.cpp20
-rw-r--r--indra/newview/llinventoryfunctions.h2
-rw-r--r--indra/newview/llpanellandmarks.cpp56
-rw-r--r--indra/newview/skins/default/xui/en/menu_favorites.xml8
-rw-r--r--indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml22
6 files changed, 110 insertions, 2 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 8791f605e9..4a40a74dec 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -1281,6 +1281,10 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
LLNotificationsUtil::add("RenameLandmark", args, payload, boost::bind(onRenameCommit, _1, _2));
}
+ else if (action == "move_to_landmarks")
+ {
+ change_item_parent(mSelectedItemID, gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
+ }
// Pop-up the overflow menu again (it gets hidden whenever the user clicks a context menu item).
// See EXT-4217 and STORM-207.
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index f84bc68c82..f2e06d19f3 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1847,6 +1847,26 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
return result && !has_bad_items;
}
+void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id)
+{
+ LLInventoryItem* inv_item = gInventory.getItem(item_id);
+ if (inv_item)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
+ new_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
+}
+
///----------------------------------------------------------------------------
/// LLInventoryCollectFunctor implementations
///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 04eb962372..37c3c47336 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -92,6 +92,8 @@ S32 depth_nesting_in_marketplace(LLUUID cur_uuid);
LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth);
S32 compute_stock_count(LLUUID cat_uuid, bool force_count = false);
+void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id);
+
/** Miscellaneous global functions
** **
*******************************************************************************/
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 8bc4bca675..4b73412e60 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -615,6 +615,8 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
? mCurrentSelectedList->getRootFolder()
: NULL;
+ bool is_single_selection = root_folder_view && root_folder_view->getSelectedCount() == 1;
+
if ("collapse_all" == command_name)
{
return has_expanded_folders(mCurrentSelectedList->getRootFolder());
@@ -669,7 +671,6 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
)
{
// disable some commands for multi-selection. EXT-1757
- bool is_single_selection = root_folder_view && root_folder_view->getSelectedCount() == 1;
if (!is_single_selection)
{
return false;
@@ -718,7 +719,6 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
}
else if ("add_landmark" == command_name)
{
- bool is_single_selection = root_folder_view && root_folder_view->getSelectedCount() == 1;
if (!is_single_selection)
{
return false;
@@ -759,6 +759,36 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
}
return true;
}
+ else if (command_name == "move_to_landmarks" || command_name == "move_to_favorites")
+ {
+ LLFolderViewModelItemInventory* cur_item_model = getCurSelectedViewModelItem();
+ if (cur_item_model)
+ {
+ LLFolderType::EType folder_type = command_name == "move_to_landmarks" ? LLFolderType::FT_FAVORITE : LLFolderType::FT_LANDMARK;
+ if (!gInventory.isObjectDescendentOf(cur_item_model->getUUID(), gInventory.findCategoryUUIDForType(folder_type)))
+ {
+ return false;
+ }
+
+ if (root_folder_view)
+ {
+ std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
+ for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
+ {
+ LLFolderViewItem* item = *iter;
+ if (!item) return false;
+
+ cur_item_model = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (!cur_item_model || cur_item_model->getInventoryType() != LLInventoryType::IT_LANDMARK)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
else
{
LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL;
@@ -798,6 +828,28 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
{
mCurrentSelectedList->doToSelected(userdata);
}
+ else if (command_name == "move_to_landmarks" || command_name == "move_to_favorites")
+ {
+ LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
+ if (root_folder_view)
+ {
+ LLFolderType::EType folder_type = command_name == "move_to_landmarks" ? LLFolderType::FT_LANDMARK : LLFolderType::FT_FAVORITE;
+ std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
+ for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
+ {
+ LLFolderViewItem* item = *iter;
+ if (item)
+ {
+ LLFolderViewModelItemInventory* item_model = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (item_model)
+ {
+ change_item_parent(item_model->getUUID(), gInventory.findCategoryUUIDForType(folder_type));
+ }
+ }
+ }
+ }
+
+ }
}
void LLLandmarksPanel::onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param)
diff --git a/indra/newview/skins/default/xui/en/menu_favorites.xml b/indra/newview/skins/default/xui/en/menu_favorites.xml
index 6c28032e3f..0eab7c451b 100644
--- a/indra/newview/skins/default/xui/en/menu_favorites.xml
+++ b/indra/newview/skins/default/xui/en/menu_favorites.xml
@@ -21,6 +21,14 @@
parameter="about" />
</menu_item_call>
<menu_item_call
+ label="Move to Landmarks"
+ layout="topleft"
+ name="Move to Landmarks">
+ <menu_item_call.on_click
+ function="Favorites.DoToSelected"
+ parameter="move_to_landmarks" />
+ </menu_item_call>
+ <menu_item_call
label="Show on Map"
layout="topleft"
name="Show On Map">
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
index 7a7edc0ab7..c89b498ddf 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
@@ -40,6 +40,28 @@
parameter="more_info" />
</menu_item_call>
<menu_item_call
+ label="Move to Landmarks"
+ layout="topleft"
+ name="Move to Landmarks">
+ <menu_item_call.on_click
+ function="Places.LandmarksGear.Custom.Action"
+ parameter="move_to_landmarks" />
+ <menu_item_call.on_visible
+ function="Places.LandmarksGear.Enable"
+ parameter="move_to_landmarks" />
+ </menu_item_call>
+ <menu_item_call
+ label="Move to Favorites"
+ layout="topleft"
+ name="Move to Favorites">
+ <menu_item_call.on_click
+ function="Places.LandmarksGear.Custom.Action"
+ parameter="move_to_favorites" />
+ <menu_item_call.on_visible
+ function="Places.LandmarksGear.Enable"
+ parameter="move_to_favorites" />
+ </menu_item_call>
+ <menu_item_call
label="Show on Map"
layout="topleft"
name="show_on_map">