summaryrefslogtreecommitdiff
path: root/indra/llui/llfolderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llfolderview.cpp')
-rw-r--r--indra/llui/llfolderview.cpp48
1 files changed, 31 insertions, 17 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index baab17830b..8ece3384cd 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -257,20 +257,13 @@ LLFolderView::LLFolderView(const Params& p)
// Destroys the object
LLFolderView::~LLFolderView( void )
{
- mRenamerTopLostSignalConnection.disconnect();
- if (mRenamer)
- {
- // instead of using closeRenamer remove it directly,
- // since it might already be hidden
- LLUI::getInstance()->removePopup(mRenamer);
- }
-
// 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
// about calling into the invalid scroll container.
// Same with the renamer.
mScrollContainer = NULL;
+ cancelRenaming();
mRenameItem = NULL;
mRenamer = NULL;
mStatusTextBox = NULL;
@@ -655,7 +648,10 @@ void LLFolderView::commitRename( const LLSD& data )
// since this can be called from 'focus lost' event.
// Ex: clicking inworld should commit the rename.
finishRenamingItem();
- arrange( NULL, NULL );
+ if (mRenamer && mViewModel)
+ {
+ arrange( NULL, NULL );
+ }
}
void LLFolderView::draw()
@@ -729,7 +725,7 @@ void LLFolderView::draw()
void LLFolderView::finishRenamingItem( void )
{
- if (!mRenamer)
+ if(!mRenamer || !mViewModel)
{
return;
}
@@ -758,12 +754,33 @@ void LLFolderView::closeRenamer( void )
}
}
+void LLFolderView::cancelRenaming( void )
+{
+ mRenamerTopLostSignalConnection.disconnect();
+
+ if (mRenamer)
+ {
+ mRenamer->setCommitOnFocusLost(false);
+ if (LLUI::instanceExists())
+ {
+ LLUI::getInstance()->removePopup(mRenamer);
+ }
+ if (gFocusMgr.childHasKeyboardFocus(mRenamer))
+ {
+ gFocusMgr.releaseFocusIfNeeded(mRenamer);
+ }
+ mRenamer->setVisible(false);
+ }
+
+ mRenameItem = NULL;
+}
+
void LLFolderView::removeSelectedItems()
{
if(getVisible() && getEnabled())
{
- // just in case we're removing the renaming item.
- mRenameItem = NULL;
+ // Cancel active rename in case the renaming item is among the selected items
+ cancelRenaming();
// create a temporary structure which we will use to remove
// items, since the removal will futz with internal data
@@ -1087,6 +1104,7 @@ void LLFolderView::startRenamingSelectedItem( void )
mRenamer->setText(item->getName());
mRenamer->selectAll();
mRenamer->setVisible( true );
+ mRenamer->setCommitOnFocusLost( true );
// set focus will fail unless item is visible
mRenamer->setFocus( true );
if (!mRenamerTopLostSignalConnection.connected())
@@ -1626,11 +1644,7 @@ bool LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
void LLFolderView::deleteAllChildren()
{
- mRenamerTopLostSignalConnection.disconnect();
- if (mRenamer)
- {
- LLUI::getInstance()->removePopup(mRenamer);
- }
+ cancelRenaming();
if (mPopupMenuHandle.get())
{
mPopupMenuHandle.get()->die();