-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 216 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 6 |
2 files changed, 141 insertions, 81 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index b5fcccf..ee3f736 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -61,8 +61,11 @@ | |||
61 | #include <dirent.h> | 61 | #include <dirent.h> |
62 | #include <stdio.h> | 62 | #include <stdio.h> |
63 | #include <time.h> | 63 | #include <time.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | #include <mntent.h> | ||
66 | #include <string.h> | ||
67 | #include <errno.h> | ||
65 | 68 | ||
66 | AdvancedFm::AdvancedFm( ) | 69 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) | 70 | : QMainWindow( ) |
68 | { | 71 | { |
@@ -270,25 +273,19 @@ void AdvancedFm::tabChanged(QWidget *w) | |||
270 | 273 | ||
271 | 274 | ||
272 | void AdvancedFm::populateLocalView() | 275 | void AdvancedFm::populateLocalView() |
273 | { | 276 | { |
274 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | ||
275 | // QListViewItemIterator it( Local_View ); | ||
276 | // for ( ; it.current(); ++it ) { | ||
277 | // if ( it.current()->isSelected() ) { | ||
278 | // QString strItem = it.current()->text(0); | ||
279 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | ||
280 | // QFileInfo fi(localFile); | ||
281 | // } | ||
282 | // } | ||
283 | QPixmap pm; | 277 | QPixmap pm; |
284 | Local_View->clear(); | 278 | Local_View->clear(); |
285 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
286 | currentDir.setMatchAllDirs(TRUE); | 280 | currentDir.setMatchAllDirs(TRUE); |
287 | currentDir.setNameFilter(filterStr); | 281 | currentDir.setNameFilter(filterStr); |
288 | QString fileL, fileS, fileDate; | 282 | QString fileL, fileS, fileDate; |
289 | // qDebug(currentDir.canonicalPath()); | 283 | // qDebug(currentDir.canonicalPath()); |
290 | 284 | // struct stat buf; | |
285 | // mode_t mode; | ||
286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | ||
287 | setCaption("AdvancedFm :: "+fs); | ||
291 | bool isDir=FALSE; | 288 | bool isDir=FALSE; |
292 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
293 | QFileInfoListIterator it(*list); | 290 | QFileInfoListIterator it(*list); |
294 | QFileInfo *fi; | 291 | QFileInfo *fi; |
@@ -303,62 +300,62 @@ void AdvancedFm::populateLocalView() | |||
303 | } else { | 300 | } else { |
304 | fileS.sprintf( "%10li", fi->size() ); | 301 | fileS.sprintf( "%10li", fi->size() ); |
305 | fileL.sprintf( "%s",fi->fileName().data() ); | 302 | fileL.sprintf( "%s",fi->fileName().data() ); |
306 | fileDate= fi->lastModified().toString(); | 303 | fileDate= fi->lastModified().toString(); |
307 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
308 | fileL+="/"; | 305 | fileL+="/"; |
309 | isDir=TRUE; | 306 | isDir=TRUE; |
310 | // qDebug( fileL); | 307 | // qDebug( fileL); |
311 | } | 308 | } |
312 | } | 309 | } |
310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | ||
313 | if(fileL !="./" && fi->exists()) { | 311 | if(fileL !="./" && fi->exists()) { |
314 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
313 | |||
315 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 314 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
316 | if( !QDir( fi->filePath() ).isReadable()) | 315 | |
316 | if( !QDir( fi->filePath() ).isReadable()) //is directory | ||
317 | pm = Resource::loadPixmap( "lockedfolder" ); | 317 | pm = Resource::loadPixmap( "lockedfolder" ); |
318 | else | 318 | else |
319 | pm= Resource::loadPixmap( "folder" ); | 319 | pm= Resource::loadPixmap( "folder" ); |
320 | item->setPixmap( 0,pm ); | 320 | // item->setPixmap( 0,pm ); |
321 | } else { | 321 | } else if( fileInfo.isExecutable() || fs == "vfat" && fi->filePath().contains("/bin") ) { //is exec |
322 | // if(fi->isExecutable()) { | 322 | pm = Resource::loadPixmap( "exec"); |
323 | // pm = Resource::loadPixmap( "exec"); | 323 | // item->setPixmap( 0,pm); |
324 | // item->setPixmap( 0,pm); | 324 | } else if( !fi->isReadable() ) { |
325 | // } | 325 | pm = Resource::loadPixmap( "locked" ); |
326 | if( !fi->isReadable() ) { | 326 | // item->setPixmap( 0,pm); |
327 | pm = Resource::loadPixmap( "locked" ); | 327 | } else { //everything else goes by mimetype |
328 | item->setPixmap( 0,pm); | 328 | MimeType mt(fi->filePath()); |
329 | 329 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | |
330 | } | 330 | if(pm.isNull()) |
331 | else { | 331 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
332 | MimeType mt(fi->filePath()); | 332 | // item->setPixmap( 0,pm); |
333 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | ||
334 | if(pm.isNull()) | ||
335 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
336 | item->setPixmap( 0,pm); | ||
337 | } | ||
338 | } | 333 | } |
339 | if( fileL.find("->",0,TRUE) != -1) { | 334 | item->setPixmap( 0,pm); |
335 | if( fi->isSymLink() &&fileL.find("->",0,TRUE) != -1) { | ||
340 | // overlay link image | 336 | // overlay link image |
341 | pm= Resource::loadPixmap( "folder" ); | 337 | pm= Resource::loadPixmap( "folder" ); |
342 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 338 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
343 | QPainter painter( &pm ); | 339 | QPainter painter( &pm ); |
344 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 340 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
345 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 341 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
346 | item->setPixmap( 0, pm); | 342 | item->setPixmap( 0, pm); |
347 | } | 343 | } |
348 | } isDir=FALSE; | 344 | } |
345 | isDir=FALSE; | ||
349 | ++it; | 346 | ++it; |
350 | } | 347 | } |
351 | 348 | ||
352 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 349 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
353 | struct stat buf; | 350 | struct stat buf; |
354 | struct stat st; | 351 | // struct stat st; |
355 | dev_t devT; | 352 | dev_t devT; |
356 | mode_t mode; | 353 | // mode_t mode; |
357 | DIR *dir; | 354 | DIR *dir; |
358 | int fd = 0; | 355 | // int fd = 0; |
359 | struct dirent *mydirent; | 356 | struct dirent *mydirent; |
360 | int i = 1; | 357 | // int i = 1; |
361 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 358 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
362 | while ((mydirent = readdir(dir)) != NULL) { | 359 | while ((mydirent = readdir(dir)) != NULL) { |
363 | lstat( mydirent->d_name, &buf); | 360 | lstat( mydirent->d_name, &buf); |
364 | qDebug(mydirent->d_name); | 361 | qDebug(mydirent->d_name); |
@@ -400,8 +397,11 @@ void AdvancedFm::populateRemoteView() | |||
400 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 397 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
401 | currentRemoteDir.setMatchAllDirs(TRUE); | 398 | currentRemoteDir.setMatchAllDirs(TRUE); |
402 | currentRemoteDir.setNameFilter(filterStr); | 399 | currentRemoteDir.setNameFilter(filterStr); |
403 | QString fileL, fileS, fileDate; | 400 | QString fileL, fileS, fileDate; |
401 | |||
402 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | ||
403 | setCaption("AdvancedFm :: "+fs); | ||
404 | bool isDir=FALSE; | 404 | bool isDir=FALSE; |
405 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 405 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
406 | QFileInfoListIterator it(*list); | 406 | QFileInfoListIterator it(*list); |
407 | QFileInfo *fi; | 407 | QFileInfo *fi; |
@@ -432,46 +432,45 @@ void AdvancedFm::populateRemoteView() | |||
432 | if( !QDir( fi->filePath() ).isReadable()) | 432 | if( !QDir( fi->filePath() ).isReadable()) |
433 | pm = Resource::loadPixmap( "lockedfolder" ); | 433 | pm = Resource::loadPixmap( "lockedfolder" ); |
434 | else | 434 | else |
435 | pm= Resource::loadPixmap( "folder" ); | 435 | pm= Resource::loadPixmap( "folder" ); |
436 | item->setPixmap( 0,pm ); | 436 | // item->setPixmap( 0,pm ); |
437 | } else if( fi->isExecutable() || fs == "vfat" && fi->filePath().contains("/bin") ) { | ||
438 | pm = Resource::loadPixmap( "exec"); | ||
439 | // item->setPixmap( 0,pm); | ||
440 | } else if( !fi->isReadable() ) { | ||
441 | pm = Resource::loadPixmap( "locked" ); | ||
442 | // item->setPixmap( 0,pm); | ||
437 | } else { | 443 | } else { |
438 | // if(fi->isExecutable()) { | 444 | MimeType mt(fi->filePath()); |
439 | // pm = Resource::loadPixmap( "exec"); | 445 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
446 | if(pm.isNull()) | ||
447 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
440 | // item->setPixmap( 0,pm); | 448 | // item->setPixmap( 0,pm); |
441 | // } | ||
442 | if( !fi->isReadable() ) { | ||
443 | pm = Resource::loadPixmap( "locked" ); | ||
444 | item->setPixmap( 0,pm); | ||
445 | } else { | ||
446 | MimeType mt(fi->filePath()); | ||
447 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | ||
448 | if(pm.isNull()) | ||
449 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
450 | item->setPixmap( 0,pm); | ||
451 | } | ||
452 | } | ||
453 | if( fileL.find("->",0,TRUE) != -1) { | ||
454 | // overlay link image | ||
455 | pm= Resource::loadPixmap( "folder" ); | ||
456 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | ||
457 | QPainter painter( &pm ); | ||
458 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | ||
459 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
460 | item->setPixmap( 0, pm); | ||
461 | } | 449 | } |
462 | } isDir=FALSE; | 450 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
451 | // overlay link image | ||
452 | pm= Resource::loadPixmap( "folder" ); | ||
453 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | ||
454 | QPainter painter( &pm ); | ||
455 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | ||
456 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
457 | // item->setPixmap( 0, pm); | ||
458 | } | ||
459 | item->setPixmap( 0, pm); | ||
460 | } | ||
461 | isDir=FALSE; | ||
463 | ++it; | 462 | ++it; |
464 | } | 463 | } |
465 | 464 | ||
466 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 465 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
467 | struct stat buf; | 466 | struct stat buf; |
468 | struct stat st; | 467 | // struct stat st; |
469 | mode_t mode; | 468 | // mode_t mode; |
470 | DIR *dir; | 469 | DIR *dir; |
471 | int fd = 0; | 470 | // int fd = 0; |
472 | struct dirent *mydirent; | 471 | struct dirent *mydirent; |
473 | int i = 1; | 472 | // int i = 1; |
474 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 473 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
475 | while ((mydirent = readdir(dir)) != NULL) { | 474 | while ((mydirent = readdir(dir)) != NULL) { |
476 | lstat( mydirent->d_name, &buf); | 475 | lstat( mydirent->d_name, &buf); |
477 | qDebug(mydirent->d_name); | 476 | qDebug(mydirent->d_name); |
@@ -659,8 +658,9 @@ void AdvancedFm::showLocalMenu(QListViewItem * item) | |||
659 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 658 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
660 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 659 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
661 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 660 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
662 | m.insertSeparator(); | 661 | m.insertSeparator(); |
662 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | ||
663 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 663 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
664 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 664 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
665 | m.insertSeparator(); | 665 | m.insertSeparator(); |
666 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 666 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
@@ -694,8 +694,9 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item) | |||
694 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 694 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
695 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 695 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
696 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 696 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
697 | m.insertSeparator(); | 697 | m.insertSeparator(); |
698 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | ||
698 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 699 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
699 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 700 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
700 | m.insertSeparator(); | 701 | m.insertSeparator(); |
701 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 702 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
@@ -712,41 +713,47 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item) | |||
712 | } | 713 | } |
713 | 714 | ||
714 | void AdvancedFm::runThis() { | 715 | void AdvancedFm::runThis() { |
715 | // QFileInfo *fi; | 716 | // QFileInfo *fi; |
717 | QString fs; | ||
716 | if (TabWidget->currentPageIndex() == 0) { | 718 | if (TabWidget->currentPageIndex() == 0) { |
717 | QString curFile = Local_View->currentItem()->text(0); | 719 | QString curFile = Local_View->currentItem()->text(0); |
720 | |||
721 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | ||
718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 722 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
719 | // if(fileInfo.isExecutable()) { | 723 | qDebug( fileInfo.owner()); |
720 | // QCopEnvelope e("QPE/System", "execute(QString)" ); | 724 | if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
721 | // e << curFile; | 725 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
722 | // } else { | 726 | e << curFile; |
727 | } else { | ||
723 | curFile = currentDir.canonicalPath()+"/"+curFile; | 728 | curFile = currentDir.canonicalPath()+"/"+curFile; |
724 | DocLnk nf(curFile); | 729 | DocLnk nf(curFile); |
725 | QString execStr = nf.exec(); | 730 | QString execStr = nf.exec(); |
726 | qDebug( execStr); | 731 | qDebug( execStr); |
727 | if( execStr.isEmpty() ) { | 732 | if( execStr.isEmpty() ) { |
728 | } else { | 733 | } else { |
729 | nf.execute(); | 734 | nf.execute(); |
730 | } | 735 | } |
731 | // } | 736 | } |
732 | // MimeType mt( curFile); | 737 | // MimeType mt( curFile); |
733 | } else { | 738 | } else { |
734 | QString curFile = Remote_View->currentItem()->text(0); | 739 | QString curFile = Remote_View->currentItem()->text(0); |
740 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | ||
741 | qDebug("Filesystemtype is "+fs); | ||
735 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 742 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
736 | // if(fileInfo.isExecutable()) { | 743 | if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
737 | // QCopEnvelope e("QPE/System", "execute(QString)" ); | 744 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
738 | // e << curFile; | 745 | e << curFile; |
739 | // } else { | 746 | } else { |
740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 747 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
741 | DocLnk nf(curFile); | 748 | DocLnk nf(curFile); |
742 | QString execStr = nf.exec(); | 749 | QString execStr = nf.exec(); |
743 | qDebug(execStr); | 750 | qDebug(execStr); |
744 | if( execStr.isEmpty() ) { | 751 | if( execStr.isEmpty() ) { |
745 | } else { | 752 | } else { |
746 | nf.execute(); | 753 | nf.execute(); |
747 | } | 754 | } |
748 | // } | 755 | } |
749 | // MimeType mt( curFile); | 756 | // MimeType mt( curFile); |
750 | } | 757 | } |
751 | } | 758 | } |
752 | 759 | ||
@@ -1343,9 +1350,9 @@ void AdvancedFm::runCommand() { | |||
1343 | QString command; | 1350 | QString command; |
1344 | if( fileDlg->result() == 1 ) { | 1351 | if( fileDlg->result() == 1 ) { |
1345 | command = fileDlg->LineEdit1->text(); | 1352 | command = fileDlg->LineEdit1->text(); |
1346 | 1353 | ||
1347 | int err=0; | 1354 | // int err=0; |
1348 | Output *outDlg; | 1355 | Output *outDlg; |
1349 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1356 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1350 | outDlg->showMaximized(); | 1357 | outDlg->showMaximized(); |
1351 | outDlg->show(); | 1358 | outDlg->show(); |
@@ -1401,9 +1408,9 @@ void AdvancedFm::fileStatus() { | |||
1401 | } else { | 1408 | } else { |
1402 | curFile = Remote_View->currentItem()->text(0); | 1409 | curFile = Remote_View->currentItem()->text(0); |
1403 | } | 1410 | } |
1404 | QString command = " stat -l "+ curFile +" 2>&1"; | 1411 | QString command = " stat -l "+ curFile +" 2>&1"; |
1405 | int err=0; | 1412 | // int err=0; |
1406 | Output *outDlg; | 1413 | Output *outDlg; |
1407 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1414 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1408 | outDlg->showMaximized(); | 1415 | outDlg->showMaximized(); |
1409 | outDlg->show(); | 1416 | outDlg->show(); |
@@ -1518,13 +1525,9 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
1518 | case Key_9: | 1525 | case Key_9: |
1519 | break; | 1526 | break; |
1520 | case Key_0: | 1527 | case Key_0: |
1521 | break; | 1528 | break; |
1522 | |||
1523 | |||
1524 | |||
1525 | } | 1529 | } |
1526 | |||
1527 | } | 1530 | } |
1528 | 1531 | ||
1529 | void AdvancedFm::mkSym() { | 1532 | void AdvancedFm::mkSym() { |
1530 | QString cmd; | 1533 | QString cmd; |
@@ -1566,6 +1569,59 @@ void AdvancedFm::QPEButtonPushed() { | |||
1566 | currentRemoteDir.cd( current, TRUE); | 1569 | currentRemoteDir.cd( current, TRUE); |
1567 | populateRemoteView(); | 1570 | populateRemoteView(); |
1568 | } | 1571 | } |
1569 | update(); | 1572 | update(); |
1573 | } | ||
1570 | 1574 | ||
1575 | void AdvancedFm::parsetab(const QString &fileName) { | ||
1576 | |||
1577 | fileSystemTypeList.clear(); | ||
1578 | fsList.clear(); | ||
1579 | struct mntent *me; | ||
1580 | // if(fileName == "/etc/mtab") { | ||
1581 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | ||
1582 | if ( mntfp ) { | ||
1583 | while ( (me = getmntent( mntfp )) != 0 ) { | ||
1584 | QString deviceName = me->mnt_fsname; | ||
1585 | QString filesystemType = me->mnt_type; | ||
1586 | QString mountDir = me->mnt_dir; | ||
1587 | if(deviceName != "none") { | ||
1588 | if( fsList.contains(filesystemType) == 0 | ||
1589 | & filesystemType.find("proc",0,TRUE) == -1 | ||
1590 | & filesystemType.find("cramfs",0,TRUE) == -1 | ||
1591 | & filesystemType.find("auto",0,TRUE) == -1) | ||
1592 | fsList << filesystemType; | ||
1593 | // deviceList << deviceName; | ||
1594 | // qDebug(mountDir+"::"+filesystemType); | ||
1595 | fileSystemTypeList << mountDir+"::"+filesystemType; | ||
1596 | } | ||
1597 | } | ||
1598 | } | ||
1599 | endmntent( mntfp ); | ||
1571 | } | 1600 | } |
1601 | |||
1602 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | ||
1603 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | ||
1604 | QString current = currentText;//.right( currentText.length()-1); | ||
1605 | QString baseFs; | ||
1606 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | ||
1607 | QString temp = (*it); | ||
1608 | QString path = temp.left(temp.find("::",0,TRUE) ); | ||
1609 | path = path.right( path.length()-1); | ||
1610 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | ||
1611 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | ||
1612 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | ||
1613 | } | ||
1614 | } | ||
1615 | return baseFs; | ||
1616 | } | ||
1617 | |||
1618 | |||
1619 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | ||
1620 | // QListViewItemIterator it( Local_View ); | ||
1621 | // for ( ; it.current(); ++it ) { | ||
1622 | // if ( it.current()->isSelected() ) { | ||
1623 | // QString strItem = it.current()->text(0); | ||
1624 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | ||
1625 | // QFileInfo fi(localFile); | ||
1626 | // } | ||
1627 | // } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 5c2719e..90619ba 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -57,8 +57,9 @@ public: | |||
57 | QComboBox *currentPathCombo; | 57 | QComboBox *currentPathCombo; |
58 | QString filterStr; | 58 | QString filterStr; |
59 | QListViewItem * item; | 59 | QListViewItem * item; |
60 | bool b; | 60 | bool b; |
61 | QStringList fileSystemTypeList, fsList; | ||
61 | int currentServerConfig; | 62 | int currentServerConfig; |
62 | protected slots: | 63 | protected slots: |
63 | void showLocalMenu( QListViewItem *); | 64 | void showLocalMenu( QListViewItem *); |
64 | void showRemoteMenu( QListViewItem *); | 65 | void showRemoteMenu( QListViewItem *); |
@@ -101,9 +102,12 @@ protected slots: | |||
101 | 102 | ||
102 | protected: | 103 | protected: |
103 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 104 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
104 | QStringList remoteDirPathStringList, localDirPathStringList; | 105 | QStringList remoteDirPathStringList, localDirPathStringList; |
105 | void keyReleaseEvent( QKeyEvent *); | 106 | void keyReleaseEvent( QKeyEvent *); |
107 | QString getFileSystemType(const QString &); | ||
108 | void parsetab(const QString &fileName); | ||
109 | |||
106 | protected slots: | 110 | protected slots: |
107 | void homeButtonPushed(); | 111 | void homeButtonPushed(); |
108 | void docButtonPushed(); | 112 | void docButtonPushed(); |
109 | void SDButtonPushed(); | 113 | void SDButtonPushed(); |