author | llornkcor <llornkcor> | 2002-05-02 02:09:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-02 02:09:49 (UTC) |
commit | 6dfc6f34420b8c9222d1c785efc950fc5031a7f0 (patch) (unidiff) | |
tree | a144e5e4c2be3e57d0939090ee5a39982f17804d | |
parent | 45ba3b844e3fb8d9b9e1936ad2abec869d25dd33 (diff) | |
download | opie-6dfc6f34420b8c9222d1c785efc950fc5031a7f0.zip opie-6dfc6f34420b8c9222d1c785efc950fc5031a7f0.tar.gz opie-6dfc6f34420b8c9222d1c785efc950fc5031a7f0.tar.bz2 |
damned QFileInfo::isExecutable bug...
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index e3ab76b..7cd8644 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -541,404 +541,411 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem) | |||
541 | } | 541 | } |
542 | 542 | ||
543 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 543 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
544 | { | 544 | { |
545 | if(selectedItem) { | 545 | if(selectedItem) { |
546 | QString strItem=selectedItem->text(0); | 546 | QString strItem=selectedItem->text(0); |
547 | QString strSize=selectedItem->text(1); | 547 | QString strSize=selectedItem->text(1); |
548 | strSize=strSize.stripWhiteSpace(); | 548 | strSize=strSize.stripWhiteSpace(); |
549 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 549 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
550 | // is symlink | 550 | // is symlink |
551 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 551 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
552 | if(QDir(strItem2).exists() ) { | 552 | if(QDir(strItem2).exists() ) { |
553 | currentRemoteDir.cd(strItem2, TRUE); | 553 | currentRemoteDir.cd(strItem2, TRUE); |
554 | populateRemoteView(); | 554 | populateRemoteView(); |
555 | } | 555 | } |
556 | } else { // not a symlink | 556 | } else { // not a symlink |
557 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 557 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
558 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 558 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
559 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 559 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
560 | currentRemoteDir.cd(strItem,FALSE); | 560 | currentRemoteDir.cd(strItem,FALSE); |
561 | populateRemoteView(); | 561 | populateRemoteView(); |
562 | } else { | 562 | } else { |
563 | currentRemoteDir.cdUp(); | 563 | currentRemoteDir.cdUp(); |
564 | populateRemoteView(); | 564 | populateRemoteView(); |
565 | } | 565 | } |
566 | if(QDir(strItem).exists()){ | 566 | if(QDir(strItem).exists()){ |
567 | currentRemoteDir.cd(strItem, TRUE); | 567 | currentRemoteDir.cd(strItem, TRUE); |
568 | populateRemoteView(); | 568 | populateRemoteView(); |
569 | } | 569 | } |
570 | } else { | 570 | } else { |
571 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 571 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
572 | if( QFile::exists(strItem ) ) { | 572 | if( QFile::exists(strItem ) ) { |
573 | // qDebug("upload "+strItem); | 573 | // qDebug("upload "+strItem); |
574 | } | 574 | } |
575 | } //end not symlink | 575 | } //end not symlink |
576 | chdir(strItem.latin1()); | 576 | chdir(strItem.latin1()); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | } | 579 | } |
580 | 580 | ||
581 | void AdvancedFm::doLocalCd() | 581 | void AdvancedFm::doLocalCd() |
582 | { | 582 | { |
583 | localListClicked( Local_View->currentItem()); | 583 | localListClicked( Local_View->currentItem()); |
584 | } | 584 | } |
585 | 585 | ||
586 | void AdvancedFm::doRemoteCd() | 586 | void AdvancedFm::doRemoteCd() |
587 | { | 587 | { |
588 | localListClicked( Remote_View->currentItem()); | 588 | localListClicked( Remote_View->currentItem()); |
589 | } | 589 | } |
590 | 590 | ||
591 | void AdvancedFm::showHidden() | 591 | void AdvancedFm::showHidden() |
592 | { | 592 | { |
593 | if (b) { | 593 | if (b) { |
594 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 594 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
595 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 595 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
596 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 596 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
597 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 597 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
598 | b=FALSE; | 598 | b=FALSE; |
599 | 599 | ||
600 | } else { | 600 | } else { |
601 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 601 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
602 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 602 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
603 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 603 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
604 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 604 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
605 | b=TRUE; | 605 | b=TRUE; |
606 | } | 606 | } |
607 | populateLocalView(); | 607 | populateLocalView(); |
608 | 608 | ||
609 | } | 609 | } |
610 | 610 | ||
611 | void AdvancedFm::showRemoteHidden() | 611 | void AdvancedFm::showRemoteHidden() |
612 | { | 612 | { |
613 | if (b) { | 613 | if (b) { |
614 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 614 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
615 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 615 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
616 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 616 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
617 | b=TRUE; | 617 | b=TRUE; |
618 | 618 | ||
619 | } else { | 619 | } else { |
620 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 620 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
621 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 621 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
622 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 622 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
623 | b=FALSE; | 623 | b=FALSE; |
624 | } | 624 | } |
625 | populateRemoteView(); | 625 | populateRemoteView(); |
626 | } | 626 | } |
627 | 627 | ||
628 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 628 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
629 | { | 629 | { |
630 | switch (mouse) { | 630 | switch (mouse) { |
631 | case 1: | 631 | case 1: |
632 | break; | 632 | break; |
633 | case 2: | 633 | case 2: |
634 | showLocalMenu(item); | 634 | showLocalMenu(item); |
635 | Local_View->clearSelection(); | 635 | Local_View->clearSelection(); |
636 | break; | 636 | break; |
637 | }; | 637 | }; |
638 | } | 638 | } |
639 | 639 | ||
640 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 640 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
641 | { | 641 | { |
642 | switch (mouse) { | 642 | switch (mouse) { |
643 | case 1: | 643 | case 1: |
644 | break; | 644 | break; |
645 | case 2: | 645 | case 2: |
646 | showRemoteMenu(item); | 646 | showRemoteMenu(item); |
647 | Remote_View->clearSelection(); | 647 | Remote_View->clearSelection(); |
648 | break; | 648 | break; |
649 | }; | 649 | }; |
650 | } | 650 | } |
651 | 651 | ||
652 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 652 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
653 | { | 653 | { |
654 | if(item) { | 654 | if(item) { |
655 | QPopupMenu m; | 655 | QPopupMenu m; |
656 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 656 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
657 | m.insertSeparator(); | 657 | m.insertSeparator(); |
658 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 658 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
659 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 659 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
660 | else | 660 | else |
661 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 661 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
662 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 662 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
663 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 663 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
664 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 664 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
665 | m.insertSeparator(); | 665 | m.insertSeparator(); |
666 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 666 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
667 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 667 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
668 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 668 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
669 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 669 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
670 | m.insertSeparator(); | 670 | m.insertSeparator(); |
671 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 671 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
672 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 672 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
673 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 673 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
674 | m.insertSeparator(); | 674 | m.insertSeparator(); |
675 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 675 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
676 | m.insertSeparator(); | 676 | m.insertSeparator(); |
677 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 677 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
678 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 678 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
679 | m.setCheckable(TRUE); | 679 | m.setCheckable(TRUE); |
680 | if (!b) | 680 | if (!b) |
681 | m.setItemChecked(m.idAt(0),TRUE); | 681 | m.setItemChecked(m.idAt(0),TRUE); |
682 | else | 682 | else |
683 | m.setItemChecked(m.idAt(0),FALSE); | 683 | m.setItemChecked(m.idAt(0),FALSE); |
684 | m.exec( QCursor::pos() ); | 684 | m.exec( QCursor::pos() ); |
685 | } | 685 | } |
686 | } | 686 | } |
687 | 687 | ||
688 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 688 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
689 | { | 689 | { |
690 | if(item) { | 690 | if(item) { |
691 | QPopupMenu m; | 691 | QPopupMenu m; |
692 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 692 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
693 | m.insertSeparator(); | 693 | m.insertSeparator(); |
694 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 694 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
695 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 695 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
696 | else | 696 | else |
697 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 697 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
698 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 698 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
699 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 699 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
700 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 700 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
701 | m.insertSeparator(); | 701 | m.insertSeparator(); |
702 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 702 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
703 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 703 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
704 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 704 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
705 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 705 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
706 | m.insertSeparator(); | 706 | m.insertSeparator(); |
707 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 707 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
708 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 708 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
709 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 709 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
710 | m.insertSeparator(); | 710 | m.insertSeparator(); |
711 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 711 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
712 | m.insertSeparator(); | 712 | m.insertSeparator(); |
713 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 713 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
714 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 714 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
715 | m.setCheckable(TRUE); | 715 | m.setCheckable(TRUE); |
716 | if (!b) | 716 | if (!b) |
717 | m.setItemChecked(m.idAt(0),TRUE); | 717 | m.setItemChecked(m.idAt(0),TRUE); |
718 | else | 718 | else |
719 | m.setItemChecked(m.idAt(0),FALSE); | 719 | m.setItemChecked(m.idAt(0),FALSE); |
720 | m.exec( QCursor::pos() ); | 720 | m.exec( QCursor::pos() ); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | 723 | ||
724 | void AdvancedFm::runThis() { | 724 | void AdvancedFm::runThis() { |
725 | // QFileInfo *fi; | 725 | // QFileInfo *fi; |
726 | QString fs; | 726 | QString fs; |
727 | if (TabWidget->currentPageIndex() == 0) { | 727 | if (TabWidget->currentPageIndex() == 0) { |
728 | QString curFile = Local_View->currentItem()->text(0); | 728 | QString curFile = Local_View->currentItem()->text(0); |
729 | 729 | ||
730 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 730 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
731 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 731 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
732 | qDebug( fileInfo.owner()); | 732 | qDebug( fileInfo.owner()); |
733 | if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 733 | if( (fileInfo.permission( QFileInfo::ExeUser) |
734 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 734 | | fileInfo.permission( QFileInfo::ExeGroup) |
735 | e << curFile; | 735 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
736 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | ||
737 | // if( fileInfo.isExecutable() | | ||
738 | QCopEnvelope e("QPE/System", "execute(QString)" ); | ||
739 | e << curFile; | ||
736 | } else { | 740 | } else { |
737 | curFile = currentDir.canonicalPath()+"/"+curFile; | 741 | curFile = currentDir.canonicalPath()+"/"+curFile; |
738 | DocLnk nf(curFile); | 742 | DocLnk nf(curFile); |
739 | QString execStr = nf.exec(); | 743 | QString execStr = nf.exec(); |
740 | qDebug( execStr); | 744 | qDebug( execStr); |
741 | if( execStr.isEmpty() ) { | 745 | if( execStr.isEmpty() ) { |
742 | } else { | 746 | } else { |
743 | nf.execute(); | 747 | nf.execute(); |
744 | } | 748 | } |
745 | } | 749 | } |
746 | // MimeType mt( curFile); | 750 | // MimeType mt( curFile); |
747 | } else { | 751 | } else { |
748 | QString curFile = Remote_View->currentItem()->text(0); | 752 | QString curFile = Remote_View->currentItem()->text(0); |
749 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 753 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
750 | qDebug("Filesystemtype is "+fs); | 754 | qDebug("Filesystemtype is "+fs); |
751 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 755 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
752 | if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 756 | if( (fileInfo.permission( QFileInfo::ExeUser) |
757 | | fileInfo.permission( QFileInfo::ExeGroup) | ||
758 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | ||
759 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | ||
753 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 760 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
754 | e << curFile; | 761 | e << curFile; |
755 | } else { | 762 | } else { |
756 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 763 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
757 | DocLnk nf(curFile); | 764 | DocLnk nf(curFile); |
758 | QString execStr = nf.exec(); | 765 | QString execStr = nf.exec(); |
759 | qDebug(execStr); | 766 | qDebug(execStr); |
760 | if( execStr.isEmpty() ) { | 767 | if( execStr.isEmpty() ) { |
761 | } else { | 768 | } else { |
762 | nf.execute(); | 769 | nf.execute(); |
763 | } | 770 | } |
764 | } | 771 | } |
765 | // MimeType mt( curFile); | 772 | // MimeType mt( curFile); |
766 | } | 773 | } |
767 | } | 774 | } |
768 | 775 | ||
769 | void AdvancedFm::runText() { | 776 | void AdvancedFm::runText() { |
770 | if (TabWidget->currentPageIndex() == 0) { | 777 | if (TabWidget->currentPageIndex() == 0) { |
771 | QString curFile = Local_View->currentItem()->text(0); | 778 | QString curFile = Local_View->currentItem()->text(0); |
772 | curFile = currentDir.canonicalPath()+"/"+curFile; | 779 | curFile = currentDir.canonicalPath()+"/"+curFile; |
773 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 780 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
774 | e << curFile; | 781 | e << curFile; |
775 | } else { | 782 | } else { |
776 | QString curFile = Remote_View->currentItem()->text(0); | 783 | QString curFile = Remote_View->currentItem()->text(0); |
777 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 784 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
778 | DocLnk nf(curFile); | 785 | DocLnk nf(curFile); |
779 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 786 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
780 | e << curFile; | 787 | e << curFile; |
781 | } | 788 | } |
782 | } | 789 | } |
783 | 790 | ||
784 | void AdvancedFm::localMakDir() | 791 | void AdvancedFm::localMakDir() |
785 | { | 792 | { |
786 | InputDialog *fileDlg; | 793 | InputDialog *fileDlg; |
787 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 794 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
788 | fileDlg->exec(); | 795 | fileDlg->exec(); |
789 | if( fileDlg->result() == 1 ) { | 796 | if( fileDlg->result() == 1 ) { |
790 | QString filename = fileDlg->LineEdit1->text(); | 797 | QString filename = fileDlg->LineEdit1->text(); |
791 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 798 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
792 | } | 799 | } |
793 | populateLocalView(); | 800 | populateLocalView(); |
794 | } | 801 | } |
795 | 802 | ||
796 | void AdvancedFm::remoteMakDir() | 803 | void AdvancedFm::remoteMakDir() |
797 | { | 804 | { |
798 | InputDialog *fileDlg; | 805 | InputDialog *fileDlg; |
799 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 806 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
800 | fileDlg->exec(); | 807 | fileDlg->exec(); |
801 | if( fileDlg->result() == 1 ) { | 808 | if( fileDlg->result() == 1 ) { |
802 | QString filename = fileDlg->LineEdit1->text(); | 809 | QString filename = fileDlg->LineEdit1->text(); |
803 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 810 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
804 | } | 811 | } |
805 | populateRemoteView(); | 812 | populateRemoteView(); |
806 | } | 813 | } |
807 | 814 | ||
808 | void AdvancedFm::localDelete() | 815 | void AdvancedFm::localDelete() |
809 | { | 816 | { |
810 | QStringList curFileList = getPath(); | 817 | QStringList curFileList = getPath(); |
811 | QString myFile; | 818 | QString myFile; |
812 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 819 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
813 | myFile = (*it); | 820 | myFile = (*it); |
814 | if( myFile.find(" -> ",0,TRUE) != -1) | 821 | if( myFile.find(" -> ",0,TRUE) != -1) |
815 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 822 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
816 | 823 | ||
817 | QString f = currentDir.canonicalPath(); | 824 | QString f = currentDir.canonicalPath(); |
818 | if(f.right(1).find("/",0,TRUE) == -1) | 825 | if(f.right(1).find("/",0,TRUE) == -1) |
819 | f+="/"; | 826 | f+="/"; |
820 | f+=myFile; | 827 | f+=myFile; |
821 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 828 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
822 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 829 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
823 | "\nand all it's contents ?" | 830 | "\nand all it's contents ?" |
824 | ,tr("Yes"),tr("No"),0,0,1) ) { | 831 | ,tr("Yes"),tr("No"),0,0,1) ) { |
825 | case 0: { | 832 | case 0: { |
826 | f=f.left(f.length()-1); | 833 | f=f.left(f.length()-1); |
827 | QString cmd="rm -rf "+f; | 834 | QString cmd="rm -rf "+f; |
828 | system( cmd.latin1()); | 835 | system( cmd.latin1()); |
829 | populateLocalView(); | 836 | populateLocalView(); |
830 | } | 837 | } |
831 | break; | 838 | break; |
832 | case 1: | 839 | case 1: |
833 | // exit | 840 | // exit |
834 | break; | 841 | break; |
835 | }; | 842 | }; |
836 | 843 | ||
837 | } else { | 844 | } else { |
838 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 845 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
839 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 846 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
840 | case 0: { | 847 | case 0: { |
841 | QString cmd="rm "+f; | 848 | QString cmd="rm "+f; |
842 | QFile file(f); | 849 | QFile file(f); |
843 | file.remove(); | 850 | file.remove(); |
844 | // system( cmd.latin1()); | 851 | // system( cmd.latin1()); |
845 | populateLocalView(); | 852 | populateLocalView(); |
846 | } | 853 | } |
847 | break; | 854 | break; |
848 | case 1: | 855 | case 1: |
849 | // exit | 856 | // exit |
850 | break; | 857 | break; |
851 | }; | 858 | }; |
852 | } | 859 | } |
853 | } | 860 | } |
854 | } | 861 | } |
855 | 862 | ||
856 | void AdvancedFm::remoteDelete() | 863 | void AdvancedFm::remoteDelete() |
857 | { | 864 | { |
858 | QStringList curFileList = getPath(); | 865 | QStringList curFileList = getPath(); |
859 | QString myFile; | 866 | QString myFile; |
860 | 867 | ||
861 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 868 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
862 | myFile = (*it); | 869 | myFile = (*it); |
863 | if(myFile.find(" -> ",0,TRUE) != -1) | 870 | if(myFile.find(" -> ",0,TRUE) != -1) |
864 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 871 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
865 | QString f = currentRemoteDir.canonicalPath(); | 872 | QString f = currentRemoteDir.canonicalPath(); |
866 | if(f.right(1).find("/",0,TRUE) == -1) | 873 | if(f.right(1).find("/",0,TRUE) == -1) |
867 | f+="/"; | 874 | f+="/"; |
868 | f+=myFile; | 875 | f+=myFile; |
869 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 876 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
870 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 877 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
871 | "\nand all it's contents ?", | 878 | "\nand all it's contents ?", |
872 | tr("Yes"),tr("No"),0,0,1) ) { | 879 | tr("Yes"),tr("No"),0,0,1) ) { |
873 | case 0: { | 880 | case 0: { |
874 | f=f.left(f.length()-1); | 881 | f=f.left(f.length()-1); |
875 | QString cmd="rm -rf "+f; | 882 | QString cmd="rm -rf "+f; |
876 | system( cmd.latin1()); | 883 | system( cmd.latin1()); |
877 | populateRemoteView(); | 884 | populateRemoteView(); |
878 | } | 885 | } |
879 | break; | 886 | break; |
880 | case 1: | 887 | case 1: |
881 | // exit | 888 | // exit |
882 | break; | 889 | break; |
883 | }; | 890 | }; |
884 | 891 | ||
885 | } else { | 892 | } else { |
886 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 893 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
887 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 894 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
888 | case 0: { | 895 | case 0: { |
889 | QString cmd="rm "+f; | 896 | QString cmd="rm "+f; |
890 | QFile file(f); | 897 | QFile file(f); |
891 | file.remove(); | 898 | file.remove(); |
892 | // system( cmd.latin1()); | 899 | // system( cmd.latin1()); |
893 | populateRemoteView(); | 900 | populateRemoteView(); |
894 | } | 901 | } |
895 | break; | 902 | break; |
896 | case 1: | 903 | case 1: |
897 | // exit | 904 | // exit |
898 | break; | 905 | break; |
899 | }; | 906 | }; |
900 | } | 907 | } |
901 | } | 908 | } |
902 | } | 909 | } |
903 | 910 | ||
904 | void AdvancedFm::localRename() | 911 | void AdvancedFm::localRename() |
905 | { | 912 | { |
906 | QString curFile = Local_View->currentItem()->text(0); | 913 | QString curFile = Local_View->currentItem()->text(0); |
907 | InputDialog *fileDlg; | 914 | InputDialog *fileDlg; |
908 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 915 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
909 | fileDlg->setInputText((const QString &)curFile); | 916 | fileDlg->setInputText((const QString &)curFile); |
910 | fileDlg->exec(); | 917 | fileDlg->exec(); |
911 | if( fileDlg->result() == 1 ) { | 918 | if( fileDlg->result() == 1 ) { |
912 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 919 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
913 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 920 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
914 | if( rename(oldname.latin1(), newName.latin1())== -1) | 921 | if( rename(oldname.latin1(), newName.latin1())== -1) |
915 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 922 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
916 | } | 923 | } |
917 | populateLocalView(); | 924 | populateLocalView(); |
918 | } | 925 | } |
919 | 926 | ||
920 | void AdvancedFm::remoteRename() | 927 | void AdvancedFm::remoteRename() |
921 | { | 928 | { |
922 | QString curFile = Local_View->currentItem()->text(0); | 929 | QString curFile = Local_View->currentItem()->text(0); |
923 | InputDialog *fileDlg; | 930 | InputDialog *fileDlg; |
924 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 931 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
925 | fileDlg->setInputText((const QString &)curFile); | 932 | fileDlg->setInputText((const QString &)curFile); |
926 | fileDlg->exec(); | 933 | fileDlg->exec(); |
927 | if( fileDlg->result() == 1 ) { | 934 | if( fileDlg->result() == 1 ) { |
928 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 935 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
929 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 936 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
930 | if( rename(oldname.latin1(), newName.latin1())== -1) | 937 | if( rename(oldname.latin1(), newName.latin1())== -1) |
931 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 938 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
932 | } | 939 | } |
933 | populateRemoteView(); | 940 | populateRemoteView(); |
934 | } | 941 | } |
935 | 942 | ||
936 | void AdvancedFm::switchToLocalTab() | 943 | void AdvancedFm::switchToLocalTab() |
937 | { | 944 | { |
938 | TabWidget->setCurrentPage(0); | 945 | TabWidget->setCurrentPage(0); |
939 | Local_View->setFocus(); | 946 | Local_View->setFocus(); |
940 | } | 947 | } |
941 | 948 | ||
942 | void AdvancedFm::switchToRemoteTab() | 949 | void AdvancedFm::switchToRemoteTab() |
943 | { | 950 | { |
944 | TabWidget->setCurrentPage(1); | 951 | TabWidget->setCurrentPage(1); |