-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 90c887f..26bc36d 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -802,3 +802,4 @@ void AdvancedFm::doRename(QListView * view) { r.setX( view->contentsX() ); - if ( r.width() > view->visibleWidth() ) + + if ( r.width() > view->visibleWidth() ) r.setWidth( view->visibleWidth() ); @@ -812,6 +813,10 @@ void AdvancedFm::doRename(QListView * view) { renameBox->installEventFilter( this ); + view->addChild( renameBox, r.x(), r.y() ); - renameBox->resize( r.size() ); - view->viewport()->setFocusProxy( renameBox ); - renameBox->setFocus(); + + renameBox->resize( r.size() ); + + view->viewport()->setFocusProxy( renameBox ); + + renameBox->setFocus(); renameBox->show(); @@ -821,7 +826,7 @@ void AdvancedFm::doRename(QListView * view) { void AdvancedFm::renameIt() { - if( !CurrentView()->currentItem()) return; - QListView *thisView = CurrentView(); + if( !CurrentView()->currentItem()) return; + + QListView *thisView = CurrentView(); oldName = thisView->currentItem()->text(0); doRename( thisView ); - rePopulate(); } @@ -830,5 +835,6 @@ void AdvancedFm::okRename() { if( !CurrentView()->currentItem()) return; + QString newName = renameBox->text(); - cancelRename(); - QListView * view = CurrentView(); + cancelRename(); + QListView * view = CurrentView(); QString path = CurrentDir()->canonicalPath() + "/"; @@ -836,3 +842,2 @@ void AdvancedFm::okRename() { newName = path + newName; - if( rename( oldName.latin1(), newName.latin1())== -1) @@ -841,6 +846,5 @@ void AdvancedFm::okRename() { oldName = ""; - view->takeItem( view->currentItem() ); delete view->currentItem(); - rePopulate(); + rePopulate(); } |