author | llornkcor <llornkcor> | 2003-05-12 14:03:37 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-12 14:03:37 (UTC) |
commit | 3c19dcc0e905d3142acc9c1ab0ce8349740afe76 (patch) (unidiff) | |
tree | 2fe7fd08d98045e85bd398c19aa835678a005f6d | |
parent | 9659016253efa1e81b782e6fd787225522602428 (diff) | |
download | opie-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.
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 55 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 7 |
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 | |||
@@ -55,12 +55,15 @@ AdvancedFm::AdvancedFm( ) | |||
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 | ||
63 | AdvancedFm::~AdvancedFm() { | 66 | AdvancedFm::~AdvancedFm() { |
64 | } | 67 | } |
65 | 68 | ||
66 | 69 | ||
@@ -803,33 +806,34 @@ void AdvancedFm::removeCustomDir() | |||
803 | 806 | ||
804 | } | 807 | } |
805 | 808 | ||
806 | void AdvancedFm::gotoCustomDir(const QString &dir) | 809 | void 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 | ||
833 | QDir *AdvancedFm::CurrentDir() | 837 | QDir *AdvancedFm::CurrentDir() |
834 | { | 838 | { |
835 | if ( whichTab == 1) | 839 | if ( whichTab == 1) |
@@ -874,6 +878,35 @@ void 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 | |||
885 | void 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 | |||
901 | void 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 | |||
@@ -13,13 +13,15 @@ | |||
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> |
@@ -86,12 +88,13 @@ protected slots: | |||
86 | void switchToLocalTab(); | 88 | void switchToLocalTab(); |
87 | void switchToRemoteTab(); | 89 | void switchToRemoteTab(); |
88 | 90 | ||
89 | protected: | 91 | protected: |
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 | ||
@@ -158,14 +161,18 @@ private: | |||
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 | ||
165 | private slots: | 169 | private 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 |