summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-28 13:51:21 (UTC)
committer llornkcor <llornkcor>2002-04-28 13:51:21 (UTC)
commitc55ffe32ced1ecbac991ca2e85c6993cf8a04ee0 (patch) (unidiff)
tree479063624eb052aa80198c157a3acc5ea9e3ccac
parentcaae6c7deade10081709daa8a0de8ad548b6e30d (diff)
downloadopie-c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0.zip
opie-c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0.tar.gz
opie-c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0.tar.bz2
fixed functions for x86
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp65
1 files changed, 50 insertions, 15 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index faa03dc..bd513c0 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -813,49 +813,48 @@ void AdvancedFm::localDelete()
813 populateLocalView(); 813 populateLocalView();
814 } 814 }
815 break; 815 break;
816 case 1: 816 case 1:
817 // exit 817 // exit
818 break; 818 break;
819 }; 819 };
820 820
821 } else { 821 } else {
822 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 822 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
823 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 823 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
824 case 0: { 824 case 0: {
825 QString cmd="rm "+f; 825 QString cmd="rm "+f;
826 QFile file(f); 826 QFile file(f);
827 file.remove(); 827 file.remove();
828// system( cmd.latin1()); 828// system( cmd.latin1());
829 populateLocalView(); 829 populateLocalView();
830 } 830 }
831 break; 831 break;
832 case 1: 832 case 1:
833 // exit 833 // exit
834 break; 834 break;
835 }; 835 };
836 } 836 }
837
838 } 837 }
839} 838}
840 839
841void AdvancedFm::remoteDelete() 840void AdvancedFm::remoteDelete()
842{ 841{
843 QStringList curFileList = getPath(); 842 QStringList curFileList = getPath();
844 QString myFile; 843 QString myFile;
845 844
846 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 845 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
847 myFile = (*it); 846 myFile = (*it);
848 if(myFile.find(" -> ",0,TRUE) != -1) 847 if(myFile.find(" -> ",0,TRUE) != -1)
849 myFile = myFile.left(myFile.find(" -> ",0,TRUE)); 848 myFile = myFile.left(myFile.find(" -> ",0,TRUE));
850 QString f = currentDir.canonicalPath(); 849 QString f = currentDir.canonicalPath();
851 if(f.right(1).find("/",0,TRUE) == -1) 850 if(f.right(1).find("/",0,TRUE) == -1)
852 f+="/"; 851 f+="/";
853 f+=myFile; 852 f+=myFile;
854 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 853 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
855 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 854 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
856 "\nand all it's contents ?", 855 "\nand all it's contents ?",
857 tr("Yes"),tr("No"),0,0,1) ) { 856 tr("Yes"),tr("No"),0,0,1) ) {
858 case 0: { 857 case 0: {
859 f=f.left(f.length()-1); 858 f=f.left(f.length()-1);
860 QString cmd="rm -rf "+f; 859 QString cmd="rm -rf "+f;
861 system( cmd.latin1()); 860 system( cmd.latin1());
@@ -1119,157 +1118,193 @@ void AdvancedFm::upDir()
1119 current = dir.canonicalPath(); 1118 current = dir.canonicalPath();
1120 chdir( current.latin1() ); 1119 chdir( current.latin1() );
1121 currentDir.cd( current, TRUE); 1120 currentDir.cd( current, TRUE);
1122 populateLocalView(); 1121 populateLocalView();
1123 update(); 1122 update();
1124 } else { 1123 } else {
1125 QString current = currentRemoteDir.canonicalPath(); 1124 QString current = currentRemoteDir.canonicalPath();
1126 QDir dir(current); 1125 QDir dir(current);
1127 dir.cdUp(); 1126 dir.cdUp();
1128 current = dir.canonicalPath(); 1127 current = dir.canonicalPath();
1129 chdir( current.latin1() ); 1128 chdir( current.latin1() );
1130 currentRemoteDir.cd( current, TRUE); 1129 currentRemoteDir.cd( current, TRUE);
1131 populateRemoteView(); 1130 populateRemoteView();
1132 update(); 1131 update();
1133 } 1132 }
1134} 1133}
1135 1134
1136void AdvancedFm::copy() 1135void AdvancedFm::copy()
1137{ 1136{
1138 QStringList curFileList = getPath(); 1137 QStringList curFileList = getPath();
1139 QString curFile; 1138 QString curFile;
1140 if (TabWidget->currentPageIndex() == 0) { 1139 if (TabWidget->currentPageIndex() == 0) {
1141 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1140 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1142 1141
1143 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1142 QString destFile = currentRemoteDir.canonicalPath();
1144 curFile = currentDir.canonicalPath()+"/"+(*it); 1143 if(destFile.right(1).find("/",0,TRUE) == -1)
1144 destFile+="/";
1145 destFile +=(*it);
1146 curFile = currentDir.canonicalPath();
1147 if(curFile.right(1).find("/",0,TRUE) == -1)
1148 curFile +="/";
1149 curFile +=(*it);
1145 QFile f(destFile); 1150 QFile f(destFile);
1146 if( f.exists()) 1151 if( f.exists())
1147 f.remove(); 1152 f.remove();
1148 if(!copyFile(destFile, curFile) ) 1153 if(!copyFile(destFile, curFile) )
1149 qWarning("nothin doing"); 1154 qWarning("nothin doing");
1150 } 1155 }
1151 populateRemoteView(); 1156 populateRemoteView();
1152 TabWidget->setCurrentPage(1); 1157 TabWidget->setCurrentPage(1);
1153 1158
1154 } else { 1159 } else {
1155 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1160 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1156 1161
1157 QString destFile = currentDir.canonicalPath()+"/"+(*it); 1162 QString destFile = currentDir.canonicalPath();
1158 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1163 if(destFile.right(1).find("/",0,TRUE) == -1)
1164 destFile+="/";
1165 destFile +=(*it);
1166 curFile = currentRemoteDir.canonicalPath();
1167 if(curFile.right(1).find("/",0,TRUE) == -1)
1168 curFile +="/";
1169 curFile +=(*it);
1159 QFile f(destFile); 1170 QFile f(destFile);
1160 if( f.exists()) 1171 if( f.exists())
1161 f.remove(); 1172 f.remove();
1162 if(!copyFile(destFile, curFile) ) 1173 if(!copyFile(destFile, curFile) )
1163 qWarning("nothin doing"); 1174 qWarning("nothin doing");
1164 } 1175 }
1165 populateLocalView(); 1176 populateLocalView();
1166 TabWidget->setCurrentPage(0); 1177 TabWidget->setCurrentPage(0);
1167 } 1178 }
1168} 1179}
1169 1180
1170void AdvancedFm::copyAs() 1181void AdvancedFm::copyAs()
1171{ 1182{
1172 QStringList curFileList = getPath(); 1183 QStringList curFileList = getPath();
1173 QString curFile; 1184 QString curFile;
1174 InputDialog *fileDlg; 1185 InputDialog *fileDlg;
1175 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1186 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1176 1187
1177 if (TabWidget->currentPageIndex() == 0) { 1188 if (TabWidget->currentPageIndex() == 0) {
1178 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1189 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1179 QString destFile = *it; 1190 QString destFile;
1180 curFile = currentDir.canonicalPath()+"/"+(*it); 1191 curFile = currentDir.canonicalPath();
1192 if(curFile.right(1).find("/",0,TRUE) == -1)
1193 curFile +="/";
1194 curFile+=(*it);
1181// InputDialog *fileDlg; 1195// InputDialog *fileDlg;
1182// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1196// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1183 fileDlg->setInputText((const QString &) destFile ); 1197 fileDlg->setInputText((const QString &) destFile );
1184 fileDlg->exec(); 1198 fileDlg->exec();
1185 if( fileDlg->result() == 1 ) { 1199 if( fileDlg->result() == 1 ) {
1186 QString filename = fileDlg->LineEdit1->text(); 1200 QString filename = fileDlg->LineEdit1->text();
1187 destFile = currentRemoteDir.canonicalPath()+"/"+destFile; 1201 destFile = currentRemoteDir.canonicalPath();
1202 if(destFile.right(1).find("/",0,TRUE) == -1)
1203 destFile+="/";
1204 destFile +=(*it);
1188 1205
1189 QFile f(destFile); 1206 QFile f(destFile);
1190 if( f.exists()) 1207 if( f.exists())
1191 f.remove(); 1208 f.remove();
1192 if(!copyFile(destFile, curFile) ) 1209 if(!copyFile(destFile, curFile) )
1193 qWarning("nothin doing"); 1210 qWarning("nothin doing");
1194 } 1211 }
1195 } 1212 }
1196 1213
1197 populateRemoteView(); 1214 populateRemoteView();
1198 TabWidget->setCurrentPage(1); 1215 TabWidget->setCurrentPage(1);
1199 } else { 1216 } else {
1200 if (TabWidget->currentPageIndex() == 0) { 1217 if (TabWidget->currentPageIndex() == 0) {
1201 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1218 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1202 1219
1203 curFile = currentDir.canonicalPath()+"/"+(*it); 1220 curFile = currentDir.canonicalPath();
1204 QString destFile = *it; 1221 if(curFile.right(1).find("/",0,TRUE) == -1)
1222 curFile +="/";
1223 curFile+=(*it);
1224 QString destFile;
1205 fileDlg->setInputText((const QString &) destFile); 1225 fileDlg->setInputText((const QString &) destFile);
1206 fileDlg->exec(); 1226 fileDlg->exec();
1207 if( fileDlg->result() == 1 ) { 1227 if( fileDlg->result() == 1 ) {
1208 QString filename = fileDlg->LineEdit1->text(); 1228 QString filename = fileDlg->LineEdit1->text();
1209 destFile = currentDir.canonicalPath()+"/"+destFile; 1229 destFile = currentDir.canonicalPath();
1230 if(destFile.right(1).find("/",0,TRUE) == -1)
1231 destFile+="/";
1232 destFile +=(*it);
1210 1233
1211 QFile f(destFile); 1234 QFile f(destFile);
1212 if( f.exists()) 1235 if( f.exists())
1213 f.remove(); 1236 f.remove();
1214 if(!copyFile(destFile, curFile) ) 1237 if(!copyFile(destFile, curFile) )
1215 qWarning("nothin doing"); 1238 qWarning("nothin doing");
1216 } 1239 }
1217 } 1240 }
1218 populateLocalView(); 1241 populateLocalView();
1219 TabWidget->setCurrentPage(0); 1242 TabWidget->setCurrentPage(0);
1220 } 1243 }
1221 } 1244 }
1222} 1245}
1223 1246
1224void AdvancedFm::move() { 1247void AdvancedFm::move() {
1225 1248
1226 QStringList curFileList = getPath(); 1249 QStringList curFileList = getPath();
1227 QString curFile; 1250 QString curFile;
1228// qDebug(curFile); 1251// qDebug(curFile);
1229 QString destFile; 1252 QString destFile;
1230 1253
1231 if (TabWidget->currentPageIndex() == 0) { 1254 if (TabWidget->currentPageIndex() == 0) {
1232 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1255 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1233 QString destFile = currentRemoteDir.canonicalPath() + "/" + *it; 1256 QString destFile = currentRemoteDir.canonicalPath();
1234 curFile = currentDir.canonicalPath()+"/"+(*it); 1257 if(destFile.right(1).find("/",0,TRUE) == -1)
1258 destFile+="/";
1259 destFile +=(*it);
1260 curFile = currentDir.canonicalPath();
1235 qDebug("Destination file is "+destFile); 1261 qDebug("Destination file is "+destFile);
1262 if(curFile.right(1).find("/",0,TRUE) == -1)
1263 curFile +="/";
1264 curFile+=(*it);
1236 1265
1237 QFile f(destFile); 1266 QFile f(destFile);
1238 if( f.exists()) 1267 if( f.exists())
1239 f.remove(); 1268 f.remove();
1240 if(!copyFile( destFile, curFile) ) { 1269 if(!copyFile( destFile, curFile) ) {
1241 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1270 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1242 return; 1271 return;
1243 } 1272 }
1244 QFile::remove(curFile); 1273 QFile::remove(curFile);
1245 } 1274 }
1246 TabWidget->setCurrentPage(1); 1275 TabWidget->setCurrentPage(1);
1247 } else { 1276 } else {
1248 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1277 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1249 QString destFile = currentRemoteDir.canonicalPath() + "/" + *it; 1278 QString destFile = currentRemoteDir.canonicalPath();
1279 if(destFile.right(1).find("/",0,TRUE) == -1)
1280 destFile+="/";
1281 destFile +=(*it);
1250 qDebug("Destination file is "+destFile); 1282 qDebug("Destination file is "+destFile);
1251 curFile = currentDir.canonicalPath()+"/"+(*it); 1283 curFile = currentDir.canonicalPath();
1284 if(curFile.right(1).find("/",0,TRUE) == -1)
1285 curFile +="/";
1286 curFile+=(*it);
1252 1287
1253 QFile f(destFile); 1288 QFile f(destFile);
1254 if( f.exists()) 1289 if( f.exists())
1255 f.remove(); 1290 f.remove();
1256 if(!copyFile(destFile, curFile) ) { 1291 if(!copyFile(destFile, curFile) ) {
1257 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1292 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1258 return; 1293 return;
1259 } 1294 }
1260 QFile::remove(curFile); 1295 QFile::remove(curFile);
1261 TabWidget->setCurrentPage(0); 1296 TabWidget->setCurrentPage(0);
1262 } 1297 }
1263 } 1298 }
1264 populateRemoteView(); 1299 populateRemoteView();
1265 populateLocalView(); 1300 populateLocalView();
1266 } 1301 }
1267 1302
1268 bool AdvancedFm::copyFile( const QString & dest, const QString & src ) 1303 bool AdvancedFm::copyFile( const QString & dest, const QString & src )
1269{ 1304{
1270 char bf[ 50000 ]; 1305 char bf[ 50000 ];
1271 int bytesRead; 1306 int bytesRead;
1272 bool success = TRUE; 1307 bool success = TRUE;
1273 struct stat status; 1308 struct stat status;
1274 1309
1275 QFile s( src ); 1310 QFile s( src );