Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 6b7fa1f..60558e7 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -881,32 +881,55 @@ void AdvancedFm::setOtherTabCurrent() | |||
881 | else | 881 | else |
882 | TabWidget->setCurrentTab(0); | 882 | TabWidget->setCurrentTab(0); |
883 | } | 883 | } |
884 | 884 | ||
885 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 885 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
886 | qDebug("qcop message "+msg ); | 886 | qDebug("qcop message "+msg ); |
887 | QDataStream stream ( data, IO_ReadOnly ); | 887 | QDataStream stream ( data, IO_ReadOnly ); |
888 | if ( msg == "openDirectory(QString)" ) { | 888 | if ( msg == "openDirectory(QString)" ) { |
889 | qDebug("received"); | 889 | qDebug("received"); |
890 | QString file; | 890 | QString file; |
891 | stream >> file; | 891 | stream >> file; |
892 | gotoDirectory( (const QString &) file); | 892 | gotoDirectory( (const QString &) file); |
893 | } | 893 | } |
894 | } | 894 | } |
895 | 895 | ||
896 | void AdvancedFm::setDocument(const QString &file) { | 896 | void AdvancedFm::setDocument(const QString &file) { |
897 | gotoDirectory( file); | 897 | gotoDirectory( file); |
898 | 898 | ||
899 | } | 899 | } |
900 | 900 | ||
901 | void AdvancedFm::gotoDirectory(const QString &file) { | 901 | void AdvancedFm::gotoDirectory(const QString &file) { |
902 | 902 | ||
903 | QString curDir = file; | 903 | QString curDir = file; |
904 | QDir *thisDir = CurrentDir(); | 904 | QDir *thisDir = CurrentDir(); |
905 | 905 | if(QDir( curDir).exists() ) { | |
906 | if(QDir( curDir).exists() ) { | ||
907 | thisDir->setPath( curDir ); | 906 | thisDir->setPath( curDir ); |
908 | chdir( curDir.latin1() ); | 907 | chdir( curDir.latin1() ); |
909 | thisDir->cd( curDir, TRUE); | 908 | thisDir->cd( curDir, TRUE); |
910 | populateView(); | 909 | populateView(); |
911 | } | 910 | } |
911 | else if(QFileInfo(curDir).exists()) { | ||
912 | QFileInfo fileInfo(curDir); | ||
913 | curDir=fileInfo.dirPath(); | ||
914 | if(QDir( curDir).exists() ) { | ||
915 | thisDir->setPath( curDir ); | ||
916 | chdir( curDir.latin1() ); | ||
917 | thisDir->cd( curDir, TRUE); | ||
918 | populateView(); | ||
919 | } | ||
920 | findFile(file); | ||
921 | } | ||
922 | |||
923 | } | ||
924 | |||
925 | void AdvancedFm::findFile(const QString &fileName) { | ||
926 | QFileInfo fi(fileName); | ||
927 | QListView *thisView = CurrentView(); | ||
928 | QListViewItemIterator it( thisView ); | ||
929 | for ( ; it.current(); ++it ) { | ||
930 | if(it.current()->text(0) == fi.fileName()) { | ||
931 | it.current()->setSelected(true); | ||
932 | thisView->ensureItemVisible(it.current()); | ||
933 | } | ||
934 | } | ||
912 | } | 935 | } |