-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 @@ -53,16 +53,19 @@ AdvancedFm::AdvancedFm( ) renameBox = 0; unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); initConnections(); whichTab=1; rePopulate(); currentPathCombo->setFocus(); + channel = new QCopChannel( "QPE/Application/advancedfm", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); } AdvancedFm::~AdvancedFm() { } void AdvancedFm::cleanUp() { @@ -801,37 +804,38 @@ void AdvancedFm::removeCustomDir() } // customDirsToMenu(); } void AdvancedFm::gotoCustomDir(const QString &dir) { // qDebug("gotoCustomDir(const QString &dir) " +dir ); - QString curDir = dir; - QDir *thisDir = CurrentDir(); +// QString curDir = dir; +// QDir *thisDir = CurrentDir(); // if( curDir.isEmpty()) { // } - if( curDir == s_addBookmark) + if( dir == s_addBookmark) { addCustomDir(); } - if( curDir == s_removeBookmark) + if( dir == s_removeBookmark) { removeCustomDir( ); } else { - if(QDir( curDir).exists() ) - { - thisDir->setPath( curDir ); - chdir( curDir.latin1() ); - thisDir->cd( curDir, TRUE); - populateView(); - } + gotoDirectory( dir); +// if(QDir( curDir).exists() ) +// { +// thisDir->setPath( curDir ); +// chdir( curDir.latin1() ); +// thisDir->cd( curDir, TRUE); +// populateView(); +// } } } QDir *AdvancedFm::CurrentDir() { if ( whichTab == 1) { return ¤tDir; @@ -872,8 +876,37 @@ QListView * AdvancedFm::OtherView() void AdvancedFm::setOtherTabCurrent() { if ( whichTab == 1) TabWidget->setCurrentTab(1); else TabWidget->setCurrentTab(0); } + +void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { + qDebug("qcop message "+msg ); + QDataStream stream ( data, IO_ReadOnly ); + if ( msg == "openDirectory(QString)" ) { + qDebug("received"); + QString file; + stream >> file; + gotoDirectory( (const QString &) file); + } +} + + void AdvancedFm::setDocument(const QString &file) { + gotoDirectory( file); + + } + +void AdvancedFm::gotoDirectory(const QString &file) { + + QString curDir = file; + QDir *thisDir = CurrentDir(); + + if(QDir( curDir).exists() ) { + thisDir->setPath( curDir ); + chdir( curDir.latin1() ); + thisDir->cd( curDir, TRUE); + populateView(); + } +} 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 @@ -11,17 +11,19 @@ ***************************************************************************/ #ifndef ADVANCEDFM_H #define ADVANCEDFM_H #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties #define QT_QWS_OPIE //#include <opie/otabwidget.h> #include <opie/oprocess.h> + #include <qpe/ir.h> +#include <qpe/qcopenvelope_qws.h> #include <qvariant.h> #include <qdialog.h> #include <qmainwindow.h> #include <qstringlist.h> #include <qdir.h> #include <qstring.h> #include <qpoint.h> @@ -84,16 +86,17 @@ protected slots: QStringList getPath(); void mkSym(); void switchToLocalTab(); void switchToRemoteTab(); protected: OTabWidget *TabWidget; + QCopChannel * channel; QPixmap unknownXpm; int whichTab; // QTabWidget *TabWidget; QWidget *tab, *tab_2, *tab_3; QListView *Local_View, *Remote_View; QLineEdit *currentPathEdit; QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; @@ -156,16 +159,20 @@ private: void startProcess(const QString &); bool eventFilter( QObject * , QEvent * ); void cancelRename(); void doRename(QListView *); void okRename(); void customDirsToMenu(); void addCustomDir(); void removeCustomDir(); + void gotoDirectory(const QString &); private slots: void processEnded(OProcess *); void oprocessStderr(OProcess *, char *, int); void gotoCustomDir(const QString &); + void qcopReceive(const QCString&, const QByteArray&); + void setDocument(const QString &); + }; #endif // ADVANCEDFM_H |