summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-02-23 03:47:07 (UTC)
committer llornkcor <llornkcor>2003-02-23 03:47:07 (UTC)
commit2678456bf180bcf0ab7cfa112f3c723cf1d87c84 (patch) (unidiff)
treeeb7edd83adc3204088f2f3e0ed3c0ff9e48f5040
parentd51ca116a8c4d234db93021ccad36506980c317f (diff)
downloadopie-2678456bf180bcf0ab7cfa112f3c723cf1d87c84.zip
opie-2678456bf180bcf0ab7cfa112f3c723cf1d87c84.tar.gz
opie-2678456bf180bcf0ab7cfa112f3c723cf1d87c84.tar.bz2
fix rename
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 2ddcabc..e7c0b6a 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1050,88 +1050,88 @@ void AdvancedFm::cancelRename()
1050 { 1050 {
1051 view = Remote_View; 1051 view = Remote_View;
1052 } 1052 }
1053 1053
1054 bool resetFocus = view->viewport()->focusProxy() == renameBox; 1054 bool resetFocus = view->viewport()->focusProxy() == renameBox;
1055 delete renameBox; 1055 delete renameBox;
1056 renameBox = 0; 1056 renameBox = 0;
1057 if ( resetFocus ) { 1057 if ( resetFocus ) {
1058 view->viewport()->setFocusProxy( view); 1058 view->viewport()->setFocusProxy( view);
1059 view->setFocus(); 1059 view->setFocus();
1060 } 1060 }
1061} 1061}
1062 1062
1063void AdvancedFm::doRename(QListView * view) 1063void AdvancedFm::doRename(QListView * view)
1064{ 1064{
1065 1065
1066 QRect r = view->itemRect( view->currentItem( )); 1066 QRect r = view->itemRect( view->currentItem( ));
1067 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 1067 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
1068 r.setX( view->contentsX() ); 1068 r.setX( view->contentsX() );
1069 if ( r.width() > view->visibleWidth() ) 1069 if ( r.width() > view->visibleWidth() )
1070 r.setWidth( view->visibleWidth() ); 1070 r.setWidth( view->visibleWidth() );
1071 1071
1072 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 1072 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
1073 renameBox->setFrame(true); 1073 renameBox->setFrame(true);
1074 1074
1075 renameBox->setText( view->currentItem()->text(0) ); 1075 renameBox->setText( view->currentItem()->text(0) );
1076 1076
1077 renameBox->selectAll(); 1077 renameBox->selectAll();
1078 renameBox->installEventFilter( this ); 1078 renameBox->installEventFilter( this );
1079 view->addChild( renameBox, r.x(), r.y() ); 1079 view->addChild( renameBox, r.x(), r.y() );
1080 renameBox->resize( r.size() ); 1080 renameBox->resize( r.size() );
1081 view->viewport()->setFocusProxy( renameBox ); 1081 view->viewport()->setFocusProxy( renameBox );
1082 renameBox->setFocus(); 1082 renameBox->setFocus();
1083 renameBox->show(); 1083 renameBox->show();
1084 1084
1085} 1085}
1086 1086
1087 1087
1088void AdvancedFm::localRename() 1088void AdvancedFm::localRename()
1089{ 1089{
1090 oldName = Local_View->currentItem()->text(0); 1090 oldName = Local_View->currentItem()->text(0);
1091 doRename(Local_View ); 1091 doRename(Local_View );
1092 populateLocalView(); 1092 populateLocalView();
1093} 1093}
1094 1094
1095void AdvancedFm::remoteRename() 1095void AdvancedFm::remoteRename()
1096{ 1096{
1097 oldName = Remote_View->currentItem()->text(0); 1097 oldName = Remote_View->currentItem()->text(0);
1098 doRename(Local_View ); 1098 doRename(Remote_View );
1099 populateRemoteView(); 1099 populateRemoteView();
1100} 1100}
1101 1101
1102void AdvancedFm::okRename() 1102void AdvancedFm::okRename()
1103{ 1103{
1104 QString newName = renameBox->text(); 1104 QString newName = renameBox->text();
1105 cancelRename(); 1105 cancelRename();
1106 int tabs=0; 1106 int tabs=0;
1107 QListView * view; 1107 QListView * view;
1108 tabs = TabWidget->getCurrentTab(); 1108 tabs = TabWidget->getCurrentTab();
1109 if ( tabs == 0) 1109 if ( tabs == 0)
1110 { 1110 {
1111 view = Local_View; 1111 view = Local_View;
1112 QString path = currentDir.canonicalPath() + "/"; 1112 QString path = currentDir.canonicalPath() + "/";
1113 oldName = path + oldName; 1113 oldName = path + oldName;
1114 newName = path + newName; 1114 newName = path + newName;
1115 } 1115 }
1116 else 1116 else
1117 { 1117 {
1118 view = Remote_View; 1118 view = Remote_View;
1119 QString path = currentRemoteDir.canonicalPath() + "/"; 1119 QString path = currentRemoteDir.canonicalPath() + "/";
1120 oldName = path + oldName; 1120 oldName = path + oldName;
1121 newName = path + newName; 1121 newName = path + newName;
1122 } 1122 }
1123 1123
1124 if( view->currentItem() == NULL) 1124 if( view->currentItem() == NULL)
1125 return; 1125 return;
1126 if( rename(oldName.latin1(), newName.latin1())== -1) 1126 if( rename(oldName.latin1(), newName.latin1())== -1)
1127 QMessageBox::message(tr("Note"),tr("Could not rename")); 1127 QMessageBox::message(tr("Note"),tr("Could not rename"));
1128 else 1128 else
1129 oldName = ""; 1129 oldName = "";
1130 1130
1131 view->takeItem( view->currentItem() ); 1131 view->takeItem( view->currentItem() );
1132 delete view->currentItem(); 1132 delete view->currentItem();
1133 if ( tabs == 0) 1133 if ( tabs == 0)
1134 populateLocalView(); 1134 populateLocalView();
1135 else 1135 else
1136 populateRemoteView(); 1136 populateRemoteView();
1137} 1137}