author | llornkcor <llornkcor> | 2003-03-26 02:07:38 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-03-26 02:07:38 (UTC) |
commit | 445c957aeddcea7ee0b83657e00987103a6d35b0 (patch) (unidiff) | |
tree | 4efbff1b8896295e532d1c10dd33e4ab177f014c /noncore/apps/advancedfm | |
parent | a76176911328349414203edda3785ac8925c0648 (diff) | |
download | opie-445c957aeddcea7ee0b83657e00987103a6d35b0.zip opie-445c957aeddcea7ee0b83657e00987103a6d35b0.tar.gz opie-445c957aeddcea7ee0b83657e00987103a6d35b0.tar.bz2 |
change to UnknownDocument icon and scale
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 943 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 2 |
2 files changed, 477 insertions, 468 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index bb7f346..1a5e131 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -33,2 +33,3 @@ | |||
33 | 33 | ||
34 | #include <qwmatrix.h> | ||
34 | #include <qregexp.h> | 35 | #include <qregexp.h> |
@@ -71,10 +72,15 @@ | |||
71 | AdvancedFm::AdvancedFm( ) | 72 | AdvancedFm::AdvancedFm( ) |
72 | : QMainWindow( ) { | 73 | : QMainWindow( ) { |
73 | init(); | 74 | init(); |
74 | renameBox = 0; | 75 | renameBox = 0; |
75 | 76 | ||
76 | initConnections(); | 77 | QWMatrix matrix; |
77 | whichTab=1; | 78 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); |
78 | rePopulate(); | 79 | matrix.scale( .4, .4); |
79 | currentPathCombo->setFocus(); | 80 | unknownXpm = pix.xForm(matrix); |
81 | |||
82 | initConnections(); | ||
83 | whichTab=1; | ||
84 | rePopulate(); | ||
85 | currentPathCombo->setFocus(); | ||
80 | } | 86 | } |
@@ -99,20 +105,20 @@ void AdvancedFm::tabChanged(QWidget *w) | |||
99 | { | 105 | { |
100 | if( w == tab) | 106 | if( w == tab) |
101 | whichTab = 1; | 107 | whichTab = 1; |
102 | else | 108 | else |
103 | whichTab = 2; | 109 | whichTab = 2; |
104 | 110 | ||
105 | //qDebug("tab changed %d", whichTab ); | 111 | // qDebug("tab changed %d", whichTab ); |
106 | 112 | ||
107 | QString path = CurrentDir()->canonicalPath(); | 113 | QString path = CurrentDir()->canonicalPath(); |
108 | currentPathCombo->lineEdit()->setText( path ); | 114 | currentPathCombo->lineEdit()->setText( path ); |
109 | 115 | ||
110 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 116 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
111 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 117 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
112 | 118 | ||
113 | QString fs= getFileSystemType( (const QString &) path); | 119 | QString fs= getFileSystemType( (const QString &) path); |
114 | 120 | ||
115 | setCaption("AdvancedFm :: "+fs+" :: " | 121 | setCaption("AdvancedFm :: "+fs+" :: " |
116 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 122 | +checkDiskSpace( (const QString &) path )+ " kB free" ); |
117 | chdir( path.latin1()); | 123 | chdir( path.latin1()); |
118 | } | 124 | } |
@@ -123,5 +129,5 @@ void AdvancedFm::populateView() | |||
123 | QPixmap pm; | 129 | QPixmap pm; |
124 | QListView *thisView = CurrentView(); | 130 | QListView *thisView = CurrentView(); |
125 | QDir *thisDir = CurrentDir(); | 131 | QDir *thisDir = CurrentDir(); |
126 | QString path = thisDir->canonicalPath(); | 132 | QString path = thisDir->canonicalPath(); |
127 | 133 | ||
@@ -140,99 +146,100 @@ void AdvancedFm::populateView() | |||
140 | while ( (fi=it.current()) ) | 146 | while ( (fi=it.current()) ) |
141 | { | 147 | { |
142 | if (fi->isSymLink() ) | 148 | if (fi->isSymLink() ) |
143 | { | 149 | { |
144 | QString symLink=fi->readLink(); | 150 | QString symLink=fi->readLink(); |
145 | QFileInfo sym( symLink); | 151 | QFileInfo sym( symLink); |
146 | fileS.sprintf( "%10i", sym.size() ); | 152 | fileS.sprintf( "%10i", sym.size() ); |
147 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 153 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
148 | fileDate = sym.lastModified().toString(); | 154 | fileDate = sym.lastModified().toString(); |
149 | } | 155 | } |
150 | else | 156 | else |
151 | { | 157 | { |
152 | fileS.sprintf( "%10i", fi->size() ); | 158 | fileS.sprintf( "%10i", fi->size() ); |
153 | fileL.sprintf( "%s",fi->fileName().data() ); | 159 | fileL.sprintf( "%s",fi->fileName().data() ); |
154 | fileDate= fi->lastModified().toString(); | 160 | fileDate= fi->lastModified().toString(); |
155 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) | 161 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) |
156 | { | 162 | { |
157 | fileL+="/"; | 163 | fileL+="/"; |
158 | isDir=TRUE; | 164 | isDir=TRUE; |
159 | } | 165 | } |
160 | } | 166 | } |
161 | 167 | ||
162 | QFileInfo fileInfo( path + "/" + fileL); | 168 | QFileInfo fileInfo( path + "/" + fileL); |
163 | 169 | ||
164 | if(fileL !="./" && fi->exists()) | 170 | if(fileL !="./" && fi->exists()) |
165 | { | 171 | { |
166 | item= new QListViewItem( thisView, fileL, fileS , fileDate); | 172 | item= new QListViewItem( thisView, fileL, fileS , fileDate); |
167 | 173 | ||
168 | if(isDir || fileL.find("/",0,TRUE) != -1) | 174 | if(isDir || fileL.find("/",0,TRUE) != -1) |
169 | { | 175 | { |
170 | 176 | ||
171 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 177 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
172 | pm = Resource::loadPixmap( "lockedfolder" ); | 178 | pm = Resource::loadPixmap( "lockedfolder" ); |
173 | else | 179 | else |
174 | pm= Resource::loadPixmap( "folder" ); | 180 | pm= Resource::loadPixmap( "folder" ); |
175 | } | 181 | } |
176 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) | 182 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) |
177 | { | 183 | { |
178 | pm = Resource::loadPixmap( "exec"); | 184 | pm = Resource::loadPixmap( "exec"); |
179 | } | 185 | } |
180 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 186 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
181 | | fileInfo.permission( QFileInfo::ExeGroup) | 187 | | fileInfo.permission( QFileInfo::ExeGroup) |
182 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) | 188 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) |
183 | { | 189 | { |
184 | pm = Resource::loadPixmap( "exec"); | 190 | pm = Resource::loadPixmap( "exec"); |
185 | } | 191 | } |
186 | else if( !fi->isReadable() ) | 192 | else if( !fi->isReadable() ) |
187 | { | 193 | { |
188 | pm = Resource::loadPixmap( "locked" ); | 194 | pm = Resource::loadPixmap( "locked" ); |
189 | } | 195 | } |
190 | else { //everything else goes by mimetype | 196 | else { //everything else goes by mimetype |
191 | MimeType mt(fi->filePath()); | 197 | MimeType mt(fi->filePath()); |
192 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 198 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
193 | if(pm.isNull()) | 199 | if(pm.isNull()) { |
194 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 200 | pm = unknownXpm; |
195 | } | 201 | } |
196 | item->setPixmap( 0,pm); | 202 | } |
197 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) | 203 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) |
198 | { | 204 | { |
199 | // overlay link image | 205 | // overlay link image |
200 | pm= Resource::loadPixmap( "folder" ); | 206 | pm= Resource::loadPixmap( "folder" ); |
201 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 207 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
202 | QPainter painter( &pm ); | 208 | QPainter painter( &pm ); |
203 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 209 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
204 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 210 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
205 | item->setPixmap( 0, pm); | 211 | } |
206 | } | 212 | item->setPixmap( 0,pm); |
207 | } | 213 | |
208 | isDir=FALSE; | 214 | } |
209 | ++it; | 215 | isDir=FALSE; |
210 | } | 216 | ++it; |
217 | } | ||
211 | 218 | ||
212 | if( path.find("dev",0,TRUE) != -1) | 219 | if( path.find("dev",0,TRUE) != -1) |
213 | { | 220 | { |
214 | struct stat buf; | 221 | struct stat buf; |
215 | dev_t devT; | 222 | dev_t devT; |
216 | DIR *dir; | 223 | DIR *dir; |
217 | struct dirent *mydirent; | 224 | struct dirent *mydirent; |
218 | 225 | ||
219 | if((dir = opendir( path.latin1())) != NULL) | 226 | if((dir = opendir( path.latin1())) != NULL) |
220 | while ((mydirent = readdir(dir)) != NULL) | 227 | while ((mydirent = readdir(dir)) != NULL) |
221 | { | 228 | { |
222 | lstat( mydirent->d_name, &buf); | 229 | lstat( mydirent->d_name, &buf); |
223 | // qDebug(mydirent->d_name); | 230 | // qDebug(mydirent->d_name); |
224 | fileL.sprintf("%s", mydirent->d_name); | 231 | fileL.sprintf("%s", mydirent->d_name); |
225 | devT = buf.st_dev; | 232 | devT = buf.st_dev; |
226 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 233 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
227 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 234 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
228 | if( fileL.find(".") == -1 ) | 235 | if( fileL.find(".") == -1 ) |
229 | { | 236 | { |
230 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 237 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
231 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 238 | pm = unknownXpm; |
232 | item->setPixmap( 0,pm); | 239 | item->setPixmap( 0,pm); |
233 | } | 240 | } |
234 | } | 241 | } |
235 | 242 | ||
236 | closedir(dir); | 243 | closedir(dir); |
237 | } | 244 | } |
238 | 245 | ||
@@ -244,11 +251,11 @@ void AdvancedFm::rePopulate() | |||
244 | { | 251 | { |
245 | int tmpTab = whichTab; | 252 | int tmpTab = whichTab; |
246 | qDebug("%d", tmpTab); | 253 | qDebug("%d", tmpTab); |
247 | 254 | ||
248 | for(int i =1; i < 3; i++) | 255 | for(int i =1; i < 3; i++) |
249 | { | 256 | { |
250 | TabWidget->setCurrentTab(i - 1); | 257 | TabWidget->setCurrentTab(i - 1); |
251 | populateView(); | 258 | populateView(); |
252 | } | 259 | } |
253 | TabWidget->setCurrentTab( tmpTab - 1); | 260 | TabWidget->setCurrentTab( tmpTab - 1); |
254 | } | 261 | } |
@@ -258,31 +265,31 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) | |||
258 | if(selectedItem) | 265 | if(selectedItem) |
259 | { | 266 | { |
260 | QString strItem=selectedItem->text(0); | 267 | QString strItem=selectedItem->text(0); |
261 | QString strSize=selectedItem->text(1); | 268 | QString strSize=selectedItem->text(1); |
262 | strSize=strSize.stripWhiteSpace(); | 269 | strSize=strSize.stripWhiteSpace(); |
263 | bool isDirectory = false; | 270 | bool isDirectory = false; |
264 | QString strItem2; | 271 | QString strItem2; |
265 | 272 | ||
266 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 273 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink |
267 | { | 274 | { |
268 | strItem2 = dealWithSymName((const QString&)strItem); | 275 | strItem2 = dealWithSymName((const QString&)strItem); |
269 | if(QDir(strItem2).exists() ) | 276 | if(QDir(strItem2).exists() ) |
270 | strItem = strItem2; | 277 | strItem = strItem2; |
271 | } | 278 | } |
272 | 279 | ||
273 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 280 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) |
274 | { | 281 | { |
275 | 282 | ||
276 | if(QDir(strItem).exists()) | 283 | if(QDir(strItem).exists()) |
277 | isDirectory = true; | 284 | isDirectory = true; |
278 | } | 285 | } |
279 | 286 | ||
280 | if( isDirectory ) | 287 | if( isDirectory ) |
281 | { | 288 | { |
282 | CurrentDir()->cd( strItem, TRUE); | 289 | CurrentDir()->cd( strItem, TRUE); |
283 | populateView(); | 290 | populateView(); |
284 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 291 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
285 | } | 292 | } |
286 | chdir( strItem.latin1()); | 293 | chdir( strItem.latin1()); |
287 | } | 294 | } |
288 | } | 295 | } |
@@ -293,8 +300,8 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) | |||
293 | { | 300 | { |
294 | if(renameBox != 0 ) | 301 | if(renameBox != 0 ) |
295 | { | 302 | { |
296 | cancelRename(); | 303 | cancelRename(); |
297 | } | 304 | } |
298 | } | 305 | } |
299 | break; | 306 | break; |
300 | case 2: | 307 | case 2: |
@@ -329,11 +336,11 @@ void AdvancedFm::currentPathComboChanged() | |||
329 | { | 336 | { |
330 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) | 337 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) |
331 | { | 338 | { |
332 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 339 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
333 | populateView(); | 340 | populateView(); |
334 | } | 341 | } |
335 | else | 342 | else |
336 | { | 343 | { |
337 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 344 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
338 | } | 345 | } |
339 | } | 346 | } |
@@ -344,21 +351,21 @@ void AdvancedFm::fillCombo(const QString ¤tPath) | |||
344 | if ( whichTab == 1) | 351 | if ( whichTab == 1) |
345 | { | 352 | { |
346 | currentPathCombo->lineEdit()->setText( currentPath); | 353 | currentPathCombo->lineEdit()->setText( currentPath); |
347 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 354 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) |
348 | { | 355 | { |
349 | currentPathCombo->clear(); | 356 | currentPathCombo->clear(); |
350 | localDirPathStringList.prepend( currentPath ); | 357 | localDirPathStringList.prepend( currentPath ); |
351 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 358 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
352 | } | 359 | } |
353 | } | 360 | } |
354 | else | 361 | else |
355 | { | 362 | { |
356 | currentPathCombo->lineEdit()->setText( currentPath); | 363 | currentPathCombo->lineEdit()->setText( currentPath); |
357 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 364 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) |
358 | { | 365 | { |
359 | currentPathCombo->clear(); | 366 | currentPathCombo->clear(); |
360 | remoteDirPathStringList.prepend( currentPath ); | 367 | remoteDirPathStringList.prepend( currentPath ); |
361 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 368 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
362 | } | 369 | } |
363 | } | 370 | } |
364 | } | 371 | } |
@@ -376,14 +383,14 @@ QStringList AdvancedFm::getPath() | |||
376 | QStringList strList; | 383 | QStringList strList; |
377 | QListView *thisView=CurrentView(); | 384 | QListView *thisView=CurrentView(); |
378 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 385 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
379 | QListViewItemIterator it( thisView ); | 386 | QListViewItemIterator it( thisView ); |
380 | for ( ; it.current(); ++it ) | 387 | for ( ; it.current(); ++it ) |
381 | { | 388 | { |
382 | if ( it.current()->isSelected() ) | 389 | if ( it.current()->isSelected() ) |
383 | { | 390 | { |
384 | strList << it.current()->text(0); | 391 | strList << it.current()->text(0); |
385 | // qDebug(it.current()->text(0)); | 392 | // qDebug(it.current()->text(0)); |
386 | } | 393 | } |
387 | } | 394 | } |
388 | return strList; | 395 | return strList; |
389 | } | 396 | } |
@@ -394,4 +401,4 @@ void AdvancedFm::homeButtonPushed() | |||
394 | chdir( current.latin1() ); | 401 | chdir( current.latin1() ); |
395 | CurrentDir()->cd( current, TRUE); | 402 | CurrentDir()->cd( current, TRUE); |
396 | populateView(); | 403 | populateView(); |
397 | update(); | 404 | update(); |
@@ -403,4 +410,4 @@ void AdvancedFm::docButtonPushed() | |||
403 | chdir( current.latin1() ); | 410 | chdir( current.latin1() ); |
404 | CurrentDir()->cd( current, TRUE); | 411 | CurrentDir()->cd( current, TRUE); |
405 | populateView(); | 412 | populateView(); |
406 | update(); | 413 | update(); |
@@ -410,6 +417,6 @@ void AdvancedFm::SDButtonPushed() | |||
410 | { | 417 | { |
411 | QString current = "/mnt/card";// this can change so fix | 418 | QString current = "/mnt/card";// this can change so fix |
412 | chdir( current.latin1() ); | 419 | chdir( current.latin1() ); |
413 | CurrentDir()->cd( current, TRUE); | 420 | CurrentDir()->cd( current, TRUE); |
414 | populateView(); | 421 | populateView(); |
415 | update(); | 422 | update(); |
@@ -419,11 +426,11 @@ void AdvancedFm::CFButtonPushed() | |||
419 | { | 426 | { |
420 | QString current; | 427 | QString current; |
421 | if(zaurusDevice) | 428 | if(zaurusDevice) |
422 | current= "/mnt/cf"; //zaurus | 429 | current= "/mnt/cf"; //zaurus |
423 | else | 430 | else |
424 | current = "/mnt/hda"; //ipaq | 431 | current = "/mnt/hda"; //ipaq |
425 | chdir( current.latin1() ); | 432 | chdir( current.latin1() ); |
426 | CurrentDir()->cd( current, TRUE); | 433 | CurrentDir()->cd( current, TRUE); |
427 | populateView(); | 434 | populateView(); |
428 | update(); | 435 | update(); |
429 | } | 436 | } |
@@ -434,5 +441,5 @@ void AdvancedFm::doAbout() | |||
434 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 441 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
435 | "is copyright 2002-2003 by\n" | 442 | "is copyright 2002-2003 by\n" |
436 | "L.J.Potter<llornkcor@handhelds.org>\n" | 443 | "L.J.Potter<llornkcor@handhelds.org>\n" |
437 | "and is licensed by the GPL")); | 444 | "and is licensed by the GPL")); |
438 | } | 445 | } |
@@ -444,18 +451,18 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) | |||
444 | { | 451 | { |
445 | switch ( e->key() ) { | 452 | switch ( e->key() ) { |
446 | case Key_Delete: | 453 | case Key_Delete: |
447 | del(); | 454 | del(); |
448 | break; | 455 | break; |
449 | case Key_A: | 456 | case Key_A: |
450 | copyAs(); | 457 | copyAs(); |
451 | break; | 458 | break; |
452 | case Key_C: | 459 | case Key_C: |
453 | copy(); | 460 | copy(); |
454 | break; | 461 | break; |
455 | case Key_E: | 462 | case Key_E: |
456 | runThis(); | 463 | runThis(); |
457 | break; | 464 | break; |
458 | case Key_G: | 465 | case Key_G: |
459 | { | 466 | { |
460 | currentPathCombo->lineEdit()->setFocus(); | 467 | currentPathCombo->lineEdit()->setFocus(); |
461 | } | 468 | } |
@@ -463,51 +470,51 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) | |||
463 | 470 | ||
464 | case Key_H: | 471 | case Key_H: |
465 | showHidden(); | 472 | showHidden(); |
466 | break; | 473 | break; |
467 | case Key_I: | 474 | case Key_I: |
468 | fileStatus(); | 475 | fileStatus(); |
469 | break; | 476 | break; |
470 | case Key_M: | 477 | case Key_M: |
471 | move(); | 478 | move(); |
472 | break; | 479 | break; |
473 | case Key_N: | 480 | case Key_N: |
474 | mkDir(); | 481 | mkDir(); |
475 | break; | 482 | break; |
476 | case Key_P: | 483 | case Key_P: |
477 | filePerms(); | 484 | filePerms(); |
478 | break; | 485 | break; |
479 | case Key_R: | 486 | case Key_R: |
480 | rn(); | 487 | rn(); |
481 | break; | 488 | break; |
482 | case Key_U: | 489 | case Key_U: |
483 | upDir(); | 490 | upDir(); |
484 | break; | 491 | break; |
485 | case Key_1: | 492 | case Key_1: |
486 | switchToLocalTab(); | 493 | switchToLocalTab(); |
487 | break; | 494 | break; |
488 | case Key_2: | 495 | case Key_2: |
489 | switchToRemoteTab(); | 496 | switchToRemoteTab(); |
490 | break; | 497 | break; |
491 | case Key_3: | 498 | case Key_3: |
492 | CFButtonPushed(); | 499 | CFButtonPushed(); |
493 | break; | 500 | break; |
494 | case Key_4: | 501 | case Key_4: |
495 | SDButtonPushed(); | 502 | SDButtonPushed(); |
496 | break; | 503 | break; |
497 | case Key_5: | 504 | case Key_5: |
498 | homeButtonPushed(); | 505 | homeButtonPushed(); |
499 | break; | 506 | break; |
500 | case Key_6: | 507 | case Key_6: |
501 | docButtonPushed(); | 508 | docButtonPushed(); |
502 | break; | 509 | break; |
503 | case Key_7: | 510 | case Key_7: |
504 | break; | 511 | break; |
505 | case Key_8: | 512 | case Key_8: |
506 | break; | 513 | break; |
507 | case Key_9: | 514 | case Key_9: |
508 | break; | 515 | break; |
509 | case Key_0: | 516 | case Key_0: |
510 | break; | 517 | break; |
511 | }; | 518 | }; |
512 | e->accept(); | 519 | e->accept(); |
513 | } | 520 | } |
@@ -517,4 +524,4 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
517 | { | 524 | { |
518 | if( CurrentView()->hasFocus() ) | 525 | if( CurrentView()->hasFocus() ) |
519 | e->ignore(); | 526 | e->ignore(); |
520 | } | 527 | } |
@@ -539,5 +546,5 @@ void AdvancedFm::parsetab(const QString &fileName) | |||
539 | if ( mntfp ) | 546 | if ( mntfp ) |
540 | { | 547 | { |
541 | while ( (me = getmntent( mntfp )) != 0 ) | 548 | while ( (me = getmntent( mntfp )) != 0 ) |
542 | { | 549 | { |
543 | QString deviceName = me->mnt_fsname; | 550 | QString deviceName = me->mnt_fsname; |
@@ -546,3 +553,3 @@ void AdvancedFm::parsetab(const QString &fileName) | |||
546 | if(deviceName != "none") | 553 | if(deviceName != "none") |
547 | { | 554 | { |
548 | if( fsList.contains(filesystemType) == 0 | 555 | if( fsList.contains(filesystemType) == 0 |
@@ -578,16 +585,16 @@ QString AdvancedFm::getDiskSpace( const QString &path) | |||
578 | { | 585 | { |
579 | struct statfs fss; | 586 | struct statfs fss; |
580 | if ( !statfs( path.latin1(), &fss ) ) { | 587 | if ( !statfs( path.latin1(), &fss ) ) { |
581 | int blkSize = fss.f_bsize; | 588 | int blkSize = fss.f_bsize; |
582 | // int totalBlks = fs.f_blocks; | 589 | // int totalBlks = fs.f_blocks; |
583 | int availBlks = fss.f_bavail; | 590 | int availBlks = fss.f_bavail; |
584 | 591 | ||
585 | long mult = blkSize / 1024; | 592 | long mult = blkSize / 1024; |
586 | long div = 1024 / blkSize; | 593 | long div = 1024 / blkSize; |
587 | if ( !mult ) mult = 1; | 594 | if ( !mult ) mult = 1; |
588 | if ( !div ) div = 1; | 595 | if ( !div ) div = 1; |
589 | 596 | ||
590 | return QString::number(availBlks * mult / div); | 597 | return QString::number(availBlks * mult / div); |
591 | } | 598 | } |
592 | return ""; | 599 | return ""; |
593 | } | 600 | } |
@@ -597,67 +604,67 @@ void AdvancedFm::showFileMenu() | |||
597 | { | 604 | { |
598 | QString curApp; | 605 | QString curApp; |
599 | curApp = CurrentView()->currentItem()->text(0); | 606 | curApp = CurrentView()->currentItem()->text(0); |
600 | 607 | ||
601 | MimeType mt( curApp ); | 608 | MimeType mt( curApp ); |
602 | const AppLnk* app = mt.application(); | 609 | const AppLnk* app = mt.application(); |
603 | QFile fi(curApp); | 610 | QFile fi(curApp); |
604 | QPopupMenu *m = new QPopupMenu(0); | 611 | QPopupMenu *m = new QPopupMenu(0); |
605 | QPopupMenu *n = new QPopupMenu(0); | 612 | QPopupMenu *n = new QPopupMenu(0); |
606 | // QPopupMenu *o = new QPopupMenu(0); | 613 | // QPopupMenu *o = new QPopupMenu(0); |
607 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 614 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
608 | 615 | ||
609 | if ( QFileInfo(fi).isDir() ) | 616 | if ( QFileInfo(fi).isDir() ) |
610 | { | 617 | { |
611 | m->insertSeparator(); | 618 | m->insertSeparator(); |
612 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); | 619 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); |
613 | } | 620 | } |
614 | else | 621 | else |
615 | { | 622 | { |
616 | 623 | ||
617 | if ( app ) | 624 | if ( app ) |
618 | m->insertItem( app->pixmap(), tr( "Open in " | 625 | m->insertItem( app->pixmap(), tr( "Open in " |
619 | + app->name() ), this, SLOT( runThis() ) ); | 626 | + app->name() ), this, SLOT( runThis() ) ); |
620 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 627 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
621 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 628 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
622 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 629 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
623 | } | 630 | } |
624 | 631 | ||
625 | m->insertItem(tr("Actions"),n); | 632 | m->insertItem(tr("Actions"),n); |
626 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); | 633 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); |
627 | 634 | ||
628 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 635 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
629 | 636 | ||
630 | n->insertSeparator(); | 637 | n->insertSeparator(); |
631 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); | 638 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); |
632 | 639 | ||
633 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 640 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
634 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 641 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
635 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 642 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
636 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 643 | n->insertItem( tr( "Move" ), this, SLOT( move() )); |
637 | 644 | ||
638 | n->insertSeparator(); | 645 | n->insertSeparator(); |
639 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); | 646 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); |
640 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 647 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
641 | 648 | ||
642 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 649 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
643 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 650 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
644 | 651 | ||
645 | m->insertSeparator(); | 652 | m->insertSeparator(); |
646 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 653 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
647 | 654 | ||
648 | #if defined(QT_QWS_OPIE) | 655 | #if defined(QT_QWS_OPIE) |
649 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 656 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
650 | #endif | 657 | #endif |
651 | m->setCheckable(TRUE); | 658 | m->setCheckable(TRUE); |
652 | if (!b) | 659 | if (!b) |
653 | m->setItemChecked(m->idAt(0),TRUE); | 660 | m->setItemChecked(m->idAt(0),TRUE); |
654 | else | 661 | else |
655 | m->setItemChecked(m->idAt(0),FALSE); | 662 | m->setItemChecked(m->idAt(0),FALSE); |
656 | 663 | ||
657 | if(Ir::supported()) | 664 | if(Ir::supported()) |
658 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 665 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
659 | m->setFocus(); | 666 | m->setFocus(); |
660 | m->exec( QPoint( 4,QCursor::pos().y()) ); | 667 | m->exec( QPoint( 4,QCursor::pos().y()) ); |
661 | 668 | ||
662 | if(m) delete m; | 669 | if(m) delete m; |
663 | } | 670 | } |
@@ -676,3 +683,3 @@ QString AdvancedFm::checkDiskSpace(const QString &path) | |||
676 | if ( !statfs( path.latin1(), &fss ) ) | 683 | if ( !statfs( path.latin1(), &fss ) ) |
677 | { | 684 | { |
678 | int blkSize = fss.f_bsize; | 685 | int blkSize = fss.f_bsize; |
@@ -694,19 +701,19 @@ void AdvancedFm::addToDocs() | |||
694 | { | 701 | { |
695 | QStringList strListPaths = getPath(); | 702 | QStringList strListPaths = getPath(); |
696 | QDir *thisDir = CurrentDir(); | 703 | QDir *thisDir = CurrentDir(); |
697 | 704 | ||
698 | if( strListPaths.count() > 0) | 705 | if( strListPaths.count() > 0) |
699 | { | 706 | { |
700 | QString curFile; | 707 | QString curFile; |
701 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) | 708 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) |
702 | { | 709 | { |
703 | curFile = thisDir->canonicalPath()+"/"+(*it); | 710 | curFile = thisDir->canonicalPath()+"/"+(*it); |
704 | // qDebug(curFile); | 711 | // qDebug(curFile); |
705 | DocLnk f; | 712 | DocLnk f; |
706 | // curFile.replace(QRegExp("\\..*"),""); | 713 | // curFile.replace(QRegExp("\\..*"),""); |
707 | f.setName((*it)); | 714 | f.setName((*it)); |
708 | f.setFile( curFile); | 715 | f.setFile( curFile); |
709 | f.writeLink(); | 716 | f.writeLink(); |
710 | } | 717 | } |
711 | } | 718 | } |
712 | } | 719 | } |
@@ -717,7 +724,7 @@ void AdvancedFm::customDirsToMenu() | |||
717 | 724 | ||
718 | Config cfg("AdvancedFm"); | 725 | Config cfg("AdvancedFm"); |
719 | cfg.setGroup("Menu"); | 726 | cfg.setGroup("Menu"); |
720 | 727 | ||
721 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 728 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
722 | menuButton->insertItems(list ); | 729 | menuButton->insertItems(list ); |
723 | 730 | ||
@@ -731,22 +738,22 @@ void AdvancedFm::dirMenuSelected(int item) | |||
731 | { | 738 | { |
732 | qDebug("menu item %d", item); | 739 | qDebug("menu item %d", item); |
733 | switch(item) | 740 | switch(item) |
734 | { | 741 | { |
735 | 742 | ||
736 | case -21: | 743 | case -21: |
737 | case 0: | 744 | case 0: |
738 | addCustomDir(); | 745 | addCustomDir(); |
739 | break; | 746 | break; |
740 | case -22: | 747 | case -22: |
741 | case 1: | 748 | case 1: |
742 | removeCustomDir(); | 749 | removeCustomDir(); |
743 | break; | 750 | break; |
744 | default: | 751 | default: |
745 | { | 752 | { |
746 | // gotoCustomDir( menuButton->text(item)); | 753 | // gotoCustomDir( menuButton->text(item)); |
747 | // gotoCustomDir( customDirMenu->text(item)); | 754 | // gotoCustomDir( customDirMenu->text(item)); |
748 | } | 755 | } |
749 | break; | 756 | break; |
750 | 757 | ||
751 | }; | 758 | }; |
752 | } | 759 | } |
@@ -755,26 +762,26 @@ void AdvancedFm::addCustomDir() | |||
755 | { | 762 | { |
756 | Config cfg("AdvancedFm"); | 763 | Config cfg("AdvancedFm"); |
757 | cfg.setGroup("Menu"); | 764 | cfg.setGroup("Menu"); |
758 | QString dir; | 765 | QString dir; |
759 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 766 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
760 | 767 | ||
761 | dir = CurrentDir()->canonicalPath(); | 768 | dir = CurrentDir()->canonicalPath(); |
762 | 769 | ||
763 | bool addIt=true; | 770 | bool addIt=true; |
764 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 771 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
765 | { | 772 | { |
766 | if( dir == (*it)) | 773 | if( dir == (*it)) |
767 | { | 774 | { |
768 | addIt=false; | 775 | addIt=false; |
769 | } | 776 | } |
770 | } | 777 | } |
771 | if(addIt) | 778 | if(addIt) |
772 | { | 779 | { |
773 | menuButton->insertItem(dir); | 780 | menuButton->insertItem(dir); |
774 | // customDirMenu->insertItem(dir); | 781 | // customDirMenu->insertItem(dir); |
775 | list << dir; | 782 | list << dir; |
776 | } | 783 | } |
777 | 784 | ||
778 | cfg.writeEntry("CustomDir", list, ','); | 785 | cfg.writeEntry("CustomDir", list, ','); |
779 | cfg.write(); | 786 | cfg.write(); |
780 | } | 787 | } |
@@ -789,3 +796,3 @@ void AdvancedFm::removeCustomDir() | |||
789 | QStringList list2; | 796 | QStringList list2; |
790 | dir = CurrentDir()->canonicalPath(); | 797 | dir = CurrentDir()->canonicalPath(); |
791 | int ramble=2; | 798 | int ramble=2; |
@@ -795,4 +802,4 @@ void AdvancedFm::removeCustomDir() | |||
795 | { | 802 | { |
796 | QMessageBox::message("AdvancedFm", | 803 | QMessageBox::message("AdvancedFm", |
797 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!!")); | 804 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!!")); |
798 | } | 805 | } |
@@ -800,20 +807,20 @@ void AdvancedFm::removeCustomDir() | |||
800 | { | 807 | { |
801 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 808 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
802 | { | 809 | { |
803 | if((*it) != dir)//current item is not our current dir, so add it to temp list | 810 | if((*it) != dir)//current item is not our current dir, so add it to temp list |
804 | { | 811 | { |
805 | list2 <<(*it); | 812 | list2 <<(*it); |
806 | } | 813 | } |
807 | else | 814 | else |
808 | { | 815 | { |
809 | // customDirMenu->removeItem( ramble); | 816 | // customDirMenu->removeItem( ramble); |
810 | menuButton->remove( ramble); | 817 | menuButton->remove( ramble); |
811 | 818 | ||
812 | } | 819 | } |
813 | ramble++; | 820 | ramble++; |
814 | // ramble--; | 821 | // ramble--; |
815 | } | 822 | } |
816 | 823 | ||
817 | cfg.writeEntry("CustomDir", list2, ','); | 824 | cfg.writeEntry("CustomDir", list2, ','); |
818 | cfg.write(); | 825 | cfg.write(); |
819 | } | 826 | } |
@@ -826,24 +833,24 @@ void AdvancedFm::gotoCustomDir(const QString &dir) | |||
826 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | 833 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); |
827 | QString curDir = dir; | 834 | QString curDir = dir; |
828 | QDir *thisDir = CurrentDir(); | 835 | QDir *thisDir = CurrentDir(); |
829 | // if( curDir.isEmpty()) { | 836 | // if( curDir.isEmpty()) { |
830 | // } | 837 | // } |
831 | if( curDir == s_addBookmark) | 838 | if( curDir == s_addBookmark) |
832 | { | 839 | { |
833 | addCustomDir(); | 840 | addCustomDir(); |
834 | } | 841 | } |
835 | if( curDir == s_removeBookmark) | 842 | if( curDir == s_removeBookmark) |
836 | { | 843 | { |
837 | removeCustomDir( ); | 844 | removeCustomDir( ); |
838 | } | 845 | } |
839 | else | 846 | else |
840 | { | 847 | { |
841 | if(QDir( curDir).exists() ) | 848 | if(QDir( curDir).exists() ) |
842 | { | 849 | { |
843 | thisDir->setPath( curDir ); | 850 | thisDir->setPath( curDir ); |
844 | chdir( curDir.latin1() ); | 851 | chdir( curDir.latin1() ); |
845 | thisDir->cd( curDir, TRUE); | 852 | thisDir->cd( curDir, TRUE); |
846 | populateView(); | 853 | populateView(); |
847 | } | 854 | } |
848 | } | 855 | } |
849 | } | 856 | } |
@@ -852,10 +859,10 @@ QDir *AdvancedFm::CurrentDir() | |||
852 | { | 859 | { |
853 | if ( whichTab == 1) | 860 | if ( whichTab == 1) |
854 | { | 861 | { |
855 | return ¤tDir; | 862 | return ¤tDir; |
856 | } | 863 | } |
857 | else | 864 | else |
858 | { | 865 | { |
859 | return ¤tRemoteDir; | 866 | return ¤tRemoteDir; |
860 | } | 867 | } |
861 | } | 868 | } |
@@ -864,10 +871,10 @@ QDir *AdvancedFm::OtherDir() | |||
864 | { | 871 | { |
865 | if ( whichTab == 1) | 872 | if ( whichTab == 1) |
866 | { | 873 | { |
867 | return ¤tRemoteDir; | 874 | return ¤tRemoteDir; |
868 | } | 875 | } |
869 | else | 876 | else |
870 | { | 877 | { |
871 | return ¤tDir; | 878 | return ¤tDir; |
872 | } | 879 | } |
873 | } | 880 | } |
@@ -876,6 +883,6 @@ QListView * AdvancedFm::CurrentView() | |||
876 | { | 883 | { |
877 | if ( whichTab == 1) | 884 | if ( whichTab == 1) |
878 | return Local_View; | 885 | return Local_View; |
879 | else | 886 | else |
880 | return Remote_View; | 887 | return Remote_View; |
881 | } | 888 | } |
@@ -884,6 +891,6 @@ QListView * AdvancedFm::OtherView() | |||
884 | { | 891 | { |
885 | if ( whichTab == 1) | 892 | if ( whichTab == 1) |
886 | return Remote_View; | 893 | return Remote_View; |
887 | else | 894 | else |
888 | return Local_View; | 895 | return Local_View; |
889 | } | 896 | } |
@@ -892,6 +899,6 @@ void AdvancedFm::setOtherTabCurrent() | |||
892 | { | 899 | { |
893 | if ( whichTab == 1) | 900 | if ( whichTab == 1) |
894 | TabWidget->setCurrentTab(1); | 901 | TabWidget->setCurrentTab(1); |
895 | else | 902 | else |
896 | TabWidget->setCurrentTab(0); | 903 | TabWidget->setCurrentTab(0); |
897 | } | 904 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index f31956c..c30d8e0 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -28,2 +28,3 @@ | |||
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qpixmap.h> | ||
29 | 30 | ||
@@ -93,2 +94,3 @@ protected: | |||
93 | OTabWidget *TabWidget; | 94 | OTabWidget *TabWidget; |
95 | QPixmap unknownXpm; | ||
94 | int whichTab; | 96 | int whichTab; |