author | llornkcor <llornkcor> | 2002-10-20 15:51:08 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-20 15:51:08 (UTC) |
commit | 0535df00106c4e4c78e6ae8dde8f4f41f8487dae (patch) (unidiff) | |
tree | a00836456d62b54a2959c76276879d12efc5501e | |
parent | 1a583682e8a49e65d5c478ab72dffb78d120c850 (diff) | |
download | opie-0535df00106c4e4c78e6ae8dde8f4f41f8487dae.zip opie-0535df00106c4e4c78e6ae8dde8f4f41f8487dae.tar.gz opie-0535df00106c4e4c78e6ae8dde8f4f41f8487dae.tar.bz2 |
converted to otab, and updated show hidden dir functions
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 56 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 5 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 80 |
5 files changed, 99 insertions, 58 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f23fd86..08dc24e 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,38 +1,39 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | #include <opie/otabwidget.h> | ||
15 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
16 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
17 | 18 | ||
18 | #include <qpe/filemanager.h> | 19 | #include <qpe/filemanager.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
24 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 26 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 28 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
29 | 30 | ||
30 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
31 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
32 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
33 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
34 | #include <qdir.h> | 35 | #include <qdir.h> |
35 | #include <qfile.h> | 36 | #include <qfile.h> |
36 | #include <qstring.h> | 37 | #include <qstring.h> |
37 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
38 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
@@ -66,58 +67,61 @@ | |||
66 | AdvancedFm::AdvancedFm( ) | 67 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) { | 68 | : QMainWindow( ) { |
68 | init(); | 69 | init(); |
69 | initConnections(); | 70 | initConnections(); |
70 | populateLocalView(); | 71 | populateLocalView(); |
71 | populateRemoteView(); | 72 | populateRemoteView(); |
72 | currentPathCombo->setFocus(); | 73 | currentPathCombo->setFocus(); |
73 | } | 74 | } |
74 | 75 | ||
75 | AdvancedFm::~AdvancedFm() { | 76 | AdvancedFm::~AdvancedFm() { |
76 | } | 77 | } |
77 | 78 | ||
78 | void AdvancedFm::cleanUp() { | 79 | void AdvancedFm::cleanUp() { |
79 | QString sfile=QDir::homeDirPath(); | 80 | QString sfile=QDir::homeDirPath(); |
80 | if(sfile.right(1) != "/") | 81 | if(sfile.right(1) != "/") |
81 | sfile+="/._temp"; | 82 | sfile+="/._temp"; |
82 | else | 83 | else |
83 | sfile+="._temp"; | 84 | sfile+="._temp"; |
84 | QFile file( sfile); | 85 | QFile file( sfile); |
85 | if(file.exists()) | 86 | if(file.exists()) |
86 | file.remove(); | 87 | file.remove(); |
87 | } | 88 | } |
88 | 89 | ||
89 | void AdvancedFm::tabChanged(QWidget *) { | 90 | void AdvancedFm::tabChanged(QWidget *) { |
90 | if (TabWidget->currentPageIndex() == 0) { | 91 | if (TabWidget->getCurrentTab() == 0) { |
92 | // if (TabWidget->currentPageIndex() == 0) { | ||
91 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 93 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
92 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
94 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 96 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
95 | setCaption("AdvancedFm :: "+fs+" :: " | 97 | setCaption("AdvancedFm :: "+fs+" :: " |
96 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 98 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
97 | 99 | ||
98 | } | 100 | } |
99 | if (TabWidget->currentPageIndex() == 1) { | 101 | if (TabWidget->getCurrentTab() == 1) { |
102 | |||
103 | // if (TabWidget->currentPageIndex() == 1) { | ||
100 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 104 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
101 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 105 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
102 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 106 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
103 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 107 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
104 | setCaption("AdvancedFm :: "+fs+" :: " | 108 | setCaption("AdvancedFm :: "+fs+" :: " |
105 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 109 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
106 | } | 110 | } |
107 | } | 111 | } |
108 | 112 | ||
109 | 113 | ||
110 | void AdvancedFm::populateLocalView() { | 114 | void AdvancedFm::populateLocalView() { |
111 | QPixmap pm; | 115 | QPixmap pm; |
112 | Local_View->clear(); | 116 | Local_View->clear(); |
113 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 117 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
114 | currentDir.setMatchAllDirs(TRUE); | 118 | currentDir.setMatchAllDirs(TRUE); |
115 | currentDir.setNameFilter(filterStr); | 119 | currentDir.setNameFilter(filterStr); |
116 | QString fileL, fileS, fileDate; | 120 | QString fileL, fileS, fileDate; |
117 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 121 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
118 | setCaption("AdvancedFm :: "+fs+" :: " | 122 | setCaption("AdvancedFm :: "+fs+" :: " |
119 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 123 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
120 | bool isDir=FALSE; | 124 | bool isDir=FALSE; |
121 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 125 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
122 | QFileInfoListIterator it(*list); | 126 | QFileInfoListIterator it(*list); |
123 | QFileInfo *fi; | 127 | QFileInfo *fi; |
@@ -393,192 +397,202 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , i | |||
393 | switch (mouse) { | 397 | switch (mouse) { |
394 | case 1: | 398 | case 1: |
395 | break; | 399 | break; |
396 | case 2: | 400 | case 2: |
397 | menuTimer.start( 500, TRUE ); | 401 | menuTimer.start( 500, TRUE ); |
398 | qDebug("Start menu timer\n"); | 402 | qDebug("Start menu timer\n"); |
399 | break; | 403 | break; |
400 | }; | 404 | }; |
401 | } | 405 | } |
402 | 406 | ||
403 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { | 407 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { |
404 | 408 | ||
405 | switch (mouse) { | 409 | switch (mouse) { |
406 | case 1: | 410 | case 1: |
407 | break; | 411 | break; |
408 | case 2: | 412 | case 2: |
409 | menuTimer.start( 500, TRUE ); | 413 | menuTimer.start( 500, TRUE ); |
410 | qDebug("Start menu timer"); | 414 | qDebug("Start menu timer"); |
411 | break; | 415 | break; |
412 | }; | 416 | }; |
413 | } | 417 | } |
414 | 418 | ||
415 | 419 | ||
416 | void AdvancedFm::switchToLocalTab() { | 420 | void AdvancedFm::switchToLocalTab() { |
417 | TabWidget->setCurrentPage(0); | 421 | TabWidget->setCurrentTab(0); |
418 | Local_View->setFocus(); | 422 | Local_View->setFocus(); |
419 | } | 423 | } |
420 | 424 | ||
421 | void AdvancedFm::switchToRemoteTab() { | 425 | void AdvancedFm::switchToRemoteTab() { |
422 | TabWidget->setCurrentPage(1); | 426 | TabWidget->setCurrentTab(1); |
423 | Remote_View->setFocus(); | 427 | Remote_View->setFocus(); |
424 | } | 428 | } |
425 | 429 | ||
426 | void AdvancedFm::readConfig() { | 430 | void AdvancedFm::readConfig() { |
427 | Config cfg("AdvancedFm"); | 431 | Config cfg("AdvancedFm"); |
428 | } | 432 | } |
429 | 433 | ||
430 | void AdvancedFm::writeConfig() { | 434 | void AdvancedFm::writeConfig() { |
431 | Config cfg("AdvancedFm"); | 435 | Config cfg("AdvancedFm"); |
432 | } | 436 | } |
433 | 437 | ||
434 | void AdvancedFm::currentPathComboChanged() { | 438 | void AdvancedFm::currentPathComboChanged() { |
435 | if (TabWidget->currentPageIndex() == 0) { | 439 | if (TabWidget->getCurrentTab() == 0) { |
440 | // if (TabWidget->currentPageIndex() == 0) { | ||
436 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 441 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
437 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 442 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
438 | populateLocalView(); | 443 | populateLocalView(); |
439 | } else { | 444 | } else { |
440 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 445 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
441 | } | 446 | } |
442 | } | 447 | } |
443 | if (TabWidget->currentPageIndex() == 0) { | 448 | if (TabWidget->getCurrentTab() == 0) { |
449 | // if (TabWidget->currentPageIndex() == 0) { | ||
444 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 450 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
445 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 451 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
446 | populateRemoteView(); | 452 | populateRemoteView(); |
447 | } else { | 453 | } else { |
448 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 454 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
449 | } | 455 | } |
450 | } | 456 | } |
451 | } | 457 | } |
452 | 458 | ||
453 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 459 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
454 | 460 | ||
455 | if (TabWidget->currentPageIndex() == 0) { | 461 | if (TabWidget->getCurrentTab() == 0) { |
462 | // if (TabWidget->currentPageIndex() == 0) { | ||
456 | currentPathCombo->lineEdit()->setText( currentPath); | 463 | currentPathCombo->lineEdit()->setText( currentPath); |
457 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 464 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
458 | currentPathCombo->clear(); | 465 | currentPathCombo->clear(); |
459 | localDirPathStringList.prepend( currentPath ); | 466 | localDirPathStringList.prepend( currentPath ); |
460 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 467 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
461 | } | 468 | } |
462 | } else { | 469 | } else { |
463 | currentPathCombo->lineEdit()->setText( currentPath); | 470 | currentPathCombo->lineEdit()->setText( currentPath); |
464 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 471 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
465 | currentPathCombo->clear(); | 472 | currentPathCombo->clear(); |
466 | remoteDirPathStringList.prepend( currentPath ); | 473 | remoteDirPathStringList.prepend( currentPath ); |
467 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 474 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
468 | } | 475 | } |
469 | } | 476 | } |
470 | } | 477 | } |
471 | 478 | ||
472 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 479 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
473 | if (TabWidget->currentPageIndex() == 0) { | 480 | if (TabWidget->getCurrentTab() == 0) { |
481 | // if (TabWidget->currentPageIndex() == 0) { | ||
474 | chdir( currentPath.latin1() ); | 482 | chdir( currentPath.latin1() ); |
475 | currentDir.cd( currentPath, TRUE); | 483 | currentDir.cd( currentPath, TRUE); |
476 | populateLocalView(); | 484 | populateLocalView(); |
477 | update(); | 485 | update(); |
478 | } else { | 486 | } else { |
479 | chdir( currentPath.latin1() ); | 487 | chdir( currentPath.latin1() ); |
480 | currentRemoteDir.cd( currentPath, TRUE); | 488 | currentRemoteDir.cd( currentPath, TRUE); |
481 | populateRemoteView(); | 489 | populateRemoteView(); |
482 | update(); | 490 | update(); |
483 | } | 491 | } |
484 | } | 492 | } |
485 | 493 | ||
486 | QStringList AdvancedFm::getPath() { | 494 | QStringList AdvancedFm::getPath() { |
487 | QStringList strList; | 495 | QStringList strList; |
488 | if (TabWidget->currentPageIndex() == 0) { | 496 | if (TabWidget->getCurrentTab() == 0) { |
497 | // if (TabWidget->currentPageIndex() == 0) { | ||
489 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 498 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
490 | QListViewItemIterator it( Local_View ); | 499 | QListViewItemIterator it( Local_View ); |
491 | for ( ; it.current(); ++it ) { | 500 | for ( ; it.current(); ++it ) { |
492 | if ( it.current()->isSelected() ) { | 501 | if ( it.current()->isSelected() ) { |
493 | strList << it.current()->text(0); | 502 | strList << it.current()->text(0); |
494 | qDebug(it.current()->text(0)); | 503 | qDebug(it.current()->text(0)); |
495 | } | 504 | } |
496 | } | 505 | } |
497 | return strList; | 506 | return strList; |
498 | } else { | 507 | } else { |
499 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 508 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
500 | QListViewItemIterator it( Remote_View ); | 509 | QListViewItemIterator it( Remote_View ); |
501 | for ( ; it.current(); ++it ) { | 510 | for ( ; it.current(); ++it ) { |
502 | if ( it.current()->isSelected() ) { | 511 | if ( it.current()->isSelected() ) { |
503 | strList << it.current()->text(0); | 512 | strList << it.current()->text(0); |
504 | qDebug(it.current()->text(0)); | 513 | qDebug(it.current()->text(0)); |
505 | } | 514 | } |
506 | } | 515 | } |
507 | return strList; | 516 | return strList; |
508 | } | 517 | } |
509 | return ""; | 518 | return ""; |
510 | } | 519 | } |
511 | 520 | ||
512 | void AdvancedFm::homeButtonPushed() { | 521 | void AdvancedFm::homeButtonPushed() { |
513 | QString current = QDir::homeDirPath(); | 522 | QString current = QDir::homeDirPath(); |
514 | chdir( current.latin1() ); | 523 | chdir( current.latin1() ); |
515 | if (TabWidget->currentPageIndex() == 0) { | 524 | if (TabWidget->getCurrentTab() == 0) { |
525 | // if (TabWidget->currentPageIndex() == 0) { | ||
516 | currentDir.cd( current, TRUE); | 526 | currentDir.cd( current, TRUE); |
517 | populateLocalView(); | 527 | populateLocalView(); |
518 | } else { | 528 | } else { |
519 | currentRemoteDir.cd( current, TRUE); | 529 | currentRemoteDir.cd( current, TRUE); |
520 | populateRemoteView(); | 530 | populateRemoteView(); |
521 | } | 531 | } |
522 | update(); | 532 | update(); |
523 | } | 533 | } |
524 | 534 | ||
525 | void AdvancedFm::docButtonPushed() { | 535 | void AdvancedFm::docButtonPushed() { |
526 | QString current = QPEApplication::documentDir(); | 536 | QString current = QPEApplication::documentDir(); |
527 | chdir( current.latin1() ); | 537 | chdir( current.latin1() ); |
528 | if (TabWidget->currentPageIndex() == 0) { | 538 | |
539 | if (TabWidget->getCurrentTab() == 0) { | ||
540 | //if (TabWidget->currentPageIndex() == 0) { | ||
529 | currentDir.cd( current, TRUE); | 541 | currentDir.cd( current, TRUE); |
530 | populateLocalView(); | 542 | populateLocalView(); |
531 | } else { | 543 | } else { |
532 | currentRemoteDir.cd( current, TRUE); | 544 | currentRemoteDir.cd( current, TRUE); |
533 | populateRemoteView(); | 545 | populateRemoteView(); |
534 | } | 546 | } |
535 | update(); | 547 | update(); |
536 | } | 548 | } |
537 | 549 | ||
538 | void AdvancedFm::SDButtonPushed() { | 550 | void AdvancedFm::SDButtonPushed() { |
539 | QString current = "/mnt/card";// this can change so fix | 551 | QString current = "/mnt/card";// this can change so fix |
540 | chdir( current.latin1() ); | 552 | chdir( current.latin1() ); |
541 | if (TabWidget->currentPageIndex() == 0) { | 553 | if (TabWidget->getCurrentTab() == 0) { |
554 | // if (TabWidget->currentPageIndex() == 0) { | ||
542 | currentDir.cd( current, TRUE); | 555 | currentDir.cd( current, TRUE); |
543 | populateLocalView(); | 556 | populateLocalView(); |
544 | } else { | 557 | } else { |
545 | currentRemoteDir.cd( current, TRUE); | 558 | currentRemoteDir.cd( current, TRUE); |
546 | populateRemoteView(); | 559 | populateRemoteView(); |
547 | } | 560 | } |
548 | update(); | 561 | update(); |
549 | 562 | ||
550 | } | 563 | } |
551 | 564 | ||
552 | void AdvancedFm::CFButtonPushed() { | 565 | void AdvancedFm::CFButtonPushed() { |
553 | QString current; | 566 | QString current; |
554 | if(zaurusDevice) | 567 | if(zaurusDevice) |
555 | current= "/mnt/cf"; //zaurus | 568 | current= "/mnt/cf"; //zaurus |
556 | else | 569 | else |
557 | current = "/mnt/hda"; //ipaq | 570 | current = "/mnt/hda"; //ipaq |
558 | 571 | ||
559 | chdir( current.latin1() ); | 572 | chdir( current.latin1() ); |
560 | if (TabWidget->currentPageIndex() == 0) { | 573 | if (TabWidget->getCurrentTab() == 0) { |
574 | // if (TabWidget->currentPageIndex() == 0) { | ||
561 | currentDir.cd( current, TRUE); | 575 | currentDir.cd( current, TRUE); |
562 | populateLocalView(); | 576 | populateLocalView(); |
563 | } else { | 577 | } else { |
564 | currentRemoteDir.cd( current, TRUE); | 578 | currentRemoteDir.cd( current, TRUE); |
565 | populateRemoteView(); | 579 | populateRemoteView(); |
566 | } | 580 | } |
567 | update(); | 581 | update(); |
568 | } | 582 | } |
569 | 583 | ||
570 | 584 | ||
571 | 585 | ||
572 | void AdvancedFm::doAbout() { | 586 | void AdvancedFm::doAbout() { |
573 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 587 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
574 | "is copyright 2002 by\n" | 588 | "is copyright 2002 by\n" |
575 | "L.J.Potter<llornkcor@handhelds.org>\n" | 589 | "L.J.Potter<llornkcor@handhelds.org>\n" |
576 | "and is licensed by the GPL")); | 590 | "and is licensed by the GPL")); |
577 | } | 591 | } |
578 | 592 | ||
579 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 593 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
580 | if( TabWidget->hasFocus()) | 594 | if( TabWidget->hasFocus()) |
581 | switch ( e->key() ) { | 595 | switch ( e->key() ) { |
582 | case Key_Delete: | 596 | case Key_Delete: |
583 | del(); | 597 | del(); |
584 | break; | 598 | break; |
@@ -624,49 +638,50 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | |||
624 | case Key_4: | 638 | case Key_4: |
625 | SDButtonPushed(); | 639 | SDButtonPushed(); |
626 | break; | 640 | break; |
627 | case Key_5: | 641 | case Key_5: |
628 | homeButtonPushed(); | 642 | homeButtonPushed(); |
629 | break; | 643 | break; |
630 | case Key_6: | 644 | case Key_6: |
631 | docButtonPushed(); | 645 | docButtonPushed(); |
632 | break; | 646 | break; |
633 | case Key_7: | 647 | case Key_7: |
634 | break; | 648 | break; |
635 | case Key_8: | 649 | case Key_8: |
636 | break; | 650 | break; |
637 | case Key_9: | 651 | case Key_9: |
638 | break; | 652 | break; |
639 | case Key_0: | 653 | case Key_0: |
640 | break; | 654 | break; |
641 | } | 655 | } |
642 | } | 656 | } |
643 | 657 | ||
644 | 658 | ||
645 | void AdvancedFm::QPEButtonPushed() { | 659 | void AdvancedFm::QPEButtonPushed() { |
646 | QString current = QPEApplication::qpeDir(); | 660 | QString current = QPEApplication::qpeDir(); |
647 | chdir( current.latin1() ); | 661 | chdir( current.latin1() ); |
648 | if (TabWidget->currentPageIndex() == 0) { | 662 | if (TabWidget->getCurrentTab() == 0) { |
663 | // if (TabWidget->currentPageIndex() == 0) { | ||
649 | currentDir.cd( current, TRUE); | 664 | currentDir.cd( current, TRUE); |
650 | populateLocalView(); | 665 | populateLocalView(); |
651 | } else { | 666 | } else { |
652 | currentRemoteDir.cd( current, TRUE); | 667 | currentRemoteDir.cd( current, TRUE); |
653 | populateRemoteView(); | 668 | populateRemoteView(); |
654 | } | 669 | } |
655 | update(); | 670 | update(); |
656 | } | 671 | } |
657 | 672 | ||
658 | void AdvancedFm::parsetab(const QString &fileName) { | 673 | void AdvancedFm::parsetab(const QString &fileName) { |
659 | 674 | ||
660 | fileSystemTypeList.clear(); | 675 | fileSystemTypeList.clear(); |
661 | fsList.clear(); | 676 | fsList.clear(); |
662 | struct mntent *me; | 677 | struct mntent *me; |
663 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 678 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
664 | if ( mntfp ) { | 679 | if ( mntfp ) { |
665 | while ( (me = getmntent( mntfp )) != 0 ) { | 680 | while ( (me = getmntent( mntfp )) != 0 ) { |
666 | QString deviceName = me->mnt_fsname; | 681 | QString deviceName = me->mnt_fsname; |
667 | QString filesystemType = me->mnt_type; | 682 | QString filesystemType = me->mnt_type; |
668 | QString mountDir = me->mnt_dir; | 683 | QString mountDir = me->mnt_dir; |
669 | if(deviceName != "none") { | 684 | if(deviceName != "none") { |
670 | if( fsList.contains(filesystemType) == 0 | 685 | if( fsList.contains(filesystemType) == 0 |
671 | & filesystemType.find("proc",0,TRUE) == -1 | 686 | & filesystemType.find("proc",0,TRUE) == -1 |
672 | & filesystemType.find("cramfs",0,TRUE) == -1 | 687 | & filesystemType.find("cramfs",0,TRUE) == -1 |
@@ -696,63 +711,67 @@ QString AdvancedFm::getFileSystemType(const QString ¤tText) { | |||
696 | } | 711 | } |
697 | 712 | ||
698 | QString AdvancedFm::getDiskSpace( const QString &path) { | 713 | QString AdvancedFm::getDiskSpace( const QString &path) { |
699 | struct statfs fss; | 714 | struct statfs fss; |
700 | if ( !statfs( path.latin1(), &fss ) ) { | 715 | if ( !statfs( path.latin1(), &fss ) ) { |
701 | int blkSize = fss.f_bsize; | 716 | int blkSize = fss.f_bsize; |
702 | // int totalBlks = fs.f_blocks; | 717 | // int totalBlks = fs.f_blocks; |
703 | int availBlks = fss.f_bavail; | 718 | int availBlks = fss.f_bavail; |
704 | 719 | ||
705 | long mult = blkSize / 1024; | 720 | long mult = blkSize / 1024; |
706 | long div = 1024 / blkSize; | 721 | long div = 1024 / blkSize; |
707 | if ( !mult ) mult = 1; | 722 | if ( !mult ) mult = 1; |
708 | if ( !div ) div = 1; | 723 | if ( !div ) div = 1; |
709 | 724 | ||
710 | return QString::number(availBlks * mult / div); | 725 | return QString::number(availBlks * mult / div); |
711 | } | 726 | } |
712 | return ""; | 727 | return ""; |
713 | } | 728 | } |
714 | 729 | ||
715 | 730 | ||
716 | void AdvancedFm::showFileMenu() { | 731 | void AdvancedFm::showFileMenu() { |
717 | 732 | ||
718 | QString curApp; | 733 | QString curApp; |
719 | bool isLocalView = false; | 734 | bool isLocalView = false; |
720 | if (TabWidget->currentPageIndex() == 0) { | 735 | if (TabWidget->getCurrentTab() == 0) { |
736 | // if (TabWidget->currentPageIndex() == 0) { | ||
721 | isLocalView = TRUE; | 737 | isLocalView = TRUE; |
722 | curApp = Local_View->currentItem()->text(0); | 738 | curApp = Local_View->currentItem()->text(0); |
723 | } else { | 739 | } else { |
724 | curApp = Remote_View->currentItem()->text(0); | 740 | curApp = Remote_View->currentItem()->text(0); |
725 | } | 741 | } |
726 | 742 | ||
727 | MimeType mt( curApp ); | 743 | MimeType mt( curApp ); |
728 | const AppLnk* app = mt.application(); | 744 | const AppLnk* app = mt.application(); |
729 | QFile fi(curApp); | 745 | QFile fi(curApp); |
730 | QPopupMenu *m = new QPopupMenu(0); | 746 | QPopupMenu *m = new QPopupMenu(0); |
731 | QPopupMenu *n = new QPopupMenu(0); | 747 | QPopupMenu *n = new QPopupMenu(0); |
732 | // QPopupMenu *o = new QPopupMenu(0); | 748 | // QPopupMenu *o = new QPopupMenu(0); |
733 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 749 | if (TabWidget->getCurrentTab() == 0) |
734 | 750 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | |
751 | else | ||
752 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | ||
753 | |||
735 | if ( QFileInfo(fi).isDir() ) { | 754 | if ( QFileInfo(fi).isDir() ) { |
736 | m->insertSeparator(); | 755 | m->insertSeparator(); |
737 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 756 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
738 | } else { | 757 | } else { |
739 | 758 | ||
740 | if ( app ) | 759 | if ( app ) |
741 | m->insertItem( app->pixmap(), tr( "Open in " | 760 | m->insertItem( app->pixmap(), tr( "Open in " |
742 | + app->name() ), this, SLOT( runThis() ) ); | 761 | + app->name() ), this, SLOT( runThis() ) ); |
743 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 762 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
744 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 763 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
745 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 764 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
746 | } | 765 | } |
747 | 766 | ||
748 | m->insertItem(tr("Actions"),n); | 767 | m->insertItem(tr("Actions"),n); |
749 | if(isLocalView) | 768 | if(isLocalView) |
750 | n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 769 | n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
751 | else | 770 | else |
752 | n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 771 | n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
753 | 772 | ||
754 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 773 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
755 | 774 | ||
756 | n->insertSeparator(); | 775 | n->insertSeparator(); |
757 | 776 | ||
758 | 777 | ||
@@ -808,48 +827,49 @@ void AdvancedFm::cancelMenuTimer() { | |||
808 | } | 827 | } |
809 | 828 | ||
810 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 829 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
811 | struct statfs fss; | 830 | struct statfs fss; |
812 | if ( !statfs( path.latin1(), &fss ) ) { | 831 | if ( !statfs( path.latin1(), &fss ) ) { |
813 | int blkSize = fss.f_bsize; | 832 | int blkSize = fss.f_bsize; |
814 | // int totalBlks = fs.f_blocks; | 833 | // int totalBlks = fs.f_blocks; |
815 | int availBlks = fss.f_bavail; | 834 | int availBlks = fss.f_bavail; |
816 | 835 | ||
817 | long mult = blkSize / 1024; | 836 | long mult = blkSize / 1024; |
818 | long div = 1024 / blkSize; | 837 | long div = 1024 / blkSize; |
819 | if ( !mult ) mult = 1; | 838 | if ( !mult ) mult = 1; |
820 | if ( !div ) div = 1; | 839 | if ( !div ) div = 1; |
821 | 840 | ||
822 | 841 | ||
823 | return QString::number(availBlks * mult / div); | 842 | return QString::number(availBlks * mult / div); |
824 | } | 843 | } |
825 | return ""; | 844 | return ""; |
826 | } | 845 | } |
827 | 846 | ||
828 | void AdvancedFm::addToDocs() { | 847 | void AdvancedFm::addToDocs() { |
829 | QStringList strListPaths = getPath(); | 848 | QStringList strListPaths = getPath(); |
830 | if( strListPaths.count() > 0) { | 849 | if( strListPaths.count() > 0) { |
831 | QString curFile; | 850 | QString curFile; |
832 | if (TabWidget->currentPageIndex() == 0) { | 851 | if (TabWidget->getCurrentTab() == 0) { |
852 | // if (TabWidget->currentPageIndex() == 0) { | ||
833 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 853 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
834 | curFile = currentDir.canonicalPath()+"/"+(*it); | 854 | curFile = currentDir.canonicalPath()+"/"+(*it); |
835 | qDebug(curFile); | 855 | qDebug(curFile); |
836 | DocLnk f; | 856 | DocLnk f; |
837 | // curFile.replace(QRegExp("\\..*"),""); | 857 | // curFile.replace(QRegExp("\\..*"),""); |
838 | f.setName((*it)); | 858 | f.setName((*it)); |
839 | f.setFile( curFile); | 859 | f.setFile( curFile); |
840 | f.writeLink(); | 860 | f.writeLink(); |
841 | } | 861 | } |
842 | } else { | 862 | } else { |
843 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 863 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
844 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 864 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
845 | qDebug(curFile); | 865 | qDebug(curFile); |
846 | 866 | ||
847 | DocLnk f; | 867 | DocLnk f; |
848 | // curFile.replace(QRegExp("\\..*"),""); | 868 | // curFile.replace(QRegExp("\\..*"),""); |
849 | f.setName((*it)); | 869 | f.setName((*it)); |
850 | f.setFile( curFile); | 870 | f.setFile( curFile); |
851 | f.writeLink(); | 871 | f.writeLink(); |
852 | } | 872 | } |
853 | } | 873 | } |
854 | } | 874 | } |
855 | } | 875 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index f846c66..12ebbf2 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,80 +1,83 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfm.h | 2 | advancedfm.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
15 | #define QT_QWS_OPIE | 15 | #define QT_QWS_OPIE |
16 | 16 | ||
17 | //#include <opie/otabwidget.h> | ||
17 | #include <qpe/ir.h> | 18 | #include <qpe/ir.h> |
18 | 19 | ||
19 | #include <qvariant.h> | 20 | #include <qvariant.h> |
20 | #include <qdialog.h> | 21 | #include <qdialog.h> |
21 | #include <qmainwindow.h> | 22 | #include <qmainwindow.h> |
22 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
23 | #include <qdir.h> | 24 | #include <qdir.h> |
24 | #include <qstring.h> | 25 | #include <qstring.h> |
25 | #include <qpoint.h> | 26 | #include <qpoint.h> |
26 | #include <qtimer.h> | 27 | #include <qtimer.h> |
27 | 28 | ||
29 | class OTabWidget; | ||
28 | class QVBoxLayout; | 30 | class QVBoxLayout; |
29 | class QHBoxLayout; | 31 | class QHBoxLayout; |
30 | class QGridLayout; | 32 | class QGridLayout; |
31 | class QComboBox; | 33 | class QComboBox; |
32 | class QListView; | 34 | class QListView; |
33 | class QListviewItem; | 35 | class QListviewItem; |
34 | class QLabel; | 36 | class QLabel; |
35 | class QProgressBar; | 37 | class QProgressBar; |
36 | class QSpinBox; | 38 | class QSpinBox; |
37 | class QTabWidget; | 39 | class QTabWidget; |
38 | class QWidget; | 40 | class QWidget; |
39 | class QPEToolBar; | 41 | class QPEToolBar; |
40 | class QPEMenuBar; | 42 | class QPEMenuBar; |
41 | class QPopupMenu; | 43 | class QPopupMenu; |
42 | class QFile; | 44 | class QFile; |
43 | class QListViewItem; | 45 | class QListViewItem; |
44 | class QLineEdit; | 46 | class QLineEdit; |
45 | //class QPushButton; | 47 | //class QPushButton; |
46 | class QToolButton; | 48 | class QToolButton; |
47 | class Ir; | 49 | class Ir; |
48 | 50 | ||
49 | class AdvancedFm : public QMainWindow | 51 | class AdvancedFm : public QMainWindow |
50 | { | 52 | { |
51 | Q_OBJECT | 53 | Q_OBJECT |
52 | public: | 54 | public: |
53 | AdvancedFm(); | 55 | AdvancedFm(); |
54 | ~AdvancedFm(); | 56 | ~AdvancedFm(); |
55 | 57 | ||
56 | QTabWidget *TabWidget; | 58 | OTabWidget *TabWidget; |
59 | // QTabWidget *TabWidget; | ||
57 | QWidget *tab, *tab_2, *tab_3; | 60 | QWidget *tab, *tab_2, *tab_3; |
58 | QListView *Local_View, *Remote_View; | 61 | QListView *Local_View, *Remote_View; |
59 | 62 | ||
60 | QLineEdit *currentPathEdit; | 63 | QLineEdit *currentPathEdit; |
61 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 64 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
62 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 65 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
63 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 66 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
64 | QDir currentDir, currentRemoteDir; | 67 | QDir currentDir, currentRemoteDir; |
65 | QComboBox *currentPathCombo; | 68 | QComboBox *currentPathCombo; |
66 | QString filterStr; | 69 | QString filterStr; |
67 | QListViewItem * item; | 70 | QListViewItem * item; |
68 | bool b; | 71 | bool b; |
69 | QStringList fileSystemTypeList, fsList; | 72 | QStringList fileSystemTypeList, fsList; |
70 | int currentServerConfig; | 73 | int currentServerConfig; |
71 | protected slots: | 74 | protected slots: |
72 | void addToDocs(); | 75 | void addToDocs(); |
73 | void doLocalCd(); | 76 | void doLocalCd(); |
74 | void doRemoteCd(); | 77 | void doRemoteCd(); |
75 | // void copy(); | 78 | // void copy(); |
76 | void mkDir(); | 79 | void mkDir(); |
77 | void del(); | 80 | void del(); |
78 | void rn(); | 81 | void rn(); |
79 | void populateLocalView(); | 82 | void populateLocalView(); |
80 | void populateRemoteView(); | 83 | void populateRemoteView(); |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index eb4f122..3896f50 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,25 +1,25 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h | 3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h |
4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp | 4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp |
5 | TARGET = advancedfm | 5 | TARGET = advancedfm |
6 | REQUIRES=medium-config | 6 | REQUIRES=medium-config |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | DESTDIR = $(OPIEDIR)/bin | 9 | DESTDIR = $(OPIEDIR)/bin |
10 | LIBS += -lqpe | 10 | LIBS += -lqpe -lopie |
11 | 11 | ||
12 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ | 12 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ |
13 | ../../../i18n/en/advancedfm.ts \ | 13 | ../../../i18n/en/advancedfm.ts \ |
14 | ../../../i18n/es/advancedfm.ts \ | 14 | ../../../i18n/es/advancedfm.ts \ |
15 | ../../../i18n/fr/advancedfm.ts \ | 15 | ../../../i18n/fr/advancedfm.ts \ |
16 | ../../../i18n/hu/advancedfm.ts \ | 16 | ../../../i18n/hu/advancedfm.ts \ |
17 | ../../../i18n/ja/advancedfm.ts \ | 17 | ../../../i18n/ja/advancedfm.ts \ |
18 | ../../../i18n/ko/advancedfm.ts \ | 18 | ../../../i18n/ko/advancedfm.ts \ |
19 | ../../../i18n/no/advancedfm.ts \ | 19 | ../../../i18n/no/advancedfm.ts \ |
20 | ../../../i18n/pl/advancedfm.ts \ | 20 | ../../../i18n/pl/advancedfm.ts \ |
21 | ../../../i18n/pt/advancedfm.ts \ | 21 | ../../../i18n/pt/advancedfm.ts \ |
22 | ../../../i18n/pt_BR/advancedfm.ts \ | 22 | ../../../i18n/pt_BR/advancedfm.ts \ |
23 | ../../../i18n/sl/advancedfm.ts \ | 23 | ../../../i18n/sl/advancedfm.ts \ |
24 | ../../../i18n/zh_CN/advancedfm.ts \ | 24 | ../../../i18n/zh_CN/advancedfm.ts \ |
25 | ../../../i18n/zh_TW/advancedfm.ts | 25 | ../../../i18n/zh_TW/advancedfm.ts |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 619a7a9..7188640 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,49 +1,49 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | #include <opie/otabwidget.h> | ||
14 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
15 | #include <qpe/qpemenubar.h> | 16 | #include <qpe/qpemenubar.h> |
16 | #include <qpe/qpetoolbar.h> | 17 | #include <qpe/qpetoolbar.h> |
17 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
18 | 19 | ||
19 | #include <qlayout.h> | 20 | #include <qlayout.h> |
20 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
21 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
22 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
23 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
24 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
25 | #include <qtabwidget.h> | ||
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | 28 | ||
29 | #include <sys/utsname.h> | 29 | #include <sys/utsname.h> |
30 | 30 | ||
31 | 31 | ||
32 | void AdvancedFm::init() { | 32 | void AdvancedFm::init() { |
33 | #if defined(QT_QWS_OPIE) | 33 | #if defined(QT_QWS_OPIE) |
34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
35 | #endif | 35 | #endif |
36 | setCaption( tr( "AdvancedFm" ) ); | 36 | setCaption( tr( "AdvancedFm" ) ); |
37 | 37 | ||
38 | QGridLayout *layout = new QGridLayout( this ); | 38 | QGridLayout *layout = new QGridLayout( this ); |
39 | layout->setSpacing( 2); | 39 | layout->setSpacing( 2); |
40 | layout->setMargin( 2); | 40 | layout->setMargin( 2); |
41 | 41 | ||
42 | 42 | ||
43 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 43 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
44 | fileMenu = new QPopupMenu( this ); | 44 | fileMenu = new QPopupMenu( this ); |
45 | viewMenu = new QPopupMenu( this ); | 45 | viewMenu = new QPopupMenu( this ); |
46 | 46 | ||
47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
48 | 48 | ||
49 | menuBar->insertItem( tr( "File" ), fileMenu); | 49 | menuBar->insertItem( tr( "File" ), fileMenu); |
@@ -87,140 +87,142 @@ 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( "Add To Documents" ), this, SLOT( addToDocs() )); | 90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
92 | fileMenu->setCheckable(TRUE); | 92 | fileMenu->setCheckable(TRUE); |
93 | 93 | ||
94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
96 | viewMenu->insertSeparator(); | 96 | viewMenu->insertSeparator(); |
97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
98 | viewMenu->setCheckable(TRUE); | 98 | viewMenu->setCheckable(TRUE); |
99 | 99 | ||
100 | 100 | ||
101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
102 | currentPathCombo->setEditable(TRUE); | 102 | currentPathCombo->setEditable(TRUE); |
103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
105 | 105 | ||
106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
107 | 107 | ||
108 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 108 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
109 | 109 | ||
110 | 110 | ||
111 | TabWidget = new QTabWidget( this, "TabWidget" ); | 111 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); |
112 | // TabWidget = new QTabWidget( this, "TabWidget" ); | ||
112 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 113 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
113 | 114 | ||
114 | tab = new QWidget( TabWidget, "tab" ); | 115 | tab = new QWidget( TabWidget, "tab" ); |
115 | tabLayout = new QGridLayout( tab ); | 116 | tabLayout = new QGridLayout( tab ); |
116 | tabLayout->setSpacing( 2); | 117 | tabLayout->setSpacing( 2); |
117 | tabLayout->setMargin( 2); | 118 | tabLayout->setMargin( 2); |
118 | 119 | ||
119 | Local_View = new QListView( tab, "Local_View" ); | 120 | Local_View = new QListView( tab, "Local_View" ); |
120 | Local_View->addColumn( tr("File"),130); | 121 | Local_View->addColumn( tr("File"),130); |
121 | Local_View->addColumn( tr("Size"),-1); | 122 | Local_View->addColumn( tr("Size"),-1); |
122 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 123 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
123 | Local_View->addColumn( tr("Date"),-1); | 124 | Local_View->addColumn( tr("Date"),-1); |
124 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 125 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
125 | Local_View->setAllColumnsShowFocus(TRUE); | 126 | Local_View->setAllColumnsShowFocus(TRUE); |
126 | Local_View->setMultiSelection( TRUE ); | 127 | Local_View->setMultiSelection( TRUE ); |
127 | Local_View->setSelectionMode(QListView::Extended); | 128 | Local_View->setSelectionMode(QListView::Extended); |
128 | 129 | ||
129 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 130 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
130 | 131 | ||
131 | tabLayout->addWidget( Local_View, 0, 0 ); | 132 | tabLayout->addWidget( Local_View, 0, 0 ); |
132 | 133 | ||
133 | TabWidget->insertTab( tab, tr("1")); | 134 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); |
135 | // TabWidget->insertTab( tab, tr("1")); | ||
134 | 136 | ||
135 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 137 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
136 | tabLayout_2 = new QGridLayout( tab_2 ); | 138 | tabLayout_2 = new QGridLayout( tab_2 ); |
137 | tabLayout_2->setSpacing( 2); | 139 | tabLayout_2->setSpacing( 2); |
138 | tabLayout_2->setMargin( 2); | 140 | tabLayout_2->setMargin( 2); |
139 | 141 | ||
140 | Remote_View = new QListView( tab_2, "Remote_View" ); | 142 | Remote_View = new QListView( tab_2, "Remote_View" ); |
141 | Remote_View->addColumn( tr("File"),130); | 143 | Remote_View->addColumn( tr("File"),130); |
142 | Remote_View->addColumn( tr("Size"),-1); | 144 | Remote_View->addColumn( tr("Size"),-1); |
143 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 145 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
144 | Remote_View->addColumn( tr("Date"),-1); | 146 | Remote_View->addColumn( tr("Date"),-1); |
145 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 147 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
146 | Remote_View->setAllColumnsShowFocus(TRUE); | 148 | Remote_View->setAllColumnsShowFocus(TRUE); |
147 | Remote_View->setMultiSelection( TRUE ); | 149 | Remote_View->setMultiSelection( TRUE ); |
148 | Remote_View->setSelectionMode(QListView::Extended); | 150 | Remote_View->setSelectionMode(QListView::Extended); |
149 | 151 | ||
150 | 152 | ||
151 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 153 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
152 | 154 | ||
153 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 155 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
154 | 156 | ||
155 | 157 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | |
156 | TabWidget->insertTab( tab_2, tr( "2")); | 158 | // TabWidget->insertTab( tab_2, tr( "2")); |
157 | 159 | ||
158 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 160 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
159 | tabLayout_3 = new QGridLayout( tab_3 ); | 161 | tabLayout_3 = new QGridLayout( tab_3 ); |
160 | tabLayout_3->setSpacing( 2); | 162 | tabLayout_3->setSpacing( 2); |
161 | tabLayout_3->setMargin( 2); | 163 | tabLayout_3->setMargin( 2); |
162 | 164 | ||
163 | 165 | ||
164 | // OFileDialog fileDialog; | 166 | // OFileDialog fileDialog; |
165 | // fileDialog; | 167 | // fileDialog; |
166 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 168 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
167 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 169 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
168 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 170 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
169 | 171 | ||
170 | QListView *fileTree; | 172 | QListView *fileTree; |
171 | fileTree = new QListView( tab_3, "tree" ); | 173 | fileTree = new QListView( tab_3, "tree" ); |
172 | 174 | ||
173 | 175 | ||
174 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 176 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
175 | 177 | ||
176 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 178 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
177 | */ | 179 | */ |
178 | 180 | ||
179 | /////////////// | 181 | /////////////// |
180 | 182 | ||
181 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 183 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
182 | if (uname(&name) != -1) { | 184 | if (uname(&name) != -1) { |
183 | QString release=name.release; | 185 | QString release=name.release; |
184 | if(release.find("embedix",0,TRUE) !=-1) { | 186 | if(release.find("embedix",0,TRUE) !=-1) { |
185 | zaurusDevice=TRUE; | 187 | zaurusDevice=TRUE; |
186 | } else { | 188 | } else { |
187 | zaurusDevice=FALSE; | 189 | zaurusDevice=FALSE; |
188 | sdButton->hide(); | 190 | sdButton->hide(); |
189 | } | 191 | } |
190 | } | 192 | } |
191 | 193 | ||
192 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 194 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
193 | currentDir.setPath( QDir::currentDirPath()); | 195 | currentDir.setPath( QDir::currentDirPath()); |
194 | 196 | ||
195 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 197 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
196 | currentRemoteDir.setPath( QDir::currentDirPath()); | 198 | currentRemoteDir.setPath( QDir::currentDirPath()); |
197 | 199 | ||
198 | b = TRUE; | 200 | b = TRUE; |
199 | 201 | ||
200 | filterStr="*"; | 202 | filterStr="*"; |
201 | b=FALSE; | 203 | b=FALSE; |
202 | 204 | TabWidget->setCurrentTab(0); | |
203 | 205 | ||
204 | } | 206 | } |
205 | 207 | ||
206 | void AdvancedFm::initConnections() { | 208 | void AdvancedFm::initConnections() { |
207 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 209 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
208 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 210 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
209 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 211 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
210 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 212 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
211 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 213 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
212 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 214 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
213 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 215 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
214 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 216 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
215 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 217 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
216 | 218 | ||
217 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 219 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
218 | this,SLOT(currentPathComboChanged())); | 220 | this,SLOT(currentPathComboChanged())); |
219 | 221 | ||
220 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 222 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
221 | this,SLOT( localListClicked(QListViewItem *)) ); | 223 | this,SLOT( localListClicked(QListViewItem *)) ); |
222 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 224 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
223 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 225 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
224 | 226 | ||
225 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 227 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
226 | 228 | ||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 5fa8d0c..27a119f 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -1,116 +1,132 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | #include "inputDialog.h" | 13 | #include "inputDialog.h" |
14 | #include "output.h" | 14 | #include "output.h" |
15 | #include "filePermissions.h" | 15 | #include "filePermissions.h" |
16 | 16 | ||
17 | #include <opie/otabwidget.h> | ||
18 | |||
17 | #include <qpe/lnkproperties.h> | 19 | #include <qpe/lnkproperties.h> |
18 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
19 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
20 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
21 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
24 | #include <qpe/ir.h> | 26 | #include <qpe/ir.h> |
25 | 27 | ||
26 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
27 | #include <qmultilineedit.h> | 29 | #include <qmultilineedit.h> |
28 | 30 | ||
29 | #include <qstring.h> | 31 | #include <qstring.h> |
30 | 32 | ||
31 | #include <qlayout.h> | 33 | #include <qlayout.h> |
32 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
33 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
35 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
36 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
37 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
38 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
39 | #include <qlistview.h> | 41 | #include <qlistview.h> |
40 | 42 | ||
41 | #include <stdlib.h> | 43 | #include <stdlib.h> |
42 | #include <unistd.h> | 44 | #include <unistd.h> |
43 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
44 | #include <dirent.h> | 46 | #include <dirent.h> |
45 | 47 | ||
46 | 48 | ||
47 | void AdvancedFm::doLocalCd() { | 49 | void AdvancedFm::doLocalCd() { |
48 | localListClicked( Local_View->currentItem()); | 50 | localListClicked( Local_View->currentItem()); |
49 | } | 51 | } |
50 | 52 | ||
51 | void AdvancedFm::doRemoteCd() { | 53 | void AdvancedFm::doRemoteCd() { |
52 | localListClicked( Remote_View->currentItem()); | 54 | localListClicked( Remote_View->currentItem()); |
53 | } | 55 | } |
54 | 56 | ||
55 | void AdvancedFm::showMenuHidden() { | 57 | void AdvancedFm::showMenuHidden() { |
56 | if(TabWidget->currentPageIndex() == 0) | 58 | if (b) { |
57 | showHidden(); | 59 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
58 | else | 60 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
59 | showRemoteHidden(); | 61 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
62 | // b=FALSE; | ||
63 | |||
64 | } else { | ||
65 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | ||
66 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | ||
67 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | ||
68 | // b=TRUE; | ||
69 | } | ||
70 | populateLocalView(); | ||
71 | populateRemoteView(); | ||
72 | // if(TabWidget->getCurrentTab() == 0) | ||
73 | // showHidden(); | ||
74 | // else | ||
75 | // showRemoteHidden(); | ||
60 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | 76 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); |
61 | if(b) b = false; else b = true; | 77 | if(b) b = false; else b = true; |
62 | } | 78 | } |
63 | 79 | ||
64 | void AdvancedFm::showHidden() { | 80 | void AdvancedFm::showHidden() { |
65 | if (b) { | 81 | if (b) { |
66 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 82 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
67 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
68 | // b=FALSE; | 84 | // b=FALSE; |
69 | 85 | ||
70 | } else { | 86 | } else { |
71 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 87 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
72 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 88 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
73 | // b=TRUE; | 89 | // b=TRUE; |
74 | } | 90 | } |
75 | populateLocalView(); | 91 | populateLocalView(); |
76 | } | 92 | } |
77 | 93 | ||
78 | void AdvancedFm::showRemoteHidden() { | 94 | void AdvancedFm::showRemoteHidden() { |
79 | if (b) { | 95 | if (b) { |
80 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 96 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
81 | // b=TRUE; | 97 | // b=TRUE; |
82 | 98 | ||
83 | } else { | 99 | } else { |
84 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 100 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
85 | // b=FALSE; | 101 | // b=FALSE; |
86 | } | 102 | } |
87 | populateRemoteView(); | 103 | populateRemoteView(); |
88 | } | 104 | } |
89 | 105 | ||
90 | void AdvancedFm::runThis() { | 106 | void AdvancedFm::runThis() { |
91 | QString fs; | 107 | QString fs; |
92 | if (TabWidget->currentPageIndex() == 0) { | 108 | if (TabWidget->getCurrentTab() == 0) { |
93 | QString curFile = Local_View->currentItem()->text(0); | 109 | QString curFile = Local_View->currentItem()->text(0); |
94 | if(curFile != "../") { | 110 | if(curFile != "../") { |
95 | 111 | ||
96 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 112 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
97 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 113 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
98 | qDebug( fileInfo.owner()); | 114 | qDebug( fileInfo.owner()); |
99 | if( (fileInfo.permission( QFileInfo::ExeUser) | 115 | if( (fileInfo.permission( QFileInfo::ExeUser) |
100 | | fileInfo.permission( QFileInfo::ExeGroup) | 116 | | fileInfo.permission( QFileInfo::ExeGroup) |
101 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 117 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
102 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 118 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
103 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 119 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
104 | e << curFile; | 120 | e << curFile; |
105 | } else { | 121 | } else { |
106 | curFile = currentDir.canonicalPath()+"/"+curFile; | 122 | curFile = currentDir.canonicalPath()+"/"+curFile; |
107 | DocLnk nf(curFile); | 123 | DocLnk nf(curFile); |
108 | QString execStr = nf.exec(); | 124 | QString execStr = nf.exec(); |
109 | qDebug( execStr); | 125 | qDebug( execStr); |
110 | if( execStr.isEmpty() ) { | 126 | if( execStr.isEmpty() ) { |
111 | } else { | 127 | } else { |
112 | nf.execute(); | 128 | nf.execute(); |
113 | } | 129 | } |
114 | } | 130 | } |
115 | } | 131 | } |
116 | } else { | 132 | } else { |
@@ -120,49 +136,49 @@ void AdvancedFm::runThis() { | |||
120 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 136 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
121 | qDebug("Filesystemtype is "+fs); | 137 | qDebug("Filesystemtype is "+fs); |
122 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 138 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
123 | if( (fileInfo.permission( QFileInfo::ExeUser) | 139 | if( (fileInfo.permission( QFileInfo::ExeUser) |
124 | | fileInfo.permission( QFileInfo::ExeGroup) | 140 | | fileInfo.permission( QFileInfo::ExeGroup) |
125 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 141 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
126 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 142 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
127 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 143 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
128 | e << curFile; | 144 | e << curFile; |
129 | } else { | 145 | } else { |
130 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 146 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
131 | DocLnk nf(curFile); | 147 | DocLnk nf(curFile); |
132 | QString execStr = nf.exec(); | 148 | QString execStr = nf.exec(); |
133 | qDebug(execStr); | 149 | qDebug(execStr); |
134 | if( execStr.isEmpty() ) { | 150 | if( execStr.isEmpty() ) { |
135 | } else { | 151 | } else { |
136 | nf.execute(); | 152 | nf.execute(); |
137 | } | 153 | } |
138 | } | 154 | } |
139 | } | 155 | } |
140 | } | 156 | } |
141 | } | 157 | } |
142 | 158 | ||
143 | void AdvancedFm::runText() { | 159 | void AdvancedFm::runText() { |
144 | if (TabWidget->currentPageIndex() == 0) { | 160 | if (TabWidget->getCurrentTab() == 0) { |
145 | QString curFile = Local_View->currentItem()->text(0); | 161 | QString curFile = Local_View->currentItem()->text(0); |
146 | if(curFile != "../") { | 162 | if(curFile != "../") { |
147 | curFile = currentDir.canonicalPath()+"/"+curFile; | 163 | curFile = currentDir.canonicalPath()+"/"+curFile; |
148 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 164 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
149 | e << curFile; | 165 | e << curFile; |
150 | } | 166 | } |
151 | } else { | 167 | } else { |
152 | QString curFile = Remote_View->currentItem()->text(0); | 168 | QString curFile = Remote_View->currentItem()->text(0); |
153 | if(curFile != "../") { | 169 | if(curFile != "../") { |
154 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 170 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
155 | DocLnk nf(curFile); | 171 | DocLnk nf(curFile); |
156 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 172 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
157 | e << curFile; | 173 | e << curFile; |
158 | } | 174 | } |
159 | } | 175 | } |
160 | } | 176 | } |
161 | 177 | ||
162 | void AdvancedFm::localMakDir() { | 178 | void AdvancedFm::localMakDir() { |
163 | InputDialog *fileDlg; | 179 | InputDialog *fileDlg; |
164 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 180 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
165 | fileDlg->exec(); | 181 | fileDlg->exec(); |
166 | if( fileDlg->result() == 1 ) { | 182 | if( fileDlg->result() == 1 ) { |
167 | QString filename = fileDlg->LineEdit1->text(); | 183 | QString filename = fileDlg->LineEdit1->text(); |
168 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 184 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
@@ -302,288 +318,288 @@ void AdvancedFm::remoteRename() | |||
302 | { | 318 | { |
303 | QString curFile = Remote_View->currentItem()->text(0); | 319 | QString curFile = Remote_View->currentItem()->text(0); |
304 | if( curFile !="../") { | 320 | if( curFile !="../") { |
305 | InputDialog *fileDlg; | 321 | InputDialog *fileDlg; |
306 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 322 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
307 | fileDlg->setInputText((const QString &)curFile); | 323 | fileDlg->setInputText((const QString &)curFile); |
308 | fileDlg->exec(); | 324 | fileDlg->exec(); |
309 | if( fileDlg->result() == 1 ) { | 325 | if( fileDlg->result() == 1 ) { |
310 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 326 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
311 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 327 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
312 | //+".playlist"; | 328 | //+".playlist"; |
313 | if( rename(oldname.latin1(), newName.latin1())== -1) | 329 | if( rename(oldname.latin1(), newName.latin1())== -1) |
314 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 330 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
315 | } | 331 | } |
316 | populateRemoteView(); | 332 | populateRemoteView(); |
317 | } | 333 | } |
318 | } | 334 | } |
319 | 335 | ||
320 | 336 | ||
321 | void AdvancedFm::filePerms() { | 337 | void AdvancedFm::filePerms() { |
322 | 338 | ||
323 | QStringList curFileList = getPath(); | 339 | QStringList curFileList = getPath(); |
324 | QString filePath; | 340 | QString filePath; |
325 | 341 | ||
326 | if (TabWidget->currentPageIndex() == 0) { | 342 | if (TabWidget->getCurrentTab() == 0) { |
327 | filePath = currentDir.canonicalPath()+"/"; | 343 | filePath = currentDir.canonicalPath()+"/"; |
328 | } else { | 344 | } else { |
329 | filePath= currentRemoteDir.canonicalPath()+"/"; | 345 | filePath= currentRemoteDir.canonicalPath()+"/"; |
330 | } | 346 | } |
331 | 347 | ||
332 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 348 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
333 | filePermissions *filePerm; | 349 | filePermissions *filePerm; |
334 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 350 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
335 | filePerm->showMaximized(); | 351 | filePerm->showMaximized(); |
336 | filePerm->exec(); | 352 | filePerm->exec(); |
337 | if( filePerm) | 353 | if( filePerm) |
338 | delete filePerm; | 354 | delete filePerm; |
339 | } | 355 | } |
340 | if (TabWidget->currentPageIndex() == 0) { | 356 | if (TabWidget->getCurrentTab() == 0) { |
341 | populateLocalView(); | 357 | populateLocalView(); |
342 | } else { | 358 | } else { |
343 | populateRemoteView(); | 359 | populateRemoteView(); |
344 | } | 360 | } |
345 | } | 361 | } |
346 | 362 | ||
347 | void AdvancedFm::doProperties() { | 363 | void AdvancedFm::doProperties() { |
348 | #if defined(QT_QWS_OPIE) | 364 | #if defined(QT_QWS_OPIE) |
349 | 365 | ||
350 | QStringList curFileList = getPath(); | 366 | QStringList curFileList = getPath(); |
351 | 367 | ||
352 | QString filePath; | 368 | QString filePath; |
353 | if (TabWidget->currentPageIndex() == 0) { | 369 | if (TabWidget->getCurrentTab() == 0) { |
354 | filePath = currentDir.canonicalPath()+"/"; | 370 | filePath = currentDir.canonicalPath()+"/"; |
355 | } else { | 371 | } else { |
356 | filePath= currentRemoteDir.canonicalPath()+"/"; | 372 | filePath= currentRemoteDir.canonicalPath()+"/"; |
357 | } | 373 | } |
358 | qDebug("%d",curFileList.count()); | 374 | qDebug("%d",curFileList.count()); |
359 | 375 | ||
360 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 376 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
361 | qDebug((filePath+*it)); | 377 | qDebug((filePath+*it)); |
362 | DocLnk lnk( (filePath+*it)); | 378 | DocLnk lnk( (filePath+*it)); |
363 | LnkProperties prop( &lnk ); | 379 | LnkProperties prop( &lnk ); |
364 | prop.showMaximized(); | 380 | prop.showMaximized(); |
365 | prop.exec(); | 381 | prop.exec(); |
366 | } | 382 | } |
367 | #endif | 383 | #endif |
368 | 384 | ||
369 | } | 385 | } |
370 | 386 | ||
371 | void AdvancedFm::upDir() { | 387 | void AdvancedFm::upDir() { |
372 | if (TabWidget->currentPageIndex() == 0) { | 388 | if (TabWidget->getCurrentTab() == 0) { |
373 | QString current = currentDir.canonicalPath(); | 389 | QString current = currentDir.canonicalPath(); |
374 | QDir dir(current); | 390 | QDir dir(current); |
375 | dir.cdUp(); | 391 | dir.cdUp(); |
376 | current = dir.canonicalPath(); | 392 | current = dir.canonicalPath(); |
377 | chdir( current.latin1() ); | 393 | chdir( current.latin1() ); |
378 | currentDir.cd( current, TRUE); | 394 | currentDir.cd( current, TRUE); |
379 | populateLocalView(); | 395 | populateLocalView(); |
380 | update(); | 396 | update(); |
381 | } else { | 397 | } else { |
382 | QString current = currentRemoteDir.canonicalPath(); | 398 | QString current = currentRemoteDir.canonicalPath(); |
383 | QDir dir(current); | 399 | QDir dir(current); |
384 | dir.cdUp(); | 400 | dir.cdUp(); |
385 | current = dir.canonicalPath(); | 401 | current = dir.canonicalPath(); |
386 | chdir( current.latin1() ); | 402 | chdir( current.latin1() ); |
387 | currentRemoteDir.cd( current, TRUE); | 403 | currentRemoteDir.cd( current, TRUE); |
388 | populateRemoteView(); | 404 | populateRemoteView(); |
389 | update(); | 405 | update(); |
390 | } | 406 | } |
391 | } | 407 | } |
392 | 408 | ||
393 | void AdvancedFm::copy() { | 409 | void AdvancedFm::copy() { |
394 | qApp->processEvents(); | 410 | qApp->processEvents(); |
395 | QStringList curFileList = getPath(); | 411 | QStringList curFileList = getPath(); |
396 | if( curFileList.count() > 0) { | 412 | if( curFileList.count() > 0) { |
397 | QString curFile, item, destFile; | 413 | QString curFile, item, destFile; |
398 | if (TabWidget->currentPageIndex() == 0) { | 414 | if (TabWidget->getCurrentTab() == 0) { |
399 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 415 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
400 | item=(*it); | 416 | item=(*it); |
401 | 417 | ||
402 | if(item.find("->",0,TRUE)) //symlink | 418 | if(item.find("->",0,TRUE)) //symlink |
403 | item = item.left(item.find("->",0,TRUE)); | 419 | item = item.left(item.find("->",0,TRUE)); |
404 | 420 | ||
405 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 421 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
406 | qDebug("Destination file is "+destFile); | 422 | qDebug("Destination file is "+destFile); |
407 | 423 | ||
408 | curFile = currentDir.canonicalPath()+"/"+ item; | 424 | curFile = currentDir.canonicalPath()+"/"+ item; |
409 | qDebug("CurrentFile file is " + curFile); | 425 | qDebug("CurrentFile file is " + curFile); |
410 | 426 | ||
411 | QFile f(destFile); | 427 | QFile f(destFile); |
412 | if( f.exists()) { | 428 | if( f.exists()) { |
413 | switch ( QMessageBox::warning(this,tr("Delete"), | 429 | switch ( QMessageBox::warning(this,tr("Delete"), |
414 | destFile+tr(" already exists\nDo you really want to delete it?"), | 430 | destFile+tr(" already exists\nDo you really want to delete it?"), |
415 | tr("Yes"),tr("No"),0,0,1) ) { | 431 | tr("Yes"),tr("No"),0,0,1) ) { |
416 | case 0: | 432 | case 0: |
417 | f.remove(); | 433 | f.remove(); |
418 | break; | 434 | break; |
419 | case 1: | 435 | case 1: |
420 | return; | 436 | return; |
421 | break; | 437 | break; |
422 | }; | 438 | }; |
423 | } | 439 | } |
424 | if(!copyFile(destFile, curFile) ) { | 440 | if(!copyFile(destFile, curFile) ) { |
425 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 441 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
426 | return; | 442 | return; |
427 | } | 443 | } |
428 | } | 444 | } |
429 | populateRemoteView(); | 445 | populateRemoteView(); |
430 | TabWidget->setCurrentPage(1); | 446 | TabWidget->setCurrentTab(1); |
431 | 447 | ||
432 | } else { | 448 | } else { |
433 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 449 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
434 | item= (*it); | 450 | item= (*it); |
435 | 451 | ||
436 | if(item.find("->",0,TRUE)) //symlink | 452 | if(item.find("->",0,TRUE)) //symlink |
437 | item = item.left(item.find("->",0,TRUE)); | 453 | item = item.left(item.find("->",0,TRUE)); |
438 | 454 | ||
439 | destFile = currentDir.canonicalPath()+"/"+ item; | 455 | destFile = currentDir.canonicalPath()+"/"+ item; |
440 | qDebug("Destination file is "+destFile); | 456 | qDebug("Destination file is "+destFile); |
441 | 457 | ||
442 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 458 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
443 | qDebug("CurrentFile file is " + curFile); | 459 | qDebug("CurrentFile file is " + curFile); |
444 | 460 | ||
445 | QFile f(destFile); | 461 | QFile f(destFile); |
446 | if( f.exists()) { | 462 | if( f.exists()) { |
447 | switch ( QMessageBox::warning(this,tr("Delete"), | 463 | switch ( QMessageBox::warning(this,tr("Delete"), |
448 | destFile+tr(" already exists\nDo you really want to delete it?"), | 464 | destFile+tr(" already exists\nDo you really want to delete it?"), |
449 | tr("Yes"),tr("No"),0,0,1) ) { | 465 | tr("Yes"),tr("No"),0,0,1) ) { |
450 | case 0: | 466 | case 0: |
451 | f.remove(); | 467 | f.remove(); |
452 | break; | 468 | break; |
453 | case 1: | 469 | case 1: |
454 | return; | 470 | return; |
455 | break; | 471 | break; |
456 | }; | 472 | }; |
457 | } | 473 | } |
458 | if(!copyFile(destFile, curFile) ) { | 474 | if(!copyFile(destFile, curFile) ) { |
459 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 475 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
460 | +curFile +tr("to\n")+destFile); | 476 | +curFile +tr("to\n")+destFile); |
461 | return; | 477 | return; |
462 | 478 | ||
463 | } | 479 | } |
464 | } | 480 | } |
465 | populateLocalView(); | 481 | populateLocalView(); |
466 | TabWidget->setCurrentPage(0); | 482 | TabWidget->setCurrentTab(0); |
467 | } | 483 | } |
468 | 484 | ||
469 | } | 485 | } |
470 | } | 486 | } |
471 | 487 | ||
472 | void AdvancedFm::copyAs() { | 488 | void AdvancedFm::copyAs() { |
473 | qApp->processEvents(); | 489 | qApp->processEvents(); |
474 | 490 | ||
475 | QStringList curFileList = getPath(); | 491 | QStringList curFileList = getPath(); |
476 | QString curFile; | 492 | QString curFile; |
477 | InputDialog *fileDlg; | 493 | InputDialog *fileDlg; |
478 | if (TabWidget->currentPageIndex() == 0) { | 494 | if (TabWidget->getCurrentTab() == 0) { |
479 | qDebug("tab 1"); | 495 | qDebug("tab 1"); |
480 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
481 | QString destFile; | 497 | QString destFile; |
482 | curFile = currentDir.canonicalPath()+"/"+(*it); | 498 | curFile = currentDir.canonicalPath()+"/"+(*it); |
483 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 499 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
484 | 500 | ||
485 | fileDlg->setInputText((const QString &) destFile ); | 501 | fileDlg->setInputText((const QString &) destFile ); |
486 | fileDlg->exec(); | 502 | fileDlg->exec(); |
487 | 503 | ||
488 | if( fileDlg->result() == 1 ) { | 504 | if( fileDlg->result() == 1 ) { |
489 | QString filename = fileDlg->LineEdit1->text(); | 505 | QString filename = fileDlg->LineEdit1->text(); |
490 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 506 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
491 | 507 | ||
492 | QFile f(destFile); | 508 | QFile f(destFile); |
493 | if( f.exists()) { | 509 | if( f.exists()) { |
494 | switch (QMessageBox::warning(this,tr("Delete"), | 510 | switch (QMessageBox::warning(this,tr("Delete"), |
495 | destFile+tr(" already exists\nDo you really want to delete it?"), | 511 | destFile+tr(" already exists\nDo you really want to delete it?"), |
496 | tr("Yes"),tr("No"),0,0,1) ) { | 512 | tr("Yes"),tr("No"),0,0,1) ) { |
497 | case 0: | 513 | case 0: |
498 | f.remove(); | 514 | f.remove(); |
499 | break; | 515 | break; |
500 | case 1: | 516 | case 1: |
501 | return; | 517 | return; |
502 | break; | 518 | break; |
503 | }; | 519 | }; |
504 | } | 520 | } |
505 | if(!copyFile(destFile, curFile) ) { | 521 | if(!copyFile(destFile, curFile) ) { |
506 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 522 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
507 | +curFile +tr("to\n")+destFile); | 523 | +curFile +tr("to\n")+destFile); |
508 | return; | 524 | return; |
509 | } | 525 | } |
510 | } | 526 | } |
511 | delete fileDlg; | 527 | delete fileDlg; |
512 | 528 | ||
513 | } | 529 | } |
514 | populateRemoteView(); | 530 | populateRemoteView(); |
515 | TabWidget->setCurrentPage(1); | 531 | TabWidget->setCurrentTab(1); |
516 | 532 | ||
517 | } else { | 533 | } else { |
518 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 534 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
519 | 535 | ||
520 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 536 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
521 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 537 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
522 | 538 | ||
523 | QString destFile; | 539 | QString destFile; |
524 | fileDlg->setInputText((const QString &) destFile); | 540 | fileDlg->setInputText((const QString &) destFile); |
525 | fileDlg->exec(); | 541 | fileDlg->exec(); |
526 | 542 | ||
527 | if( fileDlg->result() == 1 ) { | 543 | if( fileDlg->result() == 1 ) { |
528 | QString filename = fileDlg->LineEdit1->text(); | 544 | QString filename = fileDlg->LineEdit1->text(); |
529 | destFile = currentDir.canonicalPath()+"/"+filename; | 545 | destFile = currentDir.canonicalPath()+"/"+filename; |
530 | 546 | ||
531 | QFile f( destFile); | 547 | QFile f( destFile); |
532 | if( f.exists()) { | 548 | if( f.exists()) { |
533 | switch ( QMessageBox::warning(this,tr("Delete"), | 549 | switch ( QMessageBox::warning(this,tr("Delete"), |
534 | destFile+tr(" already exists\nDo you really want to delete it?"), | 550 | destFile+tr(" already exists\nDo you really want to delete it?"), |
535 | tr("Yes"),tr("No"),0,0,1) ) { | 551 | tr("Yes"),tr("No"),0,0,1) ) { |
536 | case 0: | 552 | case 0: |
537 | f.remove(); | 553 | f.remove(); |
538 | break; | 554 | break; |
539 | case 1: | 555 | case 1: |
540 | return; | 556 | return; |
541 | break; | 557 | break; |
542 | }; | 558 | }; |
543 | } | 559 | } |
544 | if(!copyFile(destFile, curFile) ) { | 560 | if(!copyFile(destFile, curFile) ) { |
545 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 561 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
546 | +curFile +tr("to\n")+destFile); | 562 | +curFile +tr("to\n")+destFile); |
547 | return; | 563 | return; |
548 | } | 564 | } |
549 | 565 | ||
550 | } | 566 | } |
551 | delete fileDlg; | 567 | delete fileDlg; |
552 | 568 | ||
553 | } | 569 | } |
554 | populateLocalView(); | 570 | populateLocalView(); |
555 | TabWidget->setCurrentPage(0); | 571 | TabWidget->setCurrentTab(0); |
556 | } | 572 | } |
557 | } | 573 | } |
558 | 574 | ||
559 | void AdvancedFm::copySameDir() { | 575 | void AdvancedFm::copySameDir() { |
560 | qApp->processEvents(); | 576 | qApp->processEvents(); |
561 | QStringList curFileList = getPath(); | 577 | QStringList curFileList = getPath(); |
562 | QString curFile, item, destFile; | 578 | QString curFile, item, destFile; |
563 | InputDialog *fileDlg; | 579 | InputDialog *fileDlg; |
564 | 580 | ||
565 | if (TabWidget->currentPageIndex() == 0) { | 581 | if (TabWidget->getCurrentTab() == 0) { |
566 | 582 | ||
567 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 583 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
568 | item=(*it); | 584 | item=(*it); |
569 | curFile = currentDir.canonicalPath()+"/"+ item; | 585 | curFile = currentDir.canonicalPath()+"/"+ item; |
570 | 586 | ||
571 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 587 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
572 | fileDlg->setInputText((const QString &) destFile ); | 588 | fileDlg->setInputText((const QString &) destFile ); |
573 | fileDlg->exec(); | 589 | fileDlg->exec(); |
574 | 590 | ||
575 | if( fileDlg->result() == 1 ) { | 591 | if( fileDlg->result() == 1 ) { |
576 | 592 | ||
577 | QString filename = fileDlg->LineEdit1->text(); | 593 | QString filename = fileDlg->LineEdit1->text(); |
578 | destFile = currentDir.canonicalPath()+"/"+filename; | 594 | destFile = currentDir.canonicalPath()+"/"+filename; |
579 | 595 | ||
580 | QFile f(destFile); | 596 | QFile f(destFile); |
581 | if( f.exists()) { | 597 | if( f.exists()) { |
582 | switch (QMessageBox::warning(this,tr("Delete"), | 598 | switch (QMessageBox::warning(this,tr("Delete"), |
583 | destFile+tr(" already exists\nDo you really want to delete it?"), | 599 | destFile+tr(" already exists\nDo you really want to delete it?"), |
584 | tr("Yes"),tr("No"),0,0,1) ) { | 600 | tr("Yes"),tr("No"),0,0,1) ) { |
585 | case 0: | 601 | case 0: |
586 | 602 | ||
587 | f.remove(); | 603 | f.remove(); |
588 | break; | 604 | break; |
589 | case 1: | 605 | case 1: |
@@ -628,316 +644,316 @@ void AdvancedFm::copySameDir() { | |||
628 | return; | 644 | return; |
629 | break; | 645 | break; |
630 | }; | 646 | }; |
631 | } | 647 | } |
632 | if(!copyFile(destFile, curFile) ) { | 648 | if(!copyFile(destFile, curFile) ) { |
633 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 649 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
634 | +curFile +tr("to\n")+destFile); | 650 | +curFile +tr("to\n")+destFile); |
635 | return; | 651 | return; |
636 | } | 652 | } |
637 | qDebug("copy "+curFile+" as "+destFile); | 653 | qDebug("copy "+curFile+" as "+destFile); |
638 | } | 654 | } |
639 | delete fileDlg; | 655 | delete fileDlg; |
640 | } | 656 | } |
641 | populateRemoteView(); | 657 | populateRemoteView(); |
642 | } | 658 | } |
643 | } | 659 | } |
644 | 660 | ||
645 | void AdvancedFm::move() { | 661 | void AdvancedFm::move() { |
646 | qApp->processEvents(); | 662 | qApp->processEvents(); |
647 | 663 | ||
648 | QStringList curFileList = getPath(); | 664 | QStringList curFileList = getPath(); |
649 | if( curFileList.count() > 0) { | 665 | if( curFileList.count() > 0) { |
650 | QString curFile, destFile, item; | 666 | QString curFile, destFile, item; |
651 | 667 | ||
652 | if (TabWidget->currentPageIndex() == 0) { | 668 | if (TabWidget->getCurrentTab() == 0) { |
653 | 669 | ||
654 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 670 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
655 | item=(*it); | 671 | item=(*it); |
656 | QString destFile = currentRemoteDir.canonicalPath(); | 672 | QString destFile = currentRemoteDir.canonicalPath(); |
657 | 673 | ||
658 | if(destFile.right(1).find("/",0,TRUE) == -1) | 674 | if(destFile.right(1).find("/",0,TRUE) == -1) |
659 | destFile+="/"; | 675 | destFile+="/"; |
660 | destFile += item; | 676 | destFile += item; |
661 | curFile = currentDir.canonicalPath(); | 677 | curFile = currentDir.canonicalPath(); |
662 | 678 | ||
663 | qDebug("Destination file is "+destFile); | 679 | qDebug("Destination file is "+destFile); |
664 | 680 | ||
665 | if(curFile.right(1).find("/",0,TRUE) == -1) | 681 | if(curFile.right(1).find("/",0,TRUE) == -1) |
666 | curFile +="/"; | 682 | curFile +="/"; |
667 | 683 | ||
668 | curFile+= item; | 684 | curFile+= item; |
669 | qDebug("CurrentFile file is " + curFile); | 685 | qDebug("CurrentFile file is " + curFile); |
670 | 686 | ||
671 | QFile f( curFile); | 687 | QFile f( curFile); |
672 | if( f.exists()) { | 688 | if( f.exists()) { |
673 | if(!copyFile( destFile, curFile) ) { | 689 | if(!copyFile( destFile, curFile) ) { |
674 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 690 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
675 | return; | 691 | return; |
676 | } else | 692 | } else |
677 | QFile::remove(curFile); | 693 | QFile::remove(curFile); |
678 | } | 694 | } |
679 | } | 695 | } |
680 | 696 | ||
681 | TabWidget->setCurrentPage(1); | 697 | TabWidget->setCurrentTab(1); |
682 | 698 | ||
683 | } else { //view 2 | 699 | } else { //view 2 |
684 | 700 | ||
685 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 701 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
686 | item = (*it); | 702 | item = (*it); |
687 | QString destFile = currentDir.canonicalPath(); | 703 | QString destFile = currentDir.canonicalPath(); |
688 | 704 | ||
689 | if(destFile.right(1).find("/",0,TRUE) == -1) | 705 | if(destFile.right(1).find("/",0,TRUE) == -1) |
690 | destFile+="/"; | 706 | destFile+="/"; |
691 | 707 | ||
692 | destFile += item; | 708 | destFile += item; |
693 | 709 | ||
694 | qDebug("Destination file is "+destFile); | 710 | qDebug("Destination file is "+destFile); |
695 | 711 | ||
696 | curFile = currentRemoteDir.canonicalPath(); | 712 | curFile = currentRemoteDir.canonicalPath(); |
697 | 713 | ||
698 | if(curFile.right(1).find("/",0,TRUE) == -1) | 714 | if(curFile.right(1).find("/",0,TRUE) == -1) |
699 | curFile +="/"; | 715 | curFile +="/"; |
700 | curFile+= item; | 716 | curFile+= item; |
701 | qDebug("CurrentFile file is " + curFile); | 717 | qDebug("CurrentFile file is " + curFile); |
702 | 718 | ||
703 | QFile f( curFile); | 719 | QFile f( curFile); |
704 | if( f.exists()) { | 720 | if( f.exists()) { |
705 | if(!copyFile( destFile, curFile) ) { | 721 | if(!copyFile( destFile, curFile) ) { |
706 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 722 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
707 | return; | 723 | return; |
708 | } else | 724 | } else |
709 | QFile::remove( curFile); | 725 | QFile::remove( curFile); |
710 | } | 726 | } |
711 | TabWidget->setCurrentPage(0); | 727 | TabWidget->setCurrentTab(0); |
712 | } | 728 | } |
713 | } | 729 | } |
714 | populateRemoteView(); | 730 | populateRemoteView(); |
715 | populateLocalView(); | 731 | populateLocalView(); |
716 | } | 732 | } |
717 | } | 733 | } |
718 | 734 | ||
719 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { | 735 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { |
720 | char bf[ 50000 ]; | 736 | char bf[ 50000 ]; |
721 | int bytesRead; | 737 | int bytesRead; |
722 | bool success = TRUE; | 738 | bool success = TRUE; |
723 | struct stat status; | 739 | struct stat status; |
724 | 740 | ||
725 | QFile s( src ); | 741 | QFile s( src ); |
726 | QFile d( dest ); | 742 | QFile d( dest ); |
727 | 743 | ||
728 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 744 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
729 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 745 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
730 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 746 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
731 | success = FALSE; | 747 | success = FALSE; |
732 | break; | 748 | break; |
733 | } | 749 | } |
734 | } | 750 | } |
735 | if( success && (bytesRead > 0) ){ | 751 | if( success && (bytesRead > 0) ){ |
736 | d.writeBlock( bf, bytesRead ); | 752 | d.writeBlock( bf, bytesRead ); |
737 | } | 753 | } |
738 | } else { | 754 | } else { |
739 | success = FALSE; | 755 | success = FALSE; |
740 | } | 756 | } |
741 | 757 | ||
742 | // Set file permissions | 758 | // Set file permissions |
743 | if( stat( (const char *) src, &status ) == 0 ){ | 759 | if( stat( (const char *) src, &status ) == 0 ){ |
744 | chmod( (const char *) dest, status.st_mode ); | 760 | chmod( (const char *) dest, status.st_mode ); |
745 | } | 761 | } |
746 | 762 | ||
747 | return success; | 763 | return success; |
748 | } | 764 | } |
749 | 765 | ||
750 | void AdvancedFm::runCommand() { | 766 | void AdvancedFm::runCommand() { |
751 | QString curFile; | 767 | QString curFile; |
752 | if (TabWidget->currentPageIndex() == 0) { | 768 | if (TabWidget->getCurrentTab() == 0) { |
753 | if( Local_View->currentItem()) | 769 | if( Local_View->currentItem()) |
754 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 770 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
755 | } else { | 771 | } else { |
756 | if(Remote_View->currentItem()) | 772 | if(Remote_View->currentItem()) |
757 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 773 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
758 | } | 774 | } |
759 | 775 | ||
760 | InputDialog *fileDlg; | 776 | InputDialog *fileDlg; |
761 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 777 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
762 | fileDlg->setInputText(curFile); | 778 | fileDlg->setInputText(curFile); |
763 | fileDlg->exec(); | 779 | fileDlg->exec(); |
764 | QString command; | 780 | QString command; |
765 | if( fileDlg->result() == 1 ) { | 781 | if( fileDlg->result() == 1 ) { |
766 | command = fileDlg->LineEdit1->text(); | 782 | command = fileDlg->LineEdit1->text(); |
767 | 783 | ||
768 | Output *outDlg; | 784 | Output *outDlg; |
769 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 785 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
770 | outDlg->showMaximized(); | 786 | outDlg->showMaximized(); |
771 | outDlg->show(); | 787 | outDlg->show(); |
772 | qApp->processEvents(); | 788 | qApp->processEvents(); |
773 | FILE *fp; | 789 | FILE *fp; |
774 | char line[130]; | 790 | char line[130]; |
775 | sleep(1); | 791 | sleep(1); |
776 | command +=" 2>&1"; | 792 | command +=" 2>&1"; |
777 | fp = popen( (const char *) command, "r"); | 793 | fp = popen( (const char *) command, "r"); |
778 | if ( !fp ) { | 794 | if ( !fp ) { |
779 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 795 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
780 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 796 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
781 | pclose(fp); | 797 | pclose(fp); |
782 | return; | 798 | return; |
783 | } else { | 799 | } else { |
784 | while ( fgets( line, sizeof line, fp)) { | 800 | while ( fgets( line, sizeof line, fp)) { |
785 | QString lineStr = line; | 801 | QString lineStr = line; |
786 | lineStr=lineStr.left(lineStr.length()-1); | 802 | lineStr=lineStr.left(lineStr.length()-1); |
787 | outDlg->OutputEdit->append(lineStr); | 803 | outDlg->OutputEdit->append(lineStr); |
788 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 804 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
789 | } | 805 | } |
790 | } | 806 | } |
791 | pclose(fp); | 807 | pclose(fp); |
792 | 808 | ||
793 | } | 809 | } |
794 | } | 810 | } |
795 | 811 | ||
796 | void AdvancedFm::runCommandStd() { | 812 | void AdvancedFm::runCommandStd() { |
797 | QString curFile; | 813 | QString curFile; |
798 | if (TabWidget->currentPageIndex() == 0) { | 814 | if (TabWidget->getCurrentTab() == 0) { |
799 | if( Local_View->currentItem()) | 815 | if( Local_View->currentItem()) |
800 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 816 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
801 | } else { | 817 | } else { |
802 | if(Remote_View->currentItem()) | 818 | if(Remote_View->currentItem()) |
803 | curFile = currentRemoteDir.canonicalPath() +"/" | 819 | curFile = currentRemoteDir.canonicalPath() +"/" |
804 | + Remote_View->currentItem()->text(0); | 820 | + Remote_View->currentItem()->text(0); |
805 | } | 821 | } |
806 | 822 | ||
807 | InputDialog *fileDlg; | 823 | InputDialog *fileDlg; |
808 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 824 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
809 | fileDlg->setInputText(curFile); | 825 | fileDlg->setInputText(curFile); |
810 | fileDlg->exec(); | 826 | fileDlg->exec(); |
811 | QString command; | 827 | QString command; |
812 | if( fileDlg->result() == 1 ) { | 828 | if( fileDlg->result() == 1 ) { |
813 | qApp->processEvents(); | 829 | qApp->processEvents(); |
814 | command = fileDlg->LineEdit1->text() + " &"; | 830 | command = fileDlg->LineEdit1->text() + " &"; |
815 | system(command.latin1()); | 831 | system(command.latin1()); |
816 | } | 832 | } |
817 | } | 833 | } |
818 | 834 | ||
819 | void AdvancedFm::fileStatus() { | 835 | void AdvancedFm::fileStatus() { |
820 | QString curFile; | 836 | QString curFile; |
821 | if (TabWidget->currentPageIndex() == 0) { | 837 | if (TabWidget->getCurrentTab() == 0) { |
822 | curFile = Local_View->currentItem()->text(0); | 838 | curFile = Local_View->currentItem()->text(0); |
823 | } else { | 839 | } else { |
824 | curFile = Remote_View->currentItem()->text(0); | 840 | curFile = Remote_View->currentItem()->text(0); |
825 | } | 841 | } |
826 | QString command = " stat -l "+ curFile +" 2>&1"; | 842 | QString command = " stat -l "+ curFile +" 2>&1"; |
827 | Output *outDlg; | 843 | Output *outDlg; |
828 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 844 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
829 | outDlg->showMaximized(); | 845 | outDlg->showMaximized(); |
830 | outDlg->show(); | 846 | outDlg->show(); |
831 | qApp->processEvents(); | 847 | qApp->processEvents(); |
832 | FILE *fp; | 848 | FILE *fp; |
833 | char line[130]; | 849 | char line[130]; |
834 | sleep(1); | 850 | sleep(1); |
835 | fp = popen( (const char *) command, "r"); | 851 | fp = popen( (const char *) command, "r"); |
836 | if ( !fp ) { | 852 | if ( !fp ) { |
837 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 853 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
838 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 854 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
839 | pclose(fp); | 855 | pclose(fp); |
840 | return; | 856 | return; |
841 | } else { | 857 | } else { |
842 | while ( fgets( line, sizeof line, fp)) { | 858 | while ( fgets( line, sizeof line, fp)) { |
843 | outDlg->OutputEdit->append(line); | 859 | outDlg->OutputEdit->append(line); |
844 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 860 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
845 | 861 | ||
846 | } | 862 | } |
847 | 863 | ||
848 | } | 864 | } |
849 | pclose(fp); | 865 | pclose(fp); |
850 | } | 866 | } |
851 | 867 | ||
852 | void AdvancedFm::mkDir() { | 868 | void AdvancedFm::mkDir() { |
853 | if (TabWidget->currentPageIndex() == 0) | 869 | if (TabWidget->getCurrentTab() == 0) |
854 | localMakDir(); | 870 | localMakDir(); |
855 | else | 871 | else |
856 | remoteMakDir(); | 872 | remoteMakDir(); |
857 | 873 | ||
858 | } | 874 | } |
859 | 875 | ||
860 | void AdvancedFm::rn() { | 876 | void AdvancedFm::rn() { |
861 | if (TabWidget->currentPageIndex() == 0) | 877 | if (TabWidget->getCurrentTab() == 0) |
862 | localRename(); | 878 | localRename(); |
863 | else | 879 | else |
864 | remoteRename(); | 880 | remoteRename(); |
865 | 881 | ||
866 | } | 882 | } |
867 | 883 | ||
868 | void AdvancedFm::del() { | 884 | void AdvancedFm::del() { |
869 | if (TabWidget->currentPageIndex() == 0) | 885 | if (TabWidget->getCurrentTab() == 0) |
870 | localDelete(); | 886 | localDelete(); |
871 | else | 887 | else |
872 | remoteDelete(); | 888 | remoteDelete(); |
873 | } | 889 | } |
874 | 890 | ||
875 | void AdvancedFm::mkSym() { | 891 | void AdvancedFm::mkSym() { |
876 | QString cmd; | 892 | QString cmd; |
877 | QStringList curFileList = getPath(); | 893 | QStringList curFileList = getPath(); |
878 | if( curFileList.count() > 0) { | 894 | if( curFileList.count() > 0) { |
879 | 895 | ||
880 | if (TabWidget->currentPageIndex() == 0) { | 896 | if (TabWidget->getCurrentTab() == 0) { |
881 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 897 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
882 | 898 | ||
883 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 899 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
884 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 900 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
885 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 901 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
886 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 902 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
887 | cmd = "ln -s "+curFile+" "+destName; | 903 | cmd = "ln -s "+curFile+" "+destName; |
888 | qDebug(cmd); | 904 | qDebug(cmd); |
889 | system(cmd.latin1() ); | 905 | system(cmd.latin1() ); |
890 | } | 906 | } |
891 | populateRemoteView(); | 907 | populateRemoteView(); |
892 | TabWidget->setCurrentPage(1); | 908 | TabWidget->setCurrentTab(1); |
893 | } else { | 909 | } else { |
894 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 910 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
895 | 911 | ||
896 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 912 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
897 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 913 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
898 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 914 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
899 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 915 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
900 | 916 | ||
901 | cmd = "ln -s "+curFile+" "+destName; | 917 | cmd = "ln -s "+curFile+" "+destName; |
902 | qDebug(cmd); | 918 | qDebug(cmd); |
903 | system(cmd.latin1() ); | 919 | system(cmd.latin1() ); |
904 | } | 920 | } |
905 | populateLocalView(); | 921 | populateLocalView(); |
906 | TabWidget->setCurrentPage(0); | 922 | TabWidget->setCurrentTab(0); |
907 | } | 923 | } |
908 | } | 924 | } |
909 | } | 925 | } |
910 | 926 | ||
911 | void AdvancedFm::doBeam() { | 927 | void AdvancedFm::doBeam() { |
912 | Ir ir; | 928 | Ir ir; |
913 | if(!ir.supported()){ | 929 | if(!ir.supported()){ |
914 | } else { | 930 | } else { |
915 | 931 | ||
916 | QStringList curFileList = getPath(); | 932 | QStringList curFileList = getPath(); |
917 | if( curFileList.count() > 0) { | 933 | if( curFileList.count() > 0) { |
918 | 934 | ||
919 | if (TabWidget->currentPageIndex() == 0) { | 935 | if (TabWidget->getCurrentTab() == 0) { |
920 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 936 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
921 | 937 | ||
922 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 938 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
923 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 939 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
924 | Ir *file = new Ir(this, "IR"); | 940 | Ir *file = new Ir(this, "IR"); |
925 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 941 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
926 | file->send( curFile, curFile ); | 942 | file->send( curFile, curFile ); |
927 | } | 943 | } |
928 | 944 | ||
929 | } else { | 945 | } else { |
930 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 946 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
931 | 947 | ||
932 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 948 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
933 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 949 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
934 | Ir *file = new Ir(this, "IR"); | 950 | Ir *file = new Ir(this, "IR"); |
935 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 951 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
936 | file->send( curFile, curFile ); | 952 | file->send( curFile, curFile ); |
937 | 953 | ||
938 | } | 954 | } |
939 | } | 955 | } |
940 | } | 956 | } |
941 | } | 957 | } |
942 | 958 | ||
943 | } | 959 | } |