author | llornkcor <llornkcor> | 2003-12-20 21:08:25 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-12-20 21:08:25 (UTC) |
commit | c7bad76e8d576fc0b6999775c89c724c6fa89158 (patch) (side-by-side diff) | |
tree | ff4c08395c6c2f90efb75ca7f1037c5a3c77c830 | |
parent | ef3584f1fd410e00d21d26d4ebbb9b6766669086 (diff) | |
download | opie-c7bad76e8d576fc0b6999775c89c724c6fa89158.zip opie-c7bad76e8d576fc0b6999775c89c724c6fa89158.tar.gz opie-c7bad76e8d576fc0b6999775c89c724c6fa89158.tar.bz2 |
fix rename
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 10 |
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 @@ -771,80 +771,84 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { } else { whichTab=2; } } OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection } return QWidget::eventFilter( o, e ); } void AdvancedFm::cancelRename() { // qDebug("cancel rename"); QListView * view; view = CurrentView(); bool resetFocus = view->viewport()->focusProxy() == renameBox; delete renameBox; renameBox = 0; if ( resetFocus ) { view->viewport()->setFocusProxy( view); view->setFocus(); } } void AdvancedFm::doRename(QListView * view) { if( !CurrentView()->currentItem()) return; 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() ); renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); renameBox->setFrame(true); renameBox->setText( view->currentItem()->text(0) ); renameBox->selectAll(); renameBox->installEventFilter( this ); + view->addChild( renameBox, r.x(), r.y() ); + renameBox->resize( r.size() ); + view->viewport()->setFocusProxy( renameBox ); + renameBox->setFocus(); renameBox->show(); } 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(); } void AdvancedFm::openSearch() { QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); } |