summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-16 03:59:23 (UTC)
committer llornkcor <llornkcor>2002-11-16 03:59:23 (UTC)
commitb17b2274c200403da25a994ed9d8ba4856d725c0 (patch) (unidiff)
treed3f64243b4f0a8b8ec6300ac33430633da9543a8
parentd3e670971b2b721eb2b484801cf1c6ecbf52d436 (diff)
downloadopie-b17b2274c200403da25a994ed9d8ba4856d725c0.zip
opie-b17b2274c200403da25a994ed9d8ba4856d725c0.tar.gz
opie-b17b2274c200403da25a994ed9d8ba4856d725c0.tar.bz2
various changes, popupmenu at complete left.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp6
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp1
2 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 08dc24e..23244a2 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,143 +1,143 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15 #include <opie/otabwidget.h> 15#include <opie/otabwidget.h>
16// #include <opie/ofileselector.h> 16// #include <opie/ofileselector.h>
17// #include <opie/ofiledialog.h> 17// #include <opie/ofiledialog.h>
18 18
19#include <qpe/filemanager.h> 19#include <qpe/filemanager.h>
20#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
21#include <qpe/qpemenubar.h> 21#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/mimetype.h> 26#include <qpe/mimetype.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28#include <qpe/ir.h> 28#include <qpe/ir.h>
29#include <qpe/resource.h> 29#include <qpe/resource.h>
30 30
31#include <qtabwidget.h> 31#include <qtabwidget.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qdatetime.h> 34#include <qdatetime.h>
35#include <qdir.h> 35#include <qdir.h>
36#include <qfile.h> 36#include <qfile.h>
37#include <qstring.h> 37#include <qstring.h>
38#include <qcombobox.h> 38#include <qcombobox.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qlistview.h> 40#include <qlistview.h>
41#include <qmainwindow.h> 41#include <qmainwindow.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qprogressbar.h> 43#include <qprogressbar.h>
44#include <qspinbox.h> 44#include <qspinbox.h>
45#include <qwidget.h> 45#include <qwidget.h>
46#include <qlayout.h> 46#include <qlayout.h>
47#include <qimage.h> 47#include <qimage.h>
48#include <qpixmap.h> 48#include <qpixmap.h>
49#include <qmessagebox.h> 49#include <qmessagebox.h>
50#include <qlineedit.h> 50#include <qlineedit.h>
51#include <qregexp.h> 51#include <qregexp.h>
52 52
53#include <unistd.h> 53#include <unistd.h>
54#include <stdlib.h> 54#include <stdlib.h>
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <dirent.h> 56#include <dirent.h>
57#include <stdio.h> 57#include <stdio.h>
58#include <time.h> 58#include <time.h>
59#include <fcntl.h> 59#include <fcntl.h>
60#include <mntent.h> 60#include <mntent.h>
61#include <string.h> 61#include <string.h>
62#include <errno.h> 62#include <errno.h>
63#include <sys/vfs.h> 63#include <sys/vfs.h>
64#include <mntent.h> 64#include <mntent.h>
65#include <sys/utsname.h> 65#include <sys/utsname.h>
66 66
67AdvancedFm::AdvancedFm( ) 67AdvancedFm::AdvancedFm( )
68 : QMainWindow( ) { 68 : QMainWindow( ) {
69 init(); 69 init();
70 initConnections(); 70 initConnections();
71 populateLocalView(); 71 populateLocalView();
72 populateRemoteView(); 72 populateRemoteView();
73 currentPathCombo->setFocus(); 73 currentPathCombo->setFocus();
74} 74}
75 75
76AdvancedFm::~AdvancedFm() { 76AdvancedFm::~AdvancedFm() {
77} 77}
78 78
79void AdvancedFm::cleanUp() { 79void AdvancedFm::cleanUp() {
80 QString sfile=QDir::homeDirPath(); 80 QString sfile=QDir::homeDirPath();
81 if(sfile.right(1) != "/") 81 if(sfile.right(1) != "/")
82 sfile+="/._temp"; 82 sfile+="/._temp";
83 else 83 else
84 sfile+="._temp"; 84 sfile+="._temp";
85 QFile file( sfile); 85 QFile file( sfile);
86 if(file.exists()) 86 if(file.exists())
87 file.remove(); 87 file.remove();
88} 88}
89 89
90void AdvancedFm::tabChanged(QWidget *) { 90void AdvancedFm::tabChanged(QWidget *) {
91 if (TabWidget->getCurrentTab() == 0) { 91 if (TabWidget->getCurrentTab() == 0) {
92// if (TabWidget->currentPageIndex() == 0) { 92// if (TabWidget->currentPageIndex() == 0) {
93 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 93 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
94 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 94 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
95 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 95 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
96 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 96 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
97 setCaption("AdvancedFm :: "+fs+" :: " 97 setCaption("AdvancedFm :: "+fs+" :: "
98 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); 98 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
99 99
100 } 100 }
101 if (TabWidget->getCurrentTab() == 1) { 101 if (TabWidget->getCurrentTab() == 1) {
102 102
103// if (TabWidget->currentPageIndex() == 1) { 103// if (TabWidget->currentPageIndex() == 1) {
104 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 104 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
105 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 105 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
106 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 106 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
107 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 107 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
108 setCaption("AdvancedFm :: "+fs+" :: " 108 setCaption("AdvancedFm :: "+fs+" :: "
109 +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); 109 +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" );
110 } 110 }
111} 111}
112 112
113 113
114void AdvancedFm::populateLocalView() { 114void AdvancedFm::populateLocalView() {
115 QPixmap pm; 115 QPixmap pm;
116 Local_View->clear(); 116 Local_View->clear();
117 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 117 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
118 currentDir.setMatchAllDirs(TRUE); 118 currentDir.setMatchAllDirs(TRUE);
119 currentDir.setNameFilter(filterStr); 119 currentDir.setNameFilter(filterStr);
120 QString fileL, fileS, fileDate; 120 QString fileL, fileS, fileDate;
121 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 121 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
122 setCaption("AdvancedFm :: "+fs+" :: " 122 setCaption("AdvancedFm :: "+fs+" :: "
123 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); 123 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
124 bool isDir=FALSE; 124 bool isDir=FALSE;
125 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 125 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
126 QFileInfoListIterator it(*list); 126 QFileInfoListIterator it(*list);
127 QFileInfo *fi; 127 QFileInfo *fi;
128 while ( (fi=it.current()) ) { 128 while ( (fi=it.current()) ) {
129 if (fi->isSymLink() ) { 129 if (fi->isSymLink() ) {
130 QString symLink=fi->readLink(); 130 QString symLink=fi->readLink();
131 QFileInfo sym( symLink); 131 QFileInfo sym( symLink);
132 fileS.sprintf( "%10i", sym.size() ); 132 fileS.sprintf( "%10i", sym.size() );
133 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); 133 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() );
134 fileDate = sym.lastModified().toString(); 134 fileDate = sym.lastModified().toString();
135 } else { 135 } else {
136 fileS.sprintf( "%10i", fi->size() ); 136 fileS.sprintf( "%10i", fi->size() );
137 fileL.sprintf( "%s",fi->fileName().data() ); 137 fileL.sprintf( "%s",fi->fileName().data() );
138 fileDate= fi->lastModified().toString(); 138 fileDate= fi->lastModified().toString();
139 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 139 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
140 fileL+="/"; 140 fileL+="/";
141 isDir=TRUE; 141 isDir=TRUE;
142 } 142 }
143 } 143 }
@@ -688,188 +688,188 @@ void AdvancedFm::parsetab(const QString &fileName) {
688 & filesystemType.find("auto",0,TRUE) == -1) 688 & filesystemType.find("auto",0,TRUE) == -1)
689 fsList << filesystemType; 689 fsList << filesystemType;
690 fileSystemTypeList << mountDir+"::"+filesystemType; 690 fileSystemTypeList << mountDir+"::"+filesystemType;
691 } 691 }
692 } 692 }
693 } 693 }
694 endmntent( mntfp ); 694 endmntent( mntfp );
695} 695}
696 696
697QString AdvancedFm::getFileSystemType(const QString &currentText) { 697QString AdvancedFm::getFileSystemType(const QString &currentText) {
698 parsetab("/etc/mtab"); //why did TT forget filesystem type? 698 parsetab("/etc/mtab"); //why did TT forget filesystem type?
699 QString current = currentText;//.right( currentText.length()-1); 699 QString current = currentText;//.right( currentText.length()-1);
700 QString baseFs; 700 QString baseFs;
701 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 701 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
702 QString temp = (*it); 702 QString temp = (*it);
703 QString path = temp.left(temp.find("::",0,TRUE) ); 703 QString path = temp.left(temp.find("::",0,TRUE) );
704 path = path.right( path.length()-1); 704 path = path.right( path.length()-1);
705 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 705 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
706 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 706 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
707 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 707 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
708 } 708 }
709 } 709 }
710 return baseFs; 710 return baseFs;
711} 711}
712 712
713QString AdvancedFm::getDiskSpace( const QString &path) { 713QString AdvancedFm::getDiskSpace( const QString &path) {
714 struct statfs fss; 714 struct statfs fss;
715 if ( !statfs( path.latin1(), &fss ) ) { 715 if ( !statfs( path.latin1(), &fss ) ) {
716 int blkSize = fss.f_bsize; 716 int blkSize = fss.f_bsize;
717 // int totalBlks = fs.f_blocks; 717 // int totalBlks = fs.f_blocks;
718 int availBlks = fss.f_bavail; 718 int availBlks = fss.f_bavail;
719 719
720 long mult = blkSize / 1024; 720 long mult = blkSize / 1024;
721 long div = 1024 / blkSize; 721 long div = 1024 / blkSize;
722 if ( !mult ) mult = 1; 722 if ( !mult ) mult = 1;
723 if ( !div ) div = 1; 723 if ( !div ) div = 1;
724 724
725 return QString::number(availBlks * mult / div); 725 return QString::number(availBlks * mult / div);
726 } 726 }
727 return ""; 727 return "";
728} 728}
729 729
730 730
731void AdvancedFm::showFileMenu() { 731void AdvancedFm::showFileMenu() {
732 732
733 QString curApp; 733 QString curApp;
734 bool isLocalView = false; 734 bool isLocalView = false;
735 if (TabWidget->getCurrentTab() == 0) { 735 if (TabWidget->getCurrentTab() == 0) {
736// if (TabWidget->currentPageIndex() == 0) { 736// if (TabWidget->currentPageIndex() == 0) {
737 isLocalView = TRUE; 737 isLocalView = TRUE;
738 curApp = Local_View->currentItem()->text(0); 738 curApp = Local_View->currentItem()->text(0);
739 } else { 739 } else {
740 curApp = Remote_View->currentItem()->text(0); 740 curApp = Remote_View->currentItem()->text(0);
741 } 741 }
742 742
743 MimeType mt( curApp ); 743 MimeType mt( curApp );
744 const AppLnk* app = mt.application(); 744 const AppLnk* app = mt.application();
745 QFile fi(curApp); 745 QFile fi(curApp);
746 QPopupMenu *m = new QPopupMenu(0); 746 QPopupMenu *m = new QPopupMenu(0);
747 QPopupMenu *n = new QPopupMenu(0); 747 QPopupMenu *n = new QPopupMenu(0);
748 // QPopupMenu *o = new QPopupMenu(0); 748 // QPopupMenu *o = new QPopupMenu(0);
749 if (TabWidget->getCurrentTab() == 0) 749 if (TabWidget->getCurrentTab() == 0)
750 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 750 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
751 else 751 else
752 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 752 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
753 753
754 if ( QFileInfo(fi).isDir() ) { 754 if ( QFileInfo(fi).isDir() ) {
755 m->insertSeparator(); 755 m->insertSeparator();
756 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 756 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
757 } else { 757 } else {
758 758
759 if ( app ) 759 if ( app )
760 m->insertItem( app->pixmap(), tr( "Open in " 760 m->insertItem( app->pixmap(), tr( "Open in "
761 + app->name() ), this, SLOT( runThis() ) ); 761 + app->name() ), this, SLOT( runThis() ) );
762 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 762 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
763 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); 763 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
764 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 764 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
765 } 765 }
766 766
767 m->insertItem(tr("Actions"),n); 767 m->insertItem(tr("Actions"),n);
768 if(isLocalView) 768 if(isLocalView)
769 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 769 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
770 else 770 else
771 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 771 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
772 772
773 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 773 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
774 774
775 n->insertSeparator(); 775 n->insertSeparator();
776 776
777 777
778 if(isLocalView) 778 if(isLocalView)
779 n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 779 n->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
780 else 780 else
781 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 781 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
782 782
783 n->insertItem( tr( "Copy" ), this, SLOT( copy() )); 783 n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
784 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 784 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
785 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 785 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
786 n->insertItem( tr( "Move" ), this, SLOT( move() )); 786 n->insertItem( tr( "Move" ), this, SLOT( move() ));
787 787
788 n->insertSeparator(); 788 n->insertSeparator();
789 789
790 if(isLocalView) 790 if(isLocalView)
791 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 791 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
792 else 792 else
793 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 793 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
794 794
795 795
796 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 796 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
797 797
798 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 798 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
799 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 799 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
800 800
801 m->insertSeparator(); 801 m->insertSeparator();
802 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 802 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
803 803
804#if defined(QT_QWS_OPIE) 804#if defined(QT_QWS_OPIE)
805 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 805 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
806#endif 806#endif
807 m->setCheckable(TRUE); 807 m->setCheckable(TRUE);
808 if (!b) 808 if (!b)
809 m->setItemChecked(m->idAt(0),TRUE); 809 m->setItemChecked(m->idAt(0),TRUE);
810 else 810 else
811 m->setItemChecked(m->idAt(0),FALSE); 811 m->setItemChecked(m->idAt(0),FALSE);
812 812
813 if(Ir::supported()) 813 if(Ir::supported())
814 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 814 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
815 m->setFocus(); 815 m->setFocus();
816 m->exec( QCursor::pos() ); 816 m->exec( QPoint( 4,QCursor::pos().y()) );
817 sleep(1); 817
818 if(m) delete m; 818 if(m) delete m;
819} 819}
820 820
821 821
822void AdvancedFm::cancelMenuTimer() { 822void AdvancedFm::cancelMenuTimer() {
823 823
824// qDebug("selectionChanged: cancel menu timer"); 824// qDebug("selectionChanged: cancel menu timer");
825 if( menuTimer.isActive() ) 825 if( menuTimer.isActive() )
826 menuTimer.stop(); 826 menuTimer.stop();
827} 827}
828 828
829QString AdvancedFm::checkDiskSpace(const QString &path) { 829QString AdvancedFm::checkDiskSpace(const QString &path) {
830 struct statfs fss; 830 struct statfs fss;
831 if ( !statfs( path.latin1(), &fss ) ) { 831 if ( !statfs( path.latin1(), &fss ) ) {
832 int blkSize = fss.f_bsize; 832 int blkSize = fss.f_bsize;
833// int totalBlks = fs.f_blocks; 833// int totalBlks = fs.f_blocks;
834 int availBlks = fss.f_bavail; 834 int availBlks = fss.f_bavail;
835 835
836 long mult = blkSize / 1024; 836 long mult = blkSize / 1024;
837 long div = 1024 / blkSize; 837 long div = 1024 / blkSize;
838 if ( !mult ) mult = 1; 838 if ( !mult ) mult = 1;
839 if ( !div ) div = 1; 839 if ( !div ) div = 1;
840 840
841 841
842 return QString::number(availBlks * mult / div); 842 return QString::number(availBlks * mult / div);
843 } 843 }
844 return ""; 844 return "";
845} 845}
846 846
847void AdvancedFm::addToDocs() { 847void AdvancedFm::addToDocs() {
848 QStringList strListPaths = getPath(); 848 QStringList strListPaths = getPath();
849 if( strListPaths.count() > 0) { 849 if( strListPaths.count() > 0) {
850 QString curFile; 850 QString curFile;
851 if (TabWidget->getCurrentTab() == 0) { 851 if (TabWidget->getCurrentTab() == 0) {
852// if (TabWidget->currentPageIndex() == 0) { 852// if (TabWidget->currentPageIndex() == 0) {
853 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 853 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
854 curFile = currentDir.canonicalPath()+"/"+(*it); 854 curFile = currentDir.canonicalPath()+"/"+(*it);
855 qDebug(curFile); 855 qDebug(curFile);
856 DocLnk f; 856 DocLnk f;
857// curFile.replace(QRegExp("\\..*"),""); 857// curFile.replace(QRegExp("\\..*"),"");
858 f.setName((*it)); 858 f.setName((*it));
859 f.setFile( curFile); 859 f.setFile( curFile);
860 f.writeLink(); 860 f.writeLink();
861 } 861 }
862 } else { 862 } else {
863 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 863 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
864 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 864 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
865 qDebug(curFile); 865 qDebug(curFile);
866 866
867 DocLnk f; 867 DocLnk f;
868// curFile.replace(QRegExp("\\..*"),""); 868// curFile.replace(QRegExp("\\..*"),"");
869 f.setName((*it)); 869 f.setName((*it));
870 f.setFile( curFile); 870 f.setFile( curFile);
871 f.writeLink(); 871 f.writeLink();
872 } 872 }
873 } 873 }
874 } 874 }
875} 875}
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index f0a0a35..0966f02 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,217 +1,218 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfmData.cpp 2 advancedfmData.cpp
3 ------------------- 3 -------------------
4** Created: Mon 09-23-2002 13:24:11 4** Created: Mon 09-23-2002 13:24:11
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13 13
14#include <opie/otabwidget.h> 14#include <opie/otabwidget.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/qpemenubar.h> 16#include <qpe/qpemenubar.h>
17#include <qpe/qpetoolbar.h> 17#include <qpe/qpetoolbar.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qtabwidget.h> 24#include <qtabwidget.h>
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qlistview.h> 27#include <qlistview.h>
28 28
29#include <sys/utsname.h> 29#include <sys/utsname.h>
30 30
31 31
32void AdvancedFm::init() { 32void AdvancedFm::init() {
33#if defined(QT_QWS_OPIE) 33#if defined(QT_QWS_OPIE)
34 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); 34 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
35#endif 35#endif
36 setCaption( tr( "AdvancedFm" ) ); 36 setCaption( tr( "AdvancedFm" ) );
37 37
38 QGridLayout *layout = new QGridLayout( this ); 38 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 2); 39 layout->setSpacing( 2);
40 layout->setMargin( 2); 40 layout->setMargin( 2);
41 41
42 42
43 QPEMenuBar *menuBar = new QPEMenuBar(this); 43 QPEMenuBar *menuBar = new QPEMenuBar(this);
44 fileMenu = new QPopupMenu( this ); 44 fileMenu = new QPopupMenu( this );
45 viewMenu = new QPopupMenu( this ); 45 viewMenu = new QPopupMenu( this );
46 46
47 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 47 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
48 48
49 menuBar->insertItem( tr( "File" ), fileMenu); 49 menuBar->insertItem( tr( "File" ), fileMenu);
50 menuBar->insertItem( tr( "View" ), viewMenu); 50 menuBar->insertItem( tr( "View" ), viewMenu);
51 51
52 qpeDirButton= new QToolButton(this,"QPEButton"); 52 qpeDirButton= new QToolButton(this,"QPEButton");
53 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 53 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
54 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 54 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
55 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 55 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
56 56
57 cfButton = new QToolButton( this,"CFButton"); 57 cfButton = new QToolButton( this,"CFButton");
58 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 58 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
59 cfButton ->setFixedSize( QSize( 20, 20 ) ); 59 cfButton ->setFixedSize( QSize( 20, 20 ) );
60 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 60 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
61 61
62 sdButton = new QToolButton( this,"SDButton"); 62 sdButton = new QToolButton( this,"SDButton");
63 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 63 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
64 sdButton->setFixedSize( QSize( 20, 20 ) ); 64 sdButton->setFixedSize( QSize( 20, 20 ) );
65 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 65 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
66 66
67 cdUpButton = new QToolButton( this,"cdUpButton"); 67 cdUpButton = new QToolButton( this,"cdUpButton");
68 cdUpButton->setPixmap(Resource::loadPixmap("up")); 68 cdUpButton->setPixmap(Resource::loadPixmap("up"));
69 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 69 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
70 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); 70 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
71 71
72 docButton = new QToolButton( this,"docsButton"); 72 docButton = new QToolButton( this,"docsButton");
73 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 73 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
74 docButton->setFixedSize( QSize( 20, 20 ) ); 74 docButton->setFixedSize( QSize( 20, 20 ) );
75 layout->addMultiCellWidget( docButton, 0, 0, 6, 6); 75 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
76 76
77 homeButton = new QToolButton( this,"homeButton"); 77 homeButton = new QToolButton( this,"homeButton");
78 homeButton->setPixmap(Resource::loadPixmap("home")); 78 homeButton->setPixmap(Resource::loadPixmap("home"));
79 homeButton->setFixedSize( QSize( 20, 20 ) ); 79 homeButton->setFixedSize( QSize( 20, 20 ) );
80 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); 80 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
81 81
82 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 82 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
83 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 83 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
84 fileMenu->insertSeparator(); 84 fileMenu->insertSeparator();
85 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 85 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
86 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 86 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
87 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 87 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
88 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 88 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
89 fileMenu->insertSeparator(); 89 fileMenu->insertSeparator();
90 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
90 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 91 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
91 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 92 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
92 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 93 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
93 fileMenu->setCheckable(TRUE); 94 fileMenu->setCheckable(TRUE);
94 95
95 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 96 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
96 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 97 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
97 viewMenu->insertSeparator(); 98 viewMenu->insertSeparator();
98 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 99 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
99 viewMenu->setCheckable(TRUE); 100 viewMenu->setCheckable(TRUE);
100 101
101 102
102 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 103 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
103 currentPathCombo->setEditable(TRUE); 104 currentPathCombo->setEditable(TRUE);
104 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 105 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
105 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 106 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
106 107
107 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 108 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
108 109
109 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 110 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
110 111
111 112
112 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); 113 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab);
113// TabWidget = new QTabWidget( this, "TabWidget" ); 114// TabWidget = new QTabWidget( this, "TabWidget" );
114 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); 115 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
115 116
116 tab = new QWidget( TabWidget, "tab" ); 117 tab = new QWidget( TabWidget, "tab" );
117 tabLayout = new QGridLayout( tab ); 118 tabLayout = new QGridLayout( tab );
118 tabLayout->setSpacing( 2); 119 tabLayout->setSpacing( 2);
119 tabLayout->setMargin( 2); 120 tabLayout->setMargin( 2);
120 121
121 Local_View = new QListView( tab, "Local_View" ); 122 Local_View = new QListView( tab, "Local_View" );
122 Local_View->addColumn( tr("File"),130); 123 Local_View->addColumn( tr("File"),130);
123 Local_View->addColumn( tr("Size"),-1); 124 Local_View->addColumn( tr("Size"),-1);
124 Local_View->setColumnAlignment(1,QListView::AlignRight); 125 Local_View->setColumnAlignment(1,QListView::AlignRight);
125 Local_View->addColumn( tr("Date"),-1); 126 Local_View->addColumn( tr("Date"),-1);
126 Local_View->setColumnAlignment(2,QListView::AlignRight); 127 Local_View->setColumnAlignment(2,QListView::AlignRight);
127 Local_View->setAllColumnsShowFocus(TRUE); 128 Local_View->setAllColumnsShowFocus(TRUE);
128 Local_View->setMultiSelection( TRUE ); 129 Local_View->setMultiSelection( TRUE );
129 Local_View->setSelectionMode(QListView::Extended); 130 Local_View->setSelectionMode(QListView::Extended);
130 131
131 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 132 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
132 133
133 tabLayout->addWidget( Local_View, 0, 0 ); 134 tabLayout->addWidget( Local_View, 0, 0 );
134 135
135 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); 136 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1"));
136// TabWidget->insertTab( tab, tr("1")); 137// TabWidget->insertTab( tab, tr("1"));
137 138
138 tab_2 = new QWidget( TabWidget, "tab_2" ); 139 tab_2 = new QWidget( TabWidget, "tab_2" );
139 tabLayout_2 = new QGridLayout( tab_2 ); 140 tabLayout_2 = new QGridLayout( tab_2 );
140 tabLayout_2->setSpacing( 2); 141 tabLayout_2->setSpacing( 2);
141 tabLayout_2->setMargin( 2); 142 tabLayout_2->setMargin( 2);
142 143
143 Remote_View = new QListView( tab_2, "Remote_View" ); 144 Remote_View = new QListView( tab_2, "Remote_View" );
144 Remote_View->addColumn( tr("File"),130); 145 Remote_View->addColumn( tr("File"),130);
145 Remote_View->addColumn( tr("Size"),-1); 146 Remote_View->addColumn( tr("Size"),-1);
146 Remote_View->setColumnAlignment(1,QListView::AlignRight); 147 Remote_View->setColumnAlignment(1,QListView::AlignRight);
147 Remote_View->addColumn( tr("Date"),-1); 148 Remote_View->addColumn( tr("Date"),-1);
148 Remote_View->setColumnAlignment(2,QListView::AlignRight); 149 Remote_View->setColumnAlignment(2,QListView::AlignRight);
149 Remote_View->setAllColumnsShowFocus(TRUE); 150 Remote_View->setAllColumnsShowFocus(TRUE);
150 Remote_View->setMultiSelection( TRUE ); 151 Remote_View->setMultiSelection( TRUE );
151 Remote_View->setSelectionMode(QListView::Extended); 152 Remote_View->setSelectionMode(QListView::Extended);
152 153
153 154
154 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 155 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
155 156
156 tabLayout_2->addWidget( Remote_View, 0, 0 ); 157 tabLayout_2->addWidget( Remote_View, 0, 0 );
157 158
158 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); 159 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
159// TabWidget->insertTab( tab_2, tr( "2")); 160// TabWidget->insertTab( tab_2, tr( "2"));
160 161
161 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 162 /* tab_3 = new QWidget( TabWidget, "tab_3" );
162 tabLayout_3 = new QGridLayout( tab_3 ); 163 tabLayout_3 = new QGridLayout( tab_3 );
163 tabLayout_3->setSpacing( 2); 164 tabLayout_3->setSpacing( 2);
164 tabLayout_3->setMargin( 2); 165 tabLayout_3->setMargin( 2);
165 166
166 167
167 // OFileDialog fileDialog; 168 // OFileDialog fileDialog;
168 // fileDialog; 169 // fileDialog;
169 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 170 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
170 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 171 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
171 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 172 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
172 173
173 QListView *fileTree; 174 QListView *fileTree;
174 fileTree = new QListView( tab_3, "tree" ); 175 fileTree = new QListView( tab_3, "tree" );
175 176
176 177
177 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 178 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
178 179
179 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 180 TabWidget->insertTab( tab_3, tr( "Remote" ) );
180 */ 181 */
181 182
182 /////////////// 183 ///////////////
183 184
184 struct utsname name; /* check for embedix kernel running on the zaurus*/ 185 struct utsname name; /* check for embedix kernel running on the zaurus*/
185 if (uname(&name) != -1) { 186 if (uname(&name) != -1) {
186 QString release=name.release; 187 QString release=name.release;
187 if(release.find("embedix",0,TRUE) !=-1) { 188 if(release.find("embedix",0,TRUE) !=-1) {
188 zaurusDevice=TRUE; 189 zaurusDevice=TRUE;
189 } else { 190 } else {
190 zaurusDevice=FALSE; 191 zaurusDevice=FALSE;
191 sdButton->hide(); 192 sdButton->hide();
192 } 193 }
193 } 194 }
194 195
195 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 196 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
196 currentDir.setPath( QDir::currentDirPath()); 197 currentDir.setPath( QDir::currentDirPath());
197 198
198 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 199 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
199 currentRemoteDir.setPath( QDir::currentDirPath()); 200 currentRemoteDir.setPath( QDir::currentDirPath());
200 201
201 b = TRUE; 202 b = TRUE;
202 203
203 filterStr="*"; 204 filterStr="*";
204 b=FALSE; 205 b=FALSE;
205 TabWidget->setCurrentTab(0); 206 TabWidget->setCurrentTab(0);
206 207
207} 208}
208 209
209void AdvancedFm::initConnections() { 210void AdvancedFm::initConnections() {
210 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 211 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
211 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 212 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
212 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 213 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
213 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 214 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
214 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 215 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
215 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 216 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
216 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 217 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
217 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 218 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),