summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-05-12 14:03:37 (UTC)
committer llornkcor <llornkcor>2003-05-12 14:03:37 (UTC)
commit3c19dcc0e905d3142acc9c1ab0ce8349740afe76 (patch) (unidiff)
tree2fe7fd08d98045e85bd398c19aa835678a005f6d
parent9659016253efa1e81b782e6fd787225522602428 (diff)
downloadopie-3c19dcc0e905d3142acc9c1ab0ce8349740afe76.zip
opie-3c19dcc0e905d3142acc9c1ab0ce8349740afe76.tar.gz
opie-3c19dcc0e905d3142acc9c1ab0ce8349740afe76.tar.bz2
added setDocument(QString) and openDirectory(QString) qcop messages to show open directory. use setDocument if you are unsure if advancedfm is executed already.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp55
-rw-r--r--noncore/apps/advancedfm/advancedfm.h7
2 files changed, 51 insertions, 11 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index d4351b0..6b7fa1f 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -37,48 +37,51 @@
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qimage.h> 39#include <qimage.h>
40#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qlineedit.h> 41#include <qlineedit.h>
42 42
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <time.h> 44#include <time.h>
45#include <dirent.h> 45#include <dirent.h>
46#include <fcntl.h> 46#include <fcntl.h>
47#include <sys/vfs.h> 47#include <sys/vfs.h>
48#include <mntent.h> 48#include <mntent.h>
49 49
50AdvancedFm::AdvancedFm( ) 50AdvancedFm::AdvancedFm( )
51 : QMainWindow( ) { 51 : QMainWindow( ) {
52 init(); 52 init();
53 renameBox = 0; 53 renameBox = 0;
54 54
55 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 55 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
56 56
57 initConnections(); 57 initConnections();
58 whichTab=1; 58 whichTab=1;
59 rePopulate(); 59 rePopulate();
60 currentPathCombo->setFocus(); 60 currentPathCombo->setFocus();
61 channel = new QCopChannel( "QPE/Application/advancedfm", this );
62 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
63 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
61} 64}
62 65
63AdvancedFm::~AdvancedFm() { 66AdvancedFm::~AdvancedFm() {
64} 67}
65 68
66 69
67void AdvancedFm::cleanUp() 70void AdvancedFm::cleanUp()
68{ 71{
69 QString sfile=QDir::homeDirPath(); 72 QString sfile=QDir::homeDirPath();
70 if(sfile.right(1) != "/") 73 if(sfile.right(1) != "/")
71 sfile+="/._temp"; 74 sfile+="/._temp";
72 else 75 else
73 sfile+="._temp"; 76 sfile+="._temp";
74 QFile file( sfile); 77 QFile file( sfile);
75 if(file.exists()) 78 if(file.exists())
76 file.remove(); 79 file.remove();
77} 80}
78 81
79void AdvancedFm::tabChanged(QWidget *w) 82void AdvancedFm::tabChanged(QWidget *w)
80{ 83{
81 if( w == tab) 84 if( w == tab)
82 whichTab = 1; 85 whichTab = 1;
83 else 86 else
84 whichTab = 2; 87 whichTab = 2;
@@ -785,69 +788,70 @@ void AdvancedFm::removeCustomDir()
785 if((*it) != dir)//current item is not our current dir, so add it to temp list 788 if((*it) != dir)//current item is not our current dir, so add it to temp list
786 { 789 {
787 list2 <<(*it); 790 list2 <<(*it);
788 } 791 }
789 else 792 else
790 { 793 {
791// customDirMenu->removeItem( ramble); 794// customDirMenu->removeItem( ramble);
792 menuButton->remove( ramble); 795 menuButton->remove( ramble);
793 796
794 } 797 }
795 ramble++; 798 ramble++;
796// ramble--; 799// ramble--;
797 } 800 }
798 801
799 cfg.writeEntry("CustomDir", list2, ','); 802 cfg.writeEntry("CustomDir", list2, ',');
800 cfg.write(); 803 cfg.write();
801 } 804 }
802// customDirsToMenu(); 805// customDirsToMenu();
803 806
804} 807}
805 808
806void AdvancedFm::gotoCustomDir(const QString &dir) 809void AdvancedFm::gotoCustomDir(const QString &dir)
807{ 810{
808// qDebug("gotoCustomDir(const QString &dir) " +dir ); 811// qDebug("gotoCustomDir(const QString &dir) " +dir );
809 QString curDir = dir; 812// QString curDir = dir;
810 QDir *thisDir = CurrentDir(); 813// QDir *thisDir = CurrentDir();
811// if( curDir.isEmpty()) { 814// if( curDir.isEmpty()) {
812// } 815// }
813 if( curDir == s_addBookmark) 816 if( dir == s_addBookmark)
814 { 817 {
815 addCustomDir(); 818 addCustomDir();
816 } 819 }
817 if( curDir == s_removeBookmark) 820 if( dir == s_removeBookmark)
818 { 821 {
819 removeCustomDir( ); 822 removeCustomDir( );
820 } 823 }
821 else 824 else
822 { 825 {
823 if(QDir( curDir).exists() ) 826 gotoDirectory( dir);
824 { 827// if(QDir( curDir).exists() )
825 thisDir->setPath( curDir ); 828// {
826 chdir( curDir.latin1() ); 829// thisDir->setPath( curDir );
827 thisDir->cd( curDir, TRUE); 830// chdir( curDir.latin1() );
828 populateView(); 831// thisDir->cd( curDir, TRUE);
829 } 832// populateView();
833// }
830 } 834 }
831} 835}
832 836
833QDir *AdvancedFm::CurrentDir() 837QDir *AdvancedFm::CurrentDir()
834{ 838{
835 if ( whichTab == 1) 839 if ( whichTab == 1)
836 { 840 {
837 return &currentDir; 841 return &currentDir;
838 } 842 }
839 else 843 else
840 { 844 {
841 return &currentRemoteDir; 845 return &currentRemoteDir;
842 } 846 }
843} 847}
844 848
845QDir *AdvancedFm::OtherDir() 849QDir *AdvancedFm::OtherDir()
846{ 850{
847 if ( whichTab == 1) 851 if ( whichTab == 1)
848 { 852 {
849 return &currentRemoteDir; 853 return &currentRemoteDir;
850 } 854 }
851 else 855 else
852 { 856 {
853 return &currentDir; 857 return &currentDir;
@@ -856,24 +860,53 @@ QDir *AdvancedFm::OtherDir()
856 860
857QListView * AdvancedFm::CurrentView() 861QListView * AdvancedFm::CurrentView()
858{ 862{
859 if ( whichTab == 1) 863 if ( whichTab == 1)
860 return Local_View; 864 return Local_View;
861 else 865 else
862 return Remote_View; 866 return Remote_View;
863} 867}
864 868
865QListView * AdvancedFm::OtherView() 869QListView * AdvancedFm::OtherView()
866{ 870{
867 if ( whichTab == 1) 871 if ( whichTab == 1)
868 return Remote_View; 872 return Remote_View;
869 else 873 else
870 return Local_View; 874 return Local_View;
871} 875}
872 876
873void AdvancedFm::setOtherTabCurrent() 877void AdvancedFm::setOtherTabCurrent()
874{ 878{
875 if ( whichTab == 1) 879 if ( whichTab == 1)
876 TabWidget->setCurrentTab(1); 880 TabWidget->setCurrentTab(1);
877 else 881 else
878 TabWidget->setCurrentTab(0); 882 TabWidget->setCurrentTab(0);
879} 883}
884
885void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
886 qDebug("qcop message "+msg );
887 QDataStream stream ( data, IO_ReadOnly );
888 if ( msg == "openDirectory(QString)" ) {
889 qDebug("received");
890 QString file;
891 stream >> file;
892 gotoDirectory( (const QString &) file);
893 }
894}
895
896 void AdvancedFm::setDocument(const QString &file) {
897 gotoDirectory( file);
898
899 }
900
901void AdvancedFm::gotoDirectory(const QString &file) {
902
903 QString curDir = file;
904 QDir *thisDir = CurrentDir();
905
906 if(QDir( curDir).exists() ) {
907 thisDir->setPath( curDir );
908 chdir( curDir.latin1() );
909 thisDir->cd( curDir, TRUE);
910 populateView();
911 }
912}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 4480051..c9a5525 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,43 +1,45 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfm.h 2 advancedfm.h
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#ifndef ADVANCEDFM_H 12#ifndef ADVANCEDFM_H
13#define ADVANCEDFM_H 13#define ADVANCEDFM_H
14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties 14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
15#define QT_QWS_OPIE 15#define QT_QWS_OPIE
16 16
17//#include <opie/otabwidget.h> 17//#include <opie/otabwidget.h>
18#include <opie/oprocess.h> 18#include <opie/oprocess.h>
19
19#include <qpe/ir.h> 20#include <qpe/ir.h>
21#include <qpe/qcopenvelope_qws.h>
20 22
21#include <qvariant.h> 23#include <qvariant.h>
22#include <qdialog.h> 24#include <qdialog.h>
23#include <qmainwindow.h> 25#include <qmainwindow.h>
24#include <qstringlist.h> 26#include <qstringlist.h>
25#include <qdir.h> 27#include <qdir.h>
26#include <qstring.h> 28#include <qstring.h>
27#include <qpoint.h> 29#include <qpoint.h>
28#include <qtimer.h> 30#include <qtimer.h>
29#include <qpixmap.h> 31#include <qpixmap.h>
30 32
31class OTabWidget; 33class OTabWidget;
32class QVBoxLayout; 34class QVBoxLayout;
33class QHBoxLayout; 35class QHBoxLayout;
34class QGridLayout; 36class QGridLayout;
35class QComboBox; 37class QComboBox;
36class QListView; 38class QListView;
37class QListviewItem; 39class QListviewItem;
38class QLabel; 40class QLabel;
39class QProgressBar; 41class QProgressBar;
40class QSpinBox; 42class QSpinBox;
41class QTabWidget; 43class QTabWidget;
42class QWidget; 44class QWidget;
43class QPopupMenu; 45class QPopupMenu;
@@ -68,48 +70,49 @@ protected slots:
68 void showMenuHidden(); 70 void showMenuHidden();
69 void writeConfig(); 71 void writeConfig();
70 void readConfig(); 72 void readConfig();
71 void ListClicked(QListViewItem *); 73 void ListClicked(QListViewItem *);
72 void ListPressed( int, QListViewItem *, const QPoint&, int); 74 void ListPressed( int, QListViewItem *, const QPoint&, int);
73 void makeDir(); 75 void makeDir();
74 void doDelete(); 76 void doDelete();
75 void tabChanged(QWidget*); 77 void tabChanged(QWidget*);
76 void cleanUp(); 78 void cleanUp();
77 void renameIt(); 79 void renameIt();
78 void runThis(); 80 void runThis();
79 void runText(); 81 void runText();
80 void filePerms(); 82 void filePerms();
81 void doProperties(); 83 void doProperties();
82 void runCommand(); 84 void runCommand();
83 void runCommandStd(); 85 void runCommandStd();
84 QStringList getPath(); 86 QStringList getPath();
85 void mkSym(); 87 void mkSym();
86 void switchToLocalTab(); 88 void switchToLocalTab();
87 void switchToRemoteTab(); 89 void switchToRemoteTab();
88 90
89protected: 91protected:
90 92
91 OTabWidget *TabWidget; 93 OTabWidget *TabWidget;
94 QCopChannel * channel;
92 QPixmap unknownXpm; 95 QPixmap unknownXpm;
93 int whichTab; 96 int whichTab;
94// QTabWidget *TabWidget; 97// QTabWidget *TabWidget;
95 QWidget *tab, *tab_2, *tab_3; 98 QWidget *tab, *tab_2, *tab_3;
96 QListView *Local_View, *Remote_View; 99 QListView *Local_View, *Remote_View;
97 100
98 QLineEdit *currentPathEdit; 101 QLineEdit *currentPathEdit;
99 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 102 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
100 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 103 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
101// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 104// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
102 QDir currentDir, currentRemoteDir; 105 QDir currentDir, currentRemoteDir;
103 QComboBox *currentPathCombo; 106 QComboBox *currentPathCombo;
104 QString filterStr, s_addBookmark, s_removeBookmark; 107 QString filterStr, s_addBookmark, s_removeBookmark;
105 QListViewItem * item; 108 QListViewItem * item;
106 bool b; 109 bool b;
107 QStringList fileSystemTypeList, fsList; 110 QStringList fileSystemTypeList, fsList;
108 int currentServerConfig; 111 int currentServerConfig;
109 bool zaurusDevice; 112 bool zaurusDevice;
110 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 113 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
111 QStringList remoteDirPathStringList, localDirPathStringList; 114 QStringList remoteDirPathStringList, localDirPathStringList;
112 QLineEdit *renameBox; 115 QLineEdit *renameBox;
113 116
114 void init(); 117 void init();
115 void initConnections(); 118 void initConnections();
@@ -140,32 +143,36 @@ protected slots:
140 void copy(); 143 void copy();
141 void copyAs(); 144 void copyAs();
142 void copySameDir(); 145 void copySameDir();
143 void currentPathComboActivated(const QString &); 146 void currentPathComboActivated(const QString &);
144 void fillCombo(const QString &); 147 void fillCombo(const QString &);
145 bool copyFile( const QString & , const QString & ); 148 bool copyFile( const QString & , const QString & );
146 void move(); 149 void move();
147 void fileStatus(); 150 void fileStatus();
148 void doAbout(); 151 void doAbout();
149 void doBeam(); 152 void doBeam();
150 void fileBeamFinished( Ir *); 153 void fileBeamFinished( Ir *);
151 154
152private: 155private:
153 MenuButton *menuButton; 156 MenuButton *menuButton;
154 QString oldName; 157 QString oldName;
155 QTimer menuTimer; 158 QTimer menuTimer;
156 void startProcess(const QString &); 159 void startProcess(const QString &);
157 bool eventFilter( QObject * , QEvent * ); 160 bool eventFilter( QObject * , QEvent * );
158 void cancelRename(); 161 void cancelRename();
159 void doRename(QListView *); 162 void doRename(QListView *);
160 void okRename(); 163 void okRename();
161 void customDirsToMenu(); 164 void customDirsToMenu();
162 void addCustomDir(); 165 void addCustomDir();
163 void removeCustomDir(); 166 void removeCustomDir();
167 void gotoDirectory(const QString &);
164 168
165private slots: 169private slots:
166 void processEnded(OProcess *); 170 void processEnded(OProcess *);
167 void oprocessStderr(OProcess *, char *, int); 171 void oprocessStderr(OProcess *, char *, int);
168 void gotoCustomDir(const QString &); 172 void gotoCustomDir(const QString &);
173 void qcopReceive(const QCString&, const QByteArray&);
174 void setDocument(const QString &);
175
169}; 176};
170 177
171#endif // ADVANCEDFM_H 178#endif // ADVANCEDFM_H