author | llornkcor <llornkcor> | 2003-02-24 04:08:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-24 04:08:24 (UTC) |
commit | d5746c625ebf540711179ef01a7bb99bc3b2c3d6 (patch) (unidiff) | |
tree | 6fc93d296422f38e1beb27828b5b0b1dc3cf497c | |
parent | 009b85e8daa341d4a2fc62404f4a58715e775b86 (diff) | |
download | opie-d5746c625ebf540711179ef01a7bb99bc3b2c3d6.zip opie-d5746c625ebf540711179ef01a7bb99bc3b2c3d6.tar.gz opie-d5746c625ebf540711179ef01a7bb99bc3b2c3d6.tar.bz2 |
fix hidden again
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 19 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 3 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 5 |
3 files changed, 18 insertions, 9 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index d56e746..bb7f346 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -29,140 +29,137 @@ | |||
29 | #include <qpe/ir.h> | 29 | #include <qpe/ir.h> |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/menubutton.h> | 31 | #include <qpe/menubutton.h> |
32 | 32 | ||
33 | 33 | ||
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qprogressbar.h> | 47 | #include <qprogressbar.h> |
48 | #include <qspinbox.h> | 48 | #include <qspinbox.h> |
49 | #include <qwidget.h> | 49 | #include <qwidget.h> |
50 | #include <qlayout.h> | 50 | #include <qlayout.h> |
51 | #include <qimage.h> | 51 | #include <qimage.h> |
52 | #include <qpixmap.h> | 52 | #include <qpixmap.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qlineedit.h> | 54 | #include <qlineedit.h> |
55 | #include <qregexp.h> | 55 | #include <qregexp.h> |
56 | 56 | ||
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | #include <stdlib.h> | 58 | #include <stdlib.h> |
59 | #include <sys/stat.h> | 59 | #include <sys/stat.h> |
60 | #include <dirent.h> | 60 | #include <dirent.h> |
61 | #include <stdio.h> | 61 | #include <stdio.h> |
62 | #include <time.h> | 62 | #include <time.h> |
63 | #include <fcntl.h> | 63 | #include <fcntl.h> |
64 | #include <mntent.h> | 64 | #include <mntent.h> |
65 | #include <string.h> | 65 | #include <string.h> |
66 | #include <errno.h> | 66 | #include <errno.h> |
67 | #include <sys/vfs.h> | 67 | #include <sys/vfs.h> |
68 | #include <mntent.h> | 68 | #include <mntent.h> |
69 | #include <sys/utsname.h> | 69 | #include <sys/utsname.h> |
70 | 70 | ||
71 | AdvancedFm::AdvancedFm( ) | 71 | AdvancedFm::AdvancedFm( ) |
72 | : QMainWindow( ) { | 72 | : QMainWindow( ) { |
73 | init(); | 73 | init(); |
74 | renameBox = 0; | 74 | renameBox = 0; |
75 | 75 | ||
76 | initConnections(); | 76 | initConnections(); |
77 | TabWidget->setCurrentTab(1); | 77 | whichTab=1; |
78 | populateView(); | 78 | rePopulate(); |
79 | TabWidget->setCurrentTab(0); | ||
80 | populateView(); | ||
81 | currentPathCombo->setFocus(); | 79 | currentPathCombo->setFocus(); |
82 | } | 80 | } |
83 | 81 | ||
84 | AdvancedFm::~AdvancedFm() { | 82 | AdvancedFm::~AdvancedFm() { |
85 | } | 83 | } |
86 | 84 | ||
87 | 85 | ||
88 | void AdvancedFm::cleanUp() | 86 | void AdvancedFm::cleanUp() |
89 | { | 87 | { |
90 | QString sfile=QDir::homeDirPath(); | 88 | QString sfile=QDir::homeDirPath(); |
91 | if(sfile.right(1) != "/") | 89 | if(sfile.right(1) != "/") |
92 | sfile+="/._temp"; | 90 | sfile+="/._temp"; |
93 | else | 91 | else |
94 | sfile+="._temp"; | 92 | sfile+="._temp"; |
95 | QFile file( sfile); | 93 | QFile file( sfile); |
96 | if(file.exists()) | 94 | if(file.exists()) |
97 | file.remove(); | 95 | file.remove(); |
98 | } | 96 | } |
99 | 97 | ||
100 | void AdvancedFm::tabChanged(QWidget *w) | 98 | void AdvancedFm::tabChanged(QWidget *w) |
101 | { | 99 | { |
102 | if( w == tab) | 100 | if( w == tab) |
103 | whichTab = 1; | 101 | whichTab = 1; |
104 | else | 102 | else |
105 | whichTab = 2; | 103 | whichTab = 2; |
106 | 104 | ||
107 | //qDebug("tab changed %d", whichTab ); | 105 | //qDebug("tab changed %d", whichTab ); |
108 | 106 | ||
109 | QString path = CurrentDir()->canonicalPath(); | 107 | QString path = CurrentDir()->canonicalPath(); |
110 | currentPathCombo->lineEdit()->setText( path ); | 108 | currentPathCombo->lineEdit()->setText( path ); |
111 | 109 | ||
112 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 110 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
113 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 111 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
114 | 112 | ||
115 | QString fs= getFileSystemType( (const QString &) path); | 113 | QString fs= getFileSystemType( (const QString &) path); |
116 | 114 | ||
117 | setCaption("AdvancedFm :: "+fs+" :: " | 115 | setCaption("AdvancedFm :: "+fs+" :: " |
118 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 116 | +checkDiskSpace( (const QString &) path )+ " kB free" ); |
119 | chdir( path.latin1()); | 117 | chdir( path.latin1()); |
120 | //2populateView(); | ||
121 | } | 118 | } |
122 | 119 | ||
123 | 120 | ||
124 | void AdvancedFm::populateView() | 121 | void AdvancedFm::populateView() |
125 | { | 122 | { |
126 | QPixmap pm; | 123 | QPixmap pm; |
127 | QListView *thisView = CurrentView(); | 124 | QListView *thisView = CurrentView(); |
128 | QDir *thisDir = CurrentDir(); | 125 | QDir *thisDir = CurrentDir(); |
129 | QString path = thisDir->canonicalPath(); | 126 | QString path = thisDir->canonicalPath(); |
130 | 127 | ||
131 | thisView->clear(); | 128 | thisView->clear(); |
132 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 129 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
133 | thisDir->setMatchAllDirs(TRUE); | 130 | thisDir->setMatchAllDirs(TRUE); |
134 | thisDir->setNameFilter(filterStr); | 131 | thisDir->setNameFilter(filterStr); |
135 | QString fileL, fileS, fileDate; | 132 | QString fileL, fileS, fileDate; |
136 | QString fs= getFileSystemType((const QString &) path); | 133 | QString fs= getFileSystemType((const QString &) path); |
137 | setCaption("AdvancedFm :: "+fs+" :: " | 134 | setCaption("AdvancedFm :: "+fs+" :: " |
138 | +checkDiskSpace((const QString &) path)+" kB free" ); | 135 | +checkDiskSpace((const QString &) path)+" kB free" ); |
139 | bool isDir=FALSE; | 136 | bool isDir=FALSE; |
140 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 137 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
141 | QFileInfoListIterator it(*list); | 138 | QFileInfoListIterator it(*list); |
142 | QFileInfo *fi; | 139 | QFileInfo *fi; |
143 | while ( (fi=it.current()) ) | 140 | while ( (fi=it.current()) ) |
144 | { | 141 | { |
145 | if (fi->isSymLink() ) | 142 | if (fi->isSymLink() ) |
146 | { | 143 | { |
147 | QString symLink=fi->readLink(); | 144 | QString symLink=fi->readLink(); |
148 | QFileInfo sym( symLink); | 145 | QFileInfo sym( symLink); |
149 | fileS.sprintf( "%10i", sym.size() ); | 146 | fileS.sprintf( "%10i", sym.size() ); |
150 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 147 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
151 | fileDate = sym.lastModified().toString(); | 148 | fileDate = sym.lastModified().toString(); |
152 | } | 149 | } |
153 | else | 150 | else |
154 | { | 151 | { |
155 | fileS.sprintf( "%10i", fi->size() ); | 152 | fileS.sprintf( "%10i", fi->size() ); |
156 | fileL.sprintf( "%s",fi->fileName().data() ); | 153 | fileL.sprintf( "%s",fi->fileName().data() ); |
157 | fileDate= fi->lastModified().toString(); | 154 | fileDate= fi->lastModified().toString(); |
158 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) | 155 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) |
159 | { | 156 | { |
160 | fileL+="/"; | 157 | fileL+="/"; |
161 | isDir=TRUE; | 158 | isDir=TRUE; |
162 | } | 159 | } |
163 | } | 160 | } |
164 | 161 | ||
165 | QFileInfo fileInfo( path + "/" + fileL); | 162 | QFileInfo fileInfo( path + "/" + fileL); |
166 | 163 | ||
167 | if(fileL !="./" && fi->exists()) | 164 | if(fileL !="./" && fi->exists()) |
168 | { | 165 | { |
@@ -198,96 +195,108 @@ void AdvancedFm::populateView() | |||
198 | } | 195 | } |
199 | item->setPixmap( 0,pm); | 196 | item->setPixmap( 0,pm); |
200 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) | 197 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) |
201 | { | 198 | { |
202 | // overlay link image | 199 | // overlay link image |
203 | pm= Resource::loadPixmap( "folder" ); | 200 | pm= Resource::loadPixmap( "folder" ); |
204 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 201 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
205 | QPainter painter( &pm ); | 202 | QPainter painter( &pm ); |
206 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 203 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
207 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 204 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
208 | item->setPixmap( 0, pm); | 205 | item->setPixmap( 0, pm); |
209 | } | 206 | } |
210 | } | 207 | } |
211 | isDir=FALSE; | 208 | isDir=FALSE; |
212 | ++it; | 209 | ++it; |
213 | } | 210 | } |
214 | 211 | ||
215 | if( path.find("dev",0,TRUE) != -1) | 212 | if( path.find("dev",0,TRUE) != -1) |
216 | { | 213 | { |
217 | struct stat buf; | 214 | struct stat buf; |
218 | dev_t devT; | 215 | dev_t devT; |
219 | DIR *dir; | 216 | DIR *dir; |
220 | struct dirent *mydirent; | 217 | struct dirent *mydirent; |
221 | 218 | ||
222 | if((dir = opendir( path.latin1())) != NULL) | 219 | if((dir = opendir( path.latin1())) != NULL) |
223 | while ((mydirent = readdir(dir)) != NULL) | 220 | while ((mydirent = readdir(dir)) != NULL) |
224 | { | 221 | { |
225 | lstat( mydirent->d_name, &buf); | 222 | lstat( mydirent->d_name, &buf); |
226 | // qDebug(mydirent->d_name); | 223 | // qDebug(mydirent->d_name); |
227 | fileL.sprintf("%s", mydirent->d_name); | 224 | fileL.sprintf("%s", mydirent->d_name); |
228 | devT = buf.st_dev; | 225 | devT = buf.st_dev; |
229 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 226 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
230 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 227 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
231 | if( fileL.find(".") == -1 ) | 228 | if( fileL.find(".") == -1 ) |
232 | { | 229 | { |
233 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 230 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
234 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 231 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
235 | item->setPixmap( 0,pm); | 232 | item->setPixmap( 0,pm); |
236 | } | 233 | } |
237 | } | 234 | } |
238 | 235 | ||
239 | closedir(dir); | 236 | closedir(dir); |
240 | } | 237 | } |
241 | 238 | ||
242 | thisView->setSorting( 3,FALSE); | 239 | thisView->setSorting( 3,FALSE); |
243 | fillCombo( (const QString &) path ); | 240 | fillCombo( (const QString &) path ); |
244 | } | 241 | } |
245 | 242 | ||
243 | void AdvancedFm::rePopulate() | ||
244 | { | ||
245 | int tmpTab = whichTab; | ||
246 | qDebug("%d", tmpTab); | ||
247 | |||
248 | for(int i =1; i < 3; i++) | ||
249 | { | ||
250 | TabWidget->setCurrentTab(i - 1); | ||
251 | populateView(); | ||
252 | } | ||
253 | TabWidget->setCurrentTab( tmpTab - 1); | ||
254 | } | ||
246 | 255 | ||
247 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) | 256 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) |
248 | { | 257 | { |
249 | if(selectedItem) | 258 | if(selectedItem) |
250 | { | 259 | { |
251 | QString strItem=selectedItem->text(0); | 260 | QString strItem=selectedItem->text(0); |
252 | QString strSize=selectedItem->text(1); | 261 | QString strSize=selectedItem->text(1); |
253 | strSize=strSize.stripWhiteSpace(); | 262 | strSize=strSize.stripWhiteSpace(); |
254 | bool isDirectory = false; | 263 | bool isDirectory = false; |
255 | QString strItem2; | 264 | QString strItem2; |
256 | 265 | ||
257 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 266 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink |
258 | { | 267 | { |
259 | strItem2 = dealWithSymName((const QString&)strItem); | 268 | strItem2 = dealWithSymName((const QString&)strItem); |
260 | if(QDir(strItem2).exists() ) | 269 | if(QDir(strItem2).exists() ) |
261 | strItem = strItem2; | 270 | strItem = strItem2; |
262 | } | 271 | } |
263 | 272 | ||
264 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 273 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) |
265 | { | 274 | { |
266 | 275 | ||
267 | if(QDir(strItem).exists()) | 276 | if(QDir(strItem).exists()) |
268 | isDirectory = true; | 277 | isDirectory = true; |
269 | } | 278 | } |
270 | 279 | ||
271 | if( isDirectory ) | 280 | if( isDirectory ) |
272 | { | 281 | { |
273 | CurrentDir()->cd( strItem, TRUE); | 282 | CurrentDir()->cd( strItem, TRUE); |
274 | populateView(); | 283 | populateView(); |
275 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 284 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
276 | } | 285 | } |
277 | chdir( strItem.latin1()); | 286 | chdir( strItem.latin1()); |
278 | } | 287 | } |
279 | } | 288 | } |
280 | 289 | ||
281 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 290 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
282 | switch (mouse) { | 291 | switch (mouse) { |
283 | case 1: | 292 | case 1: |
284 | { | 293 | { |
285 | if(renameBox != 0 ) | 294 | if(renameBox != 0 ) |
286 | { | 295 | { |
287 | cancelRename(); | 296 | cancelRename(); |
288 | } | 297 | } |
289 | } | 298 | } |
290 | break; | 299 | break; |
291 | case 2: | 300 | case 2: |
292 | menuTimer.start( 500, TRUE ); | 301 | menuTimer.start( 500, TRUE ); |
293 | break; | 302 | break; |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 024ab29..3250a66 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -19,151 +19,152 @@ | |||
19 | 19 | ||
20 | #include <qvariant.h> | 20 | #include <qvariant.h> |
21 | #include <qdialog.h> | 21 | #include <qdialog.h> |
22 | #include <qmainwindow.h> | 22 | #include <qmainwindow.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qpoint.h> | 26 | #include <qpoint.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | 28 | ||
29 | class OTabWidget; | 29 | class OTabWidget; |
30 | class QVBoxLayout; | 30 | class QVBoxLayout; |
31 | class QHBoxLayout; | 31 | class QHBoxLayout; |
32 | class QGridLayout; | 32 | class QGridLayout; |
33 | class QComboBox; | 33 | class QComboBox; |
34 | class QListView; | 34 | class QListView; |
35 | class QListviewItem; | 35 | class QListviewItem; |
36 | class QLabel; | 36 | class QLabel; |
37 | class QProgressBar; | 37 | class QProgressBar; |
38 | class QSpinBox; | 38 | class QSpinBox; |
39 | class QTabWidget; | 39 | class QTabWidget; |
40 | class QWidget; | 40 | class QWidget; |
41 | class QPEToolBar; | 41 | class QPEToolBar; |
42 | class QPEMenuBar; | 42 | class QPEMenuBar; |
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QFile; | 44 | class QFile; |
45 | class QListViewItem; | 45 | class QListViewItem; |
46 | class QLineEdit; | 46 | class QLineEdit; |
47 | class MenuButton; | 47 | class MenuButton; |
48 | 48 | ||
49 | //class QPushButton; | 49 | //class QPushButton; |
50 | class QToolButton; | 50 | class QToolButton; |
51 | class Ir; | 51 | class Ir; |
52 | 52 | ||
53 | class AdvancedFm : public QMainWindow | 53 | class AdvancedFm : public QMainWindow |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | AdvancedFm(); | 57 | AdvancedFm(); |
58 | ~AdvancedFm(); | 58 | ~AdvancedFm(); |
59 | protected slots: | 59 | protected slots: |
60 | void selectAll(); | 60 | void selectAll(); |
61 | void addToDocs(); | 61 | void addToDocs(); |
62 | void doDirChange(); | 62 | void doDirChange(); |
63 | void mkDir(); | 63 | void mkDir(); |
64 | void del(); | 64 | void del(); |
65 | void rn(); | 65 | void rn(); |
66 | void populateView(); | 66 | void populateView(); |
67 | void rePopulate(); | ||
67 | void showHidden(); | 68 | void showHidden(); |
68 | void showMenuHidden(); | 69 | void showMenuHidden(); |
69 | void writeConfig(); | 70 | void writeConfig(); |
70 | void readConfig(); | 71 | void readConfig(); |
71 | void ListClicked(QListViewItem *); | 72 | void ListClicked(QListViewItem *); |
72 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 73 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
73 | void makeDir(); | 74 | void makeDir(); |
74 | void doDelete(); | 75 | void doDelete(); |
75 | void tabChanged(QWidget*); | 76 | void tabChanged(QWidget*); |
76 | void cleanUp(); | 77 | void cleanUp(); |
77 | void renameIt(); | 78 | void renameIt(); |
78 | void runThis(); | 79 | void runThis(); |
79 | void runText(); | 80 | void runText(); |
80 | void filePerms(); | 81 | void filePerms(); |
81 | void doProperties(); | 82 | void doProperties(); |
82 | void runCommand(); | 83 | void runCommand(); |
83 | void runCommandStd(); | 84 | void runCommandStd(); |
84 | QStringList getPath(); | 85 | QStringList getPath(); |
85 | void mkSym(); | 86 | void mkSym(); |
86 | void switchToLocalTab(); | 87 | void switchToLocalTab(); |
87 | void switchToRemoteTab(); | 88 | void switchToRemoteTab(); |
88 | 89 | ||
89 | protected: | 90 | protected: |
90 | 91 | ||
91 | OTabWidget *TabWidget; | 92 | OTabWidget *TabWidget; |
92 | int whichTab; | 93 | int whichTab; |
93 | // QTabWidget *TabWidget; | 94 | // QTabWidget *TabWidget; |
94 | QWidget *tab, *tab_2, *tab_3; | 95 | QWidget *tab, *tab_2, *tab_3; |
95 | QListView *Local_View, *Remote_View; | 96 | QListView *Local_View, *Remote_View; |
96 | 97 | ||
97 | QLineEdit *currentPathEdit; | 98 | QLineEdit *currentPathEdit; |
98 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 99 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
99 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 100 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
100 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 101 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
101 | QDir currentDir, currentRemoteDir; | 102 | QDir currentDir, currentRemoteDir; |
102 | QComboBox *currentPathCombo; | 103 | QComboBox *currentPathCombo; |
103 | QString filterStr, s_addBookmark, s_removeBookmark; | 104 | QString filterStr, s_addBookmark, s_removeBookmark; |
104 | QListViewItem * item; | 105 | QListViewItem * item; |
105 | bool b; | 106 | bool b; |
106 | QStringList fileSystemTypeList, fsList; | 107 | QStringList fileSystemTypeList, fsList; |
107 | int currentServerConfig; | 108 | int currentServerConfig; |
108 | bool zaurusDevice; | 109 | bool zaurusDevice; |
109 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 110 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
110 | QStringList remoteDirPathStringList, localDirPathStringList; | 111 | QStringList remoteDirPathStringList, localDirPathStringList; |
111 | QLineEdit *renameBox; | 112 | QLineEdit *renameBox; |
112 | 113 | ||
113 | void init(); | 114 | void init(); |
114 | void initConnections(); | 115 | void initConnections(); |
115 | void keyReleaseEvent( QKeyEvent *); | 116 | void keyReleaseEvent( QKeyEvent *); |
116 | void keyPressEvent( QKeyEvent *); | 117 | void keyPressEvent( QKeyEvent *); |
117 | QString getFileSystemType(const QString &); | 118 | QString getFileSystemType(const QString &); |
118 | QString getDiskSpace(const QString &); | 119 | QString getDiskSpace(const QString &); |
119 | void parsetab(const QString &fileName); | 120 | void parsetab(const QString &fileName); |
120 | QString checkDiskSpace(const QString &); | 121 | QString checkDiskSpace(const QString &); |
121 | QString dealWithSymName(const QString &); | 122 | QString dealWithSymName(const QString &); |
122 | QDir *CurrentDir(); | 123 | QDir *CurrentDir(); |
123 | QDir *OtherDir(); | 124 | QDir *OtherDir(); |
124 | QListView *CurrentView(); | 125 | QListView *CurrentView(); |
125 | QListView *OtherView(); | 126 | QListView *OtherView(); |
126 | void setOtherTabCurrent(); | 127 | void setOtherTabCurrent(); |
127 | 128 | ||
128 | protected slots: | 129 | protected slots: |
129 | void dirMenuSelected(int); | 130 | void dirMenuSelected(int); |
130 | void showFileMenu(); | 131 | void showFileMenu(); |
131 | void cancelMenuTimer(); | 132 | void cancelMenuTimer(); |
132 | void homeButtonPushed(); | 133 | void homeButtonPushed(); |
133 | void docButtonPushed(); | 134 | void docButtonPushed(); |
134 | void SDButtonPushed(); | 135 | void SDButtonPushed(); |
135 | void CFButtonPushed(); | 136 | void CFButtonPushed(); |
136 | void QPEButtonPushed(); | 137 | void QPEButtonPushed(); |
137 | void upDir(); | 138 | void upDir(); |
138 | void currentPathComboChanged(); | 139 | void currentPathComboChanged(); |
139 | void copy(); | 140 | void copy(); |
140 | void copyAs(); | 141 | void copyAs(); |
141 | void copySameDir(); | 142 | void copySameDir(); |
142 | void currentPathComboActivated(const QString &); | 143 | void currentPathComboActivated(const QString &); |
143 | void fillCombo(const QString &); | 144 | void fillCombo(const QString &); |
144 | bool copyFile( const QString & , const QString & ); | 145 | bool copyFile( const QString & , const QString & ); |
145 | void move(); | 146 | void move(); |
146 | void fileStatus(); | 147 | void fileStatus(); |
147 | void doAbout(); | 148 | void doAbout(); |
148 | void doBeam(); | 149 | void doBeam(); |
149 | void fileBeamFinished( Ir *); | 150 | void fileBeamFinished( Ir *); |
150 | 151 | ||
151 | private: | 152 | private: |
152 | MenuButton *menuButton; | 153 | MenuButton *menuButton; |
153 | QString oldName; | 154 | QString oldName; |
154 | QTimer menuTimer; | 155 | QTimer menuTimer; |
155 | void startProcess(const QString &); | 156 | void startProcess(const QString &); |
156 | bool eventFilter( QObject * , QEvent * ); | 157 | bool eventFilter( QObject * , QEvent * ); |
157 | void cancelRename(); | 158 | void cancelRename(); |
158 | void doRename(QListView *); | 159 | void doRename(QListView *); |
159 | void okRename(); | 160 | void okRename(); |
160 | void customDirsToMenu(); | 161 | void customDirsToMenu(); |
161 | void addCustomDir(); | 162 | void addCustomDir(); |
162 | void removeCustomDir(); | 163 | void removeCustomDir(); |
163 | 164 | ||
164 | private slots: | 165 | private slots: |
165 | void processEnded(); | 166 | void processEnded(); |
166 | void gotoCustomDir(const QString &); | 167 | void gotoCustomDir(const QString &); |
167 | }; | 168 | }; |
168 | 169 | ||
169 | #endif // ADVANCEDFM_H | 170 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index f46503c..a82d69a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -23,120 +23,119 @@ | |||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | #include <qpe/ir.h> | 26 | #include <qpe/ir.h> |
27 | 27 | ||
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qmultilineedit.h> | 29 | #include <qmultilineedit.h> |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | 32 | ||
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
41 | #include <qlistview.h> | 41 | #include <qlistview.h> |
42 | 42 | ||
43 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
46 | #include <dirent.h> | 46 | #include <dirent.h> |
47 | 47 | ||
48 | 48 | ||
49 | void AdvancedFm::doDirChange() | 49 | void AdvancedFm::doDirChange() |
50 | { | 50 | { |
51 | ListClicked( CurrentView()->currentItem()); | 51 | ListClicked( CurrentView()->currentItem()); |
52 | } | 52 | } |
53 | 53 | ||
54 | void AdvancedFm::showMenuHidden() | 54 | void AdvancedFm::showMenuHidden() |
55 | { | 55 | { |
56 | if (b) | 56 | if (b) |
57 | { | 57 | { |
58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
60 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 60 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
61 | // b=FALSE; | 61 | // b=FALSE; |
62 | 62 | ||
63 | } | 63 | } |
64 | else | 64 | else |
65 | { | 65 | { |
66 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 66 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
67 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 67 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
68 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 68 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
69 | // b=TRUE; | 69 | // b=TRUE; |
70 | } | 70 | } |
71 | populateView(); | 71 | rePopulate(); |
72 | // populateRemoteView(); | ||
73 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | 72 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); |
74 | if(b) b = false; else b = true; | 73 | if(b) b = false; else b = true; |
75 | } | 74 | } |
76 | 75 | ||
77 | void AdvancedFm::showHidden() | 76 | void AdvancedFm::showHidden() |
78 | { | 77 | { |
79 | if (b) | 78 | if (b) |
80 | { | 79 | { |
81 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
82 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 82 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | // b=FALSE; | 83 | // b=FALSE; |
85 | 84 | ||
86 | } | 85 | } |
87 | else | 86 | else |
88 | { | 87 | { |
89 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 88 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
90 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 89 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
91 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 90 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
92 | // b=TRUE; | 91 | // b=TRUE; |
93 | } | 92 | } |
94 | populateView(); | 93 | rePopulate(); |
95 | } | 94 | } |
96 | 95 | ||
97 | QString AdvancedFm::dealWithSymName(const QString &fileName) | 96 | QString AdvancedFm::dealWithSymName(const QString &fileName) |
98 | { | 97 | { |
99 | QString strItem = fileName; | 98 | QString strItem = fileName; |
100 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 99 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
101 | } | 100 | } |
102 | 101 | ||
103 | void AdvancedFm::runThis() | 102 | void AdvancedFm::runThis() |
104 | { | 103 | { |
105 | QString fs; | 104 | QString fs; |
106 | QDir *thisDir = CurrentDir(); | 105 | QDir *thisDir = CurrentDir(); |
107 | 106 | ||
108 | QString curFile = CurrentView()->currentItem()->text(0); | 107 | QString curFile = CurrentView()->currentItem()->text(0); |
109 | QString path = thisDir->canonicalPath(); | 108 | QString path = thisDir->canonicalPath(); |
110 | 109 | ||
111 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 110 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
112 | 111 | ||
113 | curFile = dealWithSymName((const QString&)curFile); | 112 | curFile = dealWithSymName((const QString&)curFile); |
114 | 113 | ||
115 | if(curFile != "../") | 114 | if(curFile != "../") |
116 | { | 115 | { |
117 | 116 | ||
118 | fs = getFileSystemType((const QString &) path); | 117 | fs = getFileSystemType((const QString &) path); |
119 | QFileInfo fileInfo( path + "/" + curFile); | 118 | QFileInfo fileInfo( path + "/" + curFile); |
120 | qDebug( fileInfo.owner()); | 119 | qDebug( fileInfo.owner()); |
121 | 120 | ||
122 | if( (fileInfo.permission( QFileInfo::ExeUser) | 121 | if( (fileInfo.permission( QFileInfo::ExeUser) |
123 | | fileInfo.permission( QFileInfo::ExeGroup) | 122 | | fileInfo.permission( QFileInfo::ExeGroup) |
124 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 123 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
125 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 124 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
126 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 125 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
127 | e << curFile; | 126 | e << curFile; |
128 | } | 127 | } |
129 | else | 128 | else |
130 | { | 129 | { |
131 | curFile = path + "/" + curFile; | 130 | curFile = path + "/" + curFile; |
132 | DocLnk nf(curFile); | 131 | DocLnk nf(curFile); |
133 | QString execStr = nf.exec(); | 132 | QString execStr = nf.exec(); |
134 | qDebug( execStr); | 133 | qDebug( execStr); |
135 | if( execStr.isEmpty() ) | 134 | if( execStr.isEmpty() ) |
136 | { | 135 | { |
137 | } | 136 | } |
138 | else | 137 | else |
139 | { | 138 | { |
140 | nf.execute(); | 139 | nf.execute(); |
141 | } | 140 | } |
142 | } | 141 | } |