summaryrefslogtreecommitdiff
path: root/indra/newview/llfolderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfolderview.cpp')
-rw-r--r--indra/newview/llfolderview.cpp67
1 files changed, 31 insertions, 36 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 5d8e3f9ab9..d71e288ffe 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -56,7 +56,6 @@
#include "llviewerwindow.h"
#include "llvoavatar.h"
#include "llfloaterproperties.h"
-#include "llnotificationsutil.h"
// Linden library includes
#include "lldbstrings.h"
@@ -99,6 +98,7 @@ void copy_selected_item(void* user_data);
void open_selected_items(void* user_data);
void properties_selected_items(void* user_data);
void paste_items(void* user_data);
+void renamer_focus_lost( LLFocusableElement* handler, void* user_data );
//---------------------------------------------------------------------------
@@ -178,6 +178,7 @@ LLFolderView::LLFolderView(const Params& p)
mSourceID(p.task_id),
mRenameItem( NULL ),
mNeedsScroll( FALSE ),
+ mEnableScroll( true ),
mUseLabelSuffix(p.use_label_suffix),
mPinningSelectedItem(FALSE),
mNeedsAutoSelect( FALSE ),
@@ -243,7 +244,7 @@ LLFolderView::LLFolderView(const Params& p)
text_p.name(std::string(p.name));
text_p.font(font);
text_p.visible(false);
- text_p.parse_urls(true);
+ text_p.allow_html(true);
text_p.wrap(true); // allow multiline text. See EXT-7564, EXT-7047
// set text padding the same as in People panel. EXT-7047, EXT-4837
text_p.h_pad(STATUS_TEXT_HPAD);
@@ -268,8 +269,6 @@ LLFolderView::LLFolderView(const Params& p)
// Destroys the object
LLFolderView::~LLFolderView( void )
{
- closeRenamer();
-
// The release focus call can potentially call the
// scrollcontainer, which can potentially be called with a partly
// destroyed scollcontainer. Just null it out here, and no worries
@@ -285,6 +284,8 @@ LLFolderView::~LLFolderView( void )
LLView::deleteViewByHandle(mPopupMenuHandle);
+ gViewerWindow->removePopup(mRenamer);
+
mAutoOpenItems.removeAllNodes();
clearSelection();
mItems.clear();
@@ -991,7 +992,12 @@ void LLFolderView::finishRenamingItem( void )
mRenameItem->rename( mRenamer->getText() );
}
- closeRenamer();
+ gViewerWindow->removePopup(mRenamer);
+
+ if( mRenameItem )
+ {
+ setSelectionFromRoot( mRenameItem, TRUE );
+ }
// List is re-sorted alphabeticly, so scroll to make sure the selected item is visible.
scrollToShowSelection();
@@ -999,26 +1005,20 @@ void LLFolderView::finishRenamingItem( void )
void LLFolderView::closeRenamer( void )
{
- if (mRenamer && mRenamer->getVisible())
+ // will commit current name (which could be same as original name)
+ mRenamer->setFocus( FALSE );
+ mRenamer->setVisible( FALSE );
+ gViewerWindow->removePopup(mRenamer);
+
+ if( mRenameItem )
{
- // Triggers onRenamerLost() that actually closes the renamer.
- gViewerWindow->removePopup(mRenamer);
+ setSelectionFromRoot( mRenameItem, TRUE );
+ mRenameItem = NULL;
}
}
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));
-}
-
-void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return; // canceled
-
if(getVisible() && getEnabled())
{
// just in case we're removing the renaming item.
@@ -1438,7 +1438,8 @@ void LLFolderView::startRenamingSelectedItem( void )
mRenamer->setVisible( TRUE );
// set focus will fail unless item is visible
mRenamer->setFocus( TRUE );
- mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this));
+ mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1));
+ mRenamer->setFocusLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1));
gViewerWindow->addPopup(mRenamer);
}
}
@@ -1959,7 +1960,10 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
void LLFolderView::deleteAllChildren()
{
- closeRenamer();
+ if(mRenamer == gFocusMgr.getTopCtrl())
+ {
+ gViewerWindow->removePopup(mRenamer);
+ }
LLView::deleteViewByHandle(mPopupMenuHandle);
mPopupMenuHandle = LLHandle<LLView>();
mRenamer = NULL;
@@ -1970,9 +1974,7 @@ void LLFolderView::deleteAllChildren()
void LLFolderView::scrollToShowSelection()
{
- // If items are filtered while background fetch is in progress
- // scrollbar resets to the first filtered item. See EXT-3981.
- if (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && mSelectedItems.size())
+ if (mEnableScroll && mSelectedItems.size())
{
mNeedsScroll = TRUE;
}
@@ -2444,20 +2446,13 @@ S32 LLFolderView::notify(const LLSD& info)
/// Local function definitions
///----------------------------------------------------------------------------
-void LLFolderView::onRenamerLost()
+void LLFolderView::onRenamerLost( LLFocusableElement* renamer)
{
- if (mRenamer && mRenamer->getVisible())
- {
- mRenamer->setVisible(FALSE);
-
- // will commit current name (which could be same as original name)
- mRenamer->setFocus(FALSE);
- }
-
- if( mRenameItem )
+ mRenameItem = NULL;
+ LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(renamer);
+ if (uictrl)
{
- setSelectionFromRoot( mRenameItem, TRUE );
- mRenameItem = NULL;
+ uictrl->setVisible(FALSE);
}
}