summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-12-20 21:08:25 (UTC)
committer llornkcor <llornkcor>2003-12-20 21:08:25 (UTC)
commitc7bad76e8d576fc0b6999775c89c724c6fa89158 (patch) (unidiff)
treeff4c08395c6c2f90efb75ca7f1037c5a3c77c830
parentef3584f1fd410e00d21d26d4ebbb9b6766669086 (diff)
downloadopie-c7bad76e8d576fc0b6999775c89c724c6fa89158.zip
opie-c7bad76e8d576fc0b6999775c89c724c6fa89158.tar.gz
opie-c7bad76e8d576fc0b6999775c89c724c6fa89158.tar.bz2
fix rename
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp28
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
@@ -800,7 +800,8 @@ void AdvancedFm::doRename(QListView * view) {
800 QRect r = view->itemRect( view->currentItem( )); 800 QRect r = view->itemRect( view->currentItem( ));
801 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 801 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
802 r.setX( view->contentsX() ); 802 r.setX( view->contentsX() );
803 if ( r.width() > view->visibleWidth() ) 803
804 if ( r.width() > view->visibleWidth() )
804 r.setWidth( view->visibleWidth() ); 805 r.setWidth( view->visibleWidth() );
805 806
806 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 807 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
@@ -810,39 +811,42 @@ void AdvancedFm::doRename(QListView * view) {
810 811
811 renameBox->selectAll(); 812 renameBox->selectAll();
812 renameBox->installEventFilter( this ); 813 renameBox->installEventFilter( this );
814
813 view->addChild( renameBox, r.x(), r.y() ); 815 view->addChild( renameBox, r.x(), r.y() );
814 renameBox->resize( r.size() ); 816
815 view->viewport()->setFocusProxy( renameBox ); 817 renameBox->resize( r.size() );
816 renameBox->setFocus(); 818
819 view->viewport()->setFocusProxy( renameBox );
820
821 renameBox->setFocus();
817 renameBox->show(); 822 renameBox->show();
818} 823}
819 824
820 825
821void AdvancedFm::renameIt() { 826void AdvancedFm::renameIt() {
822 if( !CurrentView()->currentItem()) return; 827 if( !CurrentView()->currentItem()) return;
823 QListView *thisView = CurrentView(); 828
829 QListView *thisView = CurrentView();
824 oldName = thisView->currentItem()->text(0); 830 oldName = thisView->currentItem()->text(0);
825 doRename( thisView ); 831 doRename( thisView );
826 rePopulate();
827} 832}
828 833
829void AdvancedFm::okRename() { 834void AdvancedFm::okRename() {
830 if( !CurrentView()->currentItem()) return; 835 if( !CurrentView()->currentItem()) return;
836
831 QString newName = renameBox->text(); 837 QString newName = renameBox->text();
832 cancelRename(); 838 cancelRename();
833 QListView * view = CurrentView(); 839 QListView * view = CurrentView();
834 QString path = CurrentDir()->canonicalPath() + "/"; 840 QString path = CurrentDir()->canonicalPath() + "/";
835 oldName = path + oldName; 841 oldName = path + oldName;
836 newName = path + newName; 842 newName = path + newName;
837
838 if( rename( oldName.latin1(), newName.latin1())== -1) 843 if( rename( oldName.latin1(), newName.latin1())== -1)
839 QMessageBox::message(tr("Note"),tr("Could not rename")); 844 QMessageBox::message(tr("Note"),tr("Could not rename"));
840 else 845 else
841 oldName = ""; 846 oldName = "";
842
843 view->takeItem( view->currentItem() ); 847 view->takeItem( view->currentItem() );
844 delete view->currentItem(); 848 delete view->currentItem();
845 rePopulate(); 849 rePopulate();
846} 850}
847 851
848void AdvancedFm::openSearch() { 852void AdvancedFm::openSearch() {