summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-02 00:58:12 (UTC)
committer llornkcor <llornkcor>2002-05-02 00:58:12 (UTC)
commit45ba3b844e3fb8d9b9e1936ad2abec869d25dd33 (patch) (unidiff)
tree13fc9abdbea1bf258024bbd10776e18d4ad6eba2
parent21ddb4ef8f53ac003836535708736b91fd2c9f57 (diff)
downloadopie-45ba3b844e3fb8d9b9e1936ad2abec869d25dd33.zip
opie-45ba3b844e3fb8d9b9e1936ad2abec869d25dd33.tar.gz
opie-45ba3b844e3fb8d9b9e1936ad2abec869d25dd33.tar.bz2
bug fix #2 delete
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index a378170..e3ab76b 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -481,769 +481,769 @@ void AdvancedFm::populateRemoteView()
481// int i = 1; 481// int i = 1;
482 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 482 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
483 while ((mydirent = readdir(dir)) != NULL) { 483 while ((mydirent = readdir(dir)) != NULL) {
484 lstat( mydirent->d_name, &buf); 484 lstat( mydirent->d_name, &buf);
485 qDebug(mydirent->d_name); 485 qDebug(mydirent->d_name);
486// mode = buf.st_mode; 486// mode = buf.st_mode;
487 fileL.sprintf("%s", mydirent->d_name); 487 fileL.sprintf("%s", mydirent->d_name);
488// fileS.sprintf("%d, %d", ); //this isn't correct 488// fileS.sprintf("%d, %d", ); //this isn't correct
489 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 489 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
490 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 490 fileDate.sprintf("%s", ctime( &buf.st_mtime));
491 if( fileL.find(".") == -1 ){ 491 if( fileL.find(".") == -1 ){
492 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 492 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
493 pm = Resource::loadPixmap( "UnknownDocument-14" ); 493 pm = Resource::loadPixmap( "UnknownDocument-14" );
494 item->setPixmap( 0,pm); 494 item->setPixmap( 0,pm);
495 } 495 }
496 } 496 }
497 497
498 closedir(dir); 498 closedir(dir);
499 } 499 }
500 500
501 Remote_View->setSorting( 3,FALSE); 501 Remote_View->setSorting( 3,FALSE);
502 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 502 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
503} 503}
504 504
505void AdvancedFm::localListClicked(QListViewItem *selectedItem) 505void AdvancedFm::localListClicked(QListViewItem *selectedItem)
506{ 506{
507 if(selectedItem) { 507 if(selectedItem) {
508 QString strItem=selectedItem->text(0); 508 QString strItem=selectedItem->text(0);
509 QString strSize=selectedItem->text(1); 509 QString strSize=selectedItem->text(1);
510 strSize=strSize.stripWhiteSpace(); 510 strSize=strSize.stripWhiteSpace();
511 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 511 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
512 // is symlink 512 // is symlink
513 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 513 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
514 if(QDir(strItem2).exists() ) { 514 if(QDir(strItem2).exists() ) {
515 currentDir.cd(strItem2, TRUE); 515 currentDir.cd(strItem2, TRUE);
516 populateLocalView(); 516 populateLocalView();
517 } 517 }
518 } else { // not a symlink 518 } else { // not a symlink
519 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 519 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
520 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 520 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
521 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 521 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
522 currentDir.cd(strItem,FALSE); 522 currentDir.cd(strItem,FALSE);
523 populateLocalView(); 523 populateLocalView();
524 } else { 524 } else {
525 currentDir.cdUp(); 525 currentDir.cdUp();
526 populateLocalView(); 526 populateLocalView();
527 } 527 }
528 if(QDir(strItem).exists()){ 528 if(QDir(strItem).exists()){
529 currentDir.cd(strItem, TRUE); 529 currentDir.cd(strItem, TRUE);
530 populateLocalView(); 530 populateLocalView();
531 } 531 }
532 } else { 532 } else {
533 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 533 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
534 if( QFile::exists(strItem ) ) { 534 if( QFile::exists(strItem ) ) {
535// qDebug("upload "+strItem); 535// qDebug("upload "+strItem);
536 } 536 }
537 } //end not symlink 537 } //end not symlink
538 chdir(strItem.latin1()); 538 chdir(strItem.latin1());
539 } 539 }
540 } 540 }
541} 541}
542 542
543void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 543void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
544{ 544{
545 if(selectedItem) { 545 if(selectedItem) {
546 QString strItem=selectedItem->text(0); 546 QString strItem=selectedItem->text(0);
547 QString strSize=selectedItem->text(1); 547 QString strSize=selectedItem->text(1);
548 strSize=strSize.stripWhiteSpace(); 548 strSize=strSize.stripWhiteSpace();
549 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 549 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
550 // is symlink 550 // is symlink
551 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 551 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
552 if(QDir(strItem2).exists() ) { 552 if(QDir(strItem2).exists() ) {
553 currentRemoteDir.cd(strItem2, TRUE); 553 currentRemoteDir.cd(strItem2, TRUE);
554 populateRemoteView(); 554 populateRemoteView();
555 } 555 }
556 } else { // not a symlink 556 } else { // not a symlink
557 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 557 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
558 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 558 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
559 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 559 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
560 currentRemoteDir.cd(strItem,FALSE); 560 currentRemoteDir.cd(strItem,FALSE);
561 populateRemoteView(); 561 populateRemoteView();
562 } else { 562 } else {
563 currentRemoteDir.cdUp(); 563 currentRemoteDir.cdUp();
564 populateRemoteView(); 564 populateRemoteView();
565 } 565 }
566 if(QDir(strItem).exists()){ 566 if(QDir(strItem).exists()){
567 currentRemoteDir.cd(strItem, TRUE); 567 currentRemoteDir.cd(strItem, TRUE);
568 populateRemoteView(); 568 populateRemoteView();
569 } 569 }
570 } else { 570 } else {
571 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 571 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
572 if( QFile::exists(strItem ) ) { 572 if( QFile::exists(strItem ) ) {
573// qDebug("upload "+strItem); 573// qDebug("upload "+strItem);
574 } 574 }
575 } //end not symlink 575 } //end not symlink
576 chdir(strItem.latin1()); 576 chdir(strItem.latin1());
577 } 577 }
578 } 578 }
579} 579}
580 580
581void AdvancedFm::doLocalCd() 581void AdvancedFm::doLocalCd()
582{ 582{
583 localListClicked( Local_View->currentItem()); 583 localListClicked( Local_View->currentItem());
584} 584}
585 585
586void AdvancedFm::doRemoteCd() 586void AdvancedFm::doRemoteCd()
587{ 587{
588 localListClicked( Remote_View->currentItem()); 588 localListClicked( Remote_View->currentItem());
589} 589}
590 590
591void AdvancedFm::showHidden() 591void AdvancedFm::showHidden()
592{ 592{
593 if (b) { 593 if (b) {
594 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 594 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
595 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 595 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
596// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 596// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
597// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 597// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
598 b=FALSE; 598 b=FALSE;
599 599
600 } else { 600 } else {
601 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 601 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
602 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 602 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
603// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 603// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
604// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 604// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
605 b=TRUE; 605 b=TRUE;
606 } 606 }
607 populateLocalView(); 607 populateLocalView();
608 608
609} 609}
610 610
611void AdvancedFm::showRemoteHidden() 611void AdvancedFm::showRemoteHidden()
612{ 612{
613 if (b) { 613 if (b) {
614 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 614 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
615// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 615// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
616// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 616// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
617 b=TRUE; 617 b=TRUE;
618 618
619 } else { 619 } else {
620 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 620 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
621// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 621// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
622// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 622// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
623 b=FALSE; 623 b=FALSE;
624 } 624 }
625 populateRemoteView(); 625 populateRemoteView();
626} 626}
627 627
628void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 628void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
629{ 629{
630 switch (mouse) { 630 switch (mouse) {
631 case 1: 631 case 1:
632 break; 632 break;
633 case 2: 633 case 2:
634 showLocalMenu(item); 634 showLocalMenu(item);
635 Local_View->clearSelection(); 635 Local_View->clearSelection();
636 break; 636 break;
637 }; 637 };
638} 638}
639 639
640void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 640void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
641{ 641{
642 switch (mouse) { 642 switch (mouse) {
643 case 1: 643 case 1:
644 break; 644 break;
645 case 2: 645 case 2:
646 showRemoteMenu(item); 646 showRemoteMenu(item);
647 Remote_View->clearSelection(); 647 Remote_View->clearSelection();
648 break; 648 break;
649 }; 649 };
650} 650}
651 651
652void AdvancedFm::showLocalMenu(QListViewItem * item) 652void AdvancedFm::showLocalMenu(QListViewItem * item)
653{ 653{
654 if(item) { 654 if(item) {
655 QPopupMenu m; 655 QPopupMenu m;
656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
657 m.insertSeparator(); 657 m.insertSeparator();
658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
659 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 659 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
660 else 660 else
661 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 661 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
663 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 663 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
664 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 664 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
665 m.insertSeparator(); 665 m.insertSeparator();
666 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 666 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
667 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 667 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
668 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 668 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
669 m.insertItem( tr( "Move" ), this, SLOT( move() )); 669 m.insertItem( tr( "Move" ), this, SLOT( move() ));
670 m.insertSeparator(); 670 m.insertSeparator();
671 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 671 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
672 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 672 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
673 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 673 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
674 m.insertSeparator(); 674 m.insertSeparator();
675 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 675 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
676 m.insertSeparator(); 676 m.insertSeparator();
677 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 677 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
678 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 678 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
679 m.setCheckable(TRUE); 679 m.setCheckable(TRUE);
680 if (!b) 680 if (!b)
681 m.setItemChecked(m.idAt(0),TRUE); 681 m.setItemChecked(m.idAt(0),TRUE);
682 else 682 else
683 m.setItemChecked(m.idAt(0),FALSE); 683 m.setItemChecked(m.idAt(0),FALSE);
684 m.exec( QCursor::pos() ); 684 m.exec( QCursor::pos() );
685 } 685 }
686} 686}
687 687
688void AdvancedFm::showRemoteMenu(QListViewItem * item) 688void AdvancedFm::showRemoteMenu(QListViewItem * item)
689{ 689{
690 if(item) { 690 if(item) {
691 QPopupMenu m; 691 QPopupMenu m;
692 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 692 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
693 m.insertSeparator(); 693 m.insertSeparator();
694 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 694 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
695 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 695 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
696 else 696 else
697 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 697 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
698 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 698 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
699 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 699 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
700 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 700 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
701 m.insertSeparator(); 701 m.insertSeparator();
702 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 702 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
703 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 703 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
704 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 704 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
705 m.insertItem( tr( "Move" ), this, SLOT( move() )); 705 m.insertItem( tr( "Move" ), this, SLOT( move() ));
706 m.insertSeparator(); 706 m.insertSeparator();
707 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 707 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
708 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 708 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
709 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 709 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
710 m.insertSeparator(); 710 m.insertSeparator();
711 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 711 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
712 m.insertSeparator(); 712 m.insertSeparator();
713 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 713 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
714 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 714 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
715 m.setCheckable(TRUE); 715 m.setCheckable(TRUE);
716 if (!b) 716 if (!b)
717 m.setItemChecked(m.idAt(0),TRUE); 717 m.setItemChecked(m.idAt(0),TRUE);
718 else 718 else
719 m.setItemChecked(m.idAt(0),FALSE); 719 m.setItemChecked(m.idAt(0),FALSE);
720 m.exec( QCursor::pos() ); 720 m.exec( QCursor::pos() );
721 } 721 }
722} 722}
723 723
724void AdvancedFm::runThis() { 724void AdvancedFm::runThis() {
725// QFileInfo *fi; 725// QFileInfo *fi;
726QString fs; 726QString fs;
727 if (TabWidget->currentPageIndex() == 0) { 727 if (TabWidget->currentPageIndex() == 0) {
728 QString curFile = Local_View->currentItem()->text(0); 728 QString curFile = Local_View->currentItem()->text(0);
729 729
730 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 730 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
731 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 731 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
732 qDebug( fileInfo.owner()); 732 qDebug( fileInfo.owner());
733 if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 733 if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
734 QCopEnvelope e("QPE/System", "execute(QString)" ); 734 QCopEnvelope e("QPE/System", "execute(QString)" );
735 e << curFile; 735 e << curFile;
736 } else { 736 } else {
737 curFile = currentDir.canonicalPath()+"/"+curFile; 737 curFile = currentDir.canonicalPath()+"/"+curFile;
738 DocLnk nf(curFile); 738 DocLnk nf(curFile);
739 QString execStr = nf.exec(); 739 QString execStr = nf.exec();
740 qDebug( execStr); 740 qDebug( execStr);
741 if( execStr.isEmpty() ) { 741 if( execStr.isEmpty() ) {
742 } else { 742 } else {
743 nf.execute(); 743 nf.execute();
744 } 744 }
745 } 745 }
746// MimeType mt( curFile); 746// MimeType mt( curFile);
747 } else { 747 } else {
748 QString curFile = Remote_View->currentItem()->text(0); 748 QString curFile = Remote_View->currentItem()->text(0);
749 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 749 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
750 qDebug("Filesystemtype is "+fs); 750 qDebug("Filesystemtype is "+fs);
751 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 751 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
752 if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 752 if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
753 QCopEnvelope e("QPE/System", "execute(QString)" ); 753 QCopEnvelope e("QPE/System", "execute(QString)" );
754 e << curFile; 754 e << curFile;
755 } else { 755 } else {
756 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 756 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
757 DocLnk nf(curFile); 757 DocLnk nf(curFile);
758 QString execStr = nf.exec(); 758 QString execStr = nf.exec();
759 qDebug(execStr); 759 qDebug(execStr);
760 if( execStr.isEmpty() ) { 760 if( execStr.isEmpty() ) {
761 } else { 761 } else {
762 nf.execute(); 762 nf.execute();
763 } 763 }
764 } 764 }
765// MimeType mt( curFile); 765// MimeType mt( curFile);
766 } 766 }
767} 767}
768 768
769void AdvancedFm::runText() { 769void AdvancedFm::runText() {
770 if (TabWidget->currentPageIndex() == 0) { 770 if (TabWidget->currentPageIndex() == 0) {
771 QString curFile = Local_View->currentItem()->text(0); 771 QString curFile = Local_View->currentItem()->text(0);
772 curFile = currentDir.canonicalPath()+"/"+curFile; 772 curFile = currentDir.canonicalPath()+"/"+curFile;
773 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 773 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
774 e << curFile; 774 e << curFile;
775 } else { 775 } else {
776 QString curFile = Remote_View->currentItem()->text(0); 776 QString curFile = Remote_View->currentItem()->text(0);
777 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 777 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
778 DocLnk nf(curFile); 778 DocLnk nf(curFile);
779 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 779 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
780 e << curFile; 780 e << curFile;
781 } 781 }
782} 782}
783 783
784void AdvancedFm::localMakDir() 784void AdvancedFm::localMakDir()
785{ 785{
786 InputDialog *fileDlg; 786 InputDialog *fileDlg;
787 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 787 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
788 fileDlg->exec(); 788 fileDlg->exec();
789 if( fileDlg->result() == 1 ) { 789 if( fileDlg->result() == 1 ) {
790 QString filename = fileDlg->LineEdit1->text(); 790 QString filename = fileDlg->LineEdit1->text();
791 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 791 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
792 } 792 }
793 populateLocalView(); 793 populateLocalView();
794} 794}
795 795
796void AdvancedFm::remoteMakDir() 796void AdvancedFm::remoteMakDir()
797{ 797{
798 InputDialog *fileDlg; 798 InputDialog *fileDlg;
799 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 799 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
800 fileDlg->exec(); 800 fileDlg->exec();
801 if( fileDlg->result() == 1 ) { 801 if( fileDlg->result() == 1 ) {
802 QString filename = fileDlg->LineEdit1->text(); 802 QString filename = fileDlg->LineEdit1->text();
803 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 803 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
804 } 804 }
805 populateRemoteView(); 805 populateRemoteView();
806} 806}
807 807
808void AdvancedFm::localDelete() 808void AdvancedFm::localDelete()
809{ 809{
810 QStringList curFileList = getPath(); 810 QStringList curFileList = getPath();
811 QString myFile; 811 QString myFile;
812 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 812 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
813 myFile = (*it); 813 myFile = (*it);
814 if( myFile.find(" -> ",0,TRUE) != -1) 814 if( myFile.find(" -> ",0,TRUE) != -1)
815 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 815 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
816 816
817 QString f = currentDir.canonicalPath(); 817 QString f = currentDir.canonicalPath();
818 if(f.right(1).find("/",0,TRUE) == -1) 818 if(f.right(1).find("/",0,TRUE) == -1)
819 f+="/"; 819 f+="/";
820 f+=myFile; 820 f+=myFile;
821 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 821 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
822 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 822 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
823 "\nand all it's contents ?" 823 "\nand all it's contents ?"
824 ,tr("Yes"),tr("No"),0,0,1) ) { 824 ,tr("Yes"),tr("No"),0,0,1) ) {
825 case 0: { 825 case 0: {
826 f=f.left(f.length()-1); 826 f=f.left(f.length()-1);
827 QString cmd="rm -rf "+f; 827 QString cmd="rm -rf "+f;
828 system( cmd.latin1()); 828 system( cmd.latin1());
829 populateLocalView(); 829 populateLocalView();
830 } 830 }
831 break; 831 break;
832 case 1: 832 case 1:
833 // exit 833 // exit
834 break; 834 break;
835 }; 835 };
836 836
837 } else { 837 } else {
838 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 838 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
839 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 839 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
840 case 0: { 840 case 0: {
841 QString cmd="rm "+f; 841 QString cmd="rm "+f;
842 QFile file(f); 842 QFile file(f);
843 file.remove(); 843 file.remove();
844// system( cmd.latin1()); 844// system( cmd.latin1());
845 populateLocalView(); 845 populateLocalView();
846 } 846 }
847 break; 847 break;
848 case 1: 848 case 1:
849 // exit 849 // exit
850 break; 850 break;
851 }; 851 };
852 } 852 }
853 } 853 }
854} 854}
855 855
856void AdvancedFm::remoteDelete() 856void AdvancedFm::remoteDelete()
857{ 857{
858 QStringList curFileList = getPath(); 858 QStringList curFileList = getPath();
859 QString myFile; 859 QString myFile;
860 860
861 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 861 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
862 myFile = (*it); 862 myFile = (*it);
863 if(myFile.find(" -> ",0,TRUE) != -1) 863 if(myFile.find(" -> ",0,TRUE) != -1)
864 myFile = myFile.left(myFile.find(" -> ",0,TRUE)); 864 myFile = myFile.left(myFile.find(" -> ",0,TRUE));
865 QString f = currentDir.canonicalPath(); 865 QString f = currentRemoteDir.canonicalPath();
866 if(f.right(1).find("/",0,TRUE) == -1) 866 if(f.right(1).find("/",0,TRUE) == -1)
867 f+="/"; 867 f+="/";
868 f+=myFile; 868 f+=myFile;
869 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 869 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
870 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 870 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
871 "\nand all it's contents ?", 871 "\nand all it's contents ?",
872 tr("Yes"),tr("No"),0,0,1) ) { 872 tr("Yes"),tr("No"),0,0,1) ) {
873 case 0: { 873 case 0: {
874 f=f.left(f.length()-1); 874 f=f.left(f.length()-1);
875 QString cmd="rm -rf "+f; 875 QString cmd="rm -rf "+f;
876 system( cmd.latin1()); 876 system( cmd.latin1());
877 populateRemoteView(); 877 populateRemoteView();
878 } 878 }
879 break; 879 break;
880 case 1: 880 case 1:
881 // exit 881 // exit
882 break; 882 break;
883 }; 883 };
884 884
885 } else { 885 } else {
886 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 886 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
887 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 887 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
888 case 0: { 888 case 0: {
889 QString cmd="rm "+f; 889 QString cmd="rm "+f;
890 QFile file(f); 890 QFile file(f);
891 file.remove(); 891 file.remove();
892// system( cmd.latin1()); 892// system( cmd.latin1());
893 populateRemoteView(); 893 populateRemoteView();
894 } 894 }
895 break; 895 break;
896 case 1: 896 case 1:
897 // exit 897 // exit
898 break; 898 break;
899 }; 899 };
900 } 900 }
901 } 901 }
902} 902}
903 903
904void AdvancedFm::localRename() 904void AdvancedFm::localRename()
905{ 905{
906 QString curFile = Local_View->currentItem()->text(0); 906 QString curFile = Local_View->currentItem()->text(0);
907 InputDialog *fileDlg; 907 InputDialog *fileDlg;
908 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 908 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
909 fileDlg->setInputText((const QString &)curFile); 909 fileDlg->setInputText((const QString &)curFile);
910 fileDlg->exec(); 910 fileDlg->exec();
911 if( fileDlg->result() == 1 ) { 911 if( fileDlg->result() == 1 ) {
912 QString oldname = currentDir.canonicalPath() + "/" + curFile; 912 QString oldname = currentDir.canonicalPath() + "/" + curFile;
913 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 913 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
914 if( rename(oldname.latin1(), newName.latin1())== -1) 914 if( rename(oldname.latin1(), newName.latin1())== -1)
915 QMessageBox::message(tr("Note"),tr("Could not rename")); 915 QMessageBox::message(tr("Note"),tr("Could not rename"));
916 } 916 }
917 populateLocalView(); 917 populateLocalView();
918} 918}
919 919
920void AdvancedFm::remoteRename() 920void AdvancedFm::remoteRename()
921{ 921{
922 QString curFile = Local_View->currentItem()->text(0); 922 QString curFile = Local_View->currentItem()->text(0);
923 InputDialog *fileDlg; 923 InputDialog *fileDlg;
924 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 924 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
925 fileDlg->setInputText((const QString &)curFile); 925 fileDlg->setInputText((const QString &)curFile);
926 fileDlg->exec(); 926 fileDlg->exec();
927 if( fileDlg->result() == 1 ) { 927 if( fileDlg->result() == 1 ) {
928 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 928 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
929 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 929 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
930 if( rename(oldname.latin1(), newName.latin1())== -1) 930 if( rename(oldname.latin1(), newName.latin1())== -1)
931 QMessageBox::message(tr("Note"),tr("Could not rename")); 931 QMessageBox::message(tr("Note"),tr("Could not rename"));
932 } 932 }
933 populateRemoteView(); 933 populateRemoteView();
934} 934}
935 935
936void AdvancedFm::switchToLocalTab() 936void AdvancedFm::switchToLocalTab()
937{ 937{
938 TabWidget->setCurrentPage(0); 938 TabWidget->setCurrentPage(0);
939 Local_View->setFocus(); 939 Local_View->setFocus();
940} 940}
941 941
942void AdvancedFm::switchToRemoteTab() 942void AdvancedFm::switchToRemoteTab()
943{ 943{
944 TabWidget->setCurrentPage(1); 944 TabWidget->setCurrentPage(1);
945 Remote_View->setFocus(); 945 Remote_View->setFocus();
946} 946}
947 947
948void AdvancedFm::readConfig() 948void AdvancedFm::readConfig()
949{ 949{
950 Config cfg("AdvancedFm"); 950 Config cfg("AdvancedFm");
951} 951}
952 952
953void AdvancedFm::writeConfig() 953void AdvancedFm::writeConfig()
954{ 954{
955 Config cfg("AdvancedFm"); 955 Config cfg("AdvancedFm");
956} 956}
957 957
958void AdvancedFm::currentPathComboChanged() 958void AdvancedFm::currentPathComboChanged()
959{ 959{
960 if (TabWidget->currentPageIndex() == 0) { 960 if (TabWidget->currentPageIndex() == 0) {
961 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 961 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
962 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 962 currentDir.setPath( currentPathCombo->lineEdit()->text() );
963 populateLocalView(); 963 populateLocalView();
964 } else { 964 } else {
965 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 965 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
966 } 966 }
967 } 967 }
968 if (TabWidget->currentPageIndex() == 0) { 968 if (TabWidget->currentPageIndex() == 0) {
969 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 969 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
970 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 970 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
971 populateRemoteView(); 971 populateRemoteView();
972 } else { 972 } else {
973 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 973 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
974 } 974 }
975 } 975 }
976} 976}
977 977
978void AdvancedFm::fillCombo(const QString &currentPath) { 978void AdvancedFm::fillCombo(const QString &currentPath) {
979 979
980 if (TabWidget->currentPageIndex() == 0) { 980 if (TabWidget->currentPageIndex() == 0) {
981 currentPathCombo->lineEdit()->setText( currentPath); 981 currentPathCombo->lineEdit()->setText( currentPath);
982 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 982 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
983 currentPathCombo->clear(); 983 currentPathCombo->clear();
984 localDirPathStringList.prepend( currentPath ); 984 localDirPathStringList.prepend( currentPath );
985 currentPathCombo->insertStringList( localDirPathStringList,-1); 985 currentPathCombo->insertStringList( localDirPathStringList,-1);
986 } 986 }
987 } else { 987 } else {
988 currentPathCombo->lineEdit()->setText( currentPath); 988 currentPathCombo->lineEdit()->setText( currentPath);
989 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 989 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
990 currentPathCombo->clear(); 990 currentPathCombo->clear();
991 remoteDirPathStringList.prepend( currentPath ); 991 remoteDirPathStringList.prepend( currentPath );
992 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 992 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
993 } 993 }
994 } 994 }
995} 995}
996 996
997void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 997void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
998 if (TabWidget->currentPageIndex() == 0) { 998 if (TabWidget->currentPageIndex() == 0) {
999 chdir( currentPath.latin1() ); 999 chdir( currentPath.latin1() );
1000 currentDir.cd( currentPath, TRUE); 1000 currentDir.cd( currentPath, TRUE);
1001 populateLocalView(); 1001 populateLocalView();
1002 update(); 1002 update();
1003 } else { 1003 } else {
1004 chdir( currentPath.latin1() ); 1004 chdir( currentPath.latin1() );
1005 currentRemoteDir.cd( currentPath, TRUE); 1005 currentRemoteDir.cd( currentPath, TRUE);
1006 populateRemoteView(); 1006 populateRemoteView();
1007 update(); 1007 update();
1008 } 1008 }
1009} 1009}
1010 1010
1011void AdvancedFm::filePerms() { 1011void AdvancedFm::filePerms() {
1012 1012
1013 QStringList curFileList = getPath(); 1013 QStringList curFileList = getPath();
1014 QString filePath; 1014 QString filePath;
1015 1015
1016 if (TabWidget->currentPageIndex() == 0) { 1016 if (TabWidget->currentPageIndex() == 0) {
1017 filePath = currentDir.canonicalPath()+"/"; 1017 filePath = currentDir.canonicalPath()+"/";
1018 } else { 1018 } else {
1019 filePath= currentRemoteDir.canonicalPath()+"/"; 1019 filePath= currentRemoteDir.canonicalPath()+"/";
1020 } 1020 }
1021 1021
1022 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1022 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1023 filePermissions *filePerm; 1023 filePermissions *filePerm;
1024 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 1024 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
1025 filePerm->showMaximized(); 1025 filePerm->showMaximized();
1026 filePerm->exec(); 1026 filePerm->exec();
1027 if( filePerm) 1027 if( filePerm)
1028 delete filePerm; 1028 delete filePerm;
1029 } 1029 }
1030} 1030}
1031 1031
1032void AdvancedFm::doProperties() { 1032void AdvancedFm::doProperties() {
1033 QStringList curFileList = getPath(); 1033 QStringList curFileList = getPath();
1034 QString filePath; 1034 QString filePath;
1035 if (TabWidget->currentPageIndex() == 0) { 1035 if (TabWidget->currentPageIndex() == 0) {
1036 filePath = currentDir.canonicalPath()+"/"; 1036 filePath = currentDir.canonicalPath()+"/";
1037 } else { 1037 } else {
1038 filePath= currentRemoteDir.canonicalPath()+"/"; 1038 filePath= currentRemoteDir.canonicalPath()+"/";
1039 } 1039 }
1040 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1040 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1041 DocLnk lnk( (filePath+*it)); 1041 DocLnk lnk( (filePath+*it));
1042 LnkProperties prop( &lnk ); 1042 LnkProperties prop( &lnk );
1043// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 1043// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1044 prop.showMaximized(); 1044 prop.showMaximized();
1045 prop.exec(); 1045 prop.exec();
1046 } 1046 }
1047} 1047}
1048 1048
1049QStringList AdvancedFm::getPath() { 1049QStringList AdvancedFm::getPath() {
1050 QStringList strList; 1050 QStringList strList;
1051 if (TabWidget->currentPageIndex() == 0) { 1051 if (TabWidget->currentPageIndex() == 0) {
1052 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1052 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1053 QListViewItemIterator it( Local_View ); 1053 QListViewItemIterator it( Local_View );
1054 for ( ; it.current(); ++it ) { 1054 for ( ; it.current(); ++it ) {
1055 if ( it.current()->isSelected() ) { 1055 if ( it.current()->isSelected() ) {
1056 strList << it.current()->text(0); 1056 strList << it.current()->text(0);
1057 } 1057 }
1058 } 1058 }
1059 return strList; 1059 return strList;
1060 } else { 1060 } else {
1061 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1061 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1062 QListViewItemIterator it( Remote_View ); 1062 QListViewItemIterator it( Remote_View );
1063 for ( ; it.current(); ++it ) { 1063 for ( ; it.current(); ++it ) {
1064 if ( it.current()->isSelected() ) { 1064 if ( it.current()->isSelected() ) {
1065 strList << it.current()->text(0); 1065 strList << it.current()->text(0);
1066 } 1066 }
1067 } 1067 }
1068 return strList; 1068 return strList;
1069 } 1069 }
1070 return ""; 1070 return "";
1071} 1071}
1072 1072
1073void AdvancedFm::homeButtonPushed() { 1073void AdvancedFm::homeButtonPushed() {
1074 QString current = QDir::homeDirPath(); 1074 QString current = QDir::homeDirPath();
1075 chdir( current.latin1() ); 1075 chdir( current.latin1() );
1076 if (TabWidget->currentPageIndex() == 0) { 1076 if (TabWidget->currentPageIndex() == 0) {
1077 currentDir.cd( current, TRUE); 1077 currentDir.cd( current, TRUE);
1078 populateLocalView(); 1078 populateLocalView();
1079 } else { 1079 } else {
1080 currentRemoteDir.cd( current, TRUE); 1080 currentRemoteDir.cd( current, TRUE);
1081 populateRemoteView(); 1081 populateRemoteView();
1082 } 1082 }
1083 update(); 1083 update();
1084} 1084}
1085 1085
1086void AdvancedFm::docButtonPushed() { 1086void AdvancedFm::docButtonPushed() {
1087 QString current = QPEApplication::documentDir(); 1087 QString current = QPEApplication::documentDir();
1088 chdir( current.latin1() ); 1088 chdir( current.latin1() );
1089 if (TabWidget->currentPageIndex() == 0) { 1089 if (TabWidget->currentPageIndex() == 0) {
1090 currentDir.cd( current, TRUE); 1090 currentDir.cd( current, TRUE);
1091 populateLocalView(); 1091 populateLocalView();
1092 } else { 1092 } else {
1093 currentRemoteDir.cd( current, TRUE); 1093 currentRemoteDir.cd( current, TRUE);
1094 populateRemoteView(); 1094 populateRemoteView();
1095 } 1095 }
1096 update(); 1096 update();
1097} 1097}
1098 1098
1099void AdvancedFm::SDButtonPushed() { 1099void AdvancedFm::SDButtonPushed() {
1100 QString current = "/mnt/card"; 1100 QString current = "/mnt/card";
1101 chdir( current.latin1() ); 1101 chdir( current.latin1() );
1102 if (TabWidget->currentPageIndex() == 0) { 1102 if (TabWidget->currentPageIndex() == 0) {
1103 currentDir.cd( current, TRUE); 1103 currentDir.cd( current, TRUE);
1104 populateLocalView(); 1104 populateLocalView();
1105 } else { 1105 } else {
1106 currentRemoteDir.cd( current, TRUE); 1106 currentRemoteDir.cd( current, TRUE);
1107 populateRemoteView(); 1107 populateRemoteView();
1108 } 1108 }
1109 update(); 1109 update();
1110 1110
1111} 1111}
1112 1112
1113void AdvancedFm::CFButtonPushed() { 1113void AdvancedFm::CFButtonPushed() {
1114 QString current = "/mnt/cf"; 1114 QString current = "/mnt/cf";
1115 chdir( current.latin1() ); 1115 chdir( current.latin1() );
1116 if (TabWidget->currentPageIndex() == 0) { 1116 if (TabWidget->currentPageIndex() == 0) {
1117 currentDir.cd( current, TRUE); 1117 currentDir.cd( current, TRUE);
1118 populateLocalView(); 1118 populateLocalView();
1119 } else { 1119 } else {
1120 currentRemoteDir.cd( current, TRUE); 1120 currentRemoteDir.cd( current, TRUE);
1121 populateRemoteView(); 1121 populateRemoteView();
1122 } 1122 }
1123 update(); 1123 update();
1124 1124
1125} 1125}
1126 1126
1127 1127
1128void AdvancedFm::upDir() 1128void AdvancedFm::upDir()
1129{ 1129{
1130 if (TabWidget->currentPageIndex() == 0) { 1130 if (TabWidget->currentPageIndex() == 0) {
1131 QString current = currentDir.canonicalPath(); 1131 QString current = currentDir.canonicalPath();
1132 QDir dir(current); 1132 QDir dir(current);
1133 dir.cdUp(); 1133 dir.cdUp();
1134 current = dir.canonicalPath(); 1134 current = dir.canonicalPath();
1135 chdir( current.latin1() ); 1135 chdir( current.latin1() );
1136 currentDir.cd( current, TRUE); 1136 currentDir.cd( current, TRUE);
1137 populateLocalView(); 1137 populateLocalView();
1138 update(); 1138 update();
1139 } else { 1139 } else {
1140 QString current = currentRemoteDir.canonicalPath(); 1140 QString current = currentRemoteDir.canonicalPath();
1141 QDir dir(current); 1141 QDir dir(current);
1142 dir.cdUp(); 1142 dir.cdUp();
1143 current = dir.canonicalPath(); 1143 current = dir.canonicalPath();
1144 chdir( current.latin1() ); 1144 chdir( current.latin1() );
1145 currentRemoteDir.cd( current, TRUE); 1145 currentRemoteDir.cd( current, TRUE);
1146 populateRemoteView(); 1146 populateRemoteView();
1147 update(); 1147 update();
1148 } 1148 }
1149} 1149}
1150 1150
1151void AdvancedFm::copy() 1151void AdvancedFm::copy()
1152{ 1152{
1153 QStringList curFileList = getPath(); 1153 QStringList curFileList = getPath();
1154 QString curFile; 1154 QString curFile;
1155 if (TabWidget->currentPageIndex() == 0) { 1155 if (TabWidget->currentPageIndex() == 0) {
1156 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1156 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1157 1157
1158 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1158 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1159// if(destFile.right(1).find("/",0,TRUE) == -1) 1159// if(destFile.right(1).find("/",0,TRUE) == -1)
1160// destFile+="/"; 1160// destFile+="/";
1161// destFile +=(*it); 1161// destFile +=(*it);
1162 1162
1163 curFile = currentDir.canonicalPath()+"/"+(*it); 1163 curFile = currentDir.canonicalPath()+"/"+(*it);
1164// if(curFile.right(1).find("/",0,TRUE) == -1) 1164// if(curFile.right(1).find("/",0,TRUE) == -1)
1165// curFile +="/"; 1165// curFile +="/";
1166// curFile +=(*it); 1166// curFile +=(*it);
1167 1167
1168 QFile f(destFile); 1168 QFile f(destFile);
1169 if( f.exists()) 1169 if( f.exists())
1170 f.remove(); 1170 f.remove();
1171 if(!copyFile(destFile, curFile) ) { 1171 if(!copyFile(destFile, curFile) ) {
1172 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1172 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1173 qWarning("nothin doing"); 1173 qWarning("nothin doing");
1174 } 1174 }
1175 } 1175 }
1176 populateRemoteView(); 1176 populateRemoteView();
1177 TabWidget->setCurrentPage(1); 1177 TabWidget->setCurrentPage(1);
1178 1178
1179 } else { 1179 } else {
1180 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1180 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1181 1181
1182 QString destFile = currentDir.canonicalPath()+"/"+(*it); 1182 QString destFile = currentDir.canonicalPath()+"/"+(*it);
1183 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1183 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1184 1184
1185 QFile f(destFile); 1185 QFile f(destFile);
1186 if( f.exists()) 1186 if( f.exists())
1187 f.remove(); 1187 f.remove();
1188 if(!copyFile(destFile, curFile) ) { 1188 if(!copyFile(destFile, curFile) ) {
1189 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1189 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1190 1190
1191 qWarning("nothin doing"); 1191 qWarning("nothin doing");
1192 } 1192 }
1193 } 1193 }
1194 populateLocalView(); 1194 populateLocalView();
1195 TabWidget->setCurrentPage(0); 1195 TabWidget->setCurrentPage(0);
1196 } 1196 }
1197} 1197}
1198 1198
1199void AdvancedFm::copyAs() 1199void AdvancedFm::copyAs()
1200{ 1200{
1201 QStringList curFileList = getPath(); 1201 QStringList curFileList = getPath();
1202 QString curFile; 1202 QString curFile;
1203 InputDialog *fileDlg; 1203 InputDialog *fileDlg;
1204 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1204 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1205 1205
1206 if (TabWidget->currentPageIndex() == 0) { 1206 if (TabWidget->currentPageIndex() == 0) {
1207 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1207 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1208 QString destFile; 1208 QString destFile;
1209 curFile = currentDir.canonicalPath()+"/"+(*it); 1209 curFile = currentDir.canonicalPath()+"/"+(*it);
1210// InputDialog *fileDlg; 1210// InputDialog *fileDlg;
1211// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1211// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1212 fileDlg->setInputText((const QString &) destFile ); 1212 fileDlg->setInputText((const QString &) destFile );
1213 fileDlg->exec(); 1213 fileDlg->exec();
1214 if( fileDlg->result() == 1 ) { 1214 if( fileDlg->result() == 1 ) {
1215 QString filename = fileDlg->LineEdit1->text(); 1215 QString filename = fileDlg->LineEdit1->text();
1216 destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1216 destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1217 1217
1218 QFile f(destFile); 1218 QFile f(destFile);
1219 if( f.exists()) 1219 if( f.exists())
1220 f.remove(); 1220 f.remove();
1221 if(!copyFile(destFile, curFile) ) { 1221 if(!copyFile(destFile, curFile) ) {
1222 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1222 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1223 qWarning("nothin doing"); 1223 qWarning("nothin doing");
1224 } 1224 }
1225 } 1225 }
1226 } 1226 }
1227 1227
1228 populateRemoteView(); 1228 populateRemoteView();
1229 TabWidget->setCurrentPage(1); 1229 TabWidget->setCurrentPage(1);
1230 } else { 1230 } else {
1231 if (TabWidget->currentPageIndex() == 0) { 1231 if (TabWidget->currentPageIndex() == 0) {
1232 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1232 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1233 1233
1234 curFile = currentDir.canonicalPath()+"/"+(*it); 1234 curFile = currentDir.canonicalPath()+"/"+(*it);
1235 QString destFile; 1235 QString destFile;
1236 fileDlg->setInputText((const QString &) destFile); 1236 fileDlg->setInputText((const QString &) destFile);
1237 fileDlg->exec(); 1237 fileDlg->exec();
1238 if( fileDlg->result() == 1 ) { 1238 if( fileDlg->result() == 1 ) {
1239 QString filename = fileDlg->LineEdit1->text(); 1239 QString filename = fileDlg->LineEdit1->text();
1240 destFile = currentDir.canonicalPath()+"/"+(*it); 1240 destFile = currentDir.canonicalPath()+"/"+(*it);
1241 1241
1242 QFile f(destFile); 1242 QFile f(destFile);
1243 if( f.exists()) 1243 if( f.exists())
1244 f.remove(); 1244 f.remove();
1245 if(!copyFile(destFile, curFile) ) { 1245 if(!copyFile(destFile, curFile) ) {
1246 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1246 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1247 qWarning("nothin doing"); 1247 qWarning("nothin doing");
1248 } 1248 }
1249 } 1249 }