summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp10
1 files changed, 7 insertions, 3 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
@@ -800,6 +800,7 @@ void AdvancedFm::doRename(QListView * view) {
QRect r = view->itemRect( view->currentItem( ));
r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
r.setX( view->contentsX() );
+
if ( r.width() > view->visibleWidth() )
r.setWidth( view->visibleWidth() );
@@ -810,9 +811,13 @@ void AdvancedFm::doRename(QListView * view) {
renameBox->selectAll();
renameBox->installEventFilter( this );
+
view->addChild( renameBox, r.x(), r.y() );
+
renameBox->resize( r.size() );
+
view->viewport()->setFocusProxy( renameBox );
+
renameBox->setFocus();
renameBox->show();
}
@@ -820,26 +825,25 @@ void AdvancedFm::doRename(QListView * view) {
void AdvancedFm::renameIt() {
if( !CurrentView()->currentItem()) return;
+
QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
doRename( thisView );
- rePopulate();
}
void AdvancedFm::okRename() {
if( !CurrentView()->currentItem()) return;
+
QString newName = renameBox->text();
cancelRename();
QListView * view = CurrentView();
QString path = CurrentDir()->canonicalPath() + "/";
oldName = path + oldName;
newName = path + newName;
-
if( rename( oldName.latin1(), newName.latin1())== -1)
QMessageBox::message(tr("Note"),tr("Could not rename"));
else
oldName = "";
-
view->takeItem( view->currentItem() );
delete view->currentItem();
rePopulate();