-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 39 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 5 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 82 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 4 |
4 files changed, 47 insertions, 83 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 41e83c7..66353bb 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,341 +1,316 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | #include <opie/otabwidget.h> | 15 | |
16 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
17 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <opie/otabwidget.h> |
20 | |||
20 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
22 | #include <qpe/qpemenubar.h> | ||
23 | #include <qpe/qpetoolbar.h> | ||
24 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/qcopenvelope_qws.h> | ||
26 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
27 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
28 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
29 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
30 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
31 | #include <qpe/menubutton.h> | 29 | #include <qpe/menubutton.h> |
32 | 30 | ||
33 | |||
34 | #include <qwmatrix.h> | ||
35 | #include <qregexp.h> | ||
36 | #include <qtabwidget.h> | ||
37 | #include <qtextstream.h> | ||
38 | #include <qpushbutton.h> | ||
39 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
40 | #include <qdir.h> | ||
41 | #include <qfile.h> | 32 | #include <qfile.h> |
42 | #include <qstring.h> | ||
43 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
44 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
45 | #include <qlistview.h> | 35 | #include <qlistview.h> |
46 | #include <qmainwindow.h> | ||
47 | #include <qlabel.h> | 36 | #include <qlabel.h> |
48 | #include <qprogressbar.h> | ||
49 | #include <qspinbox.h> | ||
50 | #include <qwidget.h> | 37 | #include <qwidget.h> |
51 | #include <qlayout.h> | 38 | #include <qlayout.h> |
52 | #include <qimage.h> | 39 | #include <qimage.h> |
53 | #include <qpixmap.h> | ||
54 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
55 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
56 | #include <qregexp.h> | ||
57 | 42 | ||
58 | #include <unistd.h> | ||
59 | #include <stdlib.h> | ||
60 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
61 | #include <dirent.h> | ||
62 | #include <stdio.h> | ||
63 | #include <time.h> | 44 | #include <time.h> |
45 | #include <dirent.h> | ||
64 | #include <fcntl.h> | 46 | #include <fcntl.h> |
65 | #include <mntent.h> | ||
66 | #include <string.h> | ||
67 | #include <errno.h> | ||
68 | #include <sys/vfs.h> | 47 | #include <sys/vfs.h> |
69 | #include <mntent.h> | 48 | #include <mntent.h> |
70 | #include <sys/utsname.h> | ||
71 | 49 | ||
72 | AdvancedFm::AdvancedFm( ) | 50 | AdvancedFm::AdvancedFm( ) |
73 | : QMainWindow( ) { | 51 | : QMainWindow( ) { |
74 | init(); | 52 | init(); |
75 | renameBox = 0; | 53 | renameBox = 0; |
76 | 54 | ||
77 | QWMatrix matrix; | 55 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
78 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); | 56 | |
79 | matrix.scale( .4, .4); | ||
80 | unknownXpm = pix.xForm(matrix); | ||
81 | |||
82 | initConnections(); | 57 | initConnections(); |
83 | whichTab=1; | 58 | whichTab=1; |
84 | rePopulate(); | 59 | rePopulate(); |
85 | currentPathCombo->setFocus(); | 60 | currentPathCombo->setFocus(); |
86 | } | 61 | } |
87 | 62 | ||
88 | AdvancedFm::~AdvancedFm() { | 63 | AdvancedFm::~AdvancedFm() { |
89 | } | 64 | } |
90 | 65 | ||
91 | 66 | ||
92 | void AdvancedFm::cleanUp() | 67 | void AdvancedFm::cleanUp() |
93 | { | 68 | { |
94 | QString sfile=QDir::homeDirPath(); | 69 | QString sfile=QDir::homeDirPath(); |
95 | if(sfile.right(1) != "/") | 70 | if(sfile.right(1) != "/") |
96 | sfile+="/._temp"; | 71 | sfile+="/._temp"; |
97 | else | 72 | else |
98 | sfile+="._temp"; | 73 | sfile+="._temp"; |
99 | QFile file( sfile); | 74 | QFile file( sfile); |
100 | if(file.exists()) | 75 | if(file.exists()) |
101 | file.remove(); | 76 | file.remove(); |
102 | } | 77 | } |
103 | 78 | ||
104 | void AdvancedFm::tabChanged(QWidget *w) | 79 | void AdvancedFm::tabChanged(QWidget *w) |
105 | { | 80 | { |
106 | if( w == tab) | 81 | if( w == tab) |
107 | whichTab = 1; | 82 | whichTab = 1; |
108 | else | 83 | else |
109 | whichTab = 2; | 84 | whichTab = 2; |
110 | 85 | ||
111 | // qDebug("tab changed %d", whichTab ); | 86 | // qDebug("tab changed %d", whichTab ); |
112 | 87 | ||
113 | QString path = CurrentDir()->canonicalPath(); | 88 | QString path = CurrentDir()->canonicalPath(); |
114 | currentPathCombo->lineEdit()->setText( path ); | 89 | currentPathCombo->lineEdit()->setText( path ); |
115 | 90 | ||
116 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 91 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
117 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 92 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
118 | 93 | ||
119 | QString fs= getFileSystemType( (const QString &) path); | 94 | QString fs= getFileSystemType( (const QString &) path); |
120 | 95 | ||
121 | setCaption("AdvancedFm :: "+fs+" :: " | 96 | setCaption("AdvancedFm :: "+fs+" :: " |
122 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 97 | +checkDiskSpace( (const QString &) path )+ " kB free" ); |
123 | chdir( path.latin1()); | 98 | chdir( path.latin1()); |
124 | } | 99 | } |
125 | 100 | ||
126 | 101 | ||
127 | void AdvancedFm::populateView() | 102 | void AdvancedFm::populateView() |
128 | { | 103 | { |
129 | QPixmap pm; | 104 | QPixmap pm; |
130 | QListView *thisView = CurrentView(); | 105 | QListView *thisView = CurrentView(); |
131 | QDir *thisDir = CurrentDir(); | 106 | QDir *thisDir = CurrentDir(); |
132 | QString path = thisDir->canonicalPath(); | 107 | QString path = thisDir->canonicalPath(); |
133 | 108 | ||
134 | thisView->clear(); | 109 | thisView->clear(); |
135 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 110 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
136 | thisDir->setMatchAllDirs(TRUE); | 111 | thisDir->setMatchAllDirs(TRUE); |
137 | thisDir->setNameFilter(filterStr); | 112 | thisDir->setNameFilter(filterStr); |
138 | QString fileL, fileS, fileDate; | 113 | QString fileL, fileS, fileDate; |
139 | QString fs= getFileSystemType((const QString &) path); | 114 | QString fs= getFileSystemType((const QString &) path); |
140 | setCaption("AdvancedFm :: "+fs+" :: " | 115 | setCaption("AdvancedFm :: "+fs+" :: " |
141 | +checkDiskSpace((const QString &) path)+" kB free" ); | 116 | +checkDiskSpace((const QString &) path)+" kB free" ); |
142 | bool isDir=FALSE; | 117 | bool isDir=FALSE; |
143 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 118 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
144 | QFileInfoListIterator it(*list); | 119 | QFileInfoListIterator it(*list); |
145 | QFileInfo *fi; | 120 | QFileInfo *fi; |
146 | while ( (fi=it.current()) ) | 121 | while ( (fi=it.current()) ) |
147 | { | 122 | { |
148 | if (fi->isSymLink() ) | 123 | if (fi->isSymLink() ) |
149 | { | 124 | { |
150 | QString symLink=fi->readLink(); | 125 | QString symLink=fi->readLink(); |
151 | QFileInfo sym( symLink); | 126 | QFileInfo sym( symLink); |
152 | fileS.sprintf( "%10i", sym.size() ); | 127 | fileS.sprintf( "%10i", sym.size() ); |
153 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 128 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
154 | fileDate = sym.lastModified().toString(); | 129 | fileDate = sym.lastModified().toString(); |
155 | } | 130 | } |
156 | else | 131 | else |
157 | { | 132 | { |
158 | fileS.sprintf( "%10i", fi->size() ); | 133 | fileS.sprintf( "%10i", fi->size() ); |
159 | fileL.sprintf( "%s",fi->fileName().data() ); | 134 | fileL.sprintf( "%s",fi->fileName().data() ); |
160 | fileDate= fi->lastModified().toString(); | 135 | fileDate= fi->lastModified().toString(); |
161 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) | 136 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) |
162 | { | 137 | { |
163 | fileL+="/"; | 138 | fileL+="/"; |
164 | isDir=TRUE; | 139 | isDir=TRUE; |
165 | } | 140 | } |
166 | } | 141 | } |
167 | 142 | ||
168 | QFileInfo fileInfo( path + "/" + fileL); | 143 | QFileInfo fileInfo( path + "/" + fileL); |
169 | 144 | ||
170 | if(fileL !="./" && fi->exists()) | 145 | if(fileL !="./" && fi->exists()) |
171 | { | 146 | { |
172 | item= new QListViewItem( thisView, fileL, fileS , fileDate); | 147 | item= new QListViewItem( thisView, fileL, fileS , fileDate); |
173 | 148 | ||
174 | if(isDir || fileL.find("/",0,TRUE) != -1) | 149 | if(isDir || fileL.find("/",0,TRUE) != -1) |
175 | { | 150 | { |
176 | 151 | ||
177 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 152 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
178 | pm = Resource::loadPixmap( "lockedfolder" ); | 153 | pm = Resource::loadPixmap( "lockedfolder" ); |
179 | else | 154 | else |
180 | pm= Resource::loadPixmap( "folder" ); | 155 | pm= Resource::loadPixmap( "folder" ); |
181 | } | 156 | } |
182 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) | 157 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) |
183 | { | 158 | { |
184 | pm = Resource::loadPixmap( "exec"); | 159 | pm = Resource::loadPixmap( "exec"); |
185 | } | 160 | } |
186 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 161 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
187 | | fileInfo.permission( QFileInfo::ExeGroup) | 162 | | fileInfo.permission( QFileInfo::ExeGroup) |
188 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) | 163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) |
189 | { | 164 | { |
190 | pm = Resource::loadPixmap( "exec"); | 165 | pm = Resource::loadPixmap( "exec"); |
191 | } | 166 | } |
192 | else if( !fi->isReadable() ) | 167 | else if( !fi->isReadable() ) |
193 | { | 168 | { |
194 | pm = Resource::loadPixmap( "locked" ); | 169 | pm = Resource::loadPixmap( "locked" ); |
195 | } | 170 | } |
196 | else { //everything else goes by mimetype | 171 | else { //everything else goes by mimetype |
197 | MimeType mt(fi->filePath()); | 172 | MimeType mt(fi->filePath()); |
198 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 173 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
199 | if(pm.isNull()) { | 174 | if(pm.isNull()) { |
200 | pm = unknownXpm; | 175 | pm = unknownXpm; |
201 | } | 176 | } |
202 | } | 177 | } |
203 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) | 178 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) |
204 | { | 179 | { |
205 | // overlay link image | 180 | // overlay link image |
206 | pm= Resource::loadPixmap( "folder" ); | 181 | pm= Resource::loadPixmap( "folder" ); |
207 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 182 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
208 | QPainter painter( &pm ); | 183 | QPainter painter( &pm ); |
209 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 184 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
210 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 185 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
211 | } | 186 | } |
212 | item->setPixmap( 0,pm); | 187 | item->setPixmap( 0,pm); |
213 | 188 | ||
214 | } | 189 | } |
215 | isDir=FALSE; | 190 | isDir=FALSE; |
216 | ++it; | 191 | ++it; |
217 | } | 192 | } |
218 | 193 | ||
219 | if( path.find("dev",0,TRUE) != -1) | 194 | if( path.find("dev",0,TRUE) != -1) |
220 | { | 195 | { |
221 | struct stat buf; | 196 | struct stat buf; |
222 | dev_t devT; | 197 | dev_t devT; |
223 | DIR *dir; | 198 | DIR *dir; |
224 | struct dirent *mydirent; | 199 | struct dirent *mydirent; |
225 | 200 | ||
226 | if((dir = opendir( path.latin1())) != NULL) | 201 | if((dir = opendir( path.latin1())) != NULL) |
227 | while ((mydirent = readdir(dir)) != NULL) | 202 | while ((mydirent = readdir(dir)) != NULL) |
228 | { | 203 | { |
229 | lstat( mydirent->d_name, &buf); | 204 | lstat( mydirent->d_name, &buf); |
230 | // qDebug(mydirent->d_name); | 205 | // qDebug(mydirent->d_name); |
231 | fileL.sprintf("%s", mydirent->d_name); | 206 | fileL.sprintf("%s", mydirent->d_name); |
232 | devT = buf.st_dev; | 207 | devT = buf.st_dev; |
233 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 208 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
234 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 209 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
235 | if( fileL.find(".") == -1 ) | 210 | if( fileL.find(".") == -1 ) |
236 | { | 211 | { |
237 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 212 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
238 | pm = unknownXpm; | 213 | pm = unknownXpm; |
239 | item->setPixmap( 0,pm); | 214 | item->setPixmap( 0,pm); |
240 | } | 215 | } |
241 | } | 216 | } |
242 | 217 | ||
243 | closedir(dir); | 218 | closedir(dir); |
244 | } | 219 | } |
245 | 220 | ||
246 | thisView->setSorting( 3,FALSE); | 221 | thisView->setSorting( 3,FALSE); |
247 | fillCombo( (const QString &) path ); | 222 | fillCombo( (const QString &) path ); |
248 | } | 223 | } |
249 | 224 | ||
250 | void AdvancedFm::rePopulate() | 225 | void AdvancedFm::rePopulate() |
251 | { | 226 | { |
252 | int tmpTab = whichTab; | 227 | int tmpTab = whichTab; |
253 | qDebug("%d", tmpTab); | 228 | qDebug("%d", tmpTab); |
254 | 229 | ||
255 | for(int i =1; i < 3; i++) | 230 | for(int i =1; i < 3; i++) |
256 | { | 231 | { |
257 | TabWidget->setCurrentTab(i - 1); | 232 | TabWidget->setCurrentTab(i - 1); |
258 | populateView(); | 233 | populateView(); |
259 | } | 234 | } |
260 | TabWidget->setCurrentTab( tmpTab - 1); | 235 | TabWidget->setCurrentTab( tmpTab - 1); |
261 | } | 236 | } |
262 | 237 | ||
263 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) | 238 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) |
264 | { | 239 | { |
265 | if(selectedItem) | 240 | if(selectedItem) |
266 | { | 241 | { |
267 | QString strItem=selectedItem->text(0); | 242 | QString strItem=selectedItem->text(0); |
268 | QString strSize=selectedItem->text(1); | 243 | QString strSize=selectedItem->text(1); |
269 | strSize=strSize.stripWhiteSpace(); | 244 | strSize=strSize.stripWhiteSpace(); |
270 | bool isDirectory = false; | 245 | bool isDirectory = false; |
271 | QString strItem2; | 246 | QString strItem2; |
272 | 247 | ||
273 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 248 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink |
274 | { | 249 | { |
275 | strItem2 = dealWithSymName((const QString&)strItem); | 250 | strItem2 = dealWithSymName((const QString&)strItem); |
276 | if(QDir(strItem2).exists() ) | 251 | if(QDir(strItem2).exists() ) |
277 | strItem = strItem2; | 252 | strItem = strItem2; |
278 | } | 253 | } |
279 | 254 | ||
280 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 255 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) |
281 | { | 256 | { |
282 | 257 | ||
283 | if(QDir(strItem).exists()) | 258 | if(QDir(strItem).exists()) |
284 | isDirectory = true; | 259 | isDirectory = true; |
285 | } | 260 | } |
286 | 261 | ||
287 | if( isDirectory ) | 262 | if( isDirectory ) |
288 | { | 263 | { |
289 | CurrentDir()->cd( strItem, TRUE); | 264 | CurrentDir()->cd( strItem, TRUE); |
290 | populateView(); | 265 | populateView(); |
291 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 266 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
292 | } | 267 | } |
293 | chdir( strItem.latin1()); | 268 | chdir( strItem.latin1()); |
294 | } | 269 | } |
295 | } | 270 | } |
296 | 271 | ||
297 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 272 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
298 | switch (mouse) { | 273 | switch (mouse) { |
299 | case 1: | 274 | case 1: |
300 | { | 275 | { |
301 | if(renameBox != 0 ) | 276 | if(renameBox != 0 ) |
302 | { | 277 | { |
303 | cancelRename(); | 278 | cancelRename(); |
304 | } | 279 | } |
305 | } | 280 | } |
306 | break; | 281 | break; |
307 | case 2: | 282 | case 2: |
308 | menuTimer.start( 500, TRUE ); | 283 | menuTimer.start( 500, TRUE ); |
309 | break; | 284 | break; |
310 | }; | 285 | }; |
311 | } | 286 | } |
312 | 287 | ||
313 | void AdvancedFm::switchToLocalTab() | 288 | void AdvancedFm::switchToLocalTab() |
314 | { | 289 | { |
315 | TabWidget->setCurrentTab(0); | 290 | TabWidget->setCurrentTab(0); |
316 | Local_View->setFocus(); | 291 | Local_View->setFocus(); |
317 | } | 292 | } |
318 | 293 | ||
319 | void AdvancedFm::switchToRemoteTab() | 294 | void AdvancedFm::switchToRemoteTab() |
320 | { | 295 | { |
321 | TabWidget->setCurrentTab(1); | 296 | TabWidget->setCurrentTab(1); |
322 | Remote_View->setFocus(); | 297 | Remote_View->setFocus(); |
323 | } | 298 | } |
324 | 299 | ||
325 | void AdvancedFm::readConfig() | 300 | void AdvancedFm::readConfig() |
326 | { | 301 | { |
327 | Config cfg("AdvancedFm"); | 302 | Config cfg("AdvancedFm"); |
328 | } | 303 | } |
329 | 304 | ||
330 | void AdvancedFm::writeConfig() | 305 | void AdvancedFm::writeConfig() |
331 | { | 306 | { |
332 | Config cfg("AdvancedFm"); | 307 | Config cfg("AdvancedFm"); |
333 | } | 308 | } |
334 | 309 | ||
335 | void AdvancedFm::currentPathComboChanged() | 310 | void AdvancedFm::currentPathComboChanged() |
336 | { | 311 | { |
337 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) | 312 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) |
338 | { | 313 | { |
339 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 314 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
340 | populateView(); | 315 | populateView(); |
341 | } | 316 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index c30d8e0..4480051 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,174 +1,171 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfm.h | 2 | advancedfm.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
15 | #define QT_QWS_OPIE | 15 | #define QT_QWS_OPIE |
16 | 16 | ||
17 | //#include <opie/otabwidget.h> | 17 | //#include <opie/otabwidget.h> |
18 | #include <opie/oprocess.h> | 18 | #include <opie/oprocess.h> |
19 | #include <qpe/ir.h> | 19 | #include <qpe/ir.h> |
20 | 20 | ||
21 | #include <qvariant.h> | 21 | #include <qvariant.h> |
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | #include <qmainwindow.h> | 23 | #include <qmainwindow.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | #include <qdir.h> | 25 | #include <qdir.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
30 | 30 | ||
31 | class OTabWidget; | 31 | class OTabWidget; |
32 | class QVBoxLayout; | 32 | class QVBoxLayout; |
33 | class QHBoxLayout; | 33 | class QHBoxLayout; |
34 | class QGridLayout; | 34 | class QGridLayout; |
35 | class QComboBox; | 35 | class QComboBox; |
36 | class QListView; | 36 | class QListView; |
37 | class QListviewItem; | 37 | class QListviewItem; |
38 | class QLabel; | 38 | class QLabel; |
39 | class QProgressBar; | 39 | class QProgressBar; |
40 | class QSpinBox; | 40 | class QSpinBox; |
41 | class QTabWidget; | 41 | class QTabWidget; |
42 | class QWidget; | 42 | class QWidget; |
43 | class QPEToolBar; | ||
44 | class QPEMenuBar; | ||
45 | class QPopupMenu; | 43 | class QPopupMenu; |
46 | class QFile; | 44 | class QFile; |
47 | class QListViewItem; | 45 | class QListViewItem; |
48 | class QLineEdit; | 46 | class QLineEdit; |
49 | class MenuButton; | 47 | class MenuButton; |
50 | 48 | ||
51 | //class QPushButton; | ||
52 | class QToolButton; | 49 | class QToolButton; |
53 | class Ir; | 50 | class Ir; |
54 | 51 | ||
55 | class AdvancedFm : public QMainWindow | 52 | class AdvancedFm : public QMainWindow |
56 | { | 53 | { |
57 | Q_OBJECT | 54 | Q_OBJECT |
58 | public: | 55 | public: |
59 | AdvancedFm(); | 56 | AdvancedFm(); |
60 | ~AdvancedFm(); | 57 | ~AdvancedFm(); |
61 | protected slots: | 58 | protected slots: |
62 | void selectAll(); | 59 | void selectAll(); |
63 | void addToDocs(); | 60 | void addToDocs(); |
64 | void doDirChange(); | 61 | void doDirChange(); |
65 | void mkDir(); | 62 | void mkDir(); |
66 | void del(); | 63 | void del(); |
67 | void rn(); | 64 | void rn(); |
68 | void populateView(); | 65 | void populateView(); |
69 | void rePopulate(); | 66 | void rePopulate(); |
70 | void showHidden(); | 67 | void showHidden(); |
71 | void showMenuHidden(); | 68 | void showMenuHidden(); |
72 | void writeConfig(); | 69 | void writeConfig(); |
73 | void readConfig(); | 70 | void readConfig(); |
74 | void ListClicked(QListViewItem *); | 71 | void ListClicked(QListViewItem *); |
75 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 72 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
76 | void makeDir(); | 73 | void makeDir(); |
77 | void doDelete(); | 74 | void doDelete(); |
78 | void tabChanged(QWidget*); | 75 | void tabChanged(QWidget*); |
79 | void cleanUp(); | 76 | void cleanUp(); |
80 | void renameIt(); | 77 | void renameIt(); |
81 | void runThis(); | 78 | void runThis(); |
82 | void runText(); | 79 | void runText(); |
83 | void filePerms(); | 80 | void filePerms(); |
84 | void doProperties(); | 81 | void doProperties(); |
85 | void runCommand(); | 82 | void runCommand(); |
86 | void runCommandStd(); | 83 | void runCommandStd(); |
87 | QStringList getPath(); | 84 | QStringList getPath(); |
88 | void mkSym(); | 85 | void mkSym(); |
89 | void switchToLocalTab(); | 86 | void switchToLocalTab(); |
90 | void switchToRemoteTab(); | 87 | void switchToRemoteTab(); |
91 | 88 | ||
92 | protected: | 89 | protected: |
93 | 90 | ||
94 | OTabWidget *TabWidget; | 91 | OTabWidget *TabWidget; |
95 | QPixmap unknownXpm; | 92 | QPixmap unknownXpm; |
96 | int whichTab; | 93 | int whichTab; |
97 | // QTabWidget *TabWidget; | 94 | // QTabWidget *TabWidget; |
98 | QWidget *tab, *tab_2, *tab_3; | 95 | QWidget *tab, *tab_2, *tab_3; |
99 | QListView *Local_View, *Remote_View; | 96 | QListView *Local_View, *Remote_View; |
100 | 97 | ||
101 | QLineEdit *currentPathEdit; | 98 | QLineEdit *currentPathEdit; |
102 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 99 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
103 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 100 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
104 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 101 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
105 | QDir currentDir, currentRemoteDir; | 102 | QDir currentDir, currentRemoteDir; |
106 | QComboBox *currentPathCombo; | 103 | QComboBox *currentPathCombo; |
107 | QString filterStr, s_addBookmark, s_removeBookmark; | 104 | QString filterStr, s_addBookmark, s_removeBookmark; |
108 | QListViewItem * item; | 105 | QListViewItem * item; |
109 | bool b; | 106 | bool b; |
110 | QStringList fileSystemTypeList, fsList; | 107 | QStringList fileSystemTypeList, fsList; |
111 | int currentServerConfig; | 108 | int currentServerConfig; |
112 | bool zaurusDevice; | 109 | bool zaurusDevice; |
113 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 110 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
114 | QStringList remoteDirPathStringList, localDirPathStringList; | 111 | QStringList remoteDirPathStringList, localDirPathStringList; |
115 | QLineEdit *renameBox; | 112 | QLineEdit *renameBox; |
116 | 113 | ||
117 | void init(); | 114 | void init(); |
118 | void initConnections(); | 115 | void initConnections(); |
119 | void keyReleaseEvent( QKeyEvent *); | 116 | void keyReleaseEvent( QKeyEvent *); |
120 | void keyPressEvent( QKeyEvent *); | 117 | void keyPressEvent( QKeyEvent *); |
121 | QString getFileSystemType(const QString &); | 118 | QString getFileSystemType(const QString &); |
122 | QString getDiskSpace(const QString &); | 119 | QString getDiskSpace(const QString &); |
123 | void parsetab(const QString &fileName); | 120 | void parsetab(const QString &fileName); |
124 | QString checkDiskSpace(const QString &); | 121 | QString checkDiskSpace(const QString &); |
125 | QString dealWithSymName(const QString &); | 122 | QString dealWithSymName(const QString &); |
126 | QDir *CurrentDir(); | 123 | QDir *CurrentDir(); |
127 | QDir *OtherDir(); | 124 | QDir *OtherDir(); |
128 | QListView *CurrentView(); | 125 | QListView *CurrentView(); |
129 | QListView *OtherView(); | 126 | QListView *OtherView(); |
130 | void setOtherTabCurrent(); | 127 | void setOtherTabCurrent(); |
131 | 128 | ||
132 | protected slots: | 129 | protected slots: |
133 | void dirMenuSelected(int); | 130 | void dirMenuSelected(int); |
134 | void showFileMenu(); | 131 | void showFileMenu(); |
135 | void cancelMenuTimer(); | 132 | void cancelMenuTimer(); |
136 | void homeButtonPushed(); | 133 | void homeButtonPushed(); |
137 | void docButtonPushed(); | 134 | void docButtonPushed(); |
138 | void SDButtonPushed(); | 135 | void SDButtonPushed(); |
139 | void CFButtonPushed(); | 136 | void CFButtonPushed(); |
140 | void QPEButtonPushed(); | 137 | void QPEButtonPushed(); |
141 | void upDir(); | 138 | void upDir(); |
142 | void currentPathComboChanged(); | 139 | void currentPathComboChanged(); |
143 | void copy(); | 140 | void copy(); |
144 | void copyAs(); | 141 | void copyAs(); |
145 | void copySameDir(); | 142 | void copySameDir(); |
146 | void currentPathComboActivated(const QString &); | 143 | void currentPathComboActivated(const QString &); |
147 | void fillCombo(const QString &); | 144 | void fillCombo(const QString &); |
148 | bool copyFile( const QString & , const QString & ); | 145 | bool copyFile( const QString & , const QString & ); |
149 | void move(); | 146 | void move(); |
150 | void fileStatus(); | 147 | void fileStatus(); |
151 | void doAbout(); | 148 | void doAbout(); |
152 | void doBeam(); | 149 | void doBeam(); |
153 | void fileBeamFinished( Ir *); | 150 | void fileBeamFinished( Ir *); |
154 | 151 | ||
155 | private: | 152 | private: |
156 | MenuButton *menuButton; | 153 | MenuButton *menuButton; |
157 | QString oldName; | 154 | QString oldName; |
158 | QTimer menuTimer; | 155 | QTimer menuTimer; |
159 | void startProcess(const QString &); | 156 | void startProcess(const QString &); |
160 | bool eventFilter( QObject * , QEvent * ); | 157 | bool eventFilter( QObject * , QEvent * ); |
161 | void cancelRename(); | 158 | void cancelRename(); |
162 | void doRename(QListView *); | 159 | void doRename(QListView *); |
163 | void okRename(); | 160 | void okRename(); |
164 | void customDirsToMenu(); | 161 | void customDirsToMenu(); |
165 | void addCustomDir(); | 162 | void addCustomDir(); |
166 | void removeCustomDir(); | 163 | void removeCustomDir(); |
167 | 164 | ||
168 | private slots: | 165 | private slots: |
169 | void processEnded(OProcess *); | 166 | void processEnded(OProcess *); |
170 | void oprocessStderr(OProcess *, char *, int); | 167 | void oprocessStderr(OProcess *, char *, int); |
171 | void gotoCustomDir(const QString &); | 168 | void gotoCustomDir(const QString &); |
172 | }; | 169 | }; |
173 | 170 | ||
174 | #endif // ADVANCEDFM_H | 171 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 1a7a6d7..eb2bcd8 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,266 +1,260 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | #include <opie/otabwidget.h> | 14 | #include <opie/otabwidget.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/qpemenubar.h> | ||
17 | #include <qpe/qpetoolbar.h> | ||
18 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
19 | #include <qpe/menubutton.h> | 17 | #include <qpe/menubutton.h> |
20 | #include <qpe/config.h> | ||
21 | 18 | ||
22 | #include <qlayout.h> | 19 | #include <qlayout.h> |
23 | #include <qpixmap.h> | 20 | #include <qhbox.h> |
21 | #include <qmenubar.h> | ||
24 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
25 | #include <qpopupmenu.h> | ||
26 | #include <qtabwidget.h> | ||
27 | #include <qtoolbutton.h> | 23 | #include <qtoolbutton.h> |
28 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
29 | #include <qlistview.h> | 25 | #include <qlistview.h> |
30 | 26 | ||
31 | #include <sys/utsname.h> | 27 | #include <sys/utsname.h> |
32 | 28 | ||
33 | 29 | ||
34 | void AdvancedFm::init() { | 30 | void AdvancedFm::init() { |
35 | #if defined(QT_QWS_OPIE) | 31 | #if defined(QT_QWS_OPIE) |
36 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 32 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
37 | #endif | 33 | #endif |
38 | setCaption( tr( "AdvancedFm" ) ); | 34 | setCaption( tr( "AdvancedFm" ) ); |
39 | 35 | ||
40 | QGridLayout *layout = new QGridLayout( this ); | 36 | QVBoxLayout *layout = new QVBoxLayout( this ); |
41 | layout->setSpacing( 2); | 37 | layout->setSpacing( 2); |
42 | layout->setMargin( 2); | 38 | layout->setMargin( 2); |
43 | 39 | ||
44 | 40 | ||
45 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 41 | QMenuBar *menuBar = new QMenuBar(this); |
46 | fileMenu = new QPopupMenu( this ); | 42 | fileMenu = new QPopupMenu( this ); |
47 | viewMenu = new QPopupMenu( this ); | 43 | viewMenu = new QPopupMenu( this ); |
48 | // customDirMenu = new QPopupMenu( this ); | 44 | // customDirMenu = new QPopupMenu( this ); |
49 | 45 | ||
50 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 46 | layout->addWidget( menuBar ); |
51 | 47 | ||
52 | menuBar->insertItem( tr( "File" ), fileMenu); | 48 | menuBar->insertItem( tr( "File" ), fileMenu); |
53 | menuBar->insertItem( tr( "View" ), viewMenu); | 49 | menuBar->insertItem( tr( "View" ), viewMenu); |
54 | // menuBar->insertItem( tr( "^" ), customDirMenu); | ||
55 | 50 | ||
56 | cdUpButton = new QToolButton( this,"cdUpButton"); | 51 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
57 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 52 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
58 | cdUpButton->setFixedSize( QSize( 20, 20 ) ); | 53 | cdUpButton->setAutoRaise( true ); |
59 | layout->addMultiCellWidget( cdUpButton , 0, 0, 2, 2); | 54 | menuBar->insertItem( cdUpButton ); |
60 | 55 | ||
61 | menuButton = new MenuButton(this); | ||
62 | menuButton->setFixedSize( QSize( 20, 20 ) ); | ||
63 | layout->addMultiCellWidget( menuButton , 0, 0, 3, 3); | ||
64 | 56 | ||
65 | qpeDirButton= new QToolButton(this,"QPEButton"); | 57 | QHBox *lineBox = new QHBox( this ); |
58 | |||
59 | qpeDirButton= new QToolButton( 0,"QPEButton"); | ||
66 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 60 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
67 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 61 | qpeDirButton->setAutoRaise( true ); |
68 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 4, 4); | 62 | menuBar->insertItem( qpeDirButton ); |
69 | 63 | ||
70 | cfButton = new QToolButton( this,"CFButton"); | 64 | cfButton = new QToolButton( 0, "CFButton"); |
71 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 65 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
72 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 66 | cfButton->setAutoRaise( true ); |
73 | layout->addMultiCellWidget( cfButton , 0, 0, 5, 5); | 67 | menuBar->insertItem( cfButton ); |
74 | 68 | ||
75 | sdButton = new QToolButton( this,"SDButton"); | 69 | sdButton = new QToolButton( 0, "SDButton"); |
76 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 70 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
77 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 71 | sdButton->setAutoRaise( true ); |
78 | layout->addMultiCellWidget( sdButton , 0, 0, 6, 6); | 72 | menuBar->insertItem( sdButton ); |
79 | |||
80 | 73 | ||
81 | docButton = new QToolButton( this,"docsButton"); | 74 | docButton = new QToolButton( 0,"docsButton"); |
82 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 75 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
83 | docButton->setFixedSize( QSize( 20, 20 ) ); | 76 | docButton->setAutoRaise( true ); |
84 | layout->addMultiCellWidget( docButton, 0, 0, 7, 7); | 77 | menuBar->insertItem( docButton ); |
85 | 78 | ||
86 | homeButton = new QToolButton( this,"homeButton"); | 79 | homeButton = new QToolButton( 0, "homeButton"); |
87 | homeButton->setPixmap(Resource::loadPixmap("home")); | 80 | homeButton->setPixmap(Resource::loadPixmap("home")); |
88 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 81 | homeButton->setAutoRaise( true ); |
89 | layout->addMultiCellWidget( homeButton, 0, 0, 8, 8); | 82 | menuBar->insertItem( homeButton ); |
90 | 83 | ||
91 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 84 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
92 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 85 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
93 | fileMenu->insertSeparator(); | 86 | fileMenu->insertSeparator(); |
94 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 87 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
95 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 88 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
96 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 89 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
97 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 90 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
98 | fileMenu->insertSeparator(); | 91 | fileMenu->insertSeparator(); |
99 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 92 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
100 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 93 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
101 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 94 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
102 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 95 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
103 | fileMenu->setCheckable(TRUE); | 96 | fileMenu->setCheckable(TRUE); |
104 | 97 | ||
105 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 98 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
106 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 99 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
107 | // viewMenu->insertSeparator(); | 100 | // viewMenu->insertSeparator(); |
108 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 101 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
109 | viewMenu->setCheckable(TRUE); | 102 | viewMenu->setCheckable(TRUE); |
110 | 103 | ||
111 | s_addBookmark = tr("Bookmark Directory"); | 104 | s_addBookmark = tr("Bookmark Directory"); |
112 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 105 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
113 | 106 | ||
114 | menuButton->setUseLabel(false); | ||
115 | menuButton->insertItem( s_addBookmark); | ||
116 | menuButton->insertItem( s_removeBookmark); | ||
117 | menuButton->insertSeparator(); | ||
118 | // menuButton->insertItem(""); | 107 | // menuButton->insertItem(""); |
119 | 108 | ||
120 | // customDirMenu->insertItem(tr("Add This Directory")); | 109 | // customDirMenu->insertItem(tr("Add This Directory")); |
121 | // customDirMenu->insertItem(tr("Remove This Directory")); | 110 | // customDirMenu->insertItem(tr("Remove This Directory")); |
122 | // customDirMenu->insertSeparator(); | 111 | // customDirMenu->insertSeparator(); |
123 | 112 | ||
124 | customDirsToMenu(); | 113 | customDirsToMenu(); |
125 | 114 | ||
126 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 115 | menuButton = new MenuButton( lineBox ); |
127 | currentPathCombo->setEditable(TRUE); | ||
128 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); | ||
129 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
130 | 116 | ||
117 | menuButton->setUseLabel(false); | ||
118 | menuButton->setMaximumWidth( 20 ); | ||
119 | menuButton->insertItem( s_addBookmark); | ||
120 | menuButton->insertItem( s_removeBookmark); | ||
121 | menuButton->insertSeparator(); | ||
122 | |||
123 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); | ||
124 | currentPathCombo->setEditable(TRUE); | ||
131 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 125 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
132 | 126 | ||
133 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); | 127 | layout->addWidget( lineBox ); |
134 | 128 | ||
135 | 129 | ||
136 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); | 130 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); |
137 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 131 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
138 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 8); | 132 | layout->addWidget( TabWidget, 4 ); |
139 | 133 | ||
140 | tab = new QWidget( TabWidget, "tab" ); | 134 | tab = new QWidget( TabWidget, "tab" ); |
141 | tabLayout = new QGridLayout( tab ); | 135 | tabLayout = new QGridLayout( tab ); |
142 | tabLayout->setSpacing( 2); | 136 | tabLayout->setSpacing( 2); |
143 | tabLayout->setMargin( 2); | 137 | tabLayout->setMargin( 2); |
144 | 138 | ||
145 | Local_View = new QListView( tab, "Local_View" ); | 139 | Local_View = new QListView( tab, "Local_View" ); |
146 | Local_View->addColumn( tr("File"),130); | 140 | Local_View->addColumn( tr("File"),130); |
147 | Local_View->addColumn( tr("Size"),-1); | 141 | Local_View->addColumn( tr("Size"),-1); |
148 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 142 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
149 | Local_View->addColumn( tr("Date"),-1); | 143 | Local_View->addColumn( tr("Date"),-1); |
150 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 144 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
151 | Local_View->setAllColumnsShowFocus(TRUE); | 145 | Local_View->setAllColumnsShowFocus(TRUE); |
152 | Local_View->setMultiSelection( TRUE ); | 146 | Local_View->setMultiSelection( TRUE ); |
153 | Local_View->setSelectionMode(QListView::Extended); | 147 | Local_View->setSelectionMode(QListView::Extended); |
154 | 148 | ||
155 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 149 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
156 | 150 | ||
157 | tabLayout->addWidget( Local_View, 0, 0 ); | 151 | tabLayout->addWidget( Local_View, 0, 0 ); |
158 | 152 | ||
159 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); | 153 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); |
160 | // TabWidget->insertTab( tab, tr("1")); | 154 | // TabWidget->insertTab( tab, tr("1")); |
161 | 155 | ||
162 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 156 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
163 | tabLayout_2 = new QGridLayout( tab_2 ); | 157 | tabLayout_2 = new QGridLayout( tab_2 ); |
164 | tabLayout_2->setSpacing( 2); | 158 | tabLayout_2->setSpacing( 2); |
165 | tabLayout_2->setMargin( 2); | 159 | tabLayout_2->setMargin( 2); |
166 | 160 | ||
167 | Remote_View = new QListView( tab_2, "Remote_View" ); | 161 | Remote_View = new QListView( tab_2, "Remote_View" ); |
168 | Remote_View->addColumn( tr("File"),130); | 162 | Remote_View->addColumn( tr("File"),130); |
169 | Remote_View->addColumn( tr("Size"),-1); | 163 | Remote_View->addColumn( tr("Size"),-1); |
170 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 164 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
171 | Remote_View->addColumn( tr("Date"),-1); | 165 | Remote_View->addColumn( tr("Date"),-1); |
172 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 166 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
173 | Remote_View->setAllColumnsShowFocus(TRUE); | 167 | Remote_View->setAllColumnsShowFocus(TRUE); |
174 | Remote_View->setMultiSelection( TRUE ); | 168 | Remote_View->setMultiSelection( TRUE ); |
175 | Remote_View->setSelectionMode(QListView::Extended); | 169 | Remote_View->setSelectionMode(QListView::Extended); |
176 | 170 | ||
177 | 171 | ||
178 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 172 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
179 | 173 | ||
180 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 174 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
181 | 175 | ||
182 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 176 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
183 | // TabWidget->insertTab( tab_2, tr( "2")); | 177 | // TabWidget->insertTab( tab_2, tr( "2")); |
184 | 178 | ||
185 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 179 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
186 | tabLayout_3 = new QGridLayout( tab_3 ); | 180 | tabLayout_3 = new QGridLayout( tab_3 ); |
187 | tabLayout_3->setSpacing( 2); | 181 | tabLayout_3->setSpacing( 2); |
188 | tabLayout_3->setMargin( 2); | 182 | tabLayout_3->setMargin( 2); |
189 | 183 | ||
190 | 184 | ||
191 | // OFileDialog fileDialog; | 185 | // OFileDialog fileDialog; |
192 | // fileDialog; | 186 | // fileDialog; |
193 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 187 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
194 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 188 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
195 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 189 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
196 | 190 | ||
197 | QListView *fileTree; | 191 | QListView *fileTree; |
198 | fileTree = new QListView( tab_3, "tree" ); | 192 | fileTree = new QListView( tab_3, "tree" ); |
199 | 193 | ||
200 | 194 | ||
201 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 195 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
202 | 196 | ||
203 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 197 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
204 | */ | 198 | */ |
205 | 199 | ||
206 | /////////////// | 200 | /////////////// |
207 | 201 | ||
208 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 202 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
209 | if (uname(&name) != -1) { | 203 | if (uname(&name) != -1) { |
210 | QString release=name.release; | 204 | QString release=name.release; |
211 | if(release.find("embedix",0,TRUE) !=-1) { | 205 | if(release.find("embedix",0,TRUE) !=-1) { |
212 | zaurusDevice=TRUE; | 206 | zaurusDevice=TRUE; |
213 | } else { | 207 | } else { |
214 | zaurusDevice=FALSE; | 208 | zaurusDevice=FALSE; |
215 | sdButton->hide(); | 209 | sdButton->hide(); |
216 | } | 210 | } |
217 | } | 211 | } |
218 | 212 | ||
219 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 213 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
220 | currentDir.setPath( QDir::currentDirPath()); | 214 | currentDir.setPath( QDir::currentDirPath()); |
221 | 215 | ||
222 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 216 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
223 | currentRemoteDir.setPath( QDir::currentDirPath()); | 217 | currentRemoteDir.setPath( QDir::currentDirPath()); |
224 | 218 | ||
225 | b = TRUE; | 219 | b = TRUE; |
226 | 220 | ||
227 | filterStr="*"; | 221 | filterStr="*"; |
228 | b=FALSE; | 222 | b=FALSE; |
229 | TabWidget->setCurrentTab(0); | 223 | TabWidget->setCurrentTab(0); |
230 | 224 | ||
231 | } | 225 | } |
232 | 226 | ||
233 | void AdvancedFm::initConnections() | 227 | void AdvancedFm::initConnections() |
234 | { | 228 | { |
235 | 229 | ||
236 | connect( qApp,SIGNAL( aboutToQuit()), | 230 | connect( qApp,SIGNAL( aboutToQuit()), |
237 | this, SLOT( cleanUp()) ); | 231 | this, SLOT( cleanUp()) ); |
238 | connect( qpeDirButton ,SIGNAL(released()), | 232 | connect( qpeDirButton ,SIGNAL(released()), |
239 | this,SLOT( QPEButtonPushed()) ); | 233 | this,SLOT( QPEButtonPushed()) ); |
240 | connect( cfButton ,SIGNAL(released()), | 234 | connect( cfButton ,SIGNAL(released()), |
241 | this,SLOT( CFButtonPushed()) ); | 235 | this,SLOT( CFButtonPushed()) ); |
242 | connect( sdButton ,SIGNAL(released()), | 236 | connect( sdButton ,SIGNAL(released()), |
243 | this,SLOT( SDButtonPushed()) ); | 237 | this,SLOT( SDButtonPushed()) ); |
244 | connect( cdUpButton ,SIGNAL(released()), | 238 | connect( cdUpButton ,SIGNAL(released()), |
245 | this,SLOT( upDir()) ); | 239 | this,SLOT( upDir()) ); |
246 | connect( docButton,SIGNAL(released()), | 240 | connect( docButton,SIGNAL(released()), |
247 | this,SLOT( docButtonPushed()) ); | 241 | this,SLOT( docButtonPushed()) ); |
248 | connect( homeButton,SIGNAL(released()), | 242 | connect( homeButton,SIGNAL(released()), |
249 | this,SLOT( homeButtonPushed()) ); | 243 | this,SLOT( homeButtonPushed()) ); |
250 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 244 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
251 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 245 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
252 | 246 | ||
253 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 247 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
254 | this,SLOT(currentPathComboChanged())); | 248 | this,SLOT(currentPathComboChanged())); |
255 | 249 | ||
256 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 250 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
257 | this,SLOT( ListClicked(QListViewItem *)) ); | 251 | this,SLOT( ListClicked(QListViewItem *)) ); |
258 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 252 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
259 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 253 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
260 | 254 | ||
261 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 255 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
262 | 256 | ||
263 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 257 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
264 | this,SLOT( ListClicked(QListViewItem *)) ); | 258 | this,SLOT( ListClicked(QListViewItem *)) ); |
265 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 259 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
266 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 260 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index eae86a4..575833a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -1,150 +1,148 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | #include "output.h" | 13 | #include "output.h" |
14 | #include "filePermissions.h" | 14 | #include "filePermissions.h" |
15 | 15 | ||
16 | #include <opie/otabwidget.h> | 16 | #include <opie/otabwidget.h> |
17 | #include <opie/oprocess.h> | 17 | #include <opie/oprocess.h> |
18 | 18 | ||
19 | #include <qpe/lnkproperties.h> | 19 | #include <qpe/lnkproperties.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/qpemenubar.h> | ||
22 | #include <qpe/qpetoolbar.h> | ||
23 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/applnk.h> | 23 | #include <qpe/applnk.h> |
26 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
27 | 25 | ||
28 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
29 | #include <qmultilineedit.h> | 27 | #include <qmultilineedit.h> |
30 | 28 | ||
31 | #include <qstring.h> | 29 | #include <qstring.h> |
32 | 30 | ||
33 | #include <qlayout.h> | 31 | #include <qlayout.h> |
34 | #include <qpixmap.h> | 32 | #include <qpixmap.h> |
35 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
36 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
37 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
38 | #include <qtoolbutton.h> | 36 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
40 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
41 | #include <qlistview.h> | 39 | #include <qlistview.h> |
42 | 40 | ||
43 | #include <stdlib.h> | 41 | #include <stdlib.h> |
44 | #include <unistd.h> | 42 | #include <unistd.h> |
45 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
46 | #include <dirent.h> | 44 | #include <dirent.h> |
47 | #include <sys/sendfile.h> | 45 | #include <sys/sendfile.h> |
48 | #include <fcntl.h> | 46 | #include <fcntl.h> |
49 | 47 | ||
50 | void AdvancedFm::doDirChange() | 48 | void AdvancedFm::doDirChange() |
51 | { | 49 | { |
52 | ListClicked( CurrentView()->currentItem()); | 50 | ListClicked( CurrentView()->currentItem()); |
53 | } | 51 | } |
54 | 52 | ||
55 | void AdvancedFm::showMenuHidden() | 53 | void AdvancedFm::showMenuHidden() |
56 | { | 54 | { |
57 | if (b) | 55 | if (b) |
58 | { | 56 | { |
59 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 57 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
60 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 58 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
61 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 59 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
62 | // b=FALSE; | 60 | // b=FALSE; |
63 | 61 | ||
64 | } | 62 | } |
65 | else | 63 | else |
66 | { | 64 | { |
67 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 65 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
68 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 66 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
69 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 67 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
70 | // b=TRUE; | 68 | // b=TRUE; |
71 | } | 69 | } |
72 | rePopulate(); | 70 | rePopulate(); |
73 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | 71 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); |
74 | if(b) b = false; else b = true; | 72 | if(b) b = false; else b = true; |
75 | } | 73 | } |
76 | 74 | ||
77 | void AdvancedFm::showHidden() | 75 | void AdvancedFm::showHidden() |
78 | { | 76 | { |
79 | if (b) | 77 | if (b) |
80 | { | 78 | { |
81 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 79 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
82 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 80 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 81 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | // b=FALSE; | 82 | // b=FALSE; |
85 | 83 | ||
86 | } | 84 | } |
87 | else | 85 | else |
88 | { | 86 | { |
89 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 87 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
90 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 88 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
91 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 89 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
92 | // b=TRUE; | 90 | // b=TRUE; |
93 | } | 91 | } |
94 | rePopulate(); | 92 | rePopulate(); |
95 | } | 93 | } |
96 | 94 | ||
97 | QString AdvancedFm::dealWithSymName(const QString &fileName) | 95 | QString AdvancedFm::dealWithSymName(const QString &fileName) |
98 | { | 96 | { |
99 | QString strItem = fileName; | 97 | QString strItem = fileName; |
100 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 98 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
101 | } | 99 | } |
102 | 100 | ||
103 | void AdvancedFm::runThis() | 101 | void AdvancedFm::runThis() |
104 | { | 102 | { |
105 | QString fs; | 103 | QString fs; |
106 | QDir *thisDir = CurrentDir(); | 104 | QDir *thisDir = CurrentDir(); |
107 | 105 | ||
108 | QString curFile = CurrentView()->currentItem()->text(0); | 106 | QString curFile = CurrentView()->currentItem()->text(0); |
109 | QString path = thisDir->canonicalPath(); | 107 | QString path = thisDir->canonicalPath(); |
110 | 108 | ||
111 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 109 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
112 | 110 | ||
113 | curFile = dealWithSymName((const QString&)curFile); | 111 | curFile = dealWithSymName((const QString&)curFile); |
114 | 112 | ||
115 | if(curFile != "../") | 113 | if(curFile != "../") |
116 | { | 114 | { |
117 | 115 | ||
118 | fs = getFileSystemType((const QString &) path); | 116 | fs = getFileSystemType((const QString &) path); |
119 | QFileInfo fileInfo( path + "/" + curFile); | 117 | QFileInfo fileInfo( path + "/" + curFile); |
120 | qDebug( fileInfo.owner()); | 118 | qDebug( fileInfo.owner()); |
121 | 119 | ||
122 | if( (fileInfo.permission( QFileInfo::ExeUser) | 120 | if( (fileInfo.permission( QFileInfo::ExeUser) |
123 | | fileInfo.permission( QFileInfo::ExeGroup) | 121 | | fileInfo.permission( QFileInfo::ExeGroup) |
124 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 122 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
125 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 123 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
126 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 124 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
127 | e << curFile; | 125 | e << curFile; |
128 | } | 126 | } |
129 | else | 127 | else |
130 | { | 128 | { |
131 | curFile = path + "/" + curFile; | 129 | curFile = path + "/" + curFile; |
132 | DocLnk nf(curFile); | 130 | DocLnk nf(curFile); |
133 | QString execStr = nf.exec(); | 131 | QString execStr = nf.exec(); |
134 | qDebug( execStr); | 132 | qDebug( execStr); |
135 | if( execStr.isEmpty() ) | 133 | if( execStr.isEmpty() ) |
136 | { | 134 | { |
137 | } | 135 | } |
138 | else | 136 | else |
139 | { | 137 | { |
140 | nf.execute(); | 138 | nf.execute(); |
141 | } | 139 | } |
142 | } | 140 | } |
143 | } | 141 | } |
144 | } | 142 | } |
145 | 143 | ||
146 | void AdvancedFm::runText() | 144 | void AdvancedFm::runText() |
147 | { | 145 | { |
148 | QString curFile = CurrentView()->currentItem()->text(0); | 146 | QString curFile = CurrentView()->currentItem()->text(0); |
149 | if(curFile != "../") | 147 | if(curFile != "../") |
150 | { | 148 | { |
@@ -649,241 +647,241 @@ void AdvancedFm::fileStatus() | |||
649 | } | 647 | } |
650 | 648 | ||
651 | 649 | ||
652 | void AdvancedFm::mkDir() | 650 | void AdvancedFm::mkDir() |
653 | { | 651 | { |
654 | makeDir(); | 652 | makeDir(); |
655 | } | 653 | } |
656 | 654 | ||
657 | void AdvancedFm::rn() | 655 | void AdvancedFm::rn() |
658 | { | 656 | { |
659 | renameIt(); | 657 | renameIt(); |
660 | } | 658 | } |
661 | 659 | ||
662 | void AdvancedFm::del() | 660 | void AdvancedFm::del() |
663 | { | 661 | { |
664 | doDelete(); | 662 | doDelete(); |
665 | } | 663 | } |
666 | 664 | ||
667 | void AdvancedFm::mkSym() | 665 | void AdvancedFm::mkSym() |
668 | { | 666 | { |
669 | QString cmd; | 667 | QString cmd; |
670 | QStringList curFileList = getPath(); | 668 | QStringList curFileList = getPath(); |
671 | if( curFileList.count() > 0) | 669 | if( curFileList.count() > 0) |
672 | { | 670 | { |
673 | QDir *thisDir = CurrentDir(); | 671 | QDir *thisDir = CurrentDir(); |
674 | QDir * thatDir = OtherDir(); | 672 | QDir * thatDir = OtherDir(); |
675 | 673 | ||
676 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 674 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
677 | { | 675 | { |
678 | 676 | ||
679 | QString destName = thatDir->canonicalPath()+"/"+(*it); | 677 | QString destName = thatDir->canonicalPath()+"/"+(*it); |
680 | if(destName.right(1) == "/") | 678 | if(destName.right(1) == "/") |
681 | { | 679 | { |
682 | destName = destName.left( destName.length() -1); | 680 | destName = destName.left( destName.length() -1); |
683 | } | 681 | } |
684 | 682 | ||
685 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 683 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
686 | 684 | ||
687 | if( curFile.right(1) == "/") | 685 | if( curFile.right(1) == "/") |
688 | { | 686 | { |
689 | curFile = curFile.left( curFile.length() -1); | 687 | curFile = curFile.left( curFile.length() -1); |
690 | } | 688 | } |
691 | 689 | ||
692 | cmd = "ln -s "+curFile+" "+destName; | 690 | cmd = "ln -s "+curFile+" "+destName; |
693 | qDebug(cmd); | 691 | qDebug(cmd); |
694 | startProcess( (const QString)cmd ); | 692 | startProcess( (const QString)cmd ); |
695 | } | 693 | } |
696 | setOtherTabCurrent(); | 694 | setOtherTabCurrent(); |
697 | populateView(); | 695 | populateView(); |
698 | } | 696 | } |
699 | } | 697 | } |
700 | 698 | ||
701 | void AdvancedFm::doBeam() | 699 | void AdvancedFm::doBeam() |
702 | { | 700 | { |
703 | Ir ir; | 701 | Ir ir; |
704 | if(!ir.supported()) | 702 | if(!ir.supported()) |
705 | { | 703 | { |
706 | } | 704 | } |
707 | else | 705 | else |
708 | { | 706 | { |
709 | QStringList curFileList = getPath(); | 707 | QStringList curFileList = getPath(); |
710 | if( curFileList.count() > 0) | 708 | if( curFileList.count() > 0) |
711 | { | 709 | { |
712 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 710 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
713 | { | 711 | { |
714 | 712 | ||
715 | QString curFile = CurrentDir()->canonicalPath()+"/"+(*it); | 713 | QString curFile = CurrentDir()->canonicalPath()+"/"+(*it); |
716 | if( curFile.right(1) == "/") | 714 | if( curFile.right(1) == "/") |
717 | { | 715 | { |
718 | curFile = curFile.left( curFile.length() -1); | 716 | curFile = curFile.left( curFile.length() -1); |
719 | } | 717 | } |
720 | Ir *file = new Ir(this, "IR"); | 718 | Ir *file = new Ir(this, "IR"); |
721 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 719 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
722 | file->send( curFile, curFile ); | 720 | file->send( curFile, curFile ); |
723 | } | 721 | } |
724 | } | 722 | } |
725 | } | 723 | } |
726 | 724 | ||
727 | } | 725 | } |
728 | 726 | ||
729 | void AdvancedFm::fileBeamFinished( Ir *) | 727 | void AdvancedFm::fileBeamFinished( Ir *) |
730 | { | 728 | { |
731 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 729 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
732 | } | 730 | } |
733 | 731 | ||
734 | void AdvancedFm::selectAll() | 732 | void AdvancedFm::selectAll() |
735 | { | 733 | { |
736 | // if (TabWidget->currentTab() == 0) { | 734 | // if (TabWidget->currentTab() == 0) { |
737 | QListView *thisView = CurrentView(); | 735 | QListView *thisView = CurrentView(); |
738 | thisView->selectAll(true); | 736 | thisView->selectAll(true); |
739 | thisView->setSelected( thisView->firstChild(),false); | 737 | thisView->setSelected( thisView->firstChild(),false); |
740 | // } else { | 738 | // } else { |
741 | // Remote_View->selectAll(true); | 739 | // Remote_View->selectAll(true); |
742 | // Remote_View->setSelected( Remote_View->firstChild(),false); | 740 | // Remote_View->setSelected( Remote_View->firstChild(),false); |
743 | // } | 741 | // } |
744 | } | 742 | } |
745 | 743 | ||
746 | void AdvancedFm::startProcess(const QString & cmd) | 744 | void AdvancedFm::startProcess(const QString & cmd) |
747 | { | 745 | { |
748 | QStringList command; | 746 | QStringList command; |
749 | OProcess *process; | 747 | OProcess *process; |
750 | process = new OProcess(); | 748 | process = new OProcess(); |
751 | connect(process, SIGNAL(processExited(OProcess *)), | 749 | connect(process, SIGNAL(processExited(OProcess *)), |
752 | this, SLOT( processEnded(OProcess *))); | 750 | this, SLOT( processEnded(OProcess *))); |
753 | 751 | ||
754 | connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), | 752 | connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), |
755 | this, SLOT( oprocessStderr(OProcess *, char *, int))); | 753 | this, SLOT( oprocessStderr(OProcess *, char *, int))); |
756 | 754 | ||
757 | command << "/bin/sh"; | 755 | command << "/bin/sh"; |
758 | command << "-c"; | 756 | command << "-c"; |
759 | command << cmd.latin1(); | 757 | command << cmd.latin1(); |
760 | *process << command; | 758 | *process << command; |
761 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 759 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
762 | qDebug("could not start process"); | 760 | qDebug("could not start process"); |
763 | } | 761 | } |
764 | 762 | ||
765 | void AdvancedFm::processEnded(OProcess *) | 763 | void AdvancedFm::processEnded(OProcess *) |
766 | { | 764 | { |
767 | // populateLocalView(); | 765 | // populateLocalView(); |
768 | populateView(); | 766 | populateView(); |
769 | } | 767 | } |
770 | 768 | ||
771 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) { | 769 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) { |
772 | qWarning("received stderrt %d bytes", buflen); | 770 | qWarning("received stderrt %d bytes", buflen); |
773 | 771 | ||
774 | QString lineStr = buffer; | 772 | QString lineStr = buffer; |
775 | // lineStr=lineStr.left(lineStr.length()-1); | 773 | // lineStr=lineStr.left(lineStr.length()-1); |
776 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 774 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
777 | 775 | ||
778 | // OutputEdit->append(lineStr); | 776 | // OutputEdit->append(lineStr); |
779 | // OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | 777 | // OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); |
780 | } | 778 | } |
781 | 779 | ||
782 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) | 780 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) |
783 | { | 781 | { |
784 | if ( o->inherits( "QLineEdit" ) ) | 782 | if ( o->inherits( "QLineEdit" ) ) |
785 | { | 783 | { |
786 | if ( e->type() == QEvent::KeyPress ) | 784 | if ( e->type() == QEvent::KeyPress ) |
787 | { | 785 | { |
788 | QKeyEvent *ke = (QKeyEvent*)e; | 786 | QKeyEvent *ke = (QKeyEvent*)e; |
789 | if ( ke->key() == Key_Return || | 787 | if ( ke->key() == Key_Return || |
790 | ke->key() == Key_Enter ) | 788 | ke->key() == Key_Enter ) |
791 | { | 789 | { |
792 | okRename(); | 790 | okRename(); |
793 | return true; | 791 | return true; |
794 | } | 792 | } |
795 | else if ( ke->key() == Key_Escape ) | 793 | else if ( ke->key() == Key_Escape ) |
796 | { | 794 | { |
797 | cancelRename(); | 795 | cancelRename(); |
798 | return true; | 796 | return true; |
799 | } | 797 | } |
800 | } | 798 | } |
801 | else if ( e->type() == QEvent::FocusOut ) | 799 | else if ( e->type() == QEvent::FocusOut ) |
802 | { | 800 | { |
803 | cancelRename(); | 801 | cancelRename(); |
804 | return true; | 802 | return true; |
805 | } | 803 | } |
806 | } | 804 | } |
807 | if ( o->inherits( "QListView" ) ) | 805 | if ( o->inherits( "QListView" ) ) |
808 | { | 806 | { |
809 | if ( e->type() == QEvent::FocusOut ) | 807 | if ( e->type() == QEvent::FocusOut ) |
810 | { | 808 | { |
811 | printf("focusIn\n"); | 809 | printf("focusIn\n"); |
812 | 810 | ||
813 | } | 811 | } |
814 | } | 812 | } |
815 | 813 | ||
816 | return QWidget::eventFilter( o, e ); | 814 | return QWidget::eventFilter( o, e ); |
817 | } | 815 | } |
818 | 816 | ||
819 | 817 | ||
820 | void AdvancedFm::cancelRename() | 818 | void AdvancedFm::cancelRename() |
821 | { | 819 | { |
822 | qDebug("cancel rename"); | 820 | qDebug("cancel rename"); |
823 | QListView * view; | 821 | QListView * view; |
824 | view = CurrentView(); | 822 | view = CurrentView(); |
825 | 823 | ||
826 | bool resetFocus = view->viewport()->focusProxy() == renameBox; | 824 | bool resetFocus = view->viewport()->focusProxy() == renameBox; |
827 | delete renameBox; | 825 | delete renameBox; |
828 | renameBox = 0; | 826 | renameBox = 0; |
829 | if ( resetFocus ) | 827 | if ( resetFocus ) |
830 | { | 828 | { |
831 | view->viewport()->setFocusProxy( view); | 829 | view->viewport()->setFocusProxy( view); |
832 | view->setFocus(); | 830 | view->setFocus(); |
833 | } | 831 | } |
834 | } | 832 | } |
835 | 833 | ||
836 | void AdvancedFm::doRename(QListView * view) | 834 | void AdvancedFm::doRename(QListView * view) |
837 | { | 835 | { |
838 | 836 | ||
839 | QRect r = view->itemRect( view->currentItem( )); | 837 | QRect r = view->itemRect( view->currentItem( )); |
840 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 838 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
841 | r.setX( view->contentsX() ); | 839 | r.setX( view->contentsX() ); |
842 | if ( r.width() > view->visibleWidth() ) | 840 | if ( r.width() > view->visibleWidth() ) |
843 | r.setWidth( view->visibleWidth() ); | 841 | r.setWidth( view->visibleWidth() ); |
844 | 842 | ||
845 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 843 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
846 | renameBox->setFrame(true); | 844 | renameBox->setFrame(true); |
847 | 845 | ||
848 | renameBox->setText( view->currentItem()->text(0) ); | 846 | renameBox->setText( view->currentItem()->text(0) ); |
849 | 847 | ||
850 | renameBox->selectAll(); | 848 | renameBox->selectAll(); |
851 | renameBox->installEventFilter( this ); | 849 | renameBox->installEventFilter( this ); |
852 | view->addChild( renameBox, r.x(), r.y() ); | 850 | view->addChild( renameBox, r.x(), r.y() ); |
853 | renameBox->resize( r.size() ); | 851 | renameBox->resize( r.size() ); |
854 | view->viewport()->setFocusProxy( renameBox ); | 852 | view->viewport()->setFocusProxy( renameBox ); |
855 | renameBox->setFocus(); | 853 | renameBox->setFocus(); |
856 | renameBox->show(); | 854 | renameBox->show(); |
857 | 855 | ||
858 | } | 856 | } |
859 | 857 | ||
860 | 858 | ||
861 | void AdvancedFm::renameIt() | 859 | void AdvancedFm::renameIt() |
862 | { | 860 | { |
863 | QListView *thisView = CurrentView(); | 861 | QListView *thisView = CurrentView(); |
864 | oldName = thisView->currentItem()->text(0); | 862 | oldName = thisView->currentItem()->text(0); |
865 | doRename( thisView ); | 863 | doRename( thisView ); |
866 | populateView(); | 864 | populateView(); |
867 | } | 865 | } |
868 | 866 | ||
869 | void AdvancedFm::okRename() | 867 | void AdvancedFm::okRename() |
870 | { | 868 | { |
871 | QString newName = renameBox->text(); | 869 | QString newName = renameBox->text(); |
872 | cancelRename(); | 870 | cancelRename(); |
873 | // int tabs=0; | 871 | // int tabs=0; |
874 | QListView * view = CurrentView(); | 872 | QListView * view = CurrentView(); |
875 | QString path = CurrentDir()->canonicalPath() + "/"; | 873 | QString path = CurrentDir()->canonicalPath() + "/"; |
876 | oldName = path + oldName; | 874 | oldName = path + oldName; |
877 | newName = path + newName; | 875 | newName = path + newName; |
878 | 876 | ||
879 | if( view->currentItem() == NULL) | 877 | if( view->currentItem() == NULL) |
880 | return; | 878 | return; |
881 | if( rename( oldName.latin1(), newName.latin1())== -1) | 879 | if( rename( oldName.latin1(), newName.latin1())== -1) |
882 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 880 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
883 | else | 881 | else |
884 | oldName = ""; | 882 | oldName = ""; |
885 | 883 | ||
886 | view->takeItem( view->currentItem() ); | 884 | view->takeItem( view->currentItem() ); |
887 | delete view->currentItem(); | 885 | delete view->currentItem(); |
888 | populateView(); | 886 | populateView(); |
889 | } | 887 | } |