-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 130 |
3 files changed, 94 insertions, 38 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 12ebbf2..7bccce9 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -72,6 +72,7 @@ public: | |||
72 | QStringList fileSystemTypeList, fsList; | 72 | QStringList fileSystemTypeList, fsList; |
73 | int currentServerConfig; | 73 | int currentServerConfig; |
74 | protected slots: | 74 | protected slots: |
75 | void selectAll(); | ||
75 | void addToDocs(); | 76 | void addToDocs(); |
76 | void doLocalCd(); | 77 | void doLocalCd(); |
77 | void doRemoteCd(); | 78 | void doRemoteCd(); |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 7188640..f0a0a35 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -87,6 +87,7 @@ void AdvancedFm::init() { | |||
87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
89 | fileMenu->insertSeparator(); | 89 | fileMenu->insertSeparator(); |
90 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | ||
90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 91 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 92 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
92 | fileMenu->setCheckable(TRUE); | 93 | fileMenu->setCheckable(TRUE); |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 27a119f..bef701a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -199,7 +199,23 @@ void AdvancedFm::remoteMakDir() { | |||
199 | 199 | ||
200 | void AdvancedFm::localDelete() { | 200 | void AdvancedFm::localDelete() { |
201 | QStringList curFileList = getPath(); | 201 | QStringList curFileList = getPath(); |
202 | if(curFileList.count() > 0) { | 202 | bool doMsg=true; |
203 | int count=curFileList.count(); | ||
204 | if( count > 0) { | ||
205 | if(count > 1 ){ | ||
206 | QString msg; | ||
207 | msg=tr("Really delete\n%1 files?").arg(count); | ||
208 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
209 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
210 | case 0: | ||
211 | doMsg=false; | ||
212 | break; | ||
213 | case 1: | ||
214 | return; | ||
215 | break; | ||
216 | }; | ||
217 | } | ||
218 | |||
203 | QString myFile; | 219 | QString myFile; |
204 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 220 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
205 | myFile = (*it); | 221 | myFile = (*it); |
@@ -211,7 +227,7 @@ void AdvancedFm::localDelete() { | |||
211 | f+="/"; | 227 | f+="/"; |
212 | f+=myFile; | 228 | f+=myFile; |
213 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 229 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
214 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 230 | switch ( QMessageBox::warning(this,tr("Delete Directory?"),tr("Really delete\n")+f+ |
215 | "\nand all it's contents ?" | 231 | "\nand all it's contents ?" |
216 | ,tr("Yes"),tr("No"),0,0,1) ) { | 232 | ,tr("Yes"),tr("No"),0,0,1) ) { |
217 | case 0: { | 233 | case 0: { |
@@ -227,28 +243,44 @@ void AdvancedFm::localDelete() { | |||
227 | }; | 243 | }; |
228 | 244 | ||
229 | } else { | 245 | } else { |
230 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 246 | if(doMsg) { |
247 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | ||
231 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 248 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
232 | case 0: { | 249 | case 1: |
250 | return; | ||
251 | break; | ||
252 | }; | ||
253 | } | ||
233 | QString cmd="rm "+f; | 254 | QString cmd="rm "+f; |
234 | QFile file(f); | 255 | QFile file(f); |
256 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | ||
235 | file.remove(); | 257 | file.remove(); |
236 | // system( cmd.latin1()); | 258 | // system( cmd.latin1()); |
259 | } | ||
260 | } | ||
261 | } | ||
237 | populateLocalView(); | 262 | populateLocalView(); |
238 | } | 263 | } |
264 | |||
265 | void AdvancedFm::remoteDelete() { | ||
266 | QStringList curFileList = getPath(); | ||
267 | bool doMsg=true; | ||
268 | int count=curFileList.count(); | ||
269 | if( count > 0) { | ||
270 | if(count > 1 ){ | ||
271 | QString msg; | ||
272 | msg=tr("Really delete\n%1 files?").arg(count); | ||
273 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
274 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
275 | case 0: | ||
276 | doMsg=false; | ||
239 | break; | 277 | break; |
240 | case 1: | 278 | case 1: |
241 | // exit | 279 | return; |
242 | break; | 280 | break; |
243 | }; | 281 | }; |
244 | } | 282 | } |
245 | } | ||
246 | } | ||
247 | } | ||
248 | 283 | ||
249 | void AdvancedFm::remoteDelete() { | ||
250 | QStringList curFileList = getPath(); | ||
251 | if( curFileList.count() > 0) { | ||
252 | QString myFile; | 284 | QString myFile; |
253 | 285 | ||
254 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 286 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
@@ -260,7 +292,7 @@ void AdvancedFm::remoteDelete() { | |||
260 | f+="/"; | 292 | f+="/"; |
261 | f+=myFile; | 293 | f+=myFile; |
262 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 294 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
263 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 295 | switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ |
264 | "\nand all it's contents ?", | 296 | "\nand all it's contents ?", |
265 | tr("Yes"),tr("No"),0,0,1) ) { | 297 | tr("Yes"),tr("No"),0,0,1) ) { |
266 | case 0: { | 298 | case 0: { |
@@ -276,23 +308,23 @@ void AdvancedFm::remoteDelete() { | |||
276 | }; | 308 | }; |
277 | 309 | ||
278 | } else { | 310 | } else { |
279 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 311 | if(doMsg) { |
312 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | ||
280 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 313 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
281 | case 0: { | 314 | case 1: |
315 | return; | ||
316 | break; | ||
317 | }; | ||
318 | } | ||
282 | QString cmd="rm "+f; | 319 | QString cmd="rm "+f; |
283 | QFile file(f); | 320 | QFile file(f); |
321 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | ||
284 | file.remove(); | 322 | file.remove(); |
285 | // system( cmd.latin1()); | 323 | // system( cmd.latin1()); |
286 | populateRemoteView(); | ||
287 | } | ||
288 | break; | ||
289 | case 1: | ||
290 | // exit | ||
291 | break; | ||
292 | }; | ||
293 | } | 324 | } |
294 | } | 325 | } |
295 | } | 326 | } |
327 | populateRemoteView(); | ||
296 | } | 328 | } |
297 | 329 | ||
298 | void AdvancedFm::localRename() { | 330 | void AdvancedFm::localRename() { |
@@ -409,12 +441,27 @@ void AdvancedFm::upDir() { | |||
409 | void AdvancedFm::copy() { | 441 | void AdvancedFm::copy() { |
410 | qApp->processEvents(); | 442 | qApp->processEvents(); |
411 | QStringList curFileList = getPath(); | 443 | QStringList curFileList = getPath(); |
412 | if( curFileList.count() > 0) { | 444 | bool doMsg=true; |
445 | int count=curFileList.count(); | ||
446 | if( count > 0) { | ||
447 | if(count > 1 ){ | ||
448 | QString msg; | ||
449 | msg=tr("Really copy\n%1 files?").arg(count); | ||
450 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
451 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
452 | case 0: | ||
453 | doMsg=false; | ||
454 | break; | ||
455 | case 1: | ||
456 | return; | ||
457 | break; | ||
458 | }; | ||
459 | } | ||
460 | |||
413 | QString curFile, item, destFile; | 461 | QString curFile, item, destFile; |
414 | if (TabWidget->getCurrentTab() == 0) { | 462 | if (TabWidget->getCurrentTab() == 0) { |
415 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 463 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
416 | item=(*it); | 464 | item=(*it); |
417 | |||
418 | if(item.find("->",0,TRUE)) //symlink | 465 | if(item.find("->",0,TRUE)) //symlink |
419 | item = item.left(item.find("->",0,TRUE)); | 466 | item = item.left(item.find("->",0,TRUE)); |
420 | 467 | ||
@@ -426,17 +473,17 @@ void AdvancedFm::copy() { | |||
426 | 473 | ||
427 | QFile f(destFile); | 474 | QFile f(destFile); |
428 | if( f.exists()) { | 475 | if( f.exists()) { |
429 | switch ( QMessageBox::warning(this,tr("Delete"), | 476 | if(doMsg) { |
430 | destFile+tr(" already exists\nDo you really want to delete it?"), | 477 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
478 | item+tr("\nexists. Ok to overwrite?"), | ||
431 | tr("Yes"),tr("No"),0,0,1) ) { | 479 | tr("Yes"),tr("No"),0,0,1) ) { |
432 | case 0: | ||
433 | f.remove(); | ||
434 | break; | ||
435 | case 1: | 480 | case 1: |
436 | return; | 481 | return; |
437 | break; | 482 | break; |
438 | }; | 483 | }; |
439 | } | 484 | } |
485 | f.remove(); | ||
486 | } | ||
440 | if(!copyFile(destFile, curFile) ) { | 487 | if(!copyFile(destFile, curFile) ) { |
441 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 488 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
442 | return; | 489 | return; |
@@ -448,7 +495,6 @@ void AdvancedFm::copy() { | |||
448 | } else { | 495 | } else { |
449 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
450 | item= (*it); | 497 | item= (*it); |
451 | |||
452 | if(item.find("->",0,TRUE)) //symlink | 498 | if(item.find("->",0,TRUE)) //symlink |
453 | item = item.left(item.find("->",0,TRUE)); | 499 | item = item.left(item.find("->",0,TRUE)); |
454 | 500 | ||
@@ -460,16 +506,14 @@ void AdvancedFm::copy() { | |||
460 | 506 | ||
461 | QFile f(destFile); | 507 | QFile f(destFile); |
462 | if( f.exists()) { | 508 | if( f.exists()) { |
463 | switch ( QMessageBox::warning(this,tr("Delete"), | 509 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
464 | destFile+tr(" already exists\nDo you really want to delete it?"), | 510 | item+tr("\nexists. Ok to overwrite?"), |
465 | tr("Yes"),tr("No"),0,0,1) ) { | 511 | tr("Yes"),tr("No"),0,0,1) ) { |
466 | case 0: | ||
467 | f.remove(); | ||
468 | break; | ||
469 | case 1: | 512 | case 1: |
470 | return; | 513 | return; |
471 | break; | 514 | break; |
472 | }; | 515 | }; |
516 | f.remove(); | ||
473 | } | 517 | } |
474 | if(!copyFile(destFile, curFile) ) { | 518 | if(!copyFile(destFile, curFile) ) { |
475 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 519 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
@@ -507,8 +551,8 @@ void AdvancedFm::copyAs() { | |||
507 | 551 | ||
508 | QFile f(destFile); | 552 | QFile f(destFile); |
509 | if( f.exists()) { | 553 | if( f.exists()) { |
510 | switch (QMessageBox::warning(this,tr("Delete"), | 554 | switch (QMessageBox::warning(this,tr("File Exists!"), |
511 | destFile+tr(" already exists\nDo you really want to delete it?"), | 555 | item+tr("\nexists. Ok to overwrite?"), |
512 | tr("Yes"),tr("No"),0,0,1) ) { | 556 | tr("Yes"),tr("No"),0,0,1) ) { |
513 | case 0: | 557 | case 0: |
514 | f.remove(); | 558 | f.remove(); |
@@ -546,8 +590,8 @@ void AdvancedFm::copyAs() { | |||
546 | 590 | ||
547 | QFile f( destFile); | 591 | QFile f( destFile); |
548 | if( f.exists()) { | 592 | if( f.exists()) { |
549 | switch ( QMessageBox::warning(this,tr("Delete"), | 593 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
550 | destFile+tr(" already exists\nDo you really want to delete it?"), | 594 | item+tr("\nexists. Ok to overwrite?"), |
551 | tr("Yes"),tr("No"),0,0,1) ) { | 595 | tr("Yes"),tr("No"),0,0,1) ) { |
552 | case 0: | 596 | case 0: |
553 | f.remove(); | 597 | f.remove(); |
@@ -962,3 +1006,13 @@ void AdvancedFm::fileBeamFinished( Ir *) { | |||
962 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1006 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
963 | 1007 | ||
964 | } | 1008 | } |
1009 | |||
1010 | void AdvancedFm::selectAll() { | ||
1011 | if (TabWidget->getCurrentTab() == 0) { | ||
1012 | Local_View->selectAll(true); | ||
1013 | Local_View->setSelected( Local_View->firstChild(),false); | ||
1014 | } else { | ||
1015 | Remote_View->selectAll(true); | ||
1016 | Remote_View->setSelected( Remote_View->firstChild(),false); | ||
1017 | } | ||
1018 | } | ||