summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfolderview.cpp7
-rw-r--r--indra/newview/llinventorypanel.cpp8
-rw-r--r--indra/newview/llpanellandmarks.cpp95
-rw-r--r--indra/newview/llpanellandmarks.h18
4 files changed, 56 insertions, 72 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 9cca1b07db..474d2ca21f 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -1822,6 +1822,13 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data,
accept, tooltip_msg);
+ // When there are no visible children drag and drop is handled
+ // by the folder which is the hierarchy root.
+ if (!handled && !hasVisibleChildren())
+ {
+ handled = mFolders.front()->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg);
+ }
+
if (handled)
{
lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderView" << llendl;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 082b7a9468..164e72e621 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -628,9 +628,15 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EAcceptance* accept,
std::string& tooltip_msg)
{
-
BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ // If folder view is empty the (x, y) point won't be in its rect
+ // so the handler must be called explicitly.
+ if (!mFolders->hasVisibleChildren())
+ {
+ handled = mFolders->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ }
+
if (handled)
{
mFolders->setDragAndDropThisFrame();
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index e16bac2098..c627c60940 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -68,12 +68,13 @@ static const std::string TRASH_BUTTON_NAME = "trash_btn";
// helper functions
static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string);
static void save_folder_state_if_no_filter(LLInventorySubTreePanel* inventory_list);
+static bool category_has_descendents(LLInventorySubTreePanel* inventory_list);
/**
- * Bridge to support knowing when the inventory has changed to update folder (open/close) state
+ * Bridge to support knowing when the inventory has changed to update folder (open/close) state
* for landmarks panels.
*
- * Due to Inventory data are loaded in background we need to save folder state each time
+ * Due to Inventory data are loaded in background we need to save folder state each time
* next level is loaded. See EXT-3094.
*/
class LLLandmarksPanelObserver : public LLInventoryObserver
@@ -90,6 +91,7 @@ private:
void LLLandmarksPanelObserver::changed(U32 mask)
{
mLP->saveFolderStateIfNoFilter();
+ mLP->updateShowFolderState();
}
LLLandmarksPanel::LLLandmarksPanel()
@@ -134,22 +136,12 @@ BOOL LLLandmarksPanel::postBuild()
getChild<LLAccordionCtrlTab>("tab_favorites")->setDisplayChildren(true);
getChild<LLAccordionCtrlTab>("tab_landmarks")->setDisplayChildren(true);
- gIdleCallbacks.addFunction(LLLandmarksPanel::doIdle, this);
return TRUE;
}
// virtual
void LLLandmarksPanel::onSearchEdit(const std::string& string)
{
- // show all folders in Landmarks Accordion for empty filter
- if (mLandmarksInventoryPanel->getFilter())
- {
- mLandmarksInventoryPanel->setShowFolderState(string.empty() ?
- LLInventoryFilter::SHOW_ALL_FOLDERS :
- LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS
- );
- }
-
// give FolderView a chance to be refreshed. So, made all accordions visible
for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter)
{
@@ -173,6 +165,10 @@ void LLLandmarksPanel::onSearchEdit(const std::string& string)
if (sFilterSubString != string)
sFilterSubString = string;
+
+ // show all folders in Landmarks Accordion for empty filter
+ // only if Landmarks inventory folder is not empty
+ updateShowFolderState();
}
// virtual
@@ -262,6 +258,23 @@ void LLLandmarksPanel::saveFolderStateIfNoFilter()
save_folder_state_if_no_filter(mLibraryInventoryPanel);
}
+void LLLandmarksPanel::updateShowFolderState()
+{
+ if (!mLandmarksInventoryPanel->getFilter())
+ return;
+
+ bool show_all_folders = mLandmarksInventoryPanel->getRootFolder()->getFilterSubString().empty();
+ if (show_all_folders)
+ {
+ show_all_folders = category_has_descendents(mLandmarksInventoryPanel);
+ }
+
+ mLandmarksInventoryPanel->setShowFolderState(show_all_folders ?
+ LLInventoryFilter::SHOW_ALL_FOLDERS :
+ LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS
+ );
+}
+
//////////////////////////////////////////////////////////////////////////
// PROTECTED METHODS
//////////////////////////////////////////////////////////////////////////
@@ -778,46 +791,6 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
}
}
-void LLLandmarksPanel::updateFilteredAccordions()
-{
- LLInventoryPanel* inventory_list = NULL;
- LLAccordionCtrlTab* accordion_tab = NULL;
- bool needs_arrange = false;
-
- for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter)
- {
- accordion_tab = *iter;
-
- accordion_tab->setVisible(TRUE);
-
- inventory_list = dynamic_cast<LLInventorySubTreePanel*> (accordion_tab->getAccordionView());
- if (NULL == inventory_list) continue;
-
- // This doesn't seem to work correctly. Disabling for now. -Seraph
- // Enabled to show/hide accordions with/without landmarks. See EXT-2346. (Seth PE)
- LLFolderView* fv = inventory_list->getRootFolder();
-
- // arrange folder view contents to draw its descendants if it has any
- fv->arrangeFromRoot();
-
- bool has_descendants = fv->hasFilteredDescendants();
- if (!has_descendants)
- needs_arrange = true;
-
- accordion_tab->setVisible(has_descendants);
-
- //accordion_tab->setVisible(TRUE);
- }
-
- // we have to arrange accordion tabs for cases when filter string is less restrictive but
- // all items are still filtered.
- if (needs_arrange)
- {
- static LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
- accordion->arrange();
- }
-}
-
/*
Processes such actions: cut/rename/delete/paste actions
@@ -926,13 +899,6 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg
return true;
}
-// static
-void LLLandmarksPanel::doIdle(void* landmarks_panel)
-{
- LLLandmarksPanel* panel = (LLLandmarksPanel* ) landmarks_panel;
- panel->updateFilteredAccordions();
-}
-
void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark)
{
LLVector3d landmark_global_pos;
@@ -1067,4 +1033,15 @@ static void save_folder_state_if_no_filter(LLInventorySubTreePanel* inventory_li
// inventory_list->saveFolderState(); // *TODO: commented out to fix build
}
}
+
+static bool category_has_descendents(LLInventorySubTreePanel* inventory_list)
+{
+ LLViewerInventoryCategory* category = gInventory.getCategory(inventory_list->getStartFolderID());
+ if (category)
+ {
+ return category->getDescendentCount() > 0;
+ }
+
+ return false;
+}
// EOF
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index b0e537f647..590fa395b6 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -72,6 +72,12 @@ public:
*/
void saveFolderStateIfNoFilter();
+ /**
+ * Update filter ShowFolderState setting to show empty folder message
+ * if Landmarks inventory folder is empty.
+ */
+ void updateShowFolderState();
+
protected:
/**
* @return true - if current selected panel is not null and selected item is a landmark
@@ -112,13 +118,6 @@ private:
void onCustomAction(const LLSD& command_name);
/**
- * Updates accordions according to filtered items in lists.
- *
- * It hides accordion for empty lists
- */
- void updateFilteredAccordions();
-
- /**
* Determines if selected item can be modified via context/gear menu.
*
* It validates Places Landmarks rules first. And then LLFolderView permissions.
@@ -133,11 +132,6 @@ private:
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
/**
- * Static callback for gIdleCallbacks to perform actions out of drawing
- */
- static void doIdle(void* landmarks_panel);
-
- /**
* Landmark actions callbacks. Fire when a landmark is loaded from the list.
*/
void doShowOnMap(LLLandmark* landmark);