summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index f4ca349..b9e254e 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -474,291 +474,297 @@ void AdvancedFm::populateRemoteView()
474 ++it; 474 ++it;
475 } 475 }
476 476
477 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 477 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
478 struct stat buf; 478 struct stat buf;
479// struct stat st; 479// struct stat st;
480// mode_t mode; 480// mode_t mode;
481 DIR *dir; 481 DIR *dir;
482// int fd = 0; 482// int fd = 0;
483 struct dirent *mydirent; 483 struct dirent *mydirent;
484// int i = 1; 484// int i = 1;
485 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 485 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
486 while ((mydirent = readdir(dir)) != NULL) { 486 while ((mydirent = readdir(dir)) != NULL) {
487 lstat( mydirent->d_name, &buf); 487 lstat( mydirent->d_name, &buf);
488 qDebug(mydirent->d_name); 488 qDebug(mydirent->d_name);
489// mode = buf.st_mode; 489// mode = buf.st_mode;
490 fileL.sprintf("%s", mydirent->d_name); 490 fileL.sprintf("%s", mydirent->d_name);
491// fileS.sprintf("%d, %d", ); //this isn't correct 491// fileS.sprintf("%d, %d", ); //this isn't correct
492 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 492 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
493 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 493 fileDate.sprintf("%s", ctime( &buf.st_mtime));
494 if( fileL.find(".") == -1 ){ 494 if( fileL.find(".") == -1 ){
495 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 495 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
496 pm = Resource::loadPixmap( "UnknownDocument-14" ); 496 pm = Resource::loadPixmap( "UnknownDocument-14" );
497 item->setPixmap( 0,pm); 497 item->setPixmap( 0,pm);
498 } 498 }
499 } 499 }
500 500
501 closedir(dir); 501 closedir(dir);
502 } 502 }
503 503
504 Remote_View->setSorting( 3,FALSE); 504 Remote_View->setSorting( 3,FALSE);
505 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 505 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
506} 506}
507 507
508void AdvancedFm::localListClicked(QListViewItem *selectedItem) 508void AdvancedFm::localListClicked(QListViewItem *selectedItem)
509{ 509{
510 if(selectedItem) { 510 if(selectedItem) {
511 QString strItem=selectedItem->text(0); 511 QString strItem=selectedItem->text(0);
512 QString strSize=selectedItem->text(1); 512 QString strSize=selectedItem->text(1);
513 strSize=strSize.stripWhiteSpace(); 513 strSize=strSize.stripWhiteSpace();
514 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 514 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
515 // is symlink 515 // is symlink
516 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 516 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
517 if(QDir(strItem2).exists() ) { 517 if(QDir(strItem2).exists() ) {
518 currentDir.cd(strItem2, TRUE); 518 currentDir.cd(strItem2, TRUE);
519 populateLocalView(); 519 populateLocalView();
520 } 520 }
521 } else { // not a symlink 521 } else { // not a symlink
522 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 522 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
523 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 523 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
524 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 524 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
525 currentDir.cd(strItem,FALSE); 525 currentDir.cd(strItem,FALSE);
526 populateLocalView(); 526 populateLocalView();
527 } else { 527 } else {
528 currentDir.cdUp(); 528 currentDir.cdUp();
529 populateLocalView(); 529 populateLocalView();
530 } 530 }
531 if(QDir(strItem).exists()){ 531 if(QDir(strItem).exists()){
532 currentDir.cd(strItem, TRUE); 532 currentDir.cd(strItem, TRUE);
533 populateLocalView(); 533 populateLocalView();
534 } 534 }
535 } else { 535 } else {
536 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 536 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
537 if( QFile::exists(strItem ) ) { 537 if( QFile::exists(strItem ) ) {
538// qDebug("upload "+strItem); 538 qDebug("clicked item "+strItem);
539 DocLnk doc( strItem, FALSE );
540 doc.execute();
541 // Local_View->clearSelection();
539 } 542 }
540 } //end not symlink 543 } //end not symlink
541 chdir(strItem.latin1()); 544 chdir(strItem.latin1());
542 } 545 }
543 } 546 }
544} 547}
545 548
546void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 549void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
547{ 550{
548 if(selectedItem) { 551 if(selectedItem) {
549 QString strItem=selectedItem->text(0); 552 QString strItem=selectedItem->text(0);
550 QString strSize=selectedItem->text(1); 553 QString strSize=selectedItem->text(1);
551 strSize=strSize.stripWhiteSpace(); 554 strSize=strSize.stripWhiteSpace();
552 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 555 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
553 // is symlink 556 // is symlink
554 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 557 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
555 if(QDir(strItem2).exists() ) { 558 if(QDir(strItem2).exists() ) {
556 currentRemoteDir.cd(strItem2, TRUE); 559 currentRemoteDir.cd(strItem2, TRUE);
557 populateRemoteView(); 560 populateRemoteView();
558 } 561 }
559 } else { // not a symlink 562 } else { // not a symlink
560 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 563 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
561 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 564 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
562 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 565 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
563 currentRemoteDir.cd(strItem,FALSE); 566 currentRemoteDir.cd(strItem,FALSE);
564 populateRemoteView(); 567 populateRemoteView();
565 } else { 568 } else {
566 currentRemoteDir.cdUp(); 569 currentRemoteDir.cdUp();
567 populateRemoteView(); 570 populateRemoteView();
568 } 571 }
569 if(QDir(strItem).exists()){ 572 if(QDir(strItem).exists()){
570 currentRemoteDir.cd(strItem, TRUE); 573 currentRemoteDir.cd(strItem, TRUE);
571 populateRemoteView(); 574 populateRemoteView();
572 } 575 }
573 } else { 576 } else {
574 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 577 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
575 if( QFile::exists(strItem ) ) { 578 if( QFile::exists(strItem ) ) {
576// qDebug("upload "+strItem); 579 qDebug("clicked item "+strItem);
580 DocLnk doc( strItem, FALSE );
581 doc.execute();
582 // Remote_View->clearSelection();
577 } 583 }
578 } //end not symlink 584 } //end not symlink
579 chdir(strItem.latin1()); 585 chdir(strItem.latin1());
580 } 586 }
581 } 587 }
582} 588}
583 589
584void AdvancedFm::doLocalCd() 590void AdvancedFm::doLocalCd()
585{ 591{
586 localListClicked( Local_View->currentItem()); 592 localListClicked( Local_View->currentItem());
587} 593}
588 594
589void AdvancedFm::doRemoteCd() 595void AdvancedFm::doRemoteCd()
590{ 596{
591 localListClicked( Remote_View->currentItem()); 597 localListClicked( Remote_View->currentItem());
592} 598}
593 599
594void AdvancedFm::showHidden() 600void AdvancedFm::showHidden()
595{ 601{
596 if (b) { 602 if (b) {
597 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 603 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
598 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 604 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
599// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 605// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
600// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 606// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
601 b=FALSE; 607 b=FALSE;
602 608
603 } else { 609 } else {
604 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 610 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
605 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 611 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
606// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 612// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
607// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 613// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
608 b=TRUE; 614 b=TRUE;
609 } 615 }
610 populateLocalView(); 616 populateLocalView();
611 617
612} 618}
613 619
614void AdvancedFm::showRemoteHidden() 620void AdvancedFm::showRemoteHidden()
615{ 621{
616 if (b) { 622 if (b) {
617 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 623 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
618// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 624// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
619// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 625// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
620 b=TRUE; 626 b=TRUE;
621 627
622 } else { 628 } else {
623 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 629 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
624// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 630// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
625// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 631// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
626 b=FALSE; 632 b=FALSE;
627 } 633 }
628 populateRemoteView(); 634 populateRemoteView();
629} 635}
630 636
631void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 637void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
632{ 638{
633 switch (mouse) { 639 switch (mouse) {
634 case 1: 640 case 1:
635 break; 641 break;
636 case 2: 642 case 2:
637 showLocalMenu(item); 643 showLocalMenu(item);
638 Local_View->clearSelection(); 644 Local_View->clearSelection();
639 break; 645 break;
640 }; 646 };
641} 647}
642 648
643void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 649void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
644{ 650{
645 switch (mouse) { 651 switch (mouse) {
646 case 1: 652 case 1:
647 break; 653 break;
648 case 2: 654 case 2:
649 showRemoteMenu(item); 655 showRemoteMenu(item);
650 Remote_View->clearSelection(); 656 Remote_View->clearSelection();
651 break; 657 break;
652 }; 658 };
653} 659}
654 660
655void AdvancedFm::showLocalMenu(QListViewItem * item) 661void AdvancedFm::showLocalMenu(QListViewItem * item)
656{ 662{
657 if(item) { 663 if(item) {
658 QPopupMenu m; 664 QPopupMenu m;
659 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 665 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
660 m.insertSeparator(); 666 m.insertSeparator();
661 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 667 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
662 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 668 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
663 else 669 else
664 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 670 m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() ));
665 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 671 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
666 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 672 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
667 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 673 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
668 m.insertSeparator(); 674 m.insertSeparator();
669 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 675 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
670 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 676 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
671 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 677 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
672 m.insertItem( tr( "Move" ), this, SLOT( move() )); 678 m.insertItem( tr( "Move" ), this, SLOT( move() ));
673 m.insertSeparator(); 679 m.insertSeparator();
674 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 680 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
675 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 681 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
676 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 682 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
677 m.insertSeparator(); 683 m.insertSeparator();
678 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 684 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
679 m.insertSeparator(); 685 m.insertSeparator();
680 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 686 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
681 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 687 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
682 m.setCheckable(TRUE); 688 m.setCheckable(TRUE);
683 if (!b) 689 if (!b)
684 m.setItemChecked(m.idAt(0),TRUE); 690 m.setItemChecked(m.idAt(0),TRUE);
685 else 691 else
686 m.setItemChecked(m.idAt(0),FALSE); 692 m.setItemChecked(m.idAt(0),FALSE);
687 m.exec( QCursor::pos() ); 693 m.exec( QCursor::pos() );
688 } 694 }
689} 695}
690 696
691void AdvancedFm::showRemoteMenu(QListViewItem * item) 697void AdvancedFm::showRemoteMenu(QListViewItem * item)
692{ 698{
693 if(item) { 699 if(item) {
694 QPopupMenu m; 700 QPopupMenu m;
695 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 701 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
696 m.insertSeparator(); 702 m.insertSeparator();
697 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 703 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
698 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 704 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
699 else 705 else
700 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 706 m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() ));
701 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 707 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
702 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 708 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
703 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 709 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
704 m.insertSeparator(); 710 m.insertSeparator();
705 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 711 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
706 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 712 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
707 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 713 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
708 m.insertItem( tr( "Move" ), this, SLOT( move() )); 714 m.insertItem( tr( "Move" ), this, SLOT( move() ));
709 m.insertSeparator(); 715 m.insertSeparator();
710 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 716 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
711 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 717 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
712 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 718 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
713 m.insertSeparator(); 719 m.insertSeparator();
714 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 720 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
715 m.insertSeparator(); 721 m.insertSeparator();
716 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 722 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
717 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 723 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
718 m.setCheckable(TRUE); 724 m.setCheckable(TRUE);
719 if (!b) 725 if (!b)
720 m.setItemChecked(m.idAt(0),TRUE); 726 m.setItemChecked(m.idAt(0),TRUE);
721 else 727 else
722 m.setItemChecked(m.idAt(0),FALSE); 728 m.setItemChecked(m.idAt(0),FALSE);
723 m.exec( QCursor::pos() ); 729 m.exec( QCursor::pos() );
724 } 730 }
725} 731}
726 732
727void AdvancedFm::runThis() { 733void AdvancedFm::runThis() {
728// QFileInfo *fi; 734// QFileInfo *fi;
729QString fs; 735QString fs;
730 if (TabWidget->currentPageIndex() == 0) { 736 if (TabWidget->currentPageIndex() == 0) {
731 QString curFile = Local_View->currentItem()->text(0); 737 QString curFile = Local_View->currentItem()->text(0);
732 738
733 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 739 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
734 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 740 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
735 qDebug( fileInfo.owner()); 741 qDebug( fileInfo.owner());
736 if( (fileInfo.permission( QFileInfo::ExeUser) 742 if( (fileInfo.permission( QFileInfo::ExeUser)
737 | fileInfo.permission( QFileInfo::ExeGroup) 743 | fileInfo.permission( QFileInfo::ExeGroup)
738 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 744 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
739 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 745 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
740// if( fileInfo.isExecutable() | 746// if( fileInfo.isExecutable() |
741 QCopEnvelope e("QPE/System", "execute(QString)" ); 747 QCopEnvelope e("QPE/System", "execute(QString)" );
742 e << curFile; 748 e << curFile;
743 } else { 749 } else {
744 curFile = currentDir.canonicalPath()+"/"+curFile; 750 curFile = currentDir.canonicalPath()+"/"+curFile;
745 DocLnk nf(curFile); 751 DocLnk nf(curFile);
746 QString execStr = nf.exec(); 752 QString execStr = nf.exec();
747 qDebug( execStr); 753 qDebug( execStr);
748 if( execStr.isEmpty() ) { 754 if( execStr.isEmpty() ) {
749 } else { 755 } else {
750 nf.execute(); 756 nf.execute();
751 } 757 }
752 } 758 }
753// MimeType mt( curFile); 759// MimeType mt( curFile);
754 } else { 760 } else {
755 QString curFile = Remote_View->currentItem()->text(0); 761 QString curFile = Remote_View->currentItem()->text(0);
756 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 762 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
757 qDebug("Filesystemtype is "+fs); 763 qDebug("Filesystemtype is "+fs);
758 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 764 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
759 if( (fileInfo.permission( QFileInfo::ExeUser) 765 if( (fileInfo.permission( QFileInfo::ExeUser)
760 | fileInfo.permission( QFileInfo::ExeGroup) 766 | fileInfo.permission( QFileInfo::ExeGroup)
761 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 767 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
762 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 768 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
763 QCopEnvelope e("QPE/System", "execute(QString)" ); 769 QCopEnvelope e("QPE/System", "execute(QString)" );
764 e << curFile; 770 e << curFile;
@@ -976,128 +982,135 @@ void AdvancedFm::currentPathComboChanged()
976 } 982 }
977 } 983 }
978 if (TabWidget->currentPageIndex() == 0) { 984 if (TabWidget->currentPageIndex() == 0) {
979 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 985 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
980 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 986 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
981 populateRemoteView(); 987 populateRemoteView();
982 } else { 988 } else {
983 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 989 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
984 } 990 }
985 } 991 }
986} 992}
987 993
988void AdvancedFm::fillCombo(const QString &currentPath) { 994void AdvancedFm::fillCombo(const QString &currentPath) {
989 995
990 if (TabWidget->currentPageIndex() == 0) { 996 if (TabWidget->currentPageIndex() == 0) {
991 currentPathCombo->lineEdit()->setText( currentPath); 997 currentPathCombo->lineEdit()->setText( currentPath);
992 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 998 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
993 currentPathCombo->clear(); 999 currentPathCombo->clear();
994 localDirPathStringList.prepend( currentPath ); 1000 localDirPathStringList.prepend( currentPath );
995 currentPathCombo->insertStringList( localDirPathStringList,-1); 1001 currentPathCombo->insertStringList( localDirPathStringList,-1);
996 } 1002 }
997 } else { 1003 } else {
998 currentPathCombo->lineEdit()->setText( currentPath); 1004 currentPathCombo->lineEdit()->setText( currentPath);
999 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 1005 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
1000 currentPathCombo->clear(); 1006 currentPathCombo->clear();
1001 remoteDirPathStringList.prepend( currentPath ); 1007 remoteDirPathStringList.prepend( currentPath );
1002 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1008 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1003 } 1009 }
1004 } 1010 }
1005} 1011}
1006 1012
1007void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 1013void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
1008 if (TabWidget->currentPageIndex() == 0) { 1014 if (TabWidget->currentPageIndex() == 0) {
1009 chdir( currentPath.latin1() ); 1015 chdir( currentPath.latin1() );
1010 currentDir.cd( currentPath, TRUE); 1016 currentDir.cd( currentPath, TRUE);
1011 populateLocalView(); 1017 populateLocalView();
1012 update(); 1018 update();
1013 } else { 1019 } else {
1014 chdir( currentPath.latin1() ); 1020 chdir( currentPath.latin1() );
1015 currentRemoteDir.cd( currentPath, TRUE); 1021 currentRemoteDir.cd( currentPath, TRUE);
1016 populateRemoteView(); 1022 populateRemoteView();
1017 update(); 1023 update();
1018 } 1024 }
1019} 1025}
1020 1026
1021void AdvancedFm::filePerms() { 1027void AdvancedFm::filePerms() {
1022 1028
1023 QStringList curFileList = getPath(); 1029 QStringList curFileList = getPath();
1024 QString filePath; 1030 QString filePath;
1025 1031
1026 if (TabWidget->currentPageIndex() == 0) { 1032 if (TabWidget->currentPageIndex() == 0) {
1027 filePath = currentDir.canonicalPath()+"/"; 1033 filePath = currentDir.canonicalPath()+"/";
1028 } else { 1034 } else {
1029 filePath= currentRemoteDir.canonicalPath()+"/"; 1035 filePath= currentRemoteDir.canonicalPath()+"/";
1030 } 1036 }
1031 1037
1032 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1038 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1033 filePermissions *filePerm; 1039 filePermissions *filePerm;
1034 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 1040 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
1035 filePerm->showMaximized(); 1041 filePerm->showMaximized();
1036 filePerm->exec(); 1042 filePerm->exec();
1037 if( filePerm) 1043 if( filePerm)
1038 delete filePerm; 1044 delete filePerm;
1039 } 1045 }
1046 if (TabWidget->currentPageIndex() == 0) {
1047 populateLocalView();
1048 } else {
1049 populateRemoteView();
1050 }
1051
1052
1040} 1053}
1041 1054
1042void AdvancedFm::doProperties() { 1055void AdvancedFm::doProperties() {
1043 QStringList curFileList = getPath(); 1056 QStringList curFileList = getPath();
1044 QString filePath; 1057 QString filePath;
1045 if (TabWidget->currentPageIndex() == 0) { 1058 if (TabWidget->currentPageIndex() == 0) {
1046 filePath = currentDir.canonicalPath()+"/"; 1059 filePath = currentDir.canonicalPath()+"/";
1047 } else { 1060 } else {
1048 filePath= currentRemoteDir.canonicalPath()+"/"; 1061 filePath= currentRemoteDir.canonicalPath()+"/";
1049 } 1062 }
1050 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1063 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1051 DocLnk lnk( (filePath+*it)); 1064 DocLnk lnk( (filePath+*it));
1052 LnkProperties prop( &lnk ); 1065 LnkProperties prop( &lnk );
1053// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 1066// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1054 prop.showMaximized(); 1067 prop.showMaximized();
1055 prop.exec(); 1068 prop.exec();
1056 } 1069 }
1057} 1070}
1058 1071
1059QStringList AdvancedFm::getPath() { 1072QStringList AdvancedFm::getPath() {
1060 QStringList strList; 1073 QStringList strList;
1061 if (TabWidget->currentPageIndex() == 0) { 1074 if (TabWidget->currentPageIndex() == 0) {
1062 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1075 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1063 QListViewItemIterator it( Local_View ); 1076 QListViewItemIterator it( Local_View );
1064 for ( ; it.current(); ++it ) { 1077 for ( ; it.current(); ++it ) {
1065 if ( it.current()->isSelected() ) { 1078 if ( it.current()->isSelected() ) {
1066 strList << it.current()->text(0); 1079 strList << it.current()->text(0);
1067 } 1080 }
1068 } 1081 }
1069 return strList; 1082 return strList;
1070 } else { 1083 } else {
1071 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1084 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1072 QListViewItemIterator it( Remote_View ); 1085 QListViewItemIterator it( Remote_View );
1073 for ( ; it.current(); ++it ) { 1086 for ( ; it.current(); ++it ) {
1074 if ( it.current()->isSelected() ) { 1087 if ( it.current()->isSelected() ) {
1075 strList << it.current()->text(0); 1088 strList << it.current()->text(0);
1076 } 1089 }
1077 } 1090 }
1078 return strList; 1091 return strList;
1079 } 1092 }
1080 return ""; 1093 return "";
1081} 1094}
1082 1095
1083void AdvancedFm::homeButtonPushed() { 1096void AdvancedFm::homeButtonPushed() {
1084 QString current = QDir::homeDirPath(); 1097 QString current = QDir::homeDirPath();
1085 chdir( current.latin1() ); 1098 chdir( current.latin1() );
1086 if (TabWidget->currentPageIndex() == 0) { 1099 if (TabWidget->currentPageIndex() == 0) {
1087 currentDir.cd( current, TRUE); 1100 currentDir.cd( current, TRUE);
1088 populateLocalView(); 1101 populateLocalView();
1089 } else { 1102 } else {
1090 currentRemoteDir.cd( current, TRUE); 1103 currentRemoteDir.cd( current, TRUE);
1091 populateRemoteView(); 1104 populateRemoteView();
1092 } 1105 }
1093 update(); 1106 update();
1094} 1107}
1095 1108
1096void AdvancedFm::docButtonPushed() { 1109void AdvancedFm::docButtonPushed() {
1097 QString current = QPEApplication::documentDir(); 1110 QString current = QPEApplication::documentDir();
1098 chdir( current.latin1() ); 1111 chdir( current.latin1() );
1099 if (TabWidget->currentPageIndex() == 0) { 1112 if (TabWidget->currentPageIndex() == 0) {
1100 currentDir.cd( current, TRUE); 1113 currentDir.cd( current, TRUE);
1101 populateLocalView(); 1114 populateLocalView();
1102 } else { 1115 } else {
1103 currentRemoteDir.cd( current, TRUE); 1116 currentRemoteDir.cd( current, TRUE);
@@ -1341,132 +1354,132 @@ void AdvancedFm::move() {
1341 d.writeBlock( bf, bytesRead ); 1354 d.writeBlock( bf, bytesRead );
1342 } 1355 }
1343 } else { 1356 } else {
1344 success = FALSE; 1357 success = FALSE;
1345 } 1358 }
1346 1359
1347 // Set file permissions 1360 // Set file permissions
1348 if( stat( (const char *) src, &status ) == 0 ){ 1361 if( stat( (const char *) src, &status ) == 0 ){
1349 chmod( (const char *) dest, status.st_mode ); 1362 chmod( (const char *) dest, status.st_mode );
1350 } 1363 }
1351 1364
1352 return success; 1365 return success;
1353} 1366}
1354 1367
1355void AdvancedFm::runCommand() { 1368void AdvancedFm::runCommand() {
1356 QString curFile; 1369 QString curFile;
1357 if (TabWidget->currentPageIndex() == 0) { 1370 if (TabWidget->currentPageIndex() == 0) {
1358 if( Local_View->currentItem()) 1371 if( Local_View->currentItem())
1359 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1372 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1360 } else { 1373 } else {
1361 if(Remote_View->currentItem()) 1374 if(Remote_View->currentItem())
1362 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 1375 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
1363 } 1376 }
1364 1377
1365 InputDialog *fileDlg; 1378 InputDialog *fileDlg;
1366 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1379 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1367 fileDlg->setInputText(curFile); 1380 fileDlg->setInputText(curFile);
1368 fileDlg->exec(); 1381 fileDlg->exec();
1369 QString command; 1382 QString command;
1370 if( fileDlg->result() == 1 ) { 1383 if( fileDlg->result() == 1 ) {
1371 command = fileDlg->LineEdit1->text(); 1384 command = fileDlg->LineEdit1->text();
1372 1385
1373// int err=0; 1386// int err=0;
1374 Output *outDlg; 1387 Output *outDlg;
1375 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1388 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1376 outDlg->showMaximized(); 1389 outDlg->showMaximized();
1377 outDlg->show(); 1390 outDlg->show();
1378 qApp->processEvents(); 1391 qApp->processEvents();
1379 FILE *fp; 1392 FILE *fp;
1380 char line[130]; 1393 char line[130];
1381 sleep(1); 1394 sleep(1);
1382// if(command.find("2>",0,TRUE) != -1) 1395// if(command.find("2>",0,TRUE) != -1)
1383 command +=" 2>&1"; 1396 command +=" 2>&1";
1384 fp = popen( (const char *) command, "r"); 1397 fp = popen( (const char *) command, "r");
1385 if ( !fp ) { 1398 if ( !fp ) {
1386 qDebug("Could not execute '" + command + "'! err=%d", fp); 1399 qDebug("Could not execute '" + command + "'! err=%d", fp);
1387 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1400 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1388 pclose(fp); 1401 pclose(fp);
1389 return; 1402 return;
1390 } else { 1403 } else {
1391 while ( fgets( line, sizeof line, fp)) { 1404 while ( fgets( line, sizeof line, fp)) {
1392 QString lineStr = line; 1405 QString lineStr = line;
1393 lineStr=lineStr.left(lineStr.length()-1); 1406 lineStr=lineStr.left(lineStr.length()-1);
1394 outDlg->OutputEdit->append(lineStr); 1407 outDlg->OutputEdit->append(lineStr);
1395 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1408 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1396 } 1409 }
1397 } 1410 }
1398 } 1411 }
1399} 1412}
1400 1413
1401void AdvancedFm::runCommandStd() { 1414void AdvancedFm::runCommandStd() {
1402 QString curFile; 1415 QString curFile;
1403 if (TabWidget->currentPageIndex() == 0) { 1416 if (TabWidget->currentPageIndex() == 0) {
1404 if( Local_View->currentItem()) 1417 if( Local_View->currentItem())
1405 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1418 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1406 } else { 1419 } else {
1407 if(Remote_View->currentItem()) 1420 if(Remote_View->currentItem())
1408 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1421 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0);
1409 } 1422 }
1410 1423
1411 InputDialog *fileDlg; 1424 InputDialog *fileDlg;
1412 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1425 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1413 fileDlg->setInputText(curFile); 1426 fileDlg->setInputText(curFile);
1414 fileDlg->exec(); 1427 fileDlg->exec();
1415 QString command; 1428 QString command;
1416 if( fileDlg->result() == 1 ) { 1429 if( fileDlg->result() == 1 ) {
1417 qApp->processEvents(); 1430 qApp->processEvents();
1418 command = fileDlg->LineEdit1->text() + " &"; 1431 command = fileDlg->LineEdit1->text() + " &";
1419 system(command.latin1()); 1432 system(command.latin1());
1420 } 1433 }
1421} 1434}
1422 1435
1423void AdvancedFm::fileStatus() { 1436void AdvancedFm::fileStatus() {
1424 QString curFile; 1437 QString curFile;
1425 if (TabWidget->currentPageIndex() == 0) { 1438 if (TabWidget->currentPageIndex() == 0) {
1426 curFile = Local_View->currentItem()->text(0); 1439 curFile = Local_View->currentItem()->text(0);
1427 } else { 1440 } else {
1428 curFile = Remote_View->currentItem()->text(0); 1441 curFile = Remote_View->currentItem()->text(0);
1429 } 1442 }
1430 QString command = " stat -l "+ curFile +" 2>&1"; 1443 QString command = " stat -l "+ curFile +" 2>&1";
1431// int err=0; 1444// int err=0;
1432 Output *outDlg; 1445 Output *outDlg;
1433 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1446 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1434 outDlg->showMaximized(); 1447 outDlg->showMaximized();
1435 outDlg->show(); 1448 outDlg->show();
1436 qApp->processEvents(); 1449 qApp->processEvents();
1437 FILE *fp; 1450 FILE *fp;
1438 char line[130]; 1451 char line[130];
1439 sleep(1); 1452 sleep(1);
1440 fp = popen( (const char *) command, "r"); 1453 fp = popen( (const char *) command, "r");
1441 if ( !fp ) { 1454 if ( !fp ) {
1442 qDebug("Could not execute '" + command + "'! err=%d", fp); 1455 qDebug("Could not execute '" + command + "'! err=%d", fp);
1443 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1456 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1444 pclose(fp); 1457 pclose(fp);
1445 return; 1458 return;
1446 } else { 1459 } else {
1447 while ( fgets( line, sizeof line, fp)) { 1460 while ( fgets( line, sizeof line, fp)) {
1448 outDlg->OutputEdit->append(line); 1461 outDlg->OutputEdit->append(line);
1449 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1462 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1450 1463
1451 } 1464 }
1452 1465
1453 } 1466 }
1454} 1467}
1455 1468
1456void AdvancedFm::mkDir() { 1469void AdvancedFm::mkDir() {
1457 if (TabWidget->currentPageIndex() == 0) 1470 if (TabWidget->currentPageIndex() == 0)
1458 localMakDir(); 1471 localMakDir();
1459 else 1472 else
1460 remoteMakDir(); 1473 remoteMakDir();
1461 1474
1462} 1475}
1463 1476
1464void AdvancedFm::rn() { 1477void AdvancedFm::rn() {
1465 if (TabWidget->currentPageIndex() == 0) 1478 if (TabWidget->currentPageIndex() == 0)
1466 localRename(); 1479 localRename();
1467 else 1480 else
1468 remoteRename(); 1481 remoteRename();
1469 1482
1470} 1483}
1471 1484
1472void AdvancedFm::del() { 1485void AdvancedFm::del() {
@@ -1495,140 +1508,144 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
1495 case Key_E: 1508 case Key_E:
1496 runThis(); 1509 runThis();
1497 break; 1510 break;
1498 case Key_C: 1511 case Key_C:
1499 copy(); 1512 copy();
1500 break; 1513 break;
1501 case Key_A: 1514 case Key_A:
1502 copyAs(); 1515 copyAs();
1503 break; 1516 break;
1504 case Key_M: 1517 case Key_M:
1505 move(); 1518 move();
1506 break; 1519 break;
1507 case Key_R: 1520 case Key_R:
1508 rn(); 1521 rn();
1509 break; 1522 break;
1510 case Key_I: 1523 case Key_I:
1511 fileStatus(); 1524 fileStatus();
1512 break; 1525 break;
1513 case Key_U: 1526 case Key_U:
1514 upDir(); 1527 upDir();
1515 break; 1528 break;
1516 case Key_P: 1529 case Key_P:
1517 filePerms(); 1530 filePerms();
1518 break; 1531 break;
1519 case Key_N: 1532 case Key_N:
1520 mkDir(); 1533 mkDir();
1521 break; 1534 break;
1522 case Key_1: 1535 case Key_1:
1523 switchToLocalTab(); 1536 switchToLocalTab();
1524 break; 1537 break;
1525 case Key_2: 1538 case Key_2:
1526 switchToRemoteTab(); 1539 switchToRemoteTab();
1527 break; 1540 break;
1528 case Key_3: 1541 case Key_3:
1529 CFButtonPushed(); 1542 CFButtonPushed();
1530 break; 1543 break;
1531 case Key_4: 1544 case Key_4:
1532 SDButtonPushed(); 1545 SDButtonPushed();
1533 break; 1546 break;
1534 case Key_5: 1547 case Key_5:
1535 homeButtonPushed(); 1548 homeButtonPushed();
1536 break; 1549 break;
1537 case Key_6: 1550 case Key_6:
1538 docButtonPushed(); 1551 docButtonPushed();
1539 break; 1552 break;
1540 case Key_7: 1553 case Key_7:
1541 break; 1554 break;
1542 case Key_8: 1555 case Key_8:
1543 break; 1556 break;
1544 case Key_9: 1557 case Key_9:
1545 break; 1558 break;
1546 case Key_0: 1559 case Key_0:
1547 break; 1560 break;
1548 } 1561 }
1549} 1562}
1550 1563
1551void AdvancedFm::mkSym() { 1564void AdvancedFm::mkSym() {
1552 QString cmd; 1565 QString cmd;
1553 QStringList curFileList = getPath(); 1566 QStringList curFileList = getPath();
1554 1567
1555 if (TabWidget->currentPageIndex() == 0) { 1568 if (TabWidget->currentPageIndex() == 0) {
1556 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1569 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1557 1570
1558 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 1571 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
1572 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1559 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1573 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1574 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1560 cmd = "ln -s "+curFile+" "+destName; 1575 cmd = "ln -s "+curFile+" "+destName;
1561 qDebug(cmd); 1576 qDebug(cmd);
1562 system(cmd.latin1() ); 1577 system(cmd.latin1() );
1563 } 1578 }
1564 populateRemoteView(); 1579 populateRemoteView();
1565 TabWidget->setCurrentPage(1); 1580 TabWidget->setCurrentPage(1);
1566 } else { 1581 } else {
1567 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1582 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1568 1583
1569 QString destName = currentDir.canonicalPath()+"/"+(*it); 1584 QString destName = currentDir.canonicalPath()+"/"+(*it);
1585 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1570 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1586 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1587 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1571 1588
1572 cmd = "ln -s "+curFile+" "+destName; 1589 cmd = "ln -s "+curFile+" "+destName;
1573 qDebug(cmd); 1590 qDebug(cmd);
1574 system(cmd.latin1() ); 1591 system(cmd.latin1() );
1575 } 1592 }
1576 populateLocalView(); 1593 populateLocalView();
1577 TabWidget->setCurrentPage(0); 1594 TabWidget->setCurrentPage(0);
1578 } 1595 }
1579} 1596}
1580 1597
1581void AdvancedFm::QPEButtonPushed() { 1598void AdvancedFm::QPEButtonPushed() {
1582 QString current = QPEApplication::qpeDir(); 1599 QString current = QPEApplication::qpeDir();
1583 chdir( current.latin1() ); 1600 chdir( current.latin1() );
1584 if (TabWidget->currentPageIndex() == 0) { 1601 if (TabWidget->currentPageIndex() == 0) {
1585 currentDir.cd( current, TRUE); 1602 currentDir.cd( current, TRUE);
1586 populateLocalView(); 1603 populateLocalView();
1587 } else { 1604 } else {
1588 currentRemoteDir.cd( current, TRUE); 1605 currentRemoteDir.cd( current, TRUE);
1589 populateRemoteView(); 1606 populateRemoteView();
1590 } 1607 }
1591 update(); 1608 update();
1592} 1609}
1593 1610
1594void AdvancedFm::parsetab(const QString &fileName) { 1611void AdvancedFm::parsetab(const QString &fileName) {
1595 1612
1596 fileSystemTypeList.clear(); 1613 fileSystemTypeList.clear();
1597 fsList.clear(); 1614 fsList.clear();
1598 struct mntent *me; 1615 struct mntent *me;
1599// if(fileName == "/etc/mtab") { 1616// if(fileName == "/etc/mtab") {
1600 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 1617 FILE *mntfp = setmntent( fileName.latin1(), "r" );
1601 if ( mntfp ) { 1618 if ( mntfp ) {
1602 while ( (me = getmntent( mntfp )) != 0 ) { 1619 while ( (me = getmntent( mntfp )) != 0 ) {
1603 QString deviceName = me->mnt_fsname; 1620 QString deviceName = me->mnt_fsname;
1604 QString filesystemType = me->mnt_type; 1621 QString filesystemType = me->mnt_type;
1605 QString mountDir = me->mnt_dir; 1622 QString mountDir = me->mnt_dir;
1606 if(deviceName != "none") { 1623 if(deviceName != "none") {
1607 if( fsList.contains(filesystemType) == 0 1624 if( fsList.contains(filesystemType) == 0
1608 & filesystemType.find("proc",0,TRUE) == -1 1625 & filesystemType.find("proc",0,TRUE) == -1
1609 & filesystemType.find("cramfs",0,TRUE) == -1 1626 & filesystemType.find("cramfs",0,TRUE) == -1
1610 & filesystemType.find("auto",0,TRUE) == -1) 1627 & filesystemType.find("auto",0,TRUE) == -1)
1611 fsList << filesystemType; 1628 fsList << filesystemType;
1612// deviceList << deviceName; 1629// deviceList << deviceName;
1613// qDebug(mountDir+"::"+filesystemType); 1630// qDebug(mountDir+"::"+filesystemType);
1614 fileSystemTypeList << mountDir+"::"+filesystemType; 1631 fileSystemTypeList << mountDir+"::"+filesystemType;
1615 } 1632 }
1616 } 1633 }
1617 } 1634 }
1618 endmntent( mntfp ); 1635 endmntent( mntfp );
1619} 1636}
1620 1637
1621QString AdvancedFm::getFileSystemType(const QString &currentText) { 1638QString AdvancedFm::getFileSystemType(const QString &currentText) {
1622 parsetab("/etc/mtab"); //why did TT forget filesystem type? 1639 parsetab("/etc/mtab"); //why did TT forget filesystem type?
1623 QString current = currentText;//.right( currentText.length()-1); 1640 QString current = currentText;//.right( currentText.length()-1);
1624 QString baseFs; 1641 QString baseFs;
1625 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 1642 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
1626 QString temp = (*it); 1643 QString temp = (*it);
1627 QString path = temp.left(temp.find("::",0,TRUE) ); 1644 QString path = temp.left(temp.find("::",0,TRUE) );
1628 path = path.right( path.length()-1); 1645 path = path.right( path.length()-1);
1629 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1646 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1630 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 1647 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
1631 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1648 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1632 } 1649 }
1633 } 1650 }
1634 return baseFs; 1651 return baseFs;