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
@@ -522,33 +522,36 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem)
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);
@@ -560,33 +563,36 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
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}
@@ -648,33 +654,33 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint
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() ));
@@ -684,33 +690,33 @@ void AdvancedFm::showLocalMenu(QListViewItem * item)
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() ));
@@ -1024,32 +1030,39 @@ void AdvancedFm::filePerms() {
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();
@@ -1389,36 +1402,36 @@ void AdvancedFm::runCommand() {
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;
@@ -1543,44 +1556,48 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
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();