summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellandmarks.cpp
diff options
context:
space:
mode:
authorMatthew Breindel (Falcon) <falcon@lindenlab.com>2010-03-31 17:36:16 -0700
committerMatthew Breindel (Falcon) <falcon@lindenlab.com>2010-03-31 17:36:16 -0700
commit6a8df364063639f342592aa40c8aa490d3f73403 (patch)
treebe649cd320bf14c48b982135e58acb2353953a63 /indra/newview/llpanellandmarks.cpp
parentb2381a039de7e0edbd643d198b85ba8e00524b6b (diff)
parent122308205b2958b27152b9dd5375554ef76dd084 (diff)
Merge
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r--indra/newview/llpanellandmarks.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 45a8dc4cbe..e3b8581aca 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -534,7 +534,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()
@@ -588,7 +588,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 +596,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)
@@ -656,9 +657,6 @@ 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
@@ -676,6 +674,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 +713,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 +772,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,7 +923,7 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
return false;
}
}
- else if (!root_folder_view)
+ else if (!root_folder_view && "category" != command_name)
{
return false;
}
@@ -940,7 +946,8 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
)
{
// disable some commands for multi-selection. EXT-1757
- if (root_folder_view->getSelectedCount() > 1)
+ if (root_folder_view &&
+ root_folder_view->getSelectedCount() > 1)
{
return false;
}
@@ -953,7 +960,8 @@ 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)
{