author | llornkcor <llornkcor> | 2002-05-07 00:14:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-07 00:14:17 (UTC) |
commit | c9849cc04b668f1cda7a16d868299c436d1de042 (patch) (unidiff) | |
tree | cc9ff9565931bec34602468b5335e19ed2b3d662 | |
parent | f046179d3b49c44896298aa86380046a21394bbc (diff) | |
download | opie-c9849cc04b668f1cda7a16d868299c436d1de042.zip opie-c9849cc04b668f1cda7a16d868299c436d1de042.tar.gz opie-c9849cc04b668f1cda7a16d868299c436d1de042.tar.bz2 |
Fix for Sharp rom not having the Properties class
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index b9e254e..18952c3 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -495,761 +495,766 @@ void AdvancedFm::populateRemoteView() | |||
495 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 495 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
496 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 496 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
497 | item->setPixmap( 0,pm); | 497 | item->setPixmap( 0,pm); |
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
501 | closedir(dir); | 501 | closedir(dir); |
502 | } | 502 | } |
503 | 503 | ||
504 | Remote_View->setSorting( 3,FALSE); | 504 | Remote_View->setSorting( 3,FALSE); |
505 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 505 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
506 | } | 506 | } |
507 | 507 | ||
508 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 508 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
509 | { | 509 | { |
510 | if(selectedItem) { | 510 | if(selectedItem) { |
511 | QString strItem=selectedItem->text(0); | 511 | QString strItem=selectedItem->text(0); |
512 | QString strSize=selectedItem->text(1); | 512 | QString strSize=selectedItem->text(1); |
513 | strSize=strSize.stripWhiteSpace(); | 513 | strSize=strSize.stripWhiteSpace(); |
514 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 514 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
515 | // is symlink | 515 | // is symlink |
516 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 516 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
517 | if(QDir(strItem2).exists() ) { | 517 | if(QDir(strItem2).exists() ) { |
518 | currentDir.cd(strItem2, TRUE); | 518 | currentDir.cd(strItem2, TRUE); |
519 | populateLocalView(); | 519 | populateLocalView(); |
520 | } | 520 | } |
521 | } else { // not a symlink | 521 | } else { // not a symlink |
522 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 522 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
523 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 523 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
524 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 524 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
525 | currentDir.cd(strItem,FALSE); | 525 | currentDir.cd(strItem,FALSE); |
526 | populateLocalView(); | 526 | populateLocalView(); |
527 | } else { | 527 | } else { |
528 | currentDir.cdUp(); | 528 | currentDir.cdUp(); |
529 | populateLocalView(); | 529 | populateLocalView(); |
530 | } | 530 | } |
531 | if(QDir(strItem).exists()){ | 531 | if(QDir(strItem).exists()){ |
532 | currentDir.cd(strItem, TRUE); | 532 | currentDir.cd(strItem, TRUE); |
533 | populateLocalView(); | 533 | populateLocalView(); |
534 | } | 534 | } |
535 | } else { | 535 | } else { |
536 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 536 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
537 | if( QFile::exists(strItem ) ) { | 537 | if( QFile::exists(strItem ) ) { |
538 | qDebug("clicked item "+strItem); | 538 | qDebug("clicked item "+strItem); |
539 | DocLnk doc( strItem, FALSE ); | 539 | DocLnk doc( strItem, FALSE ); |
540 | doc.execute(); | 540 | doc.execute(); |
541 | // Local_View->clearSelection(); | 541 | // Local_View->clearSelection(); |
542 | } | 542 | } |
543 | } //end not symlink | 543 | } //end not symlink |
544 | chdir(strItem.latin1()); | 544 | chdir(strItem.latin1()); |
545 | } | 545 | } |
546 | } | 546 | } |
547 | } | 547 | } |
548 | 548 | ||
549 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 549 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
550 | { | 550 | { |
551 | if(selectedItem) { | 551 | if(selectedItem) { |
552 | QString strItem=selectedItem->text(0); | 552 | QString strItem=selectedItem->text(0); |
553 | QString strSize=selectedItem->text(1); | 553 | QString strSize=selectedItem->text(1); |
554 | strSize=strSize.stripWhiteSpace(); | 554 | strSize=strSize.stripWhiteSpace(); |
555 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 555 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
556 | // is symlink | 556 | // is symlink |
557 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 557 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
558 | if(QDir(strItem2).exists() ) { | 558 | if(QDir(strItem2).exists() ) { |
559 | currentRemoteDir.cd(strItem2, TRUE); | 559 | currentRemoteDir.cd(strItem2, TRUE); |
560 | populateRemoteView(); | 560 | populateRemoteView(); |
561 | } | 561 | } |
562 | } else { // not a symlink | 562 | } else { // not a symlink |
563 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 563 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
564 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 564 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
565 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 565 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
566 | currentRemoteDir.cd(strItem,FALSE); | 566 | currentRemoteDir.cd(strItem,FALSE); |
567 | populateRemoteView(); | 567 | populateRemoteView(); |
568 | } else { | 568 | } else { |
569 | currentRemoteDir.cdUp(); | 569 | currentRemoteDir.cdUp(); |
570 | populateRemoteView(); | 570 | populateRemoteView(); |
571 | } | 571 | } |
572 | if(QDir(strItem).exists()){ | 572 | if(QDir(strItem).exists()){ |
573 | currentRemoteDir.cd(strItem, TRUE); | 573 | currentRemoteDir.cd(strItem, TRUE); |
574 | populateRemoteView(); | 574 | populateRemoteView(); |
575 | } | 575 | } |
576 | } else { | 576 | } else { |
577 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 577 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
578 | if( QFile::exists(strItem ) ) { | 578 | if( QFile::exists(strItem ) ) { |
579 | qDebug("clicked item "+strItem); | 579 | qDebug("clicked item "+strItem); |
580 | DocLnk doc( strItem, FALSE ); | 580 | DocLnk doc( strItem, FALSE ); |
581 | doc.execute(); | 581 | doc.execute(); |
582 | // Remote_View->clearSelection(); | 582 | // Remote_View->clearSelection(); |
583 | } | 583 | } |
584 | } //end not symlink | 584 | } //end not symlink |
585 | chdir(strItem.latin1()); | 585 | chdir(strItem.latin1()); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | } | 588 | } |
589 | 589 | ||
590 | void AdvancedFm::doLocalCd() | 590 | void AdvancedFm::doLocalCd() |
591 | { | 591 | { |
592 | localListClicked( Local_View->currentItem()); | 592 | localListClicked( Local_View->currentItem()); |
593 | } | 593 | } |
594 | 594 | ||
595 | void AdvancedFm::doRemoteCd() | 595 | void AdvancedFm::doRemoteCd() |
596 | { | 596 | { |
597 | localListClicked( Remote_View->currentItem()); | 597 | localListClicked( Remote_View->currentItem()); |
598 | } | 598 | } |
599 | 599 | ||
600 | void AdvancedFm::showHidden() | 600 | void AdvancedFm::showHidden() |
601 | { | 601 | { |
602 | if (b) { | 602 | if (b) { |
603 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 603 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
604 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 604 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
605 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 605 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
606 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 606 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
607 | b=FALSE; | 607 | b=FALSE; |
608 | 608 | ||
609 | } else { | 609 | } else { |
610 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 610 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
611 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 611 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
612 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 612 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
613 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 613 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
614 | b=TRUE; | 614 | b=TRUE; |
615 | } | 615 | } |
616 | populateLocalView(); | 616 | populateLocalView(); |
617 | 617 | ||
618 | } | 618 | } |
619 | 619 | ||
620 | void AdvancedFm::showRemoteHidden() | 620 | void AdvancedFm::showRemoteHidden() |
621 | { | 621 | { |
622 | if (b) { | 622 | if (b) { |
623 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 623 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
624 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 624 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
625 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 625 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
626 | b=TRUE; | 626 | b=TRUE; |
627 | 627 | ||
628 | } else { | 628 | } else { |
629 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 629 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
630 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 630 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
631 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 631 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
632 | b=FALSE; | 632 | b=FALSE; |
633 | } | 633 | } |
634 | populateRemoteView(); | 634 | populateRemoteView(); |
635 | } | 635 | } |
636 | 636 | ||
637 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 637 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
638 | { | 638 | { |
639 | switch (mouse) { | 639 | switch (mouse) { |
640 | case 1: | 640 | case 1: |
641 | break; | 641 | break; |
642 | case 2: | 642 | case 2: |
643 | showLocalMenu(item); | 643 | showLocalMenu(item); |
644 | Local_View->clearSelection(); | 644 | Local_View->clearSelection(); |
645 | break; | 645 | break; |
646 | }; | 646 | }; |
647 | } | 647 | } |
648 | 648 | ||
649 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 649 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
650 | { | 650 | { |
651 | switch (mouse) { | 651 | switch (mouse) { |
652 | case 1: | 652 | case 1: |
653 | break; | 653 | break; |
654 | case 2: | 654 | case 2: |
655 | showRemoteMenu(item); | 655 | showRemoteMenu(item); |
656 | Remote_View->clearSelection(); | 656 | Remote_View->clearSelection(); |
657 | break; | 657 | break; |
658 | }; | 658 | }; |
659 | } | 659 | } |
660 | 660 | ||
661 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 661 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
662 | { | 662 | { |
663 | if(item) { | 663 | if(item) { |
664 | QPopupMenu m; | 664 | QPopupMenu m; |
665 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 665 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
666 | m.insertSeparator(); | 666 | m.insertSeparator(); |
667 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 667 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
668 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 668 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
669 | else | 669 | else |
670 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | 670 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); |
671 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 671 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
672 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 672 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
673 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 673 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
674 | m.insertSeparator(); | 674 | m.insertSeparator(); |
675 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 675 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
676 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 676 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
677 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 677 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
678 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 678 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
679 | m.insertSeparator(); | 679 | m.insertSeparator(); |
680 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 680 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
681 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 681 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
682 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 682 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
683 | m.insertSeparator(); | 683 | m.insertSeparator(); |
684 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 684 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
685 | m.insertSeparator(); | 685 | m.insertSeparator(); |
686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
687 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
687 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 688 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
688 | m.setCheckable(TRUE); | 689 | m.setCheckable(TRUE); |
689 | if (!b) | 690 | if (!b) |
690 | m.setItemChecked(m.idAt(0),TRUE); | 691 | m.setItemChecked(m.idAt(0),TRUE); |
691 | else | 692 | else |
692 | m.setItemChecked(m.idAt(0),FALSE); | 693 | m.setItemChecked(m.idAt(0),FALSE); |
693 | m.exec( QCursor::pos() ); | 694 | m.exec( QCursor::pos() ); |
694 | } | 695 | } |
695 | } | 696 | } |
696 | 697 | ||
697 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 698 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
698 | { | 699 | { |
699 | if(item) { | 700 | if(item) { |
700 | QPopupMenu m; | 701 | QPopupMenu m; |
701 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 702 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
702 | m.insertSeparator(); | 703 | m.insertSeparator(); |
703 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 704 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
704 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 705 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
705 | else | 706 | else |
706 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | 707 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); |
707 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 708 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
708 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 709 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
709 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 710 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
710 | m.insertSeparator(); | 711 | m.insertSeparator(); |
711 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 712 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
712 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 713 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
713 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 714 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
714 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 715 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
715 | m.insertSeparator(); | 716 | m.insertSeparator(); |
716 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 717 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
717 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 718 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
718 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 719 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
719 | m.insertSeparator(); | 720 | m.insertSeparator(); |
720 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 721 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
721 | m.insertSeparator(); | 722 | m.insertSeparator(); |
722 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 723 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
724 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
723 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 725 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
724 | m.setCheckable(TRUE); | 726 | m.setCheckable(TRUE); |
725 | if (!b) | 727 | if (!b) |
726 | m.setItemChecked(m.idAt(0),TRUE); | 728 | m.setItemChecked(m.idAt(0),TRUE); |
727 | else | 729 | else |
728 | m.setItemChecked(m.idAt(0),FALSE); | 730 | m.setItemChecked(m.idAt(0),FALSE); |
729 | m.exec( QCursor::pos() ); | 731 | m.exec( QCursor::pos() ); |
730 | } | 732 | } |
731 | } | 733 | } |
732 | 734 | ||
733 | void AdvancedFm::runThis() { | 735 | void AdvancedFm::runThis() { |
734 | // QFileInfo *fi; | 736 | // QFileInfo *fi; |
735 | QString fs; | 737 | QString fs; |
736 | if (TabWidget->currentPageIndex() == 0) { | 738 | if (TabWidget->currentPageIndex() == 0) { |
737 | QString curFile = Local_View->currentItem()->text(0); | 739 | QString curFile = Local_View->currentItem()->text(0); |
738 | 740 | ||
739 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 741 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
740 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 742 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
741 | qDebug( fileInfo.owner()); | 743 | qDebug( fileInfo.owner()); |
742 | if( (fileInfo.permission( QFileInfo::ExeUser) | 744 | if( (fileInfo.permission( QFileInfo::ExeUser) |
743 | | fileInfo.permission( QFileInfo::ExeGroup) | 745 | | fileInfo.permission( QFileInfo::ExeGroup) |
744 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 746 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
745 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 747 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
746 | // if( fileInfo.isExecutable() | | 748 | // if( fileInfo.isExecutable() | |
747 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 749 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
748 | e << curFile; | 750 | e << curFile; |
749 | } else { | 751 | } else { |
750 | curFile = currentDir.canonicalPath()+"/"+curFile; | 752 | curFile = currentDir.canonicalPath()+"/"+curFile; |
751 | DocLnk nf(curFile); | 753 | DocLnk nf(curFile); |
752 | QString execStr = nf.exec(); | 754 | QString execStr = nf.exec(); |
753 | qDebug( execStr); | 755 | qDebug( execStr); |
754 | if( execStr.isEmpty() ) { | 756 | if( execStr.isEmpty() ) { |
755 | } else { | 757 | } else { |
756 | nf.execute(); | 758 | nf.execute(); |
757 | } | 759 | } |
758 | } | 760 | } |
759 | // MimeType mt( curFile); | 761 | // MimeType mt( curFile); |
760 | } else { | 762 | } else { |
761 | QString curFile = Remote_View->currentItem()->text(0); | 763 | QString curFile = Remote_View->currentItem()->text(0); |
762 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 764 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
763 | qDebug("Filesystemtype is "+fs); | 765 | qDebug("Filesystemtype is "+fs); |
764 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 766 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
765 | if( (fileInfo.permission( QFileInfo::ExeUser) | 767 | if( (fileInfo.permission( QFileInfo::ExeUser) |
766 | | fileInfo.permission( QFileInfo::ExeGroup) | 768 | | fileInfo.permission( QFileInfo::ExeGroup) |
767 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 769 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
768 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 770 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
769 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 771 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
770 | e << curFile; | 772 | e << curFile; |
771 | } else { | 773 | } else { |
772 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 774 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
773 | DocLnk nf(curFile); | 775 | DocLnk nf(curFile); |
774 | QString execStr = nf.exec(); | 776 | QString execStr = nf.exec(); |
775 | qDebug(execStr); | 777 | qDebug(execStr); |
776 | if( execStr.isEmpty() ) { | 778 | if( execStr.isEmpty() ) { |
777 | } else { | 779 | } else { |
778 | nf.execute(); | 780 | nf.execute(); |
779 | } | 781 | } |
780 | } | 782 | } |
781 | // MimeType mt( curFile); | 783 | // MimeType mt( curFile); |
782 | } | 784 | } |
783 | } | 785 | } |
784 | 786 | ||
785 | void AdvancedFm::runText() { | 787 | void AdvancedFm::runText() { |
786 | if (TabWidget->currentPageIndex() == 0) { | 788 | if (TabWidget->currentPageIndex() == 0) { |
787 | QString curFile = Local_View->currentItem()->text(0); | 789 | QString curFile = Local_View->currentItem()->text(0); |
788 | curFile = currentDir.canonicalPath()+"/"+curFile; | 790 | curFile = currentDir.canonicalPath()+"/"+curFile; |
789 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 791 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
790 | e << curFile; | 792 | e << curFile; |
791 | } else { | 793 | } else { |
792 | QString curFile = Remote_View->currentItem()->text(0); | 794 | QString curFile = Remote_View->currentItem()->text(0); |
793 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 795 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
794 | DocLnk nf(curFile); | 796 | DocLnk nf(curFile); |
795 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 797 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
796 | e << curFile; | 798 | e << curFile; |
797 | } | 799 | } |
798 | } | 800 | } |
799 | 801 | ||
800 | void AdvancedFm::localMakDir() | 802 | void AdvancedFm::localMakDir() |
801 | { | 803 | { |
802 | InputDialog *fileDlg; | 804 | InputDialog *fileDlg; |
803 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 805 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
804 | fileDlg->exec(); | 806 | fileDlg->exec(); |
805 | if( fileDlg->result() == 1 ) { | 807 | if( fileDlg->result() == 1 ) { |
806 | QString filename = fileDlg->LineEdit1->text(); | 808 | QString filename = fileDlg->LineEdit1->text(); |
807 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 809 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
808 | } | 810 | } |
809 | populateLocalView(); | 811 | populateLocalView(); |
810 | } | 812 | } |
811 | 813 | ||
812 | void AdvancedFm::remoteMakDir() | 814 | void AdvancedFm::remoteMakDir() |
813 | { | 815 | { |
814 | InputDialog *fileDlg; | 816 | InputDialog *fileDlg; |
815 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 817 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
816 | fileDlg->exec(); | 818 | fileDlg->exec(); |
817 | if( fileDlg->result() == 1 ) { | 819 | if( fileDlg->result() == 1 ) { |
818 | QString filename = fileDlg->LineEdit1->text(); | 820 | QString filename = fileDlg->LineEdit1->text(); |
819 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 821 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
820 | } | 822 | } |
821 | populateRemoteView(); | 823 | populateRemoteView(); |
822 | } | 824 | } |
823 | 825 | ||
824 | void AdvancedFm::localDelete() | 826 | void AdvancedFm::localDelete() |
825 | { | 827 | { |
826 | QStringList curFileList = getPath(); | 828 | QStringList curFileList = getPath(); |
827 | QString myFile; | 829 | QString myFile; |
828 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 830 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
829 | myFile = (*it); | 831 | myFile = (*it); |
830 | if( myFile.find(" -> ",0,TRUE) != -1) | 832 | if( myFile.find(" -> ",0,TRUE) != -1) |
831 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 833 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
832 | 834 | ||
833 | QString f = currentDir.canonicalPath(); | 835 | QString f = currentDir.canonicalPath(); |
834 | if(f.right(1).find("/",0,TRUE) == -1) | 836 | if(f.right(1).find("/",0,TRUE) == -1) |
835 | f+="/"; | 837 | f+="/"; |
836 | f+=myFile; | 838 | f+=myFile; |
837 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 839 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
838 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 840 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
839 | "\nand all it's contents ?" | 841 | "\nand all it's contents ?" |
840 | ,tr("Yes"),tr("No"),0,0,1) ) { | 842 | ,tr("Yes"),tr("No"),0,0,1) ) { |
841 | case 0: { | 843 | case 0: { |
842 | f=f.left(f.length()-1); | 844 | f=f.left(f.length()-1); |
843 | QString cmd="rm -rf "+f; | 845 | QString cmd="rm -rf "+f; |
844 | system( cmd.latin1()); | 846 | system( cmd.latin1()); |
845 | populateLocalView(); | 847 | populateLocalView(); |
846 | } | 848 | } |
847 | break; | 849 | break; |
848 | case 1: | 850 | case 1: |
849 | // exit | 851 | // exit |
850 | break; | 852 | break; |
851 | }; | 853 | }; |
852 | 854 | ||
853 | } else { | 855 | } else { |
854 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 856 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
855 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 857 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
856 | case 0: { | 858 | case 0: { |
857 | QString cmd="rm "+f; | 859 | QString cmd="rm "+f; |
858 | QFile file(f); | 860 | QFile file(f); |
859 | file.remove(); | 861 | file.remove(); |
860 | // system( cmd.latin1()); | 862 | // system( cmd.latin1()); |
861 | populateLocalView(); | 863 | populateLocalView(); |
862 | } | 864 | } |
863 | break; | 865 | break; |
864 | case 1: | 866 | case 1: |
865 | // exit | 867 | // exit |
866 | break; | 868 | break; |
867 | }; | 869 | }; |
868 | } | 870 | } |
869 | } | 871 | } |
870 | } | 872 | } |
871 | 873 | ||
872 | void AdvancedFm::remoteDelete() | 874 | void AdvancedFm::remoteDelete() |
873 | { | 875 | { |
874 | QStringList curFileList = getPath(); | 876 | QStringList curFileList = getPath(); |
875 | QString myFile; | 877 | QString myFile; |
876 | 878 | ||
877 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 879 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
878 | myFile = (*it); | 880 | myFile = (*it); |
879 | if(myFile.find(" -> ",0,TRUE) != -1) | 881 | if(myFile.find(" -> ",0,TRUE) != -1) |
880 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 882 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
881 | QString f = currentRemoteDir.canonicalPath(); | 883 | QString f = currentRemoteDir.canonicalPath(); |
882 | if(f.right(1).find("/",0,TRUE) == -1) | 884 | if(f.right(1).find("/",0,TRUE) == -1) |
883 | f+="/"; | 885 | f+="/"; |
884 | f+=myFile; | 886 | f+=myFile; |
885 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 887 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
886 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 888 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
887 | "\nand all it's contents ?", | 889 | "\nand all it's contents ?", |
888 | tr("Yes"),tr("No"),0,0,1) ) { | 890 | tr("Yes"),tr("No"),0,0,1) ) { |
889 | case 0: { | 891 | case 0: { |
890 | f=f.left(f.length()-1); | 892 | f=f.left(f.length()-1); |
891 | QString cmd="rm -rf "+f; | 893 | QString cmd="rm -rf "+f; |
892 | system( cmd.latin1()); | 894 | system( cmd.latin1()); |
893 | populateRemoteView(); | 895 | populateRemoteView(); |
894 | } | 896 | } |
895 | break; | 897 | break; |
896 | case 1: | 898 | case 1: |
897 | // exit | 899 | // exit |
898 | break; | 900 | break; |
899 | }; | 901 | }; |
900 | 902 | ||
901 | } else { | 903 | } else { |
902 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 904 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
903 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 905 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
904 | case 0: { | 906 | case 0: { |
905 | QString cmd="rm "+f; | 907 | QString cmd="rm "+f; |
906 | QFile file(f); | 908 | QFile file(f); |
907 | file.remove(); | 909 | file.remove(); |
908 | // system( cmd.latin1()); | 910 | // system( cmd.latin1()); |
909 | populateRemoteView(); | 911 | populateRemoteView(); |
910 | } | 912 | } |
911 | break; | 913 | break; |
912 | case 1: | 914 | case 1: |
913 | // exit | 915 | // exit |
914 | break; | 916 | break; |
915 | }; | 917 | }; |
916 | } | 918 | } |
917 | } | 919 | } |
918 | } | 920 | } |
919 | 921 | ||
920 | void AdvancedFm::localRename() | 922 | void AdvancedFm::localRename() |
921 | { | 923 | { |
922 | QString curFile = Local_View->currentItem()->text(0); | 924 | QString curFile = Local_View->currentItem()->text(0); |
923 | InputDialog *fileDlg; | 925 | InputDialog *fileDlg; |
924 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 926 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
925 | fileDlg->setInputText((const QString &)curFile); | 927 | fileDlg->setInputText((const QString &)curFile); |
926 | fileDlg->exec(); | 928 | fileDlg->exec(); |
927 | if( fileDlg->result() == 1 ) { | 929 | if( fileDlg->result() == 1 ) { |
928 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 930 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
929 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 931 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
930 | if( rename(oldname.latin1(), newName.latin1())== -1) | 932 | if( rename(oldname.latin1(), newName.latin1())== -1) |
931 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 933 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
932 | } | 934 | } |
933 | populateLocalView(); | 935 | populateLocalView(); |
934 | } | 936 | } |
935 | 937 | ||
936 | void AdvancedFm::remoteRename() | 938 | void AdvancedFm::remoteRename() |
937 | { | 939 | { |
938 | QString curFile = Local_View->currentItem()->text(0); | 940 | QString curFile = Local_View->currentItem()->text(0); |
939 | InputDialog *fileDlg; | 941 | InputDialog *fileDlg; |
940 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 942 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
941 | fileDlg->setInputText((const QString &)curFile); | 943 | fileDlg->setInputText((const QString &)curFile); |
942 | fileDlg->exec(); | 944 | fileDlg->exec(); |
943 | if( fileDlg->result() == 1 ) { | 945 | if( fileDlg->result() == 1 ) { |
944 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 946 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
945 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 947 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
946 | if( rename(oldname.latin1(), newName.latin1())== -1) | 948 | if( rename(oldname.latin1(), newName.latin1())== -1) |
947 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 949 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
948 | } | 950 | } |
949 | populateRemoteView(); | 951 | populateRemoteView(); |
950 | } | 952 | } |
951 | 953 | ||
952 | void AdvancedFm::switchToLocalTab() | 954 | void AdvancedFm::switchToLocalTab() |
953 | { | 955 | { |
954 | TabWidget->setCurrentPage(0); | 956 | TabWidget->setCurrentPage(0); |
955 | Local_View->setFocus(); | 957 | Local_View->setFocus(); |
956 | } | 958 | } |
957 | 959 | ||
958 | void AdvancedFm::switchToRemoteTab() | 960 | void AdvancedFm::switchToRemoteTab() |
959 | { | 961 | { |
960 | TabWidget->setCurrentPage(1); | 962 | TabWidget->setCurrentPage(1); |
961 | Remote_View->setFocus(); | 963 | Remote_View->setFocus(); |
962 | } | 964 | } |
963 | 965 | ||
964 | void AdvancedFm::readConfig() | 966 | void AdvancedFm::readConfig() |
965 | { | 967 | { |
966 | Config cfg("AdvancedFm"); | 968 | Config cfg("AdvancedFm"); |
967 | } | 969 | } |
968 | 970 | ||
969 | void AdvancedFm::writeConfig() | 971 | void AdvancedFm::writeConfig() |
970 | { | 972 | { |
971 | Config cfg("AdvancedFm"); | 973 | Config cfg("AdvancedFm"); |
972 | } | 974 | } |
973 | 975 | ||
974 | void AdvancedFm::currentPathComboChanged() | 976 | void AdvancedFm::currentPathComboChanged() |
975 | { | 977 | { |
976 | if (TabWidget->currentPageIndex() == 0) { | 978 | if (TabWidget->currentPageIndex() == 0) { |
977 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 979 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
978 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 980 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
979 | populateLocalView(); | 981 | populateLocalView(); |
980 | } else { | 982 | } else { |
981 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 983 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
982 | } | 984 | } |
983 | } | 985 | } |
984 | if (TabWidget->currentPageIndex() == 0) { | 986 | if (TabWidget->currentPageIndex() == 0) { |
985 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 987 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
986 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 988 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
987 | populateRemoteView(); | 989 | populateRemoteView(); |
988 | } else { | 990 | } else { |
989 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 991 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
990 | } | 992 | } |
991 | } | 993 | } |
992 | } | 994 | } |
993 | 995 | ||
994 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 996 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
995 | 997 | ||
996 | if (TabWidget->currentPageIndex() == 0) { | 998 | if (TabWidget->currentPageIndex() == 0) { |
997 | currentPathCombo->lineEdit()->setText( currentPath); | 999 | currentPathCombo->lineEdit()->setText( currentPath); |
998 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1000 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
999 | currentPathCombo->clear(); | 1001 | currentPathCombo->clear(); |
1000 | localDirPathStringList.prepend( currentPath ); | 1002 | localDirPathStringList.prepend( currentPath ); |
1001 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 1003 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
1002 | } | 1004 | } |
1003 | } else { | 1005 | } else { |
1004 | currentPathCombo->lineEdit()->setText( currentPath); | 1006 | currentPathCombo->lineEdit()->setText( currentPath); |
1005 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 1007 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
1006 | currentPathCombo->clear(); | 1008 | currentPathCombo->clear(); |
1007 | remoteDirPathStringList.prepend( currentPath ); | 1009 | remoteDirPathStringList.prepend( currentPath ); |
1008 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1010 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1009 | } | 1011 | } |
1010 | } | 1012 | } |
1011 | } | 1013 | } |
1012 | 1014 | ||
1013 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 1015 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
1014 | if (TabWidget->currentPageIndex() == 0) { | 1016 | if (TabWidget->currentPageIndex() == 0) { |
1015 | chdir( currentPath.latin1() ); | 1017 | chdir( currentPath.latin1() ); |
1016 | currentDir.cd( currentPath, TRUE); | 1018 | currentDir.cd( currentPath, TRUE); |
1017 | populateLocalView(); | 1019 | populateLocalView(); |
1018 | update(); | 1020 | update(); |
1019 | } else { | 1021 | } else { |
1020 | chdir( currentPath.latin1() ); | 1022 | chdir( currentPath.latin1() ); |
1021 | currentRemoteDir.cd( currentPath, TRUE); | 1023 | currentRemoteDir.cd( currentPath, TRUE); |
1022 | populateRemoteView(); | 1024 | populateRemoteView(); |
1023 | update(); | 1025 | update(); |
1024 | } | 1026 | } |
1025 | } | 1027 | } |
1026 | 1028 | ||
1027 | void AdvancedFm::filePerms() { | 1029 | void AdvancedFm::filePerms() { |
1028 | 1030 | ||
1029 | QStringList curFileList = getPath(); | 1031 | QStringList curFileList = getPath(); |
1030 | QString filePath; | 1032 | QString filePath; |
1031 | 1033 | ||
1032 | if (TabWidget->currentPageIndex() == 0) { | 1034 | if (TabWidget->currentPageIndex() == 0) { |
1033 | filePath = currentDir.canonicalPath()+"/"; | 1035 | filePath = currentDir.canonicalPath()+"/"; |
1034 | } else { | 1036 | } else { |
1035 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1037 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1036 | } | 1038 | } |
1037 | 1039 | ||
1038 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1040 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1039 | filePermissions *filePerm; | 1041 | filePermissions *filePerm; |
1040 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 1042 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
1041 | filePerm->showMaximized(); | 1043 | filePerm->showMaximized(); |
1042 | filePerm->exec(); | 1044 | filePerm->exec(); |
1043 | if( filePerm) | 1045 | if( filePerm) |
1044 | delete filePerm; | 1046 | delete filePerm; |
1045 | } | 1047 | } |
1046 | if (TabWidget->currentPageIndex() == 0) { | 1048 | if (TabWidget->currentPageIndex() == 0) { |
1047 | populateLocalView(); | 1049 | populateLocalView(); |
1048 | } else { | 1050 | } else { |
1049 | populateRemoteView(); | 1051 | populateRemoteView(); |
1050 | } | 1052 | } |
1051 | 1053 | ||
1052 | 1054 | ||
1053 | } | 1055 | } |
1054 | 1056 | ||
1055 | void AdvancedFm::doProperties() { | 1057 | void AdvancedFm::doProperties() { |
1056 | QStringList curFileList = getPath(); | 1058 | QStringList curFileList = getPath(); |
1057 | QString filePath; | 1059 | QString filePath; |
1058 | if (TabWidget->currentPageIndex() == 0) { | 1060 | if (TabWidget->currentPageIndex() == 0) { |
1061 | |||
1059 | filePath = currentDir.canonicalPath()+"/"; | 1062 | filePath = currentDir.canonicalPath()+"/"; |
1060 | } else { | 1063 | } else { |
1061 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1064 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1062 | } | 1065 | } |
1066 | // qDebug("%d",curFileList.count()); | ||
1063 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1067 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1068 | qDebug((filePath+*it)); | ||
1064 | DocLnk lnk( (filePath+*it)); | 1069 | DocLnk lnk( (filePath+*it)); |
1065 | LnkProperties prop( &lnk ); | 1070 | LnkProperties prop( &lnk ); |
1066 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 1071 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
1067 | prop.showMaximized(); | 1072 | prop.showMaximized(); |
1068 | prop.exec(); | 1073 | prop.exec(); |
1069 | } | 1074 | } |
1070 | } | 1075 | } |
1071 | 1076 | ||
1072 | QStringList AdvancedFm::getPath() { | 1077 | QStringList AdvancedFm::getPath() { |
1073 | QStringList strList; | 1078 | QStringList strList; |
1074 | if (TabWidget->currentPageIndex() == 0) { | 1079 | if (TabWidget->currentPageIndex() == 0) { |
1075 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1080 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1076 | QListViewItemIterator it( Local_View ); | 1081 | QListViewItemIterator it( Local_View ); |
1077 | for ( ; it.current(); ++it ) { | 1082 | for ( ; it.current(); ++it ) { |
1078 | if ( it.current()->isSelected() ) { | 1083 | if ( it.current()->isSelected() ) { |
1079 | strList << it.current()->text(0); | 1084 | strList << it.current()->text(0); |
1080 | } | 1085 | } |
1081 | } | 1086 | } |
1082 | return strList; | 1087 | return strList; |
1083 | } else { | 1088 | } else { |
1084 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1089 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1085 | QListViewItemIterator it( Remote_View ); | 1090 | QListViewItemIterator it( Remote_View ); |
1086 | for ( ; it.current(); ++it ) { | 1091 | for ( ; it.current(); ++it ) { |
1087 | if ( it.current()->isSelected() ) { | 1092 | if ( it.current()->isSelected() ) { |
1088 | strList << it.current()->text(0); | 1093 | strList << it.current()->text(0); |
1089 | } | 1094 | } |
1090 | } | 1095 | } |
1091 | return strList; | 1096 | return strList; |
1092 | } | 1097 | } |
1093 | return ""; | 1098 | return ""; |
1094 | } | 1099 | } |
1095 | 1100 | ||
1096 | void AdvancedFm::homeButtonPushed() { | 1101 | void AdvancedFm::homeButtonPushed() { |
1097 | QString current = QDir::homeDirPath(); | 1102 | QString current = QDir::homeDirPath(); |
1098 | chdir( current.latin1() ); | 1103 | chdir( current.latin1() ); |
1099 | if (TabWidget->currentPageIndex() == 0) { | 1104 | if (TabWidget->currentPageIndex() == 0) { |
1100 | currentDir.cd( current, TRUE); | 1105 | currentDir.cd( current, TRUE); |
1101 | populateLocalView(); | 1106 | populateLocalView(); |
1102 | } else { | 1107 | } else { |
1103 | currentRemoteDir.cd( current, TRUE); | 1108 | currentRemoteDir.cd( current, TRUE); |
1104 | populateRemoteView(); | 1109 | populateRemoteView(); |
1105 | } | 1110 | } |
1106 | update(); | 1111 | update(); |
1107 | } | 1112 | } |
1108 | 1113 | ||
1109 | void AdvancedFm::docButtonPushed() { | 1114 | void AdvancedFm::docButtonPushed() { |
1110 | QString current = QPEApplication::documentDir(); | 1115 | QString current = QPEApplication::documentDir(); |
1111 | chdir( current.latin1() ); | 1116 | chdir( current.latin1() ); |
1112 | if (TabWidget->currentPageIndex() == 0) { | 1117 | if (TabWidget->currentPageIndex() == 0) { |
1113 | currentDir.cd( current, TRUE); | 1118 | currentDir.cd( current, TRUE); |
1114 | populateLocalView(); | 1119 | populateLocalView(); |
1115 | } else { | 1120 | } else { |
1116 | currentRemoteDir.cd( current, TRUE); | 1121 | currentRemoteDir.cd( current, TRUE); |
1117 | populateRemoteView(); | 1122 | populateRemoteView(); |
1118 | } | 1123 | } |
1119 | update(); | 1124 | update(); |
1120 | } | 1125 | } |
1121 | 1126 | ||
1122 | void AdvancedFm::SDButtonPushed() { | 1127 | void AdvancedFm::SDButtonPushed() { |
1123 | QString current = "/mnt/card"; | 1128 | QString current = "/mnt/card"; |
1124 | chdir( current.latin1() ); | 1129 | chdir( current.latin1() ); |
1125 | if (TabWidget->currentPageIndex() == 0) { | 1130 | if (TabWidget->currentPageIndex() == 0) { |
1126 | currentDir.cd( current, TRUE); | 1131 | currentDir.cd( current, TRUE); |
1127 | populateLocalView(); | 1132 | populateLocalView(); |
1128 | } else { | 1133 | } else { |
1129 | currentRemoteDir.cd( current, TRUE); | 1134 | currentRemoteDir.cd( current, TRUE); |
1130 | populateRemoteView(); | 1135 | populateRemoteView(); |
1131 | } | 1136 | } |
1132 | update(); | 1137 | update(); |
1133 | 1138 | ||
1134 | } | 1139 | } |
1135 | 1140 | ||
1136 | void AdvancedFm::CFButtonPushed() { | 1141 | void AdvancedFm::CFButtonPushed() { |
1137 | QString current = "/mnt/cf"; | 1142 | QString current = "/mnt/cf"; |
1138 | chdir( current.latin1() ); | 1143 | chdir( current.latin1() ); |
1139 | if (TabWidget->currentPageIndex() == 0) { | 1144 | if (TabWidget->currentPageIndex() == 0) { |
1140 | currentDir.cd( current, TRUE); | 1145 | currentDir.cd( current, TRUE); |
1141 | populateLocalView(); | 1146 | populateLocalView(); |
1142 | } else { | 1147 | } else { |
1143 | currentRemoteDir.cd( current, TRUE); | 1148 | currentRemoteDir.cd( current, TRUE); |
1144 | populateRemoteView(); | 1149 | populateRemoteView(); |
1145 | } | 1150 | } |
1146 | update(); | 1151 | update(); |
1147 | 1152 | ||
1148 | } | 1153 | } |
1149 | 1154 | ||
1150 | 1155 | ||
1151 | void AdvancedFm::upDir() | 1156 | void AdvancedFm::upDir() |
1152 | { | 1157 | { |
1153 | if (TabWidget->currentPageIndex() == 0) { | 1158 | if (TabWidget->currentPageIndex() == 0) { |
1154 | QString current = currentDir.canonicalPath(); | 1159 | QString current = currentDir.canonicalPath(); |
1155 | QDir dir(current); | 1160 | QDir dir(current); |
1156 | dir.cdUp(); | 1161 | dir.cdUp(); |
1157 | current = dir.canonicalPath(); | 1162 | current = dir.canonicalPath(); |
1158 | chdir( current.latin1() ); | 1163 | chdir( current.latin1() ); |
1159 | currentDir.cd( current, TRUE); | 1164 | currentDir.cd( current, TRUE); |
1160 | populateLocalView(); | 1165 | populateLocalView(); |
1161 | update(); | 1166 | update(); |
1162 | } else { | 1167 | } else { |
1163 | QString current = currentRemoteDir.canonicalPath(); | 1168 | QString current = currentRemoteDir.canonicalPath(); |
1164 | QDir dir(current); | 1169 | QDir dir(current); |
1165 | dir.cdUp(); | 1170 | dir.cdUp(); |
1166 | current = dir.canonicalPath(); | 1171 | current = dir.canonicalPath(); |
1167 | chdir( current.latin1() ); | 1172 | chdir( current.latin1() ); |
1168 | currentRemoteDir.cd( current, TRUE); | 1173 | currentRemoteDir.cd( current, TRUE); |
1169 | populateRemoteView(); | 1174 | populateRemoteView(); |
1170 | update(); | 1175 | update(); |
1171 | } | 1176 | } |
1172 | } | 1177 | } |
1173 | 1178 | ||
1174 | void AdvancedFm::copy() | 1179 | void AdvancedFm::copy() |
1175 | { | 1180 | { |
1176 | QStringList curFileList = getPath(); | 1181 | QStringList curFileList = getPath(); |
1177 | QString curFile; | 1182 | QString curFile; |
1178 | if (TabWidget->currentPageIndex() == 0) { | 1183 | if (TabWidget->currentPageIndex() == 0) { |
1179 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1184 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1180 | 1185 | ||
1181 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1186 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1182 | // if(destFile.right(1).find("/",0,TRUE) == -1) | 1187 | // if(destFile.right(1).find("/",0,TRUE) == -1) |
1183 | // destFile+="/"; | 1188 | // destFile+="/"; |
1184 | // destFile +=(*it); | 1189 | // destFile +=(*it); |
1185 | 1190 | ||
1186 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1191 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1187 | // if(curFile.right(1).find("/",0,TRUE) == -1) | 1192 | // if(curFile.right(1).find("/",0,TRUE) == -1) |
1188 | // curFile +="/"; | 1193 | // curFile +="/"; |
1189 | // curFile +=(*it); | 1194 | // curFile +=(*it); |
1190 | 1195 | ||
1191 | QFile f(destFile); | 1196 | QFile f(destFile); |
1192 | if( f.exists()) | 1197 | if( f.exists()) |
1193 | f.remove(); | 1198 | f.remove(); |
1194 | if(!copyFile(destFile, curFile) ) { | 1199 | if(!copyFile(destFile, curFile) ) { |
1195 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1200 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1196 | qWarning("nothin doing"); | 1201 | qWarning("nothin doing"); |
1197 | } | 1202 | } |
1198 | } | 1203 | } |
1199 | populateRemoteView(); | 1204 | populateRemoteView(); |
1200 | TabWidget->setCurrentPage(1); | 1205 | TabWidget->setCurrentPage(1); |
1201 | 1206 | ||
1202 | } else { | 1207 | } else { |
1203 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1208 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1204 | 1209 | ||
1205 | QString destFile = currentDir.canonicalPath()+"/"+(*it); | 1210 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1206 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1211 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1207 | 1212 | ||
1208 | QFile f(destFile); | 1213 | QFile f(destFile); |
1209 | if( f.exists()) | 1214 | if( f.exists()) |
1210 | f.remove(); | 1215 | f.remove(); |
1211 | if(!copyFile(destFile, curFile) ) { | 1216 | if(!copyFile(destFile, curFile) ) { |
1212 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1217 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1213 | 1218 | ||
1214 | qWarning("nothin doing"); | 1219 | qWarning("nothin doing"); |
1215 | } | 1220 | } |
1216 | } | 1221 | } |
1217 | populateLocalView(); | 1222 | populateLocalView(); |
1218 | TabWidget->setCurrentPage(0); | 1223 | TabWidget->setCurrentPage(0); |
1219 | } | 1224 | } |
1220 | } | 1225 | } |
1221 | 1226 | ||
1222 | void AdvancedFm::copyAs() | 1227 | void AdvancedFm::copyAs() |
1223 | { | 1228 | { |
1224 | QStringList curFileList = getPath(); | 1229 | QStringList curFileList = getPath(); |
1225 | QString curFile; | 1230 | QString curFile; |
1226 | InputDialog *fileDlg; | 1231 | InputDialog *fileDlg; |
1227 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1232 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1228 | 1233 | ||
1229 | if (TabWidget->currentPageIndex() == 0) { | 1234 | if (TabWidget->currentPageIndex() == 0) { |
1230 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1235 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1231 | QString destFile; | 1236 | QString destFile; |
1232 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1237 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1233 | // InputDialog *fileDlg; | 1238 | // InputDialog *fileDlg; |
1234 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1239 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1235 | fileDlg->setInputText((const QString &) destFile ); | 1240 | fileDlg->setInputText((const QString &) destFile ); |
1236 | fileDlg->exec(); | 1241 | fileDlg->exec(); |
1237 | if( fileDlg->result() == 1 ) { | 1242 | if( fileDlg->result() == 1 ) { |
1238 | QString filename = fileDlg->LineEdit1->text(); | 1243 | QString filename = fileDlg->LineEdit1->text(); |
1239 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1244 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1240 | 1245 | ||
1241 | QFile f(destFile); | 1246 | QFile f(destFile); |
1242 | if( f.exists()) | 1247 | if( f.exists()) |
1243 | f.remove(); | 1248 | f.remove(); |
1244 | if(!copyFile(destFile, curFile) ) { | 1249 | if(!copyFile(destFile, curFile) ) { |
1245 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1250 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1246 | qWarning("nothin doing"); | 1251 | qWarning("nothin doing"); |
1247 | } | 1252 | } |
1248 | } | 1253 | } |
1249 | } | 1254 | } |
1250 | 1255 | ||
1251 | populateRemoteView(); | 1256 | populateRemoteView(); |
1252 | TabWidget->setCurrentPage(1); | 1257 | TabWidget->setCurrentPage(1); |
1253 | } else { | 1258 | } else { |
1254 | if (TabWidget->currentPageIndex() == 0) { | 1259 | if (TabWidget->currentPageIndex() == 0) { |
1255 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1260 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |