summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-07 00:14:17 (UTC)
committer llornkcor <llornkcor>2002-05-07 00:14:17 (UTC)
commitc9849cc04b668f1cda7a16d868299c436d1de042 (patch) (unidiff)
treecc9ff9565931bec34602468b5335e19ed2b3d662
parentf046179d3b49c44896298aa86380046a21394bbc (diff)
downloadopie-c9849cc04b668f1cda7a16d868299c436d1de042.zip
opie-c9849cc04b668f1cda7a16d868299c436d1de042.tar.gz
opie-c9849cc04b668f1cda7a16d868299c436d1de042.tar.bz2
Fix for Sharp rom not having the Properties class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp5
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
@@ -559,292 +559,294 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
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
590void AdvancedFm::doLocalCd() 590void AdvancedFm::doLocalCd()
591{ 591{
592 localListClicked( Local_View->currentItem()); 592 localListClicked( Local_View->currentItem());
593} 593}
594 594
595void AdvancedFm::doRemoteCd() 595void AdvancedFm::doRemoteCd()
596{ 596{
597 localListClicked( Remote_View->currentItem()); 597 localListClicked( Remote_View->currentItem());
598} 598}
599 599
600void AdvancedFm::showHidden() 600void 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
620void AdvancedFm::showRemoteHidden() 620void 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
637void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 637void 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
649void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 649void 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
661void AdvancedFm::showLocalMenu(QListViewItem * item) 661void 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
697void AdvancedFm::showRemoteMenu(QListViewItem * item) 698void 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
733void AdvancedFm::runThis() { 735void AdvancedFm::runThis() {
734// QFileInfo *fi; 736// QFileInfo *fi;
735QString fs; 737QString 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
785void AdvancedFm::runText() { 787void 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
800void AdvancedFm::localMakDir() 802void 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
812void AdvancedFm::remoteMakDir() 814void 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
824void AdvancedFm::localDelete() 826void 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;
@@ -931,261 +933,264 @@ void AdvancedFm::localRename()
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
936void AdvancedFm::remoteRename() 938void 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
952void AdvancedFm::switchToLocalTab() 954void AdvancedFm::switchToLocalTab()
953{ 955{
954 TabWidget->setCurrentPage(0); 956 TabWidget->setCurrentPage(0);
955 Local_View->setFocus(); 957 Local_View->setFocus();
956} 958}
957 959
958void AdvancedFm::switchToRemoteTab() 960void AdvancedFm::switchToRemoteTab()
959{ 961{
960 TabWidget->setCurrentPage(1); 962 TabWidget->setCurrentPage(1);
961 Remote_View->setFocus(); 963 Remote_View->setFocus();
962} 964}
963 965
964void AdvancedFm::readConfig() 966void AdvancedFm::readConfig()
965{ 967{
966 Config cfg("AdvancedFm"); 968 Config cfg("AdvancedFm");
967} 969}
968 970
969void AdvancedFm::writeConfig() 971void AdvancedFm::writeConfig()
970{ 972{
971 Config cfg("AdvancedFm"); 973 Config cfg("AdvancedFm");
972} 974}
973 975
974void AdvancedFm::currentPathComboChanged() 976void 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
994void AdvancedFm::fillCombo(const QString &currentPath) { 996void AdvancedFm::fillCombo(const QString &currentPath) {
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
1013void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 1015void 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
1027void AdvancedFm::filePerms() { 1029void 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
1055void AdvancedFm::doProperties() { 1057void 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
1072QStringList AdvancedFm::getPath() { 1077QStringList 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
1096void AdvancedFm::homeButtonPushed() { 1101void 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
1109void AdvancedFm::docButtonPushed() { 1114void 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
1122void AdvancedFm::SDButtonPushed() { 1127void 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
1136void AdvancedFm::CFButtonPushed() { 1141void 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
1151void AdvancedFm::upDir() 1156void 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
1174void AdvancedFm::copy() 1179void 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);