-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 209 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 42 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 56 |
3 files changed, 264 insertions, 43 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 9edf7c1..d8bdff7 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -18,2 +18,3 @@ | |||
18 | 18 | ||
19 | #include <qpe/config.h> | ||
19 | #include <qpe/filemanager.h> | 20 | #include <qpe/filemanager.h> |
@@ -29,3 +30,6 @@ | |||
29 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/menubutton.h> | ||
32 | |||
30 | 33 | ||
34 | #include <qregexp.h> | ||
31 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
@@ -92,3 +96,3 @@ void AdvancedFm::cleanUp() { | |||
92 | void AdvancedFm::tabChanged(QWidget *w) { | 96 | void AdvancedFm::tabChanged(QWidget *w) { |
93 | qDebug("tab changed %d",TabWidget->getCurrentTab()); | 97 | // qDebug("tab changed %d",TabWidget->getCurrentTab()); |
94 | 98 | ||
@@ -196,3 +200,3 @@ void AdvancedFm::populateLocalView() { | |||
196 | lstat( mydirent->d_name, &buf); | 200 | lstat( mydirent->d_name, &buf); |
197 | qDebug(mydirent->d_name); | 201 | // qDebug(mydirent->d_name); |
198 | fileL.sprintf("%s", mydirent->d_name); | 202 | fileL.sprintf("%s", mydirent->d_name); |
@@ -295,3 +299,3 @@ void AdvancedFm::populateRemoteView() { | |||
295 | lstat( mydirent->d_name, &buf); | 299 | lstat( mydirent->d_name, &buf); |
296 | qDebug(mydirent->d_name); | 300 | // qDebug(mydirent->d_name); |
297 | fileL.sprintf("%s", mydirent->d_name); | 301 | fileL.sprintf("%s", mydirent->d_name); |
@@ -409,3 +413,3 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , i | |||
409 | { | 413 | { |
410 | qDebug("cancel rename"); | 414 | // qDebug("cancel rename"); |
411 | cancelRename(); | 415 | cancelRename(); |
@@ -417,3 +421,3 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , i | |||
417 | menuTimer.start( 500, TRUE ); | 421 | menuTimer.start( 500, TRUE ); |
418 | qDebug("Start menu timer\n"); | 422 | // qDebug("Start menu timer\n"); |
419 | break; | 423 | break; |
@@ -429,3 +433,3 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, in | |||
429 | { | 433 | { |
430 | qDebug("cancel rename"); | 434 | // qDebug("cancel rename"); |
431 | cancelRename(); | 435 | cancelRename(); |
@@ -436,3 +440,3 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, in | |||
436 | menuTimer.start( 500, TRUE ); | 440 | menuTimer.start( 500, TRUE ); |
437 | qDebug("Start menu timer"); | 441 | // qDebug("Start menu timer"); |
438 | break; | 442 | break; |
@@ -482,3 +486,3 @@ void AdvancedFm::currentPathComboChanged() { | |||
482 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 486 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
483 | qDebug("%d",TabWidget->getCurrentTab()); | 487 | // qDebug("%d",TabWidget->getCurrentTab()); |
484 | if (TabWidget->getCurrentTab() == 0) { | 488 | if (TabWidget->getCurrentTab() == 0) { |
@@ -525,3 +529,3 @@ QStringList AdvancedFm::getPath() { | |||
525 | strList << it.current()->text(0); | 529 | strList << it.current()->text(0); |
526 | qDebug(it.current()->text(0)); | 530 | // qDebug(it.current()->text(0)); |
527 | } | 531 | } |
@@ -535,3 +539,3 @@ QStringList AdvancedFm::getPath() { | |||
535 | strList << it.current()->text(0); | 539 | strList << it.current()->text(0); |
536 | qDebug(it.current()->text(0)); | 540 | // qDebug(it.current()->text(0)); |
537 | } | 541 | } |
@@ -877,3 +881,3 @@ void AdvancedFm::addToDocs() { | |||
877 | curFile = currentDir.canonicalPath()+"/"+(*it); | 881 | curFile = currentDir.canonicalPath()+"/"+(*it); |
878 | qDebug(curFile); | 882 | // qDebug(curFile); |
879 | DocLnk f; | 883 | DocLnk f; |
@@ -887,3 +891,3 @@ void AdvancedFm::addToDocs() { | |||
887 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 891 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
888 | qDebug(curFile); | 892 | // qDebug(curFile); |
889 | 893 | ||
@@ -899 +903,182 @@ void AdvancedFm::addToDocs() { | |||
899 | 903 | ||
904 | |||
905 | void AdvancedFm::customDirsToMenu() | ||
906 | { | ||
907 | |||
908 | Config cfg("AdvancedFm"); | ||
909 | cfg.setGroup("Menu"); | ||
910 | |||
911 | QStringList list = cfg.readListEntry( "CustomDir", ','); | ||
912 | menuButton->insertItems(list ); | ||
913 | |||
914 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | ||
915 | // { | ||
916 | // customDirMenu->insertItem(*it ); | ||
917 | // } | ||
918 | } | ||
919 | |||
920 | void AdvancedFm::dirMenuSelected(int item) | ||
921 | { | ||
922 | qDebug("menu item %d", item); | ||
923 | switch(item) | ||
924 | { | ||
925 | |||
926 | case -21: | ||
927 | case 0: | ||
928 | addCustomDir(); | ||
929 | break; | ||
930 | case -22: | ||
931 | case 1: | ||
932 | removeCustomDir(); | ||
933 | break; | ||
934 | default: | ||
935 | { | ||
936 | // gotoCustomDir( menuButton->text(item)); | ||
937 | // gotoCustomDir( customDirMenu->text(item)); | ||
938 | } | ||
939 | break; | ||
940 | |||
941 | }; | ||
942 | } | ||
943 | |||
944 | void AdvancedFm::addCustomDir() | ||
945 | { | ||
946 | Config cfg("AdvancedFm"); | ||
947 | cfg.setGroup("Menu"); | ||
948 | QString dir; | ||
949 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | ||
950 | |||
951 | if (TabWidget->getCurrentTab() == 0) | ||
952 | { | ||
953 | dir = currentDir.canonicalPath(); | ||
954 | } | ||
955 | else | ||
956 | { | ||
957 | dir = currentRemoteDir.canonicalPath(); | ||
958 | } | ||
959 | |||
960 | bool addIt=true; | ||
961 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | ||
962 | { | ||
963 | if( dir == (*it)) | ||
964 | { | ||
965 | addIt=false; | ||
966 | } | ||
967 | } | ||
968 | if(addIt) | ||
969 | { | ||
970 | menuButton->insertItem(dir); | ||
971 | // customDirMenu->insertItem(dir); | ||
972 | list << dir; | ||
973 | } | ||
974 | |||
975 | cfg.writeEntry("CustomDir", list, ','); | ||
976 | cfg.write(); | ||
977 | } | ||
978 | |||
979 | void AdvancedFm::removeCustomDir() | ||
980 | { | ||
981 | // qDebug("remove custom dir"); | ||
982 | Config cfg("AdvancedFm"); | ||
983 | cfg.setGroup("Menu"); | ||
984 | QString dir; | ||
985 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | ||
986 | QStringList list2; | ||
987 | |||
988 | if (TabWidget->getCurrentTab() == 0) | ||
989 | { | ||
990 | dir = currentDir.canonicalPath(); | ||
991 | } | ||
992 | else | ||
993 | { | ||
994 | dir = currentRemoteDir.canonicalPath(); | ||
995 | } | ||
996 | int ramble=2; | ||
997 | // int ramble=-24; | ||
998 | //first remove list | ||
999 | if(list.grep(dir,true).isEmpty()) | ||
1000 | { | ||
1001 | QMessageBox::message("AdvancedFm",tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!!")); | ||
1002 | } | ||
1003 | else | ||
1004 | { | ||
1005 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | ||
1006 | { | ||
1007 | if((*it) != dir)//current item is not our current dir, so add it to temp list | ||
1008 | { | ||
1009 | list2 <<(*it); | ||
1010 | } | ||
1011 | else | ||
1012 | { | ||
1013 | // customDirMenu->removeItem( ramble); | ||
1014 | menuButton->remove( ramble); | ||
1015 | |||
1016 | } | ||
1017 | ramble++; | ||
1018 | // ramble--; | ||
1019 | } | ||
1020 | |||
1021 | cfg.writeEntry("CustomDir", list2, ','); | ||
1022 | cfg.write(); | ||
1023 | } | ||
1024 | // customDirsToMenu(); | ||
1025 | |||
1026 | } | ||
1027 | |||
1028 | void AdvancedFm::gotoCustomDir(const QString &dir) | ||
1029 | { | ||
1030 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | ||
1031 | QString curDir = dir; | ||
1032 | // if( curDir.isEmpty()) { | ||
1033 | // } | ||
1034 | if( curDir == s_addBookmark) | ||
1035 | { | ||
1036 | addCustomDir(); | ||
1037 | } | ||
1038 | if( curDir == s_removeBookmark) | ||
1039 | { | ||
1040 | removeCustomDir( ); | ||
1041 | } | ||
1042 | else | ||
1043 | { | ||
1044 | if(QDir( curDir).exists() ) | ||
1045 | { | ||
1046 | if (TabWidget->getCurrentTab() == 0) | ||
1047 | { | ||
1048 | currentDir.setPath( curDir ); | ||
1049 | chdir( curDir.latin1() ); | ||
1050 | currentDir.cd( curDir, TRUE); | ||
1051 | populateLocalView(); | ||
1052 | } | ||
1053 | else | ||
1054 | { | ||
1055 | currentRemoteDir.setPath( curDir ); | ||
1056 | chdir( curDir.latin1() ); | ||
1057 | currentRemoteDir.cd( curDir, TRUE); | ||
1058 | populateRemoteView(); | ||
1059 | } | ||
1060 | } | ||
1061 | } | ||
1062 | // menuButton | ||
1063 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | ||
1064 | // QString curDir = dir; | ||
1065 | // if(QDir( curDir).exists() ) | ||
1066 | // { | ||
1067 | // if (TabWidget->getCurrentTab() == 0) | ||
1068 | // { | ||
1069 | // currentDir.setPath( curDir ); | ||
1070 | // chdir( curDir.latin1() ); | ||
1071 | // currentDir.cd( curDir, TRUE); | ||
1072 | // populateLocalView(); | ||
1073 | // } | ||
1074 | // else | ||
1075 | // { | ||
1076 | // currentRemoteDir.setPath( curDir ); | ||
1077 | // chdir( curDir.latin1() ); | ||
1078 | // currentRemoteDir.cd( curDir, TRUE); | ||
1079 | // populateRemoteView(); | ||
1080 | // } | ||
1081 | // } | ||
1082 | // menuButton->setLabel(" "); | ||
1083 | // menuButton | ||
1084 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 42775ee..7478dcb 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -46,2 +46,3 @@ class QListViewItem; | |||
46 | class QLineEdit; | 46 | class QLineEdit; |
47 | class MenuButton; | ||
47 | 48 | ||
@@ -57,19 +58,2 @@ public: | |||
57 | ~AdvancedFm(); | 58 | ~AdvancedFm(); |
58 | |||
59 | OTabWidget *TabWidget; | ||
60 | // QTabWidget *TabWidget; | ||
61 | QWidget *tab, *tab_2, *tab_3; | ||
62 | QListView *Local_View, *Remote_View; | ||
63 | |||
64 | QLineEdit *currentPathEdit; | ||
65 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | ||
66 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | ||
67 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | ||
68 | QDir currentDir, currentRemoteDir; | ||
69 | QComboBox *currentPathCombo; | ||
70 | QString filterStr; | ||
71 | QListViewItem * item; | ||
72 | bool b; | ||
73 | QStringList fileSystemTypeList, fsList; | ||
74 | int currentServerConfig; | ||
75 | protected slots: | 59 | protected slots: |
@@ -116,2 +100,19 @@ protected slots: | |||
116 | protected: | 100 | protected: |
101 | |||
102 | OTabWidget *TabWidget; | ||
103 | // QTabWidget *TabWidget; | ||
104 | QWidget *tab, *tab_2, *tab_3; | ||
105 | QListView *Local_View, *Remote_View; | ||
106 | |||
107 | QLineEdit *currentPathEdit; | ||
108 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | ||
109 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | ||
110 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | ||
111 | QDir currentDir, currentRemoteDir; | ||
112 | QComboBox *currentPathCombo; | ||
113 | QString filterStr, s_addBookmark, s_removeBookmark; | ||
114 | QListViewItem * item; | ||
115 | bool b; | ||
116 | QStringList fileSystemTypeList, fsList; | ||
117 | int currentServerConfig; | ||
117 | bool zaurusDevice; | 118 | bool zaurusDevice; |
@@ -131,2 +132,3 @@ protected: | |||
131 | protected slots: | 132 | protected slots: |
133 | void dirMenuSelected(int); | ||
132 | void showFileMenu(); | 134 | void showFileMenu(); |
@@ -153,2 +155,3 @@ protected slots: | |||
153 | private: | 155 | private: |
156 | MenuButton *menuButton; | ||
154 | QString oldName; | 157 | QString oldName; |
@@ -160,4 +163,9 @@ private: | |||
160 | void okRename(); | 163 | void okRename(); |
164 | void customDirsToMenu(); | ||
165 | void addCustomDir(); | ||
166 | void removeCustomDir(); | ||
167 | |||
161 | private slots: | 168 | private slots: |
162 | void processEnded(); | 169 | void processEnded(); |
170 | void gotoCustomDir(const QString &); | ||
163 | }; | 171 | }; |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 0966f02..bb80dc6 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -18,2 +18,4 @@ | |||
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | #include <qpe/menubutton.h> | ||
20 | #include <qpe/config.h> | ||
19 | 21 | ||
@@ -45,2 +47,3 @@ void AdvancedFm::init() { | |||
45 | viewMenu = new QPopupMenu( this ); | 47 | viewMenu = new QPopupMenu( this ); |
48 | // customDirMenu = new QPopupMenu( this ); | ||
46 | 49 | ||
@@ -50,2 +53,12 @@ void AdvancedFm::init() { | |||
50 | menuBar->insertItem( tr( "View" ), viewMenu); | 53 | menuBar->insertItem( tr( "View" ), viewMenu); |
54 | // menuBar->insertItem( tr( "^" ), customDirMenu); | ||
55 | |||
56 | cdUpButton = new QToolButton( this,"cdUpButton"); | ||
57 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | ||
58 | cdUpButton->setFixedSize( QSize( 20, 20 ) ); | ||
59 | layout->addMultiCellWidget( cdUpButton , 0, 0, 2, 2); | ||
60 | |||
61 | menuButton = new MenuButton(this); | ||
62 | menuButton->setFixedSize( QSize( 20, 20 ) ); | ||
63 | layout->addMultiCellWidget( menuButton , 0, 0, 3, 3); | ||
51 | 64 | ||
@@ -54,3 +67,3 @@ void AdvancedFm::init() { | |||
54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 67 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 68 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 4, 4); |
56 | 69 | ||
@@ -59,3 +72,3 @@ void AdvancedFm::init() { | |||
59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 72 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 73 | layout->addMultiCellWidget( cfButton , 0, 0, 5, 5); |
61 | 74 | ||
@@ -64,8 +77,4 @@ void AdvancedFm::init() { | |||
64 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 77 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 78 | layout->addMultiCellWidget( sdButton , 0, 0, 6, 6); |
66 | 79 | ||
67 | cdUpButton = new QToolButton( this,"cdUpButton"); | ||
68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | ||
69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | ||
70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | ||
71 | 80 | ||
@@ -74,3 +83,3 @@ void AdvancedFm::init() { | |||
74 | docButton->setFixedSize( QSize( 20, 20 ) ); | 83 | docButton->setFixedSize( QSize( 20, 20 ) ); |
75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 84 | layout->addMultiCellWidget( docButton, 0, 0, 7, 7); |
76 | 85 | ||
@@ -79,3 +88,3 @@ void AdvancedFm::init() { | |||
79 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 88 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 89 | layout->addMultiCellWidget( homeButton, 0, 0, 8, 8); |
81 | 90 | ||
@@ -101,2 +110,16 @@ void AdvancedFm::init() { | |||
101 | 110 | ||
111 | s_addBookmark = tr("Bookmark Directory"); | ||
112 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | ||
113 | |||
114 | menuButton->setUseLabel(false); | ||
115 | menuButton->insertItem( s_addBookmark); | ||
116 | menuButton->insertItem( s_removeBookmark); | ||
117 | menuButton->insertSeparator(); | ||
118 | // menuButton->insertItem(""); | ||
119 | |||
120 | // customDirMenu->insertItem(tr("Add This Directory")); | ||
121 | // customDirMenu->insertItem(tr("Remove This Directory")); | ||
122 | // customDirMenu->insertSeparator(); | ||
123 | |||
124 | customDirsToMenu(); | ||
102 | 125 | ||
@@ -104,3 +127,3 @@ void AdvancedFm::init() { | |||
104 | currentPathCombo->setEditable(TRUE); | 127 | currentPathCombo->setEditable(TRUE); |
105 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 128 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); |
106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 129 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
@@ -109,3 +132,3 @@ void AdvancedFm::init() { | |||
109 | 132 | ||
110 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 133 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); |
111 | 134 | ||
@@ -114,3 +137,3 @@ void AdvancedFm::init() { | |||
114 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 137 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
115 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 138 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 8); |
116 | 139 | ||
@@ -216,3 +239,3 @@ void AdvancedFm::initConnections() { | |||
216 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 239 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
217 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 240 | connect( homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
218 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 241 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
@@ -235,3 +258,3 @@ void AdvancedFm::initConnections() { | |||
235 | 258 | ||
236 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 259 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), |
237 | this,SLOT(tabChanged(QWidget*))); | 260 | this,SLOT(tabChanged(QWidget*))); |
@@ -240,2 +263,7 @@ void AdvancedFm::initConnections() { | |||
240 | 263 | ||
264 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); | ||
265 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); | ||
266 | |||
267 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | ||
268 | |||
241 | } | 269 | } |