summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfolderview.cpp48
-rw-r--r--indra/newview/llfolderview.h2
2 files changed, 21 insertions, 29 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 5aa504eb35..81f00af948 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -104,7 +104,6 @@ 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 );
//---------------------------------------------------------------------------
@@ -275,6 +274,8 @@ 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
@@ -290,8 +291,6 @@ LLFolderView::~LLFolderView( void )
LLView::deleteViewByHandle(mPopupMenuHandle);
- gViewerWindow->removePopup(mRenamer);
-
mAutoOpenItems.removeAllNodes();
clearSelection();
mItems.clear();
@@ -998,12 +997,7 @@ void LLFolderView::finishRenamingItem( void )
mRenameItem->rename( mRenamer->getText() );
}
- gViewerWindow->removePopup(mRenamer);
-
- if( mRenameItem )
- {
- setSelectionFromRoot( mRenameItem, TRUE );
- }
+ closeRenamer();
// List is re-sorted alphabeticly, so scroll to make sure the selected item is visible.
scrollToShowSelection();
@@ -1011,15 +1005,10 @@ void LLFolderView::finishRenamingItem( void )
void LLFolderView::closeRenamer( void )
{
- // will commit current name (which could be same as original name)
- mRenamer->setFocus( FALSE );
- mRenamer->setVisible( FALSE );
- gViewerWindow->removePopup(mRenamer);
-
- if( mRenameItem )
+ if (mRenamer && mRenamer->getVisible())
{
- setSelectionFromRoot( mRenameItem, TRUE );
- mRenameItem = NULL;
+ // Triggers onRenamerLost() that actually closes the renamer.
+ gViewerWindow->removePopup(mRenamer);
}
}
@@ -1444,8 +1433,7 @@ 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, _1));
- mRenamer->setFocusLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1));
+ mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this));
gViewerWindow->addPopup(mRenamer);
}
}
@@ -1966,10 +1954,7 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
void LLFolderView::deleteAllChildren()
{
- if(mRenamer == gFocusMgr.getTopCtrl())
- {
- gViewerWindow->removePopup(mRenamer);
- }
+ closeRenamer();
LLView::deleteViewByHandle(mPopupMenuHandle);
mPopupMenuHandle = LLHandle<LLView>();
mRenamer = NULL;
@@ -2452,13 +2437,20 @@ S32 LLFolderView::notify(const LLSD& info)
/// Local function definitions
///----------------------------------------------------------------------------
-void LLFolderView::onRenamerLost( LLFocusableElement* renamer)
+void LLFolderView::onRenamerLost()
{
- mRenameItem = NULL;
- LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(renamer);
- if (uictrl)
+ if (mRenamer && mRenamer->getVisible())
{
- uictrl->setVisible(FALSE);
+ mRenamer->setVisible(FALSE);
+
+ // will commit current name (which could be same as original name)
+ mRenamer->setFocus(FALSE);
+ }
+
+ if( mRenameItem )
+ {
+ setSelectionFromRoot( mRenameItem, TRUE );
+ mRenameItem = NULL;
}
}
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index f1d39a41ae..31352d04bf 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -284,7 +284,7 @@ protected:
LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container.
void commitRename( const LLSD& data );
- void onRenamerLost( LLFocusableElement* renamer);
+ void onRenamerLost();
void finishRenamingItem( void );
void closeRenamer( void );