SL-15036 Add actions to move landmarks between tabs in the Places floater
parent
309fb9e892
commit
89b4611fc0
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
///----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@
|
|||
function="Favorites.DoToSelected"
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,28 @@
|
|||
function="Places.LandmarksGear.Enable"
|
||||
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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue