summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ec475a4..7fba0af 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -349,510 +349,510 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem) {
349 349
350void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { 350void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) {
351 351
352 if(selectedItem) { 352 if(selectedItem) {
353 QString strItem=selectedItem->text(0); 353 QString strItem=selectedItem->text(0);
354 QString strSize=selectedItem->text(1); 354 QString strSize=selectedItem->text(1);
355 strSize=strSize.stripWhiteSpace(); 355 strSize=strSize.stripWhiteSpace();
356 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 356 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
357 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 357 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
358 currentRemoteDir.cd(strItem2, TRUE); 358 currentRemoteDir.cd(strItem2, TRUE);
359 populateRemoteView(); 359 populateRemoteView();
360 } else { // not a symlink 360 } else { // not a symlink
361 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 361 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
362 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 362 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
363 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 363 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
364 currentRemoteDir.cd(strItem,FALSE); 364 currentRemoteDir.cd(strItem,FALSE);
365 populateRemoteView(); 365 populateRemoteView();
366 Remote_View->ensureItemVisible(Remote_View->firstChild()); 366 Remote_View->ensureItemVisible(Remote_View->firstChild());
367 } else { 367 } else {
368 currentRemoteDir.cdUp(); 368 currentRemoteDir.cdUp();
369 populateRemoteView(); 369 populateRemoteView();
370 Remote_View->ensureItemVisible(Remote_View->firstChild()); 370 Remote_View->ensureItemVisible(Remote_View->firstChild());
371 } 371 }
372 if(QDir(strItem).exists()){ 372 if(QDir(strItem).exists()){
373 currentRemoteDir.cd(strItem, TRUE); 373 currentRemoteDir.cd(strItem, TRUE);
374 populateRemoteView(); 374 populateRemoteView();
375 Remote_View->ensureItemVisible(Remote_View->firstChild()); 375 Remote_View->ensureItemVisible(Remote_View->firstChild());
376 } 376 }
377 } else { 377 } else {
378 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 378 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
379 if( QFile::exists(strItem ) ) { 379 if( QFile::exists(strItem ) ) {
380 // qDebug("clicked item "+strItem); 380 // qDebug("clicked item "+strItem);
381 // DocLnk doc( strItem, FALSE ); 381 // DocLnk doc( strItem, FALSE );
382 // doc.execute(); 382 // doc.execute();
383 // Remote_View->clearSelection(); 383 // Remote_View->clearSelection();
384 } 384 }
385 } //end not symlink 385 } //end not symlink
386 chdir(strItem.latin1()); 386 chdir(strItem.latin1());
387 } 387 }
388 } 388 }
389} 389}
390 390
391 391
392void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { 392void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) {
393// qDebug("list pressed"); 393// qDebug("list pressed");
394 switch (mouse) { 394 switch (mouse) {
395 case 1: 395 case 1:
396 break; 396 break;
397 case 2: 397 case 2:
398 menuTimer.start( 750, TRUE ); 398 menuTimer.start( 750, TRUE );
399 qDebug("Start menu timer\n"); 399 qDebug("Start menu timer\n");
400 break; 400 break;
401 }; 401 };
402} 402}
403 403
404void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { 404void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) {
405 405
406 switch (mouse) { 406 switch (mouse) {
407 case 1: 407 case 1:
408 break; 408 break;
409 case 2: 409 case 2:
410 menuTimer.start( 750, TRUE ); 410 menuTimer.start( 750, TRUE );
411 qDebug("Start menu timer"); 411 qDebug("Start menu timer");
412 break; 412 break;
413 }; 413 };
414} 414}
415 415
416 416
417void AdvancedFm::switchToLocalTab() { 417void AdvancedFm::switchToLocalTab() {
418 TabWidget->setCurrentPage(0); 418 TabWidget->setCurrentPage(0);
419 Local_View->setFocus(); 419 Local_View->setFocus();
420} 420}
421 421
422void AdvancedFm::switchToRemoteTab() { 422void AdvancedFm::switchToRemoteTab() {
423 TabWidget->setCurrentPage(1); 423 TabWidget->setCurrentPage(1);
424 Remote_View->setFocus(); 424 Remote_View->setFocus();
425} 425}
426 426
427void AdvancedFm::readConfig() { 427void AdvancedFm::readConfig() {
428 Config cfg("AdvancedFm"); 428 Config cfg("AdvancedFm");
429} 429}
430 430
431void AdvancedFm::writeConfig() { 431void AdvancedFm::writeConfig() {
432 Config cfg("AdvancedFm"); 432 Config cfg("AdvancedFm");
433} 433}
434 434
435void AdvancedFm::currentPathComboChanged() { 435void AdvancedFm::currentPathComboChanged() {
436 if (TabWidget->currentPageIndex() == 0) { 436 if (TabWidget->currentPageIndex() == 0) {
437 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 437 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
438 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 438 currentDir.setPath( currentPathCombo->lineEdit()->text() );
439 populateLocalView(); 439 populateLocalView();
440 } else { 440 } else {
441 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 441 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
442 } 442 }
443 } 443 }
444 if (TabWidget->currentPageIndex() == 0) { 444 if (TabWidget->currentPageIndex() == 0) {
445 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 445 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
446 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 446 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
447 populateRemoteView(); 447 populateRemoteView();
448 } else { 448 } else {
449 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 449 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
450 } 450 }
451 } 451 }
452} 452}
453 453
454void AdvancedFm::fillCombo(const QString &currentPath) { 454void AdvancedFm::fillCombo(const QString &currentPath) {
455 455
456 if (TabWidget->currentPageIndex() == 0) { 456 if (TabWidget->currentPageIndex() == 0) {
457 currentPathCombo->lineEdit()->setText( currentPath); 457 currentPathCombo->lineEdit()->setText( currentPath);
458 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 458 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
459 currentPathCombo->clear(); 459 currentPathCombo->clear();
460 localDirPathStringList.prepend( currentPath ); 460 localDirPathStringList.prepend( currentPath );
461 currentPathCombo->insertStringList( localDirPathStringList,-1); 461 currentPathCombo->insertStringList( localDirPathStringList,-1);
462 } 462 }
463 } else { 463 } else {
464 currentPathCombo->lineEdit()->setText( currentPath); 464 currentPathCombo->lineEdit()->setText( currentPath);
465 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 465 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
466 currentPathCombo->clear(); 466 currentPathCombo->clear();
467 remoteDirPathStringList.prepend( currentPath ); 467 remoteDirPathStringList.prepend( currentPath );
468 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 468 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
469 } 469 }
470 } 470 }
471} 471}
472 472
473void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 473void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
474 if (TabWidget->currentPageIndex() == 0) { 474 if (TabWidget->currentPageIndex() == 0) {
475 chdir( currentPath.latin1() ); 475 chdir( currentPath.latin1() );
476 currentDir.cd( currentPath, TRUE); 476 currentDir.cd( currentPath, TRUE);
477 populateLocalView(); 477 populateLocalView();
478 update(); 478 update();
479 } else { 479 } else {
480 chdir( currentPath.latin1() ); 480 chdir( currentPath.latin1() );
481 currentRemoteDir.cd( currentPath, TRUE); 481 currentRemoteDir.cd( currentPath, TRUE);
482 populateRemoteView(); 482 populateRemoteView();
483 update(); 483 update();
484 } 484 }
485} 485}
486 486
487QStringList AdvancedFm::getPath() { 487QStringList AdvancedFm::getPath() {
488 QStringList strList; 488 QStringList strList;
489 if (TabWidget->currentPageIndex() == 0) { 489 if (TabWidget->currentPageIndex() == 0) {
490 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 490 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
491 QListViewItemIterator it( Local_View ); 491 QListViewItemIterator it( Local_View );
492 for ( ; it.current(); ++it ) { 492 for ( ; it.current(); ++it ) {
493 if ( it.current()->isSelected() ) { 493 if ( it.current()->isSelected() ) {
494 strList << it.current()->text(0); 494 strList << it.current()->text(0);
495 qDebug(it.current()->text(0)); 495 qDebug(it.current()->text(0));
496 } 496 }
497 } 497 }
498 return strList; 498 return strList;
499 } else { 499 } else {
500 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 500 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
501 QListViewItemIterator it( Remote_View ); 501 QListViewItemIterator it( Remote_View );
502 for ( ; it.current(); ++it ) { 502 for ( ; it.current(); ++it ) {
503 if ( it.current()->isSelected() ) { 503 if ( it.current()->isSelected() ) {
504 strList << it.current()->text(0); 504 strList << it.current()->text(0);
505 qDebug(it.current()->text(0)); 505 qDebug(it.current()->text(0));
506 } 506 }
507 } 507 }
508 return strList; 508 return strList;
509 } 509 }
510 return ""; 510 return "";
511} 511}
512 512
513void AdvancedFm::homeButtonPushed() { 513void AdvancedFm::homeButtonPushed() {
514 QString current = QDir::homeDirPath(); 514 QString current = QDir::homeDirPath();
515 chdir( current.latin1() ); 515 chdir( current.latin1() );
516 if (TabWidget->currentPageIndex() == 0) { 516 if (TabWidget->currentPageIndex() == 0) {
517 currentDir.cd( current, TRUE); 517 currentDir.cd( current, TRUE);
518 populateLocalView(); 518 populateLocalView();
519 } else { 519 } else {
520 currentRemoteDir.cd( current, TRUE); 520 currentRemoteDir.cd( current, TRUE);
521 populateRemoteView(); 521 populateRemoteView();
522 } 522 }
523 update(); 523 update();
524} 524}
525 525
526void AdvancedFm::docButtonPushed() { 526void AdvancedFm::docButtonPushed() {
527 QString current = QPEApplication::documentDir(); 527 QString current = QPEApplication::documentDir();
528 chdir( current.latin1() ); 528 chdir( current.latin1() );
529 if (TabWidget->currentPageIndex() == 0) { 529 if (TabWidget->currentPageIndex() == 0) {
530 currentDir.cd( current, TRUE); 530 currentDir.cd( current, TRUE);
531 populateLocalView(); 531 populateLocalView();
532 } else { 532 } else {
533 currentRemoteDir.cd( current, TRUE); 533 currentRemoteDir.cd( current, TRUE);
534 populateRemoteView(); 534 populateRemoteView();
535 } 535 }
536 update(); 536 update();
537} 537}
538 538
539void AdvancedFm::SDButtonPushed() { 539void AdvancedFm::SDButtonPushed() {
540 QString current = "/mnt/card";// this can change so fix 540 QString current = "/mnt/card";// this can change so fix
541 chdir( current.latin1() ); 541 chdir( current.latin1() );
542 if (TabWidget->currentPageIndex() == 0) { 542 if (TabWidget->currentPageIndex() == 0) {
543 currentDir.cd( current, TRUE); 543 currentDir.cd( current, TRUE);
544 populateLocalView(); 544 populateLocalView();
545 } else { 545 } else {
546 currentRemoteDir.cd( current, TRUE); 546 currentRemoteDir.cd( current, TRUE);
547 populateRemoteView(); 547 populateRemoteView();
548 } 548 }
549 update(); 549 update();
550 550
551} 551}
552 552
553void AdvancedFm::CFButtonPushed() { 553void AdvancedFm::CFButtonPushed() {
554 QString current; 554 QString current;
555 if(zaurusDevice) 555 if(zaurusDevice)
556 current= "/mnt/cf"; //zaurus 556 current= "/mnt/cf"; //zaurus
557 else 557 else
558 current = "/mnt/hda"; //ipaq 558 current = "/mnt/hda"; //ipaq
559 559
560 chdir( current.latin1() ); 560 chdir( current.latin1() );
561 if (TabWidget->currentPageIndex() == 0) { 561 if (TabWidget->currentPageIndex() == 0) {
562 currentDir.cd( current, TRUE); 562 currentDir.cd( current, TRUE);
563 populateLocalView(); 563 populateLocalView();
564 } else { 564 } else {
565 currentRemoteDir.cd( current, TRUE); 565 currentRemoteDir.cd( current, TRUE);
566 populateRemoteView(); 566 populateRemoteView();
567 } 567 }
568 update(); 568 update();
569} 569}
570 570
571 571
572 572
573void AdvancedFm::doAbout() { 573void AdvancedFm::doAbout() {
574 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" 574 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
575 "is copyright 2002 by\n" 575 "is copyright 2002 by\n"
576 "L.J.Potter<llornkcor@handhelds.org>\n" 576 "L.J.Potter<llornkcor@handhelds.org>\n"
577 "and is licensed by the GPL")); 577 "and is licensed by the GPL"));
578} 578}
579 579
580void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 580void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
581 if( TabWidget->hasFocus()) 581 if( TabWidget->hasFocus())
582 switch ( e->key() ) { 582 switch ( e->key() ) {
583 case Key_Delete: 583 case Key_Delete:
584 del(); 584 del();
585 break; 585 break;
586 case Key_H: 586 case Key_H:
587 showHidden(); 587 showHidden();
588 break; 588 break;
589 case Key_E: 589 case Key_E:
590 runThis(); 590 runThis();
591 break; 591 break;
592 case Key_C: 592 case Key_C:
593 copy(); 593 copy();
594 break; 594 break;
595 case Key_A: 595 case Key_A:
596 copyAs(); 596 copyAs();
597 break; 597 break;
598 case Key_M: 598 case Key_M:
599 move(); 599 move();
600 break; 600 break;
601 case Key_R: 601 case Key_R:
602 rn(); 602 rn();
603 break; 603 break;
604 case Key_I: 604 case Key_I:
605 fileStatus(); 605 fileStatus();
606 break; 606 break;
607 case Key_U: 607 case Key_U:
608 upDir(); 608 upDir();
609 break; 609 break;
610 case Key_P: 610 case Key_P:
611 filePerms(); 611 filePerms();
612 break; 612 break;
613 case Key_N: 613 case Key_N:
614 mkDir(); 614 mkDir();
615 break; 615 break;
616 case Key_1: 616 case Key_1:
617 switchToLocalTab(); 617 switchToLocalTab();
618 break; 618 break;
619 case Key_2: 619 case Key_2:
620 switchToRemoteTab(); 620 switchToRemoteTab();
621 break; 621 break;
622 case Key_3: 622 case Key_3:
623 CFButtonPushed(); 623 CFButtonPushed();
624 break; 624 break;
625 case Key_4: 625 case Key_4:
626 SDButtonPushed(); 626 SDButtonPushed();
627 break; 627 break;
628 case Key_5: 628 case Key_5:
629 homeButtonPushed(); 629 homeButtonPushed();
630 break; 630 break;
631 case Key_6: 631 case Key_6:
632 docButtonPushed(); 632 docButtonPushed();
633 break; 633 break;
634 case Key_7: 634 case Key_7:
635 break; 635 break;
636 case Key_8: 636 case Key_8:
637 break; 637 break;
638 case Key_9: 638 case Key_9:
639 break; 639 break;
640 case Key_0: 640 case Key_0:
641 break; 641 break;
642 } 642 }
643} 643}
644 644
645 645
646void AdvancedFm::QPEButtonPushed() { 646void AdvancedFm::QPEButtonPushed() {
647 QString current = QPEApplication::qpeDir(); 647 QString current = QPEApplication::qpeDir();
648 chdir( current.latin1() ); 648 chdir( current.latin1() );
649 if (TabWidget->currentPageIndex() == 0) { 649 if (TabWidget->currentPageIndex() == 0) {
650 currentDir.cd( current, TRUE); 650 currentDir.cd( current, TRUE);
651 populateLocalView(); 651 populateLocalView();
652 } else { 652 } else {
653 currentRemoteDir.cd( current, TRUE); 653 currentRemoteDir.cd( current, TRUE);
654 populateRemoteView(); 654 populateRemoteView();
655 } 655 }
656 update(); 656 update();
657} 657}
658 658
659void AdvancedFm::parsetab(const QString &fileName) { 659void AdvancedFm::parsetab(const QString &fileName) {
660 660
661 fileSystemTypeList.clear(); 661 fileSystemTypeList.clear();
662 fsList.clear(); 662 fsList.clear();
663 struct mntent *me; 663 struct mntent *me;
664 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 664 FILE *mntfp = setmntent( fileName.latin1(), "r" );
665 if ( mntfp ) { 665 if ( mntfp ) {
666 while ( (me = getmntent( mntfp )) != 0 ) { 666 while ( (me = getmntent( mntfp )) != 0 ) {
667 QString deviceName = me->mnt_fsname; 667 QString deviceName = me->mnt_fsname;
668 QString filesystemType = me->mnt_type; 668 QString filesystemType = me->mnt_type;
669 QString mountDir = me->mnt_dir; 669 QString mountDir = me->mnt_dir;
670 if(deviceName != "none") { 670 if(deviceName != "none") {
671 if( fsList.contains(filesystemType) == 0 671 if( fsList.contains(filesystemType) == 0
672 & filesystemType.find("proc",0,TRUE) == -1 672 & filesystemType.find("proc",0,TRUE) == -1
673 & filesystemType.find("cramfs",0,TRUE) == -1 673 & filesystemType.find("cramfs",0,TRUE) == -1
674 & filesystemType.find("auto",0,TRUE) == -1) 674 & filesystemType.find("auto",0,TRUE) == -1)
675 fsList << filesystemType; 675 fsList << filesystemType;
676 fileSystemTypeList << mountDir+"::"+filesystemType; 676 fileSystemTypeList << mountDir+"::"+filesystemType;
677 } 677 }
678 } 678 }
679 } 679 }
680 endmntent( mntfp ); 680 endmntent( mntfp );
681} 681}
682 682
683QString AdvancedFm::getFileSystemType(const QString &currentText) { 683QString AdvancedFm::getFileSystemType(const QString &currentText) {
684 parsetab("/etc/mtab"); //why did TT forget filesystem type? 684 parsetab("/etc/mtab"); //why did TT forget filesystem type?
685 QString current = currentText;//.right( currentText.length()-1); 685 QString current = currentText;//.right( currentText.length()-1);
686 QString baseFs; 686 QString baseFs;
687 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 687 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
688 QString temp = (*it); 688 QString temp = (*it);
689 QString path = temp.left(temp.find("::",0,TRUE) ); 689 QString path = temp.left(temp.find("::",0,TRUE) );
690 path = path.right( path.length()-1); 690 path = path.right( path.length()-1);
691 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 691 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
692 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 692 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
693 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 693 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
694 } 694 }
695 } 695 }
696 return baseFs; 696 return baseFs;
697} 697}
698 698
699QString AdvancedFm::getDiskSpace( const QString &path) { 699QString AdvancedFm::getDiskSpace( const QString &path) {
700 struct statfs fss; 700 struct statfs fss;
701 if ( !statfs( path.latin1(), &fss ) ) { 701 if ( !statfs( path.latin1(), &fss ) ) {
702 int blkSize = fss.f_bsize; 702 int blkSize = fss.f_bsize;
703 // int totalBlks = fs.f_blocks; 703 // int totalBlks = fs.f_blocks;
704 int availBlks = fss.f_bavail; 704 int availBlks = fss.f_bavail;
705 705
706 long mult = blkSize / 1024; 706 long mult = blkSize / 1024;
707 long div = 1024 / blkSize; 707 long div = 1024 / blkSize;
708 if ( !mult ) mult = 1; 708 if ( !mult ) mult = 1;
709 if ( !div ) div = 1; 709 if ( !div ) div = 1;
710 710
711 return QString::number(availBlks * mult / div); 711 return QString::number(availBlks * mult / div);
712 } 712 }
713 return ""; 713 return "";
714} 714}
715 715
716 716
717void AdvancedFm::showFileMenu() { 717void AdvancedFm::showFileMenu() {
718 718
719 QString curApp; 719 QString curApp;
720 bool isLocalView = false; 720 bool isLocalView = false;
721 if (TabWidget->currentPageIndex() == 0) { 721 if (TabWidget->currentPageIndex() == 0) {
722 isLocalView = TRUE; 722 isLocalView = TRUE;
723 curApp = Local_View->currentItem()->text(0); 723 curApp = Local_View->currentItem()->text(0);
724 } else { 724 } else {
725 curApp = Remote_View->currentItem()->text(0); 725 curApp = Remote_View->currentItem()->text(0);
726 } 726 }
727 727
728 MimeType mt( curApp ); 728 MimeType mt( curApp );
729 const AppLnk* app = mt.application(); 729 const AppLnk* app = mt.application();
730 QFile fi(curApp); 730 QFile fi(curApp);
731 731
732 QPopupMenu *m = new QPopupMenu(0); 732 QPopupMenu *m = new QPopupMenu(0);
733 QPopupMenu *n = new QPopupMenu(0);
734// QPopupMenu *o = new QPopupMenu(0);
733 735
734 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 736 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
735 if ( !QFileInfo(fi).isDir() ) { 737 if ( !QFileInfo(fi).isDir() ) {
736 m->insertSeparator(); 738// m->insertSeparator();
737// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 739// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
738// } else { 740// } else {
739 741
740 if ( app ) 742 if ( app )
741 m->insertItem( app->pixmap(), tr( "Open in " 743 m->insertItem( app->pixmap(), tr( "Open in "
742 + app->name() ), this, SLOT( runThis() ) ); 744 + app->name() ), this, SLOT( runThis() ) );
743 else if( QFileInfo(fi).isExecutable() ) 745 else if( QFileInfo(fi).isExecutable() )
744 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) ); 746 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) );
745 747
746 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 748 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
747 } 749 }
748 m->insertSeparator();
749 750
751 m->insertItem(tr("Actions"),n);
752 if(isLocalView)
753 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
754 else
755 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
756
757 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
750 758
759 n->insertSeparator();
760
761
751 if(isLocalView) 762 if(isLocalView)
752 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 763 n->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
753 else 764 else
754 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 765 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
755 766
756 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 767 n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
757 m->insertSeparator(); 768 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
769 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
770 n->insertItem( tr( "Move" ), this, SLOT( move() ));
771
772 n->insertSeparator();
758 773
759 if(isLocalView) 774 if(isLocalView)
760 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 775 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
761 else 776 else
762 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 777 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
763 778
764 m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
765 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
766 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
767 m->insertItem( tr( "Move" ), this, SLOT( move() ));
768 m->insertSeparator();
769 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
770 779
771// if(isLocalView) 780 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
772// m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
773// else
774// m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
775 781
776 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 782 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
777 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 783 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
778 m->insertSeparator();
779
780 if(isLocalView)
781 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
782 else
783 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
784 784
785 m->insertSeparator(); 785 m->insertSeparator();
786 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 786 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
787 787
788#if defined(QT_QWS_OPIE) 788#if defined(QT_QWS_OPIE)
789 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 789 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
790#endif 790#endif
791 m->setCheckable(TRUE); 791 m->setCheckable(TRUE);
792 if (!b) 792 if (!b)
793 m->setItemChecked(m->idAt(0),TRUE); 793 m->setItemChecked(m->idAt(0),TRUE);
794 else 794 else
795 m->setItemChecked(m->idAt(0),FALSE); 795 m->setItemChecked(m->idAt(0),FALSE);
796 796
797 if(Ir::supported()) 797 if(Ir::supported())
798 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 798 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
799 m->setFocus(); 799 m->setFocus();
800 m->exec( QCursor::pos() ); 800 m->exec( QCursor::pos() );
801 sleep(1); 801 sleep(1);
802 if(m) delete m; 802 if(m) delete m;
803} 803}
804 804
805 805
806void AdvancedFm::cancelMenuTimer() { 806void AdvancedFm::cancelMenuTimer() {
807 807
808// qDebug("selectionChanged: cancel menu timer"); 808// qDebug("selectionChanged: cancel menu timer");
809 if( menuTimer.isActive() ) 809 if( menuTimer.isActive() )
810 menuTimer.stop(); 810 menuTimer.stop();
811} 811}
812 812
813QString AdvancedFm::checkDiskSpace(const QString &path) { 813QString AdvancedFm::checkDiskSpace(const QString &path) {
814 struct statfs fss; 814 struct statfs fss;
815 if ( !statfs( path.latin1(), &fss ) ) { 815 if ( !statfs( path.latin1(), &fss ) ) {
816 int blkSize = fss.f_bsize; 816 int blkSize = fss.f_bsize;
817// int totalBlks = fs.f_blocks; 817// int totalBlks = fs.f_blocks;
818 int availBlks = fss.f_bavail; 818 int availBlks = fss.f_bavail;
819 819
820 long mult = blkSize / 1024; 820 long mult = blkSize / 1024;
821 long div = 1024 / blkSize; 821 long div = 1024 / blkSize;
822 if ( !mult ) mult = 1; 822 if ( !mult ) mult = 1;
823 if ( !div ) div = 1; 823 if ( !div ) div = 1;
824 824
825 825
826 return QString::number(availBlks * mult / div); 826 return QString::number(availBlks * mult / div);
827 } 827 }
828 return ""; 828 return "";
829} 829}
830 830
831void AdvancedFm::addToDocs() { 831void AdvancedFm::addToDocs() {
832 QStringList strListPaths = getPath(); 832 QStringList strListPaths = getPath();
833 if( strListPaths.count() > 0) { 833 if( strListPaths.count() > 0) {
834 QString curFile; 834 QString curFile;
835 if (TabWidget->currentPageIndex() == 0) { 835 if (TabWidget->currentPageIndex() == 0) {
836 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 836 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
837 curFile = currentDir.canonicalPath()+"/"+(*it); 837 curFile = currentDir.canonicalPath()+"/"+(*it);
838 qDebug(curFile); 838 qDebug(curFile);
839 DocLnk f; 839 DocLnk f;
840// curFile.replace(QRegExp("\\..*"),""); 840// curFile.replace(QRegExp("\\..*"),"");
841 f.setName((*it)); 841 f.setName((*it));
842 f.setFile( curFile); 842 f.setFile( curFile);
843 f.writeLink(); 843 f.writeLink();
844 } 844 }
845 } else { 845 } else {
846 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 846 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
847 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 847 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
848 qDebug(curFile); 848 qDebug(curFile);
849 849
850 DocLnk f; 850 DocLnk f;
851// curFile.replace(QRegExp("\\..*"),""); 851// curFile.replace(QRegExp("\\..*"),"");
852 f.setName((*it)); 852 f.setName((*it));
853 f.setFile( curFile); 853 f.setFile( curFile);
854 f.writeLink(); 854 f.writeLink();
855 } 855 }
856 } 856 }
857 } 857 }
858} 858}