summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellandmarks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r--indra/newview/llpanellandmarks.cpp124
1 files changed, 87 insertions, 37 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 45a8dc4cbe..4bf4f9eac1 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -49,6 +49,7 @@
#include "lldndbutton.h"
#include "llfloaterworldmap.h"
#include "llfolderviewitem.h"
+#include "llinventorymodelbackgroundfetch.h"
#include "llinventorypanel.h"
#include "lllandmarkactions.h"
#include "llplacesinventorybridge.h"
@@ -279,6 +280,17 @@ void LLLandmarksPanel::onShowOnMap()
doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doShowOnMap, this, _1));
}
+//virtual
+void LLLandmarksPanel::onShowProfile()
+{
+ LLFolderViewItem* cur_item = getCurSelectedItem();
+
+ if(!cur_item)
+ return;
+
+ cur_item->getListener()->performAction(mCurrentSelectedList->getModel(),"about");
+}
+
// virtual
void LLLandmarksPanel::onTeleport()
{
@@ -297,6 +309,25 @@ void LLLandmarksPanel::onTeleport()
}
// virtual
+bool LLLandmarksPanel::isSingleItemSelected()
+{
+ bool result = false;
+
+ if (mCurrentSelectedList != NULL)
+ {
+ LLPlacesFolderView* root_view =
+ static_cast<LLPlacesFolderView*>(mCurrentSelectedList->getRootFolder());
+
+ if (root_view->getSelectedCount() == 1)
+ {
+ result = isLandmarkSelected();
+ }
+ }
+
+ return result;
+}
+
+// virtual
void LLLandmarksPanel::updateVerbs()
{
if (!isTabVisible())
@@ -304,7 +335,8 @@ void LLLandmarksPanel::updateVerbs()
bool landmark_selected = isLandmarkSelected();
mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport"));
- mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map"));
+ mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info"));
+ mShowOnMapBtn->setEnabled(true);
// TODO: mantipov: Uncomment when mShareBtn is supported
// Share button should be enabled when neither a folder nor a landmark is selected
@@ -434,9 +466,9 @@ LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPa
if (!inventory_list)
return NULL;
- LLFolderView* folder_view = inventory_list->getRootFolder();
+ LLFolderView* root = inventory_list->getRootFolder();
- LLFolderViewItem* item = folder_view->getItemByID(obj_id);
+ LLFolderViewItem* item = root->getItemByID(obj_id);
if (!item)
return NULL;
@@ -446,7 +478,7 @@ LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPa
tab->changeOpenClose(false);
}
- folder_view->setSelection(item, FALSE, take_keyboard_focus);
+ root->setSelection(item, FALSE, take_keyboard_focus);
LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
LLRect screen_rc;
@@ -534,7 +566,7 @@ void LLLandmarksPanel::initLandmarksInventoryPanel()
// subscribe to have auto-rename functionality while creating New Folder
mLandmarksInventoryPanel->setSelectCallback(boost::bind(&LLInventoryPanel::onSelectionChange, mLandmarksInventoryPanel, _1, _2));
- initAccordion("tab_landmarks", mLandmarksInventoryPanel, true);
+ mMyLandmarksAccordionTab = initAccordion("tab_landmarks", mLandmarksInventoryPanel, true);
}
void LLLandmarksPanel::initMyInventoryPanel()
@@ -556,7 +588,7 @@ void LLLandmarksPanel::initLibraryInventoryPanel()
const LLUUID &landmarks_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false, true);
if (landmarks_cat.notNull())
{
- gInventory.startBackgroundFetch(landmarks_cat);
+ LLInventoryModelBackgroundFetch::instance().start(landmarks_cat);
}
// Expanding "Library" tab for new users who have no landmarks in "My Inventory".
@@ -570,6 +602,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list
if (!inventory_list->getFilter())
return;
+ inventory_list->getFilter()->setEmptyLookupMessage("PlacesNoMatchingItems");
inventory_list->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK);
inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, inventory_list, _1, _2));
@@ -588,7 +621,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list
inventory_list->saveFolderState();
}
-void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list, bool expand_tab)
+LLAccordionCtrlTab* LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list, bool expand_tab)
{
LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>(accordion_tab_name);
@@ -596,6 +629,7 @@ void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPl
accordion_tab->setDropDownStateChangedCallback(
boost::bind(&LLLandmarksPanel::onAccordionExpandedCollapsed, this, _2, inventory_list));
accordion_tab->setDisplayChildren(expand_tab);
+ return accordion_tab;
}
void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list)
@@ -619,7 +653,7 @@ void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesI
if (!gInventory.isCategoryComplete(cat_id))
*/
{
- gInventory.startBackgroundFetch(cat_id);
+ LLInventoryModelBackgroundFetch::instance().start(cat_id);
}
// Apply filter substring because it might have been changed
@@ -656,14 +690,12 @@ void LLLandmarksPanel::initListCommandsHandlers()
mListCommands->childSetAction(OPTIONS_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
mListCommands->childSetAction(TRASH_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onTrashButtonClick, this));
- mListCommands->getChild<LLButton>(ADD_BUTTON_NAME)->setHeldDownCallback(boost::bind(&LLLandmarksPanel::onAddButtonHeldDown, this));
- static const LLSD add_landmark_command("add_landmark");
- mListCommands->childSetAction(ADD_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onAddAction, this, add_landmark_command));
LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>(TRASH_BUTTON_NAME);
trash_btn->setDragAndDropHandler(boost::bind(&LLLandmarksPanel::handleDragAndDropToTrash, this
, _4 // BOOL drop
, _5 // EDragAndDropType cargo_type
+ , _6 // void* cargo_data
, _7 // EAcceptance* accept
));
@@ -676,6 +708,8 @@ void LLLandmarksPanel::initListCommandsHandlers()
mGearLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_places_gear_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mGearFolderMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_places_gear_folder.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+
+ mListCommands->childSetAction(ADD_BUTTON_NAME, boost::bind(&LLLandmarksPanel::showActionMenu, this, mMenuAdd, ADD_BUTTON_NAME));
}
@@ -713,11 +747,6 @@ void LLLandmarksPanel::onActionsButtonClick()
showActionMenu(menu,OPTIONS_BUTTON_NAME);
}
-void LLLandmarksPanel::onAddButtonHeldDown()
-{
- showActionMenu(mMenuAdd,ADD_BUTTON_NAME);
-}
-
void LLLandmarksPanel::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
{
if (menu)
@@ -777,6 +806,17 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
"category"), gInventory.findCategoryUUIDForType(
LLFolderType::FT_LANDMARK));
}
+ else
+ {
+ //in case My Landmarks tab is completely empty (thus cannot be determined as being selected)
+ menu_create_inventory_item(mLandmarksInventoryPanel->getRootFolder(), NULL, LLSD("category"),
+ gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
+
+ if (mMyLandmarksAccordionTab)
+ {
+ mMyLandmarksAccordionTab->changeOpenClose(false);
+ }
+ }
}
}
@@ -917,12 +957,7 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
return false;
}
}
- else if (!root_folder_view)
- {
- return false;
- }
else if ( "paste" == command_name
- || "rename" == command_name
|| "cut" == command_name
|| "copy" == command_name
|| "delete" == command_name
@@ -934,16 +969,16 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
}
else if ( "teleport" == command_name
|| "more_info" == command_name
- || "rename" == command_name
|| "show_on_map" == command_name
|| "copy_slurl" == command_name
)
{
// disable some commands for multi-selection. EXT-1757
- if (root_folder_view->getSelectedCount() > 1)
- {
- return false;
- }
+ return root_folder_view && root_folder_view->getSelectedCount() == 1;
+ }
+ else if ("rename" == command_name)
+ {
+ return root_folder_view && root_folder_view->getSelectedCount() == 1 && canSelectedBeModified(command_name);
}
else if("category" == command_name)
{
@@ -953,14 +988,18 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
// ... but except Received folder
return !isReceivedFolderSelected();
}
- else return false;
+ //"Add a folder" is enabled by default (case when My Landmarks is empty)
+ else return true;
}
else if("create_pick" == command_name)
{
- std::set<LLUUID> selection;
- if ( mCurrentSelectedList && mCurrentSelectedList->getRootFolder()->getSelectionList(selection) )
+ if (mCurrentSelectedList)
{
- return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
+ std::set<LLUUID> selection = mCurrentSelectedList->getRootFolder()->getSelectionList();
+ if (!selection.empty())
+ {
+ return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
+ }
}
return false;
}
@@ -974,13 +1013,10 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
{
- LLFolderViewItem* cur_item = getCurSelectedItem();
- if(!cur_item)
- return;
std::string command_name = userdata.asString();
if("more_info" == command_name)
{
- cur_item->getListener()->performAction(mCurrentSelectedList->getRootFolder(),mCurrentSelectedList->getModel(),"about");
+ onShowProfile();
}
else if ("teleport" == command_name)
{
@@ -1071,7 +1107,7 @@ bool LLLandmarksPanel::canSelectedBeModified(const std::string& command_name) co
}
else if ("delete" == command_name)
{
- can_be_modified = listenerp ? listenerp->isItemRemovable() : false;
+ can_be_modified = listenerp ? listenerp->isItemRemovable() && !listenerp->isItemInTrash() : false;
}
else if("paste" == command_name)
{
@@ -1097,7 +1133,7 @@ void LLLandmarksPanel::onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* own
pick_panel = NULL;
}
-bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
+bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept)
{
*accept = ACCEPT_NO;
@@ -1113,7 +1149,21 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg
if (is_enabled && drop)
{
- onClipboardAction("delete");
+ // don't call onClipboardAction("delete")
+ // this lead to removing (N * 2 - 1) items if drag N>1 items into trash. EXT-6757
+ // So, let remove items one by one.
+ LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
+ if (item)
+ {
+ LLFolderViewItem* fv_item = (mCurrentSelectedList && mCurrentSelectedList->getRootFolder()) ?
+ mCurrentSelectedList->getRootFolder()->getItemByID(item->getUUID()) : NULL;
+
+ if (fv_item)
+ {
+ // is Item Removable checked inside of remove()
+ fv_item->remove();
+ }
+ }
}
}
break;