summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ec475a4..7fba0af 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -685,147 +685,147 @@ QString AdvancedFm::getFileSystemType(const QString &currentText) {
685 QString current = currentText;//.right( currentText.length()-1); 685 QString current = currentText;//.right( currentText.length()-1);
686 QString baseFs; 686 QString baseFs;
687 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 687 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
688 QString temp = (*it); 688 QString temp = (*it);
689 QString path = temp.left(temp.find("::",0,TRUE) ); 689 QString path = temp.left(temp.find("::",0,TRUE) );
690 path = path.right( path.length()-1); 690 path = path.right( path.length()-1);
691 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 691 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
692 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 692 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
693 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 693 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
694 } 694 }
695 } 695 }
696 return baseFs; 696 return baseFs;
697} 697}
698 698
699QString AdvancedFm::getDiskSpace( const QString &path) { 699QString AdvancedFm::getDiskSpace( const QString &path) {
700 struct statfs fss; 700 struct statfs fss;
701 if ( !statfs( path.latin1(), &fss ) ) { 701 if ( !statfs( path.latin1(), &fss ) ) {
702 int blkSize = fss.f_bsize; 702 int blkSize = fss.f_bsize;
703 // int totalBlks = fs.f_blocks; 703 // int totalBlks = fs.f_blocks;
704 int availBlks = fss.f_bavail; 704 int availBlks = fss.f_bavail;
705 705
706 long mult = blkSize / 1024; 706 long mult = blkSize / 1024;
707 long div = 1024 / blkSize; 707 long div = 1024 / blkSize;
708 if ( !mult ) mult = 1; 708 if ( !mult ) mult = 1;
709 if ( !div ) div = 1; 709 if ( !div ) div = 1;
710 710
711 return QString::number(availBlks * mult / div); 711 return QString::number(availBlks * mult / div);
712 } 712 }
713 return ""; 713 return "";
714} 714}
715 715
716 716
717void AdvancedFm::showFileMenu() { 717void AdvancedFm::showFileMenu() {
718 718
719 QString curApp; 719 QString curApp;
720 bool isLocalView = false; 720 bool isLocalView = false;
721 if (TabWidget->currentPageIndex() == 0) { 721 if (TabWidget->currentPageIndex() == 0) {
722 isLocalView = TRUE; 722 isLocalView = TRUE;
723 curApp = Local_View->currentItem()->text(0); 723 curApp = Local_View->currentItem()->text(0);
724 } else { 724 } else {
725 curApp = Remote_View->currentItem()->text(0); 725 curApp = Remote_View->currentItem()->text(0);
726 } 726 }
727 727
728 MimeType mt( curApp ); 728 MimeType mt( curApp );
729 const AppLnk* app = mt.application(); 729 const AppLnk* app = mt.application();
730 QFile fi(curApp); 730 QFile fi(curApp);
731 731
732 QPopupMenu *m = new QPopupMenu(0); 732 QPopupMenu *m = new QPopupMenu(0);
733 QPopupMenu *n = new QPopupMenu(0);
734// QPopupMenu *o = new QPopupMenu(0);
733 735
734 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 736 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
735 if ( !QFileInfo(fi).isDir() ) { 737 if ( !QFileInfo(fi).isDir() ) {
736 m->insertSeparator(); 738// m->insertSeparator();
737// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 739// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
738// } else { 740// } else {
739 741
740 if ( app ) 742 if ( app )
741 m->insertItem( app->pixmap(), tr( "Open in " 743 m->insertItem( app->pixmap(), tr( "Open in "
742 + app->name() ), this, SLOT( runThis() ) ); 744 + app->name() ), this, SLOT( runThis() ) );
743 else if( QFileInfo(fi).isExecutable() ) 745 else if( QFileInfo(fi).isExecutable() )
744 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) ); 746 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) );
745 747
746 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 748 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
747 } 749 }
748 m->insertSeparator();
749 750
751 m->insertItem(tr("Actions"),n);
752 if(isLocalView)
753 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
754 else
755 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
756
757 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
750 758
759 n->insertSeparator();
760
761
751 if(isLocalView) 762 if(isLocalView)
752 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 763 n->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
753 else 764 else
754 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 765 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
755 766
756 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 767 n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
757 m->insertSeparator(); 768 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
769 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
770 n->insertItem( tr( "Move" ), this, SLOT( move() ));
771
772 n->insertSeparator();
758 773
759 if(isLocalView) 774 if(isLocalView)
760 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 775 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
761 else 776 else
762 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 777 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
763 778
764 m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
765 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
766 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
767 m->insertItem( tr( "Move" ), this, SLOT( move() ));
768 m->insertSeparator();
769 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
770 779
771// if(isLocalView) 780 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
772// m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
773// else
774// m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
775 781
776 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 782 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
777 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 783 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
778 m->insertSeparator();
779
780 if(isLocalView)
781 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
782 else
783 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
784 784
785 m->insertSeparator(); 785 m->insertSeparator();
786 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 786 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
787 787
788#if defined(QT_QWS_OPIE) 788#if defined(QT_QWS_OPIE)
789 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 789 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
790#endif 790#endif
791 m->setCheckable(TRUE); 791 m->setCheckable(TRUE);
792 if (!b) 792 if (!b)
793 m->setItemChecked(m->idAt(0),TRUE); 793 m->setItemChecked(m->idAt(0),TRUE);
794 else 794 else
795 m->setItemChecked(m->idAt(0),FALSE); 795 m->setItemChecked(m->idAt(0),FALSE);
796 796
797 if(Ir::supported()) 797 if(Ir::supported())
798 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 798 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
799 m->setFocus(); 799 m->setFocus();
800 m->exec( QCursor::pos() ); 800 m->exec( QCursor::pos() );
801 sleep(1); 801 sleep(1);
802 if(m) delete m; 802 if(m) delete m;
803} 803}
804 804
805 805
806void AdvancedFm::cancelMenuTimer() { 806void AdvancedFm::cancelMenuTimer() {
807 807
808// qDebug("selectionChanged: cancel menu timer"); 808// qDebug("selectionChanged: cancel menu timer");
809 if( menuTimer.isActive() ) 809 if( menuTimer.isActive() )
810 menuTimer.stop(); 810 menuTimer.stop();
811} 811}
812 812
813QString AdvancedFm::checkDiskSpace(const QString &path) { 813QString AdvancedFm::checkDiskSpace(const QString &path) {
814 struct statfs fss; 814 struct statfs fss;
815 if ( !statfs( path.latin1(), &fss ) ) { 815 if ( !statfs( path.latin1(), &fss ) ) {
816 int blkSize = fss.f_bsize; 816 int blkSize = fss.f_bsize;
817// int totalBlks = fs.f_blocks; 817// int totalBlks = fs.f_blocks;
818 int availBlks = fss.f_bavail; 818 int availBlks = fss.f_bavail;
819 819
820 long mult = blkSize / 1024; 820 long mult = blkSize / 1024;
821 long div = 1024 / blkSize; 821 long div = 1024 / blkSize;
822 if ( !mult ) mult = 1; 822 if ( !mult ) mult = 1;
823 if ( !div ) div = 1; 823 if ( !div ) div = 1;
824 824
825 825
826 return QString::number(availBlks * mult / div); 826 return QString::number(availBlks * mult / div);
827 } 827 }
828 return ""; 828 return "";
829} 829}
830 830
831void AdvancedFm::addToDocs() { 831void AdvancedFm::addToDocs() {