summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfolderview.cpp196
-rw-r--r--indra/newview/llfolderview.h12
-rw-r--r--indra/newview/llfolderviewitem.cpp96
-rw-r--r--indra/newview/llfolderviewitem.h1
-rw-r--r--indra/newview/llfolderviewmodel.h13
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp81
-rw-r--r--indra/newview/llinventoryfunctions.cpp88
-rw-r--r--indra/newview/llinventoryfunctions.h7
-rw-r--r--indra/newview/llinventorypanel.cpp13
-rw-r--r--indra/newview/llinventorypanel.h2
-rw-r--r--indra/newview/llpanellandmarks.cpp4
-rw-r--r--indra/newview/llpanelmaininventory.cpp4
-rw-r--r--indra/newview/llpanelobjectinventory.cpp2
13 files changed, 245 insertions, 274 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 90c78d98b0..6bc89cdbca 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -27,33 +27,24 @@
#include "llviewerprecompiledheaders.h"
#include "llfolderview.h"
-#include "llfolderview.h"
-#include "llcallbacklist.h"
-#include "llinventorybridge.h"
#include "llclipboard.h" // *TODO: remove this once hack below gone.
-#include "llinventorypanel.h"
-#include "llfoldertype.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llmenugl.h"
#include "llpanel.h"
-#include "llpreview.h"
#include "llscrollcontainer.h" // hack to allow scrolling
-#include "lltooldraganddrop.h"
#include "lltrans.h"
#include "llui.h"
-#include "llviewertexture.h"
-#include "llviewertexturelist.h"
-#include "llviewerjointattachment.h"
-#include "llviewermenu.h"
#include "lluictrlfactory.h"
-#include "llviewercontrol.h"
-#include "llviewerfoldertype.h"
-#include "llviewerwindow.h"
-#include "llvoavatar.h"
-#include "llfloaterproperties.h"
-#include "llnotificationsutil.h"
+
+// TODO RN: kill these
+// newview includes
+#include "llcallbacklist.h" // per-frame on-idle
+#include "llfloaterproperties.h" // showProperties
+#include "llviewerwindow.h" // renamer popup handling
+#include "llpreview.h" // openSelectedItems
+#include "llinventorypanel.h" // idle loop for filtering, sort order declarations, etc.
// Linden library includes
#include "lldbstrings.h"
@@ -251,7 +242,7 @@ LLFolderView::LLFolderView(const Params& p)
// make the popup menu available
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (!menu)
{
menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu");
@@ -361,7 +352,7 @@ static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View");
void LLFolderView::filter( LLFolderViewFilter& filter )
{
LLFastTimer t2(FTM_FILTER);
- filter.setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000));
+ filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000));
getViewModelItem()->filter(filter);
}
@@ -631,7 +622,7 @@ void LLFolderView::clearSelection()
}
std::set<LLFolderViewItem*> LLFolderView::getSelectionList() const
- {
+{
std::set<LLFolderViewItem*> selection;
std::copy(mSelectedItems.begin(), mSelectedItems.end(), std::inserter(selection, selection.begin()));
return selection;
@@ -695,7 +686,7 @@ void LLFolderView::draw()
}
- if (mSearchTimer.getElapsedTimeF32() > gSavedSettings.getF32("TypeAheadTimeout") || !mSearchString.size())
+ if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size())
{
mSearchString.clear();
}
@@ -767,14 +758,6 @@ void LLFolderView::closeRenamer( void )
}
}
-void LLFolderView::removeSelectedItems( void )
-{
- if (mSelectedItems.empty()) return;
- LLSD args;
- args["QUESTION"] = LLTrans::getString(mSelectedItems.size() > 1 ? "DeleteItems" : "DeleteItem");
- LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLFolderView::onItemsRemovalConfirmation, this, _1, _2));
-}
-
bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFolderViewItem*>& selectedItems)
{
LLFolderViewItem* item_parent = dynamic_cast<LLFolderViewItem*>(item->getParent());
@@ -820,11 +803,8 @@ void LLFolderView::removeCutItems()
}
}
-void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response)
+void LLFolderView::removeSelectedItems()
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return; // canceled
-
if(getVisible() && getEnabled())
{
// just in case we're removing the renaming item.
@@ -927,42 +907,44 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL
}
}
+// TODO RN: abstract
// open the selected item.
void LLFolderView::openSelectedItems( void )
{
- if(getVisible() && getEnabled())
- {
- if (mSelectedItems.size() == 1)
- {
- mSelectedItems.front()->openItem();
- }
- else
- {
- LLMultiPreview* multi_previewp = new LLMultiPreview();
- LLMultiProperties* multi_propertiesp = new LLMultiProperties();
+ //TODO RN: get working again
+ //if(getVisible() && getEnabled())
+ //{
+ // if (mSelectedItems.size() == 1)
+ // {
+ // mSelectedItems.front()->openItem();
+ // }
+ // else
+ // {
+ // LLMultiPreview* multi_previewp = new LLMultiPreview();
+ // LLMultiProperties* multi_propertiesp = new LLMultiProperties();
- selected_items_t::iterator item_it;
- for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
- {
- // IT_{OBJECT,ATTACHMENT} creates LLProperties
- // floaters; others create LLPreviews. Put
- // each one in the right type of container.
- LLFolderViewModelItemInventory* listener = static_cast<LLFolderViewModelItemInventory*>((*item_it)->getViewModelItem());
- bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT);
- if (is_prop)
- LLFloater::setFloaterHost(multi_propertiesp);
- else
- LLFloater::setFloaterHost(multi_previewp);
- listener->openItem();
- }
+ // selected_items_t::iterator item_it;
+ // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
+ // {
+ // // IT_{OBJECT,ATTACHMENT} creates LLProperties
+ // // floaters; others create LLPreviews. Put
+ // // each one in the right type of container.
+ // LLFolderViewModelItemInventory* listener = static_cast<LLFolderViewModelItemInventory*>((*item_it)->getViewModelItem());
+ // bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT);
+ // if (is_prop)
+ // LLFloater::setFloaterHost(multi_propertiesp);
+ // else
+ // LLFloater::setFloaterHost(multi_previewp);
+ // listener->openItem();
+ // }
- LLFloater::setFloaterHost(NULL);
- // *NOTE: LLMulti* will safely auto-delete when open'd
- // without any children.
- multi_previewp->openFloater(LLSD());
- multi_propertiesp->openFloater(LLSD());
- }
- }
+ // LLFloater::setFloaterHost(NULL);
+ // // *NOTE: LLMulti* will safely auto-delete when open'd
+ // // without any children.
+ // multi_previewp->openFloater(LLSD());
+ // multi_propertiesp->openFloater(LLSD());
+ // }
+ //}
}
void LLFolderView::propertiesSelectedItems( void )
@@ -994,15 +976,6 @@ void LLFolderView::propertiesSelectedItems( void )
//}
}
-void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type)
-{
- LLFolderBridge *folder_bridge = LLFolderBridge::sSelf.get();
-
- if (!folder_bridge) return;
- LLViewerInventoryCategory *cat = folder_bridge->getCategory();
- if (!cat) return;
- cat->changeType(new_folder_type);
-}
void LLFolderView::autoOpenItem( LLFolderViewFolder* item )
{
@@ -1521,7 +1494,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
}
//do text search
- if (mSearchTimer.getElapsedTimeF32() > gSavedSettings.getF32("TypeAheadTimeout"))
+ if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout"))
{
mSearchString.clear();
}
@@ -1831,81 +1804,6 @@ void LLFolderView::setShowSingleSelection(BOOL show)
}
}
-bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
-{
- std::string action = userdata.asString();
-
- if ("rename" == action)
- {
- startRenamingSelectedItem();
- return true;
- }
- if ("delete" == action)
- {
- removeSelectedItems();
- return true;
- }
- if (("copy" == action) || ("cut" == action))
- {
- // Clear the clipboard before we start adding things on it
- LLClipboard::instance().reset();
- }
-
- static const std::string change_folder_string = "change_folder_type_";
- if (action.length() > change_folder_string.length() &&
- (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0))
- {
- LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length()));
- changeType(model, new_folder_type);
- return true;
- }
-
-
- std::set<LLFolderViewItem*> selected_items = getSelectionList();
-
- LLMultiPreview* multi_previewp = NULL;
- LLMultiProperties* multi_propertiesp = NULL;
-
- if (("task_open" == action || "open" == action) && selected_items.size() > 1)
- {
- multi_previewp = new LLMultiPreview();
- gFloaterView->addChild(multi_previewp);
-
- LLFloater::setFloaterHost(multi_previewp);
-
- }
- else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
- {
- multi_propertiesp = new LLMultiProperties();
- gFloaterView->addChild(multi_propertiesp);
-
- LLFloater::setFloaterHost(multi_propertiesp);
- }
-
- std::set<LLFolderViewItem*>::iterator set_iter;
-
- for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
- {
- LLFolderViewItem* folder_item = *set_iter;
- if(!folder_item) continue;
- LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
- if(!bridge) continue;
- bridge->performAction(model, action);
- }
-
- LLFloater::setFloaterHost(NULL);
- if (multi_previewp)
- {
- multi_previewp->openFloater(LLSD());
- }
- else if (multi_propertiesp)
- {
- multi_propertiesp->openFloater(LLSD());
- }
-
- return true;
-}
-
static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select");
static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory");
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 8a0317f840..e098119293 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -39,20 +39,17 @@
#include "lluictrl.h"
#include "v4color.h"
-#include "lldarray.h"
#include "stdenums.h"
#include "lldepthstack.h"
#include "lleditmenuhandler.h"
#include "llfontgl.h"
#include "llscrollcontainer.h"
#include "lltooldraganddrop.h"
-#include "llviewertexture.h"
class LLFolderViewModelInterface;
class LLFolderViewFolder;
class LLFolderViewItem;
class LLFolderViewFilter;
-class LLInventoryModel;
class LLPanel;
class LLLineEditor;
class LLMenuGL;
@@ -153,8 +150,9 @@ public:
virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
virtual std::set<LLFolderViewItem*> getSelectionList() const;
+ S32 getNumSelectedItems() { return mSelectedItems.size(); }
- // Make sure if ancestor is selected, descendents are not
+ // Make sure if ancestor is selected, descendants are not
void sanitizeSelection();
virtual void clearSelection();
void addToSelectionList(LLFolderViewItem* item);
@@ -173,9 +171,6 @@ public:
void openSelectedItems( void );
void propertiesSelectedItems( void );
- // Change the folder type
- void changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type);
-
void autoOpenItem(LLFolderViewFolder* item);
void closeAutoOpenedFolders();
BOOL autoOpenTest(LLFolderViewFolder* item);
@@ -228,8 +223,6 @@ public:
F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); }
bool getUseEllipses() { return mUseEllipses; }
- bool doToSelected(LLInventoryModel* model, const LLSD& userdata);
-
void doIdle(); // Real idle routine
static void idle(void* user_data); // static glue to doIdle()
@@ -270,7 +263,6 @@ protected:
BOOL addNoOptions(LLMenuGL* menu) const;
- void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response);
protected:
LLHandle<LLView> mPopupMenuHandle;
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 80893c3037..e84c765ac8 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -28,16 +28,9 @@
#include "llfolderviewitem.h"
// viewer includes
-#include "llfolderview.h" // Items depend extensively on LLFolderViews
#include "llfolderview.h"
#include "llfolderviewmodel.h"
-#include "llviewerfoldertype.h"
-#include "llinventorybridge.h" // for LLItemBridge in LLInventorySort::operator()
-#include "llinventoryfunctions.h"
-#include "llinventorymodelbackgroundfetch.h"
#include "llpanel.h"
-#include "llviewercontrol.h" // gSavedSettings
-#include "llviewerwindow.h" // Argh, only for setCursor()
// linden library includes
#include "llclipboard.h"
@@ -529,11 +522,11 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
if (can_drag)
{
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ getWindow()->setCursor(UI_CURSOR_ARROW);
}
else
{
- gViewerWindow->setCursor(UI_CURSOR_NOLOCKED);
+ getWindow()->setCursor(UI_CURSOR_NOLOCKED);
}
return TRUE;
}
@@ -541,9 +534,9 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
{
if (getRoot())
{
- getRoot()->setShowSelectionContext(FALSE);
+ getRoot()->setShowSelectionContext(FALSE);
}
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ getWindow()->setCursor(UI_CURSOR_ARROW);
// let parent handle this then...
return FALSE;
}
@@ -2075,84 +2068,3 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it
return result;
}
-bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const
-{
- // ignore sort order for landmarks in the Favorites folder.
- // they should be always sorted as in Favorites bar. See EXT-719
- //TODO RN: fix sorting in favorites folder
- //if (a->getSortGroup() == SG_ITEM
- // && b->getSortGroup() == SG_ITEM
- // && a->getInventoryType() == LLInventoryType::IT_LANDMARK
- // && b->getInventoryType() == LLInventoryType::IT_LANDMARK)
- //{
-
- // static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
-
- // LLUUID a_uuid = a->getParentFolder()->getUUID();
- // LLUUID b_uuid = b->getParentFolder()->getUUID();
-
- // if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id))
- // {
- // // *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem
- // // or to LLInvFVBridge
- // LLViewerInventoryItem* aitem = (static_cast<const LLItemBridge*>(a))->getItem();
- // LLViewerInventoryItem* bitem = (static_cast<const LLItemBridge*>(b))->getItem();
- // if (!aitem || !bitem)
- // return false;
- // S32 a_sort = aitem->getSortField();
- // S32 b_sort = bitem->getSortField();
- // return a_sort < b_sort;
- // }
- //}
-
- // We sort by name if we aren't sorting by date
- // OR if these are folders and we are sorting folders by name.
- bool by_name = (!mByDate
- || (mFoldersByName
- && (a->getSortGroup() != SG_ITEM)));
-
- if (a->getSortGroup() != b->getSortGroup())
- {
- if (mSystemToTop)
- {
- // Group order is System Folders, Trash, Normal Folders, Items
- return (a->getSortGroup() < b->getSortGroup());
- }
- else if (mByDate)
- {
- // Trash needs to go to the bottom if we are sorting by date
- if ( (a->getSortGroup() == SG_TRASH_FOLDER)
- || (b->getSortGroup() == SG_TRASH_FOLDER))
- {
- return (b->getSortGroup() == SG_TRASH_FOLDER);
- }
- }
- }
-
- if (by_name)
- {
- S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
- if (0 == compare)
- {
- return (a->getCreationDate() > b->getCreationDate());
- }
- else
- {
- return (compare < 0);
- }
- }
- else
- {
- time_t first_create = a->getCreationDate();
- time_t second_create = b->getCreationDate();
- if (first_create == second_create)
- {
- return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
- }
- else
- {
- return (first_create > second_create);
- }
- }
-}
-
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index 581ec7239e..92923e82da 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -27,7 +27,6 @@
#define LLFOLDERVIEWITEM_H
#include "llview.h"
-#include "lldarray.h" // *TODO: Eliminate, forward declare
#include "lluiimage.h"
class LLFolderView;
diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h
index 8a16ec3eff..98b7255137 100644
--- a/indra/newview/llfolderviewmodel.h
+++ b/indra/newview/llfolderviewmodel.h
@@ -22,18 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#ifndef LLFOLDERVIEWEVENTLISTENER_H
-#define LLFOLDERVIEWEVENTLISTENER_H
+#ifndef LLFOLDERVIEWMODEL_H
+#define LLFOLDERVIEWMODEL_H
-#include "lldarray.h" // *TODO: convert to std::vector
-#include "llfoldertype.h"
#include "llfontgl.h" // just for StyleFlags enum
#include "llfolderview.h"
-#include "llfolderviewitem.h"
-#include "llinventorytype.h"
-#include "llpermissionsflags.h"
-#include "llpointer.h"
-#include "llwearabletype.h"
#include "lltooldraganddrop.h"
// These are grouping of inventory types.
@@ -362,4 +355,4 @@ protected:
};
-#endif
+#endif // LLFOLDERVIEWMODEL_H
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 7ee1a10b15..99831c61bf 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -223,3 +223,84 @@ const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const
return &mInventoryViewModel;
}
+bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const
+{
+ // ignore sort order for landmarks in the Favorites folder.
+ // they should be always sorted as in Favorites bar. See EXT-719
+ //TODO RN: fix sorting in favorites folder
+ //if (a->getSortGroup() == SG_ITEM
+ // && b->getSortGroup() == SG_ITEM
+ // && a->getInventoryType() == LLInventoryType::IT_LANDMARK
+ // && b->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ //{
+
+ // static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+
+ // LLUUID a_uuid = a->getParentFolder()->getUUID();
+ // LLUUID b_uuid = b->getParentFolder()->getUUID();
+
+ // if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id))
+ // {
+ // // *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem
+ // // or to LLInvFVBridge
+ // LLViewerInventoryItem* aitem = (static_cast<const LLItemBridge*>(a))->getItem();
+ // LLViewerInventoryItem* bitem = (static_cast<const LLItemBridge*>(b))->getItem();
+ // if (!aitem || !bitem)
+ // return false;
+ // S32 a_sort = aitem->getSortField();
+ // S32 b_sort = bitem->getSortField();
+ // return a_sort < b_sort;
+ // }
+ //}
+
+ // We sort by name if we aren't sorting by date
+ // OR if these are folders and we are sorting folders by name.
+ bool by_name = (!mByDate
+ || (mFoldersByName
+ && (a->getSortGroup() != SG_ITEM)));
+
+ if (a->getSortGroup() != b->getSortGroup())
+ {
+ if (mSystemToTop)
+ {
+ // Group order is System Folders, Trash, Normal Folders, Items
+ return (a->getSortGroup() < b->getSortGroup());
+ }
+ else if (mByDate)
+ {
+ // Trash needs to go to the bottom if we are sorting by date
+ if ( (a->getSortGroup() == SG_TRASH_FOLDER)
+ || (b->getSortGroup() == SG_TRASH_FOLDER))
+ {
+ return (b->getSortGroup() == SG_TRASH_FOLDER);
+ }
+ }
+ }
+
+ if (by_name)
+ {
+ S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
+ if (0 == compare)
+ {
+ return (a->getCreationDate() > b->getCreationDate());
+ }
+ else
+ {
+ return (compare < 0);
+ }
+ }
+ else
+ {
+ time_t first_create = a->getCreationDate();
+ time_t second_create = b->getCreationDate();
+ if (first_create == second_create)
+ {
+ return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
+ }
+ else
+ {
+ return (first_create > second_create);
+ }
+ }
+}
+
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ff461236a2..07f3dd8ffb 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -45,7 +45,7 @@
// newview includes
#include "llappearancemgr.h"
#include "llappviewer.h"
-//#include "llfirstuse.h"
+#include "llclipboard.h"
#include "llfloaterinventory.h"
#include "llfloatersidepanelcontainer.h"
#include "llfocusmgr.h"
@@ -74,8 +74,10 @@
#include "llsidepanelinventory.h"
#include "lltabcontainer.h"
#include "lltooldraganddrop.h"
+#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llviewermessage.h"
+#include "llviewerfoldertype.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llviewerwindow.h"
@@ -1044,3 +1046,87 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
}
}
+void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action)
+{
+ if ("rename" == action)
+ {
+ root->startRenamingSelectedItem();
+ return;
+ }
+ if ("delete" == action)
+ {
+ LLSD args;
+ args["QUESTION"] = LLTrans::getString(root->getNumSelectedItems() > 1 ? "DeleteItems" : "DeleteItem");
+ LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root));
+ return;
+ }
+ if (("copy" == action) || ("cut" == action))
+ {
+ // Clear the clipboard before we start adding things on it
+ LLClipboard::instance().reset();
+ }
+
+ static const std::string change_folder_string = "change_folder_type_";
+ if (action.length() > change_folder_string.length() &&
+ (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0))
+ {
+ LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length()));
+ LLFolderViewModelItemInventory* inventory_item = static_cast<LLFolderViewModelItemInventory*>(root->getViewModelItem());
+ LLViewerInventoryCategory *cat = model->getCategory(inventory_item->getUUID());
+ if (!cat) return;
+ cat->changeType(new_folder_type);
+ return;
+ }
+
+
+ std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
+
+ LLMultiPreview* multi_previewp = NULL;
+ LLMultiProperties* multi_propertiesp = NULL;
+
+ if (("task_open" == action || "open" == action) && selected_items.size() > 1)
+ {
+ multi_previewp = new LLMultiPreview();
+ gFloaterView->addChild(multi_previewp);
+
+ LLFloater::setFloaterHost(multi_previewp);
+
+ }
+ else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
+ {
+ multi_propertiesp = new LLMultiProperties();
+ gFloaterView->addChild(multi_propertiesp);
+
+ LLFloater::setFloaterHost(multi_propertiesp);
+ }
+
+ std::set<LLFolderViewItem*>::iterator set_iter;
+
+ for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
+ {
+ LLFolderViewItem* folder_item = *set_iter;
+ if(!folder_item) continue;
+ LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
+ if(!bridge) continue;
+ bridge->performAction(model, action);
+ }
+
+ LLFloater::setFloaterHost(NULL);
+ if (multi_previewp)
+ {
+ multi_previewp->openFloater(LLSD());
+ }
+ else if (multi_propertiesp)
+ {
+ multi_propertiesp->openFloater(LLSD());
+ }
+}
+
+void LLInventoryAction::onItemsRemovalConfirmation( const LLSD& notification, const LLSD& response, LLFolderView* root )
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ root->removeSelectedItems();
+ }
+}
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index c6b1da0417..d8d3d9bbbb 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -427,6 +427,13 @@ public:
static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction
};
+struct LLInventoryAction
+{
+ static void doToSelected(class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
+
+ static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLFolderView* root);
+};
+
#endif // LL_LLINVENTORYFUNCTIONS_H
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index b5fcf364dd..ef8c5dc1cf 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -44,6 +44,7 @@
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
#include "llinventorymodelbackgroundfetch.h"
+#include "llpreview.h"
#include "llsidepanelinventory.h"
#include "llviewerattachmenu.h"
#include "llviewerfoldertype.h"
@@ -926,11 +927,6 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it
}
}
-void LLInventoryPanel::doToSelected(const LLSD& userdata)
-{
- mFolderRoot->doToSelected(&gInventory, userdata);
-}
-
void LLInventoryPanel::doCreate(const LLSD& userdata)
{
menu_create_inventory_item(this, LLFolderBridge::sSelf.get(), userdata);
@@ -1260,6 +1256,13 @@ void LLInventoryPanel::updateSelection()
}
}
+void LLInventoryPanel::doToSelected(const LLSD& userdata)
+{
+ LLInventoryAction::doToSelected(mInventory, mFolderRoot, userdata.asString());
+
+ return;
+}
+
/************************************************************************/
/* Recent Inventory Panel related class */
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index a62b97aa7d..58c1201e54 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -176,7 +176,7 @@ public:
LLFolderViewFolder* getFolderByID(const LLUUID& id);
void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus);
void updateSelection();
-
+
LLFolderViewModelInventory* getFolderViewModel();
const LLFolderViewModelInventory* getFolderViewModel() const;
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 0b899d34f4..faef923338 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -851,7 +851,7 @@ void LLLandmarksPanel::onClipboardAction(const LLSD& userdata) const
}
else
{
- mCurrentSelectedList->getRootFolder()->doToSelected(mCurrentSelectedList->getModel(),command_name);
+ mCurrentSelectedList->doToSelected(command_name);
}
}
@@ -896,7 +896,7 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata)
{
if(mCurrentSelectedList)
{
- mCurrentSelectedList->getRootFolder()->doToSelected(&gInventory, userdata);
+ mCurrentSelectedList->doToSelected(userdata);
}
}
}
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 6cef1f877b..fea27b37d3 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -294,7 +294,7 @@ BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask)
void LLPanelMainInventory::doToSelected(const LLSD& userdata)
{
- getPanel()->getRootFolder()->doToSelected(&gInventory, userdata);
+ getPanel()->doToSelected(userdata);
}
void LLPanelMainInventory::closeAllFolders()
@@ -970,7 +970,7 @@ void LLPanelMainInventory::onTrashButtonClick()
void LLPanelMainInventory::onClipboardAction(const LLSD& userdata)
{
std::string command_name = userdata.asString();
- getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name);
+ getActivePanel()->doToSelected(command_name);
}
void LLPanelMainInventory::saveTexture(const LLSD& userdata)
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 450e1f7ed0..002c0c1113 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1522,7 +1522,7 @@ BOOL LLPanelObjectInventory::postBuild()
void LLPanelObjectInventory::doToSelected(const LLSD& userdata)
{
- mFolders->doToSelected(&gInventory, userdata);
+ LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString());
}
void LLPanelObjectInventory::clearContents()