From c20bd2dfee1068d5a23eef9a10d21c2035c0b324 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 16 Aug 2010 15:00:51 -0700 Subject: cleaned up LLUICtrlFactory... removed redundant functionality moved buildPanel to LLPanel --- indra/newview/llpanellandmarks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 6f47fc60b0..9ad39d568c 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -202,7 +202,7 @@ LLLandmarksPanel::LLLandmarksPanel() mInventoryObserver = new LLLandmarksPanelObserver(this); gInventory.addObserver(mInventoryObserver); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml"); + buildPanel(this, "panel_landmarks.xml"); } LLLandmarksPanel::~LLLandmarksPanel() -- cgit v1.2.3 From 02d8197019dcecec7aee80a104c4644ddb4807ca Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 20 Aug 2010 10:14:28 -0700 Subject: changed buildPanel/buildFloater to member functions buildFromFile streamlined LLUICtrlFactory's interface --- indra/newview/llpanellandmarks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 9ad39d568c..038944802e 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -202,7 +202,7 @@ LLLandmarksPanel::LLLandmarksPanel() mInventoryObserver = new LLLandmarksPanelObserver(this); gInventory.addObserver(mInventoryObserver); - buildPanel(this, "panel_landmarks.xml"); + buildFromFile( "panel_landmarks.xml"); } LLLandmarksPanel::~LLLandmarksPanel() -- cgit v1.2.3 From ed31b2060c8db15d9c437eeebe510f242edd7913 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 16 Sep 2010 00:02:18 +0300 Subject: STORM-149 FIXED Disabled 'Cut' in My Landmarks context menu when selected items contain a folder. Changed some of context menu actions availability checks to be applied to all selected items instead of only the last one. --- indra/newview/llpanellandmarks.cpp | 46 ++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index ff15e3f08e..24bf67a000 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -965,12 +965,32 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const || "expand" == command_name ) { - return canSelectedBeModified(command_name); + if (!root_folder_view) return false; + + std::set selected_uuids = root_folder_view->getSelectionList(); + + // Allow to execute the command only if it can be applied to all selected items. + for (std::set::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter) + { + LLFolderViewItem* item = root_folder_view->getItemByID(*iter); + + // If no item is found it might be a folder id. + if (!item) + { + item = root_folder_view->getFolderByID(*iter); + } + if (!item) return false; + + if (!canItemBeModified(command_name, item)) return false; + } + + return true; } else if ( "teleport" == command_name || "more_info" == command_name || "show_on_map" == command_name || "copy_slurl" == command_name + || "rename" == command_name ) { // disable some commands for multi-selection. EXT-1757 @@ -994,13 +1014,16 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const // Disable "Show on Map" if landmark loading is in progress. return !gLandmarkList.isAssetInLoadedCallbackMap(asset_uuid); } + else if ("rename" == command_name) + { + LLFolderViewItem* selected_item = getCurSelectedItem(); + if (!selected_item) return false; + + return canItemBeModified(command_name, selected_item); + } return true; } - else if ("rename" == command_name) - { - return root_folder_view && root_folder_view->getSelectedCount() == 1 && canSelectedBeModified(command_name); - } else if("category" == command_name) { // we can add folder only in Landmarks Accordion @@ -1065,12 +1088,11 @@ Rules: 4. We can not paste folders from Clipboard (processed by LLFolderView::canPaste()) 5. Check LLFolderView/Inventory Bridges rules */ -bool LLLandmarksPanel::canSelectedBeModified(const std::string& command_name) const +bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const { // validate own rules first - LLFolderViewItem* selected = getCurSelectedItem(); - if (!selected) return false; + if (!item) return false; // nothing can be modified in Library if (mLibraryInventoryPanel == mCurrentSelectedList) return false; @@ -1078,7 +1100,7 @@ bool LLLandmarksPanel::canSelectedBeModified(const std::string& command_name) co bool can_be_modified = false; // landmarks can be modified in any other accordion... - if (isLandmarkSelected()) + if (item->getListener()->getInventoryType() == LLInventoryType::IT_LANDMARK) { can_be_modified = true; @@ -1107,16 +1129,16 @@ bool LLLandmarksPanel::canSelectedBeModified(const std::string& command_name) co } else if ("collapse" == command_name) { - return selected->isOpen(); + return item->isOpen(); } else if ("expand" == command_name) { - return !selected->isOpen(); + return !item->isOpen(); } if (can_be_modified) { - LLFolderViewEventListener* listenerp = selected->getListener(); + LLFolderViewEventListener* listenerp = item->getListener(); if ("cut" == command_name) { -- cgit v1.2.3