From 3c19dcc0e905d3142acc9c1ab0ce8349740afe76 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Mon, 12 May 2003 14:03:37 +0000 Subject: added setDocument(QString) and openDirectory(QString) qcop messages to show open directory. use setDocument if you are unsure if advancedfm is executed already. --- 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 @@ -58,6 +58,9 @@ AdvancedFm::AdvancedFm( ) 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() { @@ -806,27 +809,28 @@ void AdvancedFm::removeCustomDir() 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(); +// } } } @@ -877,3 +881,32 @@ void AdvancedFm::setOtherTabCurrent() 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 @@ -16,7 +16,9 @@ //#include #include + #include +#include #include #include @@ -89,6 +91,7 @@ protected slots: protected: OTabWidget *TabWidget; + QCopChannel * channel; QPixmap unknownXpm; int whichTab; // QTabWidget *TabWidget; @@ -161,11 +164,15 @@ private: 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 -- cgit v0.9.0.2