author | llornkcor <llornkcor> | 2002-07-11 16:36:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-11 16:36:34 (UTC) |
commit | 1651f048bb129b8e748a01c514d84c8626e0f1e2 (patch) (unidiff) | |
tree | 9b2783cfbb8b754a5aae098b2f4ae165b65f340c | |
parent | f568737c20bea96fb79d85681a72e142ec05d66f (diff) | |
download | opie-1651f048bb129b8e748a01c514d84c8626e0f1e2.zip opie-1651f048bb129b8e748a01c514d84c8626e0f1e2.tar.gz opie-1651f048bb129b8e748a01c514d84c8626e0f1e2.tar.bz2 |
added messageboc when copy, or move fileif file exists to ask ok to delete, added copy same dir to menu
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 162 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 |
2 files changed, 156 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 9e38d14..f97ae99 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1187,4 +1187,14 @@ void AdvancedFm::copy() | |||
1187 | QFile f(destFile); | 1187 | QFile f(destFile); |
1188 | if( f.exists()) | 1188 | if( f.exists()) { |
1189 | switch ( QMessageBox::warning(this,tr("Delete"), | ||
1190 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1191 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1192 | case 0: | ||
1189 | f.remove(); | 1193 | f.remove(); |
1194 | break; | ||
1195 | case 1: | ||
1196 | return; | ||
1197 | break; | ||
1198 | }; | ||
1199 | } | ||
1190 | if(!copyFile(destFile, curFile) ) { | 1200 | if(!copyFile(destFile, curFile) ) { |
@@ -1204,4 +1214,14 @@ void AdvancedFm::copy() | |||
1204 | QFile f(destFile); | 1214 | QFile f(destFile); |
1205 | if( f.exists()) | 1215 | if( f.exists()) { |
1216 | switch ( QMessageBox::warning(this,tr("Delete"), | ||
1217 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1218 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1219 | case 0: | ||
1206 | f.remove(); | 1220 | f.remove(); |
1221 | break; | ||
1222 | case 1: | ||
1223 | return; | ||
1224 | break; | ||
1225 | }; | ||
1226 | } | ||
1207 | if(!copyFile(destFile, curFile) ) { | 1227 | if(!copyFile(destFile, curFile) ) { |
@@ -1239,4 +1259,14 @@ void AdvancedFm::copyAs() | |||
1239 | QFile f(destFile); | 1259 | QFile f(destFile); |
1240 | if( f.exists()) | 1260 | if( f.exists()) { |
1261 | switch (QMessageBox::warning(this,tr("Delete"), | ||
1262 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1263 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1264 | case 0: | ||
1241 | f.remove(); | 1265 | f.remove(); |
1266 | break; | ||
1267 | case 1: | ||
1268 | return; | ||
1269 | break; | ||
1270 | }; | ||
1271 | } | ||
1242 | if(!copyFile(destFile, curFile) ) { | 1272 | if(!copyFile(destFile, curFile) ) { |
@@ -1247,3 +1277,2 @@ void AdvancedFm::copyAs() | |||
1247 | } | 1277 | } |
1248 | |||
1249 | populateRemoteView(); | 1278 | populateRemoteView(); |
@@ -1263,4 +1292,14 @@ void AdvancedFm::copyAs() | |||
1263 | QFile f(destFile); | 1292 | QFile f(destFile); |
1264 | if( f.exists()) | 1293 | if( f.exists()) { |
1294 | switch ( QMessageBox::warning(this,tr("Delete"), | ||
1295 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1296 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1297 | case 0: | ||
1265 | f.remove(); | 1298 | f.remove(); |
1299 | break; | ||
1300 | case 1: | ||
1301 | return; | ||
1302 | break; | ||
1303 | }; | ||
1304 | } | ||
1266 | if(!copyFile(destFile, curFile) ) { | 1305 | if(!copyFile(destFile, curFile) ) { |
@@ -1269,2 +1308,3 @@ void AdvancedFm::copyAs() | |||
1269 | } | 1308 | } |
1309 | |||
1270 | } | 1310 | } |
@@ -1276,2 +1316,89 @@ void AdvancedFm::copyAs() | |||
1276 | } | 1316 | } |
1317 | |||
1318 | } | ||
1319 | |||
1320 | void AdvancedFm::copySameDir() { | ||
1321 | QStringList curFileList = getPath(); | ||
1322 | if( curFileList.count() > 0) { | ||
1323 | QString curFile; | ||
1324 | InputDialog *fileDlg; | ||
1325 | |||
1326 | if (TabWidget->currentPageIndex() == 0) { | ||
1327 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | ||
1328 | QString destFile; | ||
1329 | curFile = currentDir.canonicalPath()+"/"+(*it); | ||
1330 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | ||
1331 | // InputDialog *fileDlg; | ||
1332 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | ||
1333 | fileDlg->setInputText((const QString &) destFile ); | ||
1334 | fileDlg->exec(); | ||
1335 | if( fileDlg->result() == 1 ) { | ||
1336 | QString filename = fileDlg->LineEdit1->text(); | ||
1337 | destFile = currentDir.canonicalPath()+"/"+filename; | ||
1338 | |||
1339 | QFile f(destFile); | ||
1340 | if( f.exists()) { | ||
1341 | switch (QMessageBox::warning(this,tr("Delete"), | ||
1342 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1343 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1344 | case 0: | ||
1345 | qDebug(""); | ||
1346 | f.remove(); | ||
1347 | break; | ||
1348 | case 1: | ||
1349 | return; | ||
1350 | break; | ||
1351 | }; | ||
1352 | } | ||
1353 | if(!copyFile(destFile, curFile) ) { | ||
1354 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | ||
1355 | qWarning("nothin doing"); | ||
1356 | } | ||
1357 | |||
1358 | qDebug("copy "+curFile+" as "+destFile); | ||
1359 | } | ||
1360 | delete fileDlg; | ||
1361 | } | ||
1362 | populateRemoteView(); | ||
1363 | TabWidget->setCurrentPage(1); | ||
1364 | } else { | ||
1365 | if (TabWidget->currentPageIndex() == 0) { | ||
1366 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | ||
1367 | |||
1368 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | ||
1369 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | ||
1370 | QString destFile; | ||
1371 | fileDlg->setInputText((const QString &) destFile); | ||
1372 | fileDlg->exec(); | ||
1373 | if( fileDlg->result() == 1 ) { | ||
1374 | QString filename = fileDlg->LineEdit1->text(); | ||
1375 | destFile = currentDir.canonicalPath()+"/"+filename; | ||
1376 | |||
1377 | QFile f(destFile); | ||
1378 | if( f.exists()) { | ||
1379 | switch ( QMessageBox::warning(this,tr("Delete"), | ||
1380 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1381 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1382 | case 0: | ||
1383 | f.remove(); | ||
1384 | break; | ||
1385 | case 1: | ||
1386 | return; | ||
1387 | break; | ||
1388 | }; | ||
1389 | } | ||
1390 | if(!copyFile(destFile, curFile) ) { | ||
1391 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | ||
1392 | qWarning("nothin doing"); | ||
1393 | } | ||
1394 | qDebug("copy "+curFile+" as "+destFile); | ||
1395 | } | ||
1396 | delete fileDlg; | ||
1397 | } | ||
1398 | populateLocalView(); | ||
1399 | TabWidget->setCurrentPage(0); | ||
1400 | } | ||
1401 | } | ||
1402 | } | ||
1403 | |||
1277 | } | 1404 | } |
@@ -1299,4 +1426,13 @@ void AdvancedFm::move() { | |||
1299 | QFile f(destFile); | 1426 | QFile f(destFile); |
1300 | if( f.exists()) | 1427 | if( f.exists()) { |
1428 | switch (QMessageBox::warning(this,tr("Delete"), | ||
1429 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1430 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1431 | case 0: | ||
1301 | f.remove(); | 1432 | f.remove(); |
1433 | break; | ||
1434 | case 1: | ||
1435 | return; | ||
1436 | break; | ||
1437 | }; | ||
1302 | if(!copyFile( destFile, curFile) ) { | 1438 | if(!copyFile( destFile, curFile) ) { |
@@ -1307,2 +1443,3 @@ void AdvancedFm::move() { | |||
1307 | } | 1443 | } |
1444 | } | ||
1308 | TabWidget->setCurrentPage(1); | 1445 | TabWidget->setCurrentPage(1); |
@@ -1321,4 +1458,13 @@ void AdvancedFm::move() { | |||
1321 | QFile f(destFile); | 1458 | QFile f(destFile); |
1322 | if( f.exists()) | 1459 | if( f.exists()) { |
1460 | switch (QMessageBox::warning(this,tr("Delete"), | ||
1461 | destFile+tr(" already exists\nDo you really want to delete it?"), | ||
1462 | tr("Yes"),tr("No"),0,0,1) ) { | ||
1463 | case 0: | ||
1323 | f.remove(); | 1464 | f.remove(); |
1465 | break; | ||
1466 | case 1: | ||
1467 | return; | ||
1468 | break; | ||
1469 | }; | ||
1324 | if(!copyFile(destFile, curFile) ) { | 1470 | if(!copyFile(destFile, curFile) ) { |
@@ -1327,2 +1473,3 @@ void AdvancedFm::move() { | |||
1327 | } | 1473 | } |
1474 | } | ||
1328 | QFile::remove(curFile); | 1475 | QFile::remove(curFile); |
@@ -1757,2 +1904,3 @@ void AdvancedFm::showFileMenu() { | |||
1757 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 1904 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
1905 | m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | ||
1758 | m->insertItem( tr( "Move" ), this, SLOT( move() )); | 1906 | m->insertItem( tr( "Move" ), this, SLOT( move() )); |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 7335773..7665fe9 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -126,2 +126,3 @@ protected slots: | |||
126 | void copyAs(); | 126 | void copyAs(); |
127 | void copySameDir(); | ||
127 | void currentPathComboActivated(const QString &); | 128 | void currentPathComboActivated(const QString &); |