Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 55 |
1 files changed, 44 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 | |||
@@ -49,24 +49,27 @@ | |||
49 | 49 | ||
50 | AdvancedFm::AdvancedFm( ) | 50 | AdvancedFm::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 | ||
63 | AdvancedFm::~AdvancedFm() { | 66 | AdvancedFm::~AdvancedFm() { |
64 | } | 67 | } |
65 | 68 | ||
66 | 69 | ||
67 | void AdvancedFm::cleanUp() | 70 | void 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 |
@@ -797,45 +800,46 @@ void AdvancedFm::removeCustomDir() | |||
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 | ||
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) |
836 | { | 840 | { |
837 | return ¤tDir; | 841 | return ¤tDir; |
838 | } | 842 | } |
839 | else | 843 | else |
840 | { | 844 | { |
841 | return ¤tRemoteDir; | 845 | return ¤tRemoteDir; |
@@ -868,12 +872,41 @@ QListView * AdvancedFm::OtherView() | |||
868 | return Remote_View; | 872 | return Remote_View; |
869 | else | 873 | else |
870 | return Local_View; | 874 | return Local_View; |
871 | } | 875 | } |
872 | 876 | ||
873 | void AdvancedFm::setOtherTabCurrent() | 877 | 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 | } | ||