author | zecke <zecke> | 2002-04-27 23:12:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-27 23:12:20 (UTC) |
commit | a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65 (patch) (unidiff) | |
tree | 80a622e1e82e46a24dc5968b7b89180d4420476c | |
parent | db95cde435e507833f58111237f86cb9f9ac927a (diff) | |
download | opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.zip opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.tar.gz opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.tar.bz2 |
compile it for Max
-rw-r--r-- | libopie/ofileselector.cc | 4 | ||||
-rw-r--r-- | libopie/ofileview.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 0e508af..9cf3f36 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -510,685 +510,685 @@ void OFileSelector::reparse() | |||
510 | 510 | ||
511 | int filter; | 511 | int filter; |
512 | /* if( m_dir && !m_files) | 512 | /* if( m_dir && !m_files) |
513 | filter |= QDir::Dirs; | 513 | filter |= QDir::Dirs; |
514 | else if( !m_dir && m_files ) | 514 | else if( !m_dir && m_files ) |
515 | filter |= QDir::Files; | 515 | filter |= QDir::Files; |
516 | else | 516 | else |
517 | filter |= QDir::All; | 517 | filter |= QDir::All; |
518 | */ | 518 | */ |
519 | if( m_selector == EXTENDED_ALL ) | 519 | if( m_selector == EXTENDED_ALL ) |
520 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 520 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
521 | else | 521 | else |
522 | filter = QDir::Files | QDir::Dirs | QDir::All; | 522 | filter = QDir::Files | QDir::Dirs | QDir::All; |
523 | dir.setFilter( filter ); | 523 | dir.setFilter( filter ); |
524 | qDebug("infoList"); | 524 | qDebug("infoList"); |
525 | const QFileInfoList *list = dir.entryInfoList(); | 525 | const QFileInfoList *list = dir.entryInfoList(); |
526 | QFileInfoListIterator it( *list ); | 526 | QFileInfoListIterator it( *list ); |
527 | QFileInfo *fi; | 527 | QFileInfo *fi; |
528 | while( (fi=it.current()) ){ | 528 | while( (fi=it.current()) ){ |
529 | if(fi->fileName() == ".." || fi->fileName() == "." ){ | 529 | if(fi->fileName() == ".." || fi->fileName() == "." ){ |
530 | ++it; | 530 | ++it; |
531 | continue; | 531 | continue; |
532 | } | 532 | } |
533 | // qWarning("Test: %s", fi->fileName().latin1() ); | 533 | // qWarning("Test: %s", fi->fileName().latin1() ); |
534 | if(fi->isSymLink() ){ | 534 | if(fi->isSymLink() ){ |
535 | // qWarning("Symlink %s", fi->fileName().latin1() ); | 535 | // qWarning("Symlink %s", fi->fileName().latin1() ); |
536 | QString file = fi->dirPath(true)+"/"+ fi->readLink(); | 536 | QString file = fi->dirPath(true)+"/"+ fi->readLink(); |
537 | // qWarning("File ->%s", file.latin1() ); | 537 | // qWarning("File ->%s", file.latin1() ); |
538 | for(int i=0; i<=4; i++ ){ // prepend from dos | 538 | for(int i=0; i<=4; i++ ){ // prepend from dos |
539 | QFileInfo info( file ); | 539 | QFileInfo info( file ); |
540 | if( !info.exists() ){ | 540 | if( !info.exists() ){ |
541 | // qWarning("does not exist" ); | 541 | // qWarning("does not exist" ); |
542 | addSymlink(currMime, fi, TRUE ); | 542 | addSymlink(currMime, fi, TRUE ); |
543 | break; | 543 | break; |
544 | }else if( info.isDir() ){ | 544 | }else if( info.isDir() ){ |
545 | // qWarning("isDir" ); | 545 | // qWarning("isDir" ); |
546 | addDir(currMime, fi, TRUE ); | 546 | addDir(currMime, fi, TRUE ); |
547 | break; | 547 | break; |
548 | }else if( info.isFile() ){ | 548 | }else if( info.isFile() ){ |
549 | // qWarning("isFile" ); | 549 | // qWarning("isFile" ); |
550 | addFile(currMime, fi, TRUE ); | 550 | addFile(currMime, fi, TRUE ); |
551 | break; | 551 | break; |
552 | }else if( info.isSymLink() ){ | 552 | }else if( info.isSymLink() ){ |
553 | file = info.dirPath(true)+ "/"+ info.readLink(); | 553 | file = info.dirPath(true)+ "/"+ info.readLink(); |
554 | // qWarning("isSymlink again %s", file.latin1() ); | 554 | // qWarning("isSymlink again %s", file.latin1() ); |
555 | }else if( i == 4 ){ // just insert it and have the symlink symbol | 555 | }else if( i == 4 ){ // just insert it and have the symlink symbol |
556 | addSymlink(currMime, fi ); | 556 | addSymlink(currMime, fi ); |
557 | // qWarning("level too deep" ); | 557 | // qWarning("level too deep" ); |
558 | } | 558 | } |
559 | } | 559 | } |
560 | }else if( fi->isDir() ){ | 560 | }else if( fi->isDir() ){ |
561 | addDir(currMime, fi ); | 561 | addDir(currMime, fi ); |
562 | }else if( fi->isFile() ) { // file ? | 562 | }else if( fi->isFile() ) { // file ? |
563 | addFile(currMime, fi ); | 563 | addFile(currMime, fi ); |
564 | } | 564 | } |
565 | ++it; | 565 | ++it; |
566 | } | 566 | } |
567 | m_View->sort(); | 567 | m_View->sort(); |
568 | // m_View->ensureItemVisible(); | 568 | // m_View->ensureItemVisible(); |
569 | } | 569 | } |
570 | 570 | ||
571 | QString OFileSelector::directory()const | 571 | QString OFileSelector::directory()const |
572 | { | 572 | { |
573 | QDir d( m_currentDir); | 573 | QDir d( m_currentDir); |
574 | return d.absPath(); | 574 | return d.absPath(); |
575 | } | 575 | } |
576 | 576 | ||
577 | int OFileSelector::fileCount() | 577 | int OFileSelector::fileCount() |
578 | { | 578 | { |
579 | return 0; | 579 | return 0; |
580 | } | 580 | } |
581 | 581 | ||
582 | void OFileSelector::slotOk( ) | 582 | void OFileSelector::slotOk( ) |
583 | { | 583 | { |
584 | emit ok(); | 584 | emit ok(); |
585 | } | 585 | } |
586 | 586 | ||
587 | void OFileSelector::slotCancel( ) | 587 | void OFileSelector::slotCancel( ) |
588 | { | 588 | { |
589 | emit cancel(); | 589 | emit cancel(); |
590 | } | 590 | } |
591 | 591 | ||
592 | void OFileSelector::initializeName() | 592 | void OFileSelector::initializeName() |
593 | { | 593 | { |
594 | m_boxName = new QHBoxLayout(this ); | 594 | m_boxName = new QHBoxLayout(this ); |
595 | m_edit = new QLineEdit(this ); | 595 | m_edit = new QLineEdit(this ); |
596 | m_fnLabel = new QLabel(this ); | 596 | m_fnLabel = new QLabel(this ); |
597 | m_fnLabel->setText(tr("Name:") ); | 597 | m_fnLabel->setText(tr("Name:") ); |
598 | m_boxName->addWidget(m_fnLabel ); | 598 | m_boxName->addWidget(m_fnLabel ); |
599 | m_boxName->insertSpacing(1, 8 ); | 599 | m_boxName->insertSpacing(1, 8 ); |
600 | m_boxName->addWidget(m_edit, 100 ); | 600 | m_boxName->addWidget(m_edit, 100 ); |
601 | 601 | ||
602 | m_lay->addLayout(m_boxName); | 602 | m_lay->addLayout(m_boxName); |
603 | } | 603 | } |
604 | 604 | ||
605 | void OFileSelector::initializeYes() | 605 | void OFileSelector::initializeYes() |
606 | { | 606 | { |
607 | m_ok = new QPushButton("&Save", this, "save" ); | 607 | m_ok = new QPushButton("&Save", this, "save" ); |
608 | m_cancel = new QPushButton("C&ancel", this, "cancel" ); | 608 | m_cancel = new QPushButton("C&ancel", this, "cancel" ); |
609 | m_boxOk = new QHBoxLayout(this ); | 609 | m_boxOk = new QHBoxLayout(this ); |
610 | m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); | 610 | m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); |
611 | m_boxOk->insertSpacing(1, 8 ); | 611 | m_boxOk->insertSpacing(1, 8 ); |
612 | m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); | 612 | m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); |
613 | m_lay->addLayout(m_boxOk ); | 613 | m_lay->addLayout(m_boxOk ); |
614 | connect(m_ok, SIGNAL(clicked() ), | 614 | connect(m_ok, SIGNAL(clicked() ), |
615 | this, SLOT(slotOk() ) ); | 615 | this, SLOT(slotOk() ) ); |
616 | connect(m_cancel, SIGNAL(clicked() ), | 616 | connect(m_cancel, SIGNAL(clicked() ), |
617 | this, SLOT(slotCancel() ) ); | 617 | this, SLOT(slotCancel() ) ); |
618 | 618 | ||
619 | } | 619 | } |
620 | 620 | ||
621 | void OFileSelector::initializeChooser() | 621 | void OFileSelector::initializeChooser() |
622 | { | 622 | { |
623 | m_boxView = new QHBoxLayout(this ); | 623 | m_boxView = new QHBoxLayout(this ); |
624 | 624 | ||
625 | m_mimeCheck = new QComboBox(this, "mime check"); | 625 | m_mimeCheck = new QComboBox(this, "mime check"); |
626 | m_viewCheck = new QComboBox(this, "view check"); | 626 | m_viewCheck = new QComboBox(this, "view check"); |
627 | m_boxView->addWidget(m_viewCheck, 0 ); | 627 | m_boxView->addWidget(m_viewCheck, 0 ); |
628 | m_boxView->insertSpacing(2, 8 ); | 628 | m_boxView->insertSpacing(2, 8 ); |
629 | m_boxView->addWidget(m_mimeCheck, 0 ); | 629 | m_boxView->addWidget(m_mimeCheck, 0 ); |
630 | m_lay->addLayout(m_boxView ); | 630 | m_lay->addLayout(m_boxView ); |
631 | m_lay->insertSpacing( 4, 8); | 631 | m_lay->insertSpacing( 4, 8); |
632 | 632 | ||
633 | m_viewCheck->insertItem(tr("Documents") ); | 633 | m_viewCheck->insertItem(tr("Documents") ); |
634 | m_viewCheck->insertItem(tr("Files") ); | 634 | m_viewCheck->insertItem(tr("Files") ); |
635 | m_viewCheck->insertItem(tr("All Files") ); | 635 | m_viewCheck->insertItem(tr("All Files") ); |
636 | 636 | ||
637 | if(!m_autoMime ) | 637 | if(!m_autoMime ) |
638 | m_mimeCheck->insertItem(m_mimetypes.join("," ) ); | 638 | m_mimeCheck->insertItem(m_mimetypes.join("," ) ); |
639 | else{ // check | 639 | else{ // check |
640 | updateMimes(); | 640 | updateMimes(); |
641 | m_mimeCheck->insertStringList( m_mimetypes ); | 641 | m_mimeCheck->insertStringList( m_mimetypes ); |
642 | } | 642 | } |
643 | 643 | ||
644 | connect( m_viewCheck, SIGNAL(activated(const QString &) ), | 644 | connect( m_viewCheck, SIGNAL(activated(const QString &) ), |
645 | this, SLOT(slotViewCheck(const QString & ) ) ); | 645 | this, SLOT(slotViewCheck(const QString & ) ) ); |
646 | 646 | ||
647 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), | 647 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), |
648 | this, SLOT(slotMimeCheck(const QString & ) ) ); | 648 | this, SLOT(slotMimeCheck(const QString & ) ) ); |
649 | } | 649 | } |
650 | 650 | ||
651 | void OFileSelector::slotMimeCheck(const QString &view ){ | 651 | void OFileSelector::slotMimeCheck(const QString &view ){ |
652 | if(m_selector == NORMAL ){ | 652 | if(m_selector == NORMAL ){ |
653 | delete m_select; | 653 | delete m_select; |
654 | m_select = new FileSelector(view == "All" ? QString::null : view | 654 | m_select = new FileSelector(view == "All" ? QString::null : view |
655 | , m_stack, "fileselector", FALSE, FALSE ); | 655 | , m_stack, "fileselector", FALSE, FALSE ); |
656 | m_stack->addWidget( m_select, NORMAL ); | 656 | m_stack->addWidget( m_select, NORMAL ); |
657 | m_stack->raiseWidget( NORMAL ); | 657 | m_stack->raiseWidget( NORMAL ); |
658 | }else{ | 658 | }else{ |
659 | reparse(); | 659 | reparse(); |
660 | } | 660 | } |
661 | } | 661 | } |
662 | 662 | ||
663 | void OFileSelector::slotViewCheck(const QString &view ){ | 663 | void OFileSelector::slotViewCheck(const QString &view ){ |
664 | qWarning("changed: show %s", view.latin1() ); | 664 | qWarning("changed: show %s", view.latin1() ); |
665 | // if the current view is the one | 665 | // if the current view is the one |
666 | QString currMime = m_mimeCheck->currentText(); | 666 | QString currMime = m_mimeCheck->currentText(); |
667 | if( view == QString::fromLatin1("Documents") ){ | 667 | if( view == QString::fromLatin1("Documents") ){ |
668 | // get the mimetype now | 668 | // get the mimetype now |
669 | // check if we're the current widget and return | 669 | // check if we're the current widget and return |
670 | if( m_View != 0) { // delete 0 shouldn't crash but it did :( | 670 | if( m_View != 0) { // delete 0 shouldn't crash but it did :( |
671 | delete m_View; | 671 | delete m_View; |
672 | delete m_boxToolbar; | 672 | delete m_boxToolbar; |
673 | delete m_homeButton; | 673 | delete m_homeButton; |
674 | delete m_docButton; | 674 | delete m_docButton; |
675 | delete m_location; | 675 | delete m_location; |
676 | delete m_up; | 676 | delete m_up; |
677 | delete m_pseudo; | 677 | delete m_pseudo; |
678 | //if(m_pseudoLayout!=0 ) | 678 | //if(m_pseudoLayout!=0 ) |
679 | // delete m_pseudoLayout; | 679 | // delete m_pseudoLayout; |
680 | } | 680 | } |
681 | m_View = 0; | 681 | m_View = 0; |
682 | m_boxToolbar = 0; | 682 | m_boxToolbar = 0; |
683 | m_homeButton = 0; | 683 | m_homeButton = 0; |
684 | m_docButton = 0; | 684 | m_docButton = 0; |
685 | m_location = 0; | 685 | m_location = 0; |
686 | m_up = 0; | 686 | m_up = 0; |
687 | m_pseudo = 0; | 687 | m_pseudo = 0; |
688 | m_pseudoLayout = 0; | 688 | m_pseudoLayout = 0; |
689 | 689 | ||
690 | delete m_select; | 690 | delete m_select; |
691 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime, | 691 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime, |
692 | m_stack,"fileselector", FALSE, FALSE ); | 692 | m_stack,"fileselector", FALSE, FALSE ); |
693 | m_stack->addWidget( m_select, NORMAL ); | 693 | m_stack->addWidget( m_select, NORMAL ); |
694 | m_mimeCheck->clear(); | 694 | m_mimeCheck->clear(); |
695 | m_selector = NORMAL; | 695 | m_selector = NORMAL; |
696 | updateMimes(); | 696 | updateMimes(); |
697 | m_mimeCheck->insertStringList( m_mimetypes ); | 697 | m_mimeCheck->insertStringList( m_mimetypes ); |
698 | m_stack->raiseWidget( NORMAL ); | 698 | m_stack->raiseWidget( NORMAL ); |
699 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | 699 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); |
700 | 700 | ||
701 | } else if(view == QString::fromLatin1("Files") ){ | 701 | } else if(view == QString::fromLatin1("Files") ){ |
702 | // remove from the stack | 702 | // remove from the stack |
703 | delete m_select; | 703 | delete m_select; |
704 | m_select = 0; | 704 | m_select = 0; |
705 | delete m_View; | 705 | delete m_View; |
706 | m_View = 0; | 706 | m_View = 0; |
707 | 707 | ||
708 | m_selector = EXTENDED; | 708 | m_selector = EXTENDED; |
709 | initializeListView(); | 709 | initializeListView(); |
710 | reparse(); | 710 | reparse(); |
711 | } else if(view == QString::fromLatin1("All Files") ) { | 711 | } else if(view == QString::fromLatin1("All Files") ) { |
712 | // remove from the stack | 712 | // remove from the stack |
713 | delete m_select; | 713 | delete m_select; |
714 | m_select = 0; | 714 | m_select = 0; |
715 | delete m_View; | 715 | delete m_View; |
716 | m_View = 0; | 716 | m_View = 0; |
717 | 717 | ||
718 | m_selector = EXTENDED_ALL; | 718 | m_selector = EXTENDED_ALL; |
719 | initializeListView(); | 719 | initializeListView(); |
720 | reparse(); | 720 | reparse(); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | 723 | ||
724 | 724 | ||
725 | void OFileSelector::updateMimes() // lets check which mode is active | 725 | void OFileSelector::updateMimes() // lets check which mode is active |
726 | // check the current dir for items then | 726 | // check the current dir for items then |
727 | { | 727 | { |
728 | if( m_autoMime ){ | 728 | if( m_autoMime ){ |
729 | m_mimetypes.clear(); | 729 | m_mimetypes.clear(); |
730 | m_mimetypes.append("All" ); | 730 | m_mimetypes.append("All" ); |
731 | if( m_selector == NORMAL ){ | 731 | if( m_selector == NORMAL ){ |
732 | DocLnkSet set; | 732 | DocLnkSet set; |
733 | Global::findDocuments(&set, QString::null ); | 733 | Global::findDocuments(&set, QString::null ); |
734 | QListIterator<DocLnk> dit( set.children() ); | 734 | QListIterator<DocLnk> dit( set.children() ); |
735 | for ( ; dit.current(); ++dit ) { | 735 | for ( ; dit.current(); ++dit ) { |
736 | if( !m_mimetypes.contains((*dit)->type() ) ) | 736 | if( !m_mimetypes.contains((*dit)->type() ) ) |
737 | m_mimetypes.append( (*dit)->type() ); | 737 | m_mimetypes.append( (*dit)->type() ); |
738 | } | 738 | } |
739 | }else{ | 739 | }else{ |
740 | // should be allreday updatet | 740 | // should be allreday updatet |
741 | ; | 741 | ; |
742 | } | 742 | } |
743 | } | 743 | } |
744 | } | 744 | } |
745 | 745 | ||
746 | void OFileSelector::initializeListView() | 746 | void OFileSelector::initializeListView() |
747 | { | 747 | { |
748 | // in the instance that a developer selected the view to be Files or Entended, | 748 | // in the instance that a developer selected the view to be Files or Entended, |
749 | // in the initial initialization, you are deleting objects here | 749 | // in the initial initialization, you are deleting objects here |
750 | // that aren't even existing yet. | 750 | // that aren't even existing yet. |
751 | 751 | ||
752 | // just to make sure but clean it up better FIXME | 752 | // just to make sure but clean it up better FIXME |
753 | delete m_View; | 753 | delete m_View; |
754 | m_View = 0; | 754 | m_View = 0; |
755 | delete m_boxToolbar; | 755 | delete m_boxToolbar; |
756 | delete m_homeButton; | 756 | delete m_homeButton; |
757 | delete m_docButton; | 757 | delete m_docButton; |
758 | delete m_location; | 758 | delete m_location; |
759 | delete m_up; | 759 | delete m_up; |
760 | delete m_pseudo; | 760 | delete m_pseudo; |
761 | 761 | ||
762 | m_boxToolbar = 0; | 762 | m_boxToolbar = 0; |
763 | m_homeButton = 0; | 763 | m_homeButton = 0; |
764 | m_docButton = 0; | 764 | m_docButton = 0; |
765 | m_location = 0; | 765 | m_location = 0; |
766 | m_up = 0; | 766 | m_up = 0; |
767 | m_pseudo = 0; | 767 | m_pseudo = 0; |
768 | m_pseudoLayout = 0; | 768 | m_pseudoLayout = 0; |
769 | qDebug(" time for the toolbar "); | 769 | qDebug(" time for the toolbar "); |
770 | m_pseudo = new QWidget(m_stack, "Pseudo Widget"); | 770 | m_pseudo = new QWidget(m_stack, "Pseudo Widget"); |
771 | m_pseudoLayout = new QVBoxLayout(m_pseudo ); | 771 | m_pseudoLayout = new QVBoxLayout(m_pseudo ); |
772 | if(m_shTool ){ | 772 | if(m_shTool ){ |
773 | m_boxToolbar = new QHBoxLayout( ); | 773 | m_boxToolbar = new QHBoxLayout( ); |
774 | m_boxToolbar->setAutoAdd( true ); | 774 | m_boxToolbar->setAutoAdd( true ); |
775 | m_location = new QComboBox(m_pseudo ); | 775 | m_location = new QComboBox(m_pseudo ); |
776 | m_location ->setEditable(TRUE); | 776 | m_location ->setEditable(TRUE); |
777 | connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); | 777 | connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); |
778 | connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); | 778 | connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); |
779 | 779 | ||
780 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); | 780 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); |
781 | m_up->setFixedSize( QSize( 20, 20 ) ); | 781 | m_up->setFixedSize( QSize( 20, 20 ) ); |
782 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); | 782 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); |
783 | m_up->setFlat(TRUE); | 783 | m_up->setFlat(TRUE); |
784 | 784 | ||
785 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); | 785 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); |
786 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); | 786 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); |
787 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); | 787 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); |
788 | m_homeButton->setFlat(TRUE); | 788 | m_homeButton->setFlat(TRUE); |
789 | 789 | ||
790 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); | 790 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); |
791 | m_docButton->setFixedSize( QSize( 20, 20 ) ); | 791 | m_docButton->setFixedSize( QSize( 20, 20 ) ); |
792 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); | 792 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); |
793 | m_docButton->setFlat(TRUE); | 793 | m_docButton->setFlat(TRUE); |
794 | 794 | ||
795 | m_boxToolbar->addWidget(m_location ); | 795 | m_boxToolbar->addWidget(m_location ); |
796 | m_boxToolbar->addWidget(m_up ); | 796 | m_boxToolbar->addWidget(m_up ); |
797 | m_boxToolbar->addWidget(m_homeButton ); | 797 | m_boxToolbar->addWidget(m_homeButton ); |
798 | m_boxToolbar->addWidget(m_docButton ); | 798 | m_boxToolbar->addWidget(m_docButton ); |
799 | m_pseudoLayout->addLayout(m_boxToolbar ); | 799 | m_pseudoLayout->addLayout(m_boxToolbar ); |
800 | qDebug("lets fill the combobox"); | 800 | qDebug("lets fill the combobox"); |
801 | StorageInfo storage; | 801 | StorageInfo storage; |
802 | const QList<FileSystem> &fs = storage.fileSystems(); | 802 | const QList<FileSystem> &fs = storage.fileSystems(); |
803 | QListIterator<FileSystem> it ( fs ); | 803 | QListIterator<FileSystem> it ( fs ); |
804 | for( ; it.current(); ++it ){ | 804 | for( ; it.current(); ++it ){ |
805 | const QString disk = (*it)->name(); | 805 | const QString disk = (*it)->name(); |
806 | const QString path = (*it)->path(); | 806 | const QString path = (*it)->path(); |
807 | m_location->insertItem(path+ "<-"+disk ); | 807 | m_location->insertItem(path+ "<-"+disk ); |
808 | } | 808 | } |
809 | int count = m_location->count(); | 809 | int count = m_location->count(); |
810 | m_location->insertItem(m_currentDir ); | 810 | m_location->insertItem(m_currentDir ); |
811 | m_location->setCurrentItem( count ); | 811 | m_location->setCurrentItem( count ); |
812 | }; | 812 | }; |
813 | 813 | ||
814 | m_View = new QListView(m_pseudo, "Extended view" ); | 814 | m_View = new QListView(m_pseudo, "Extended view" ); |
815 | m_stack->addWidget( m_pseudo, EXTENDED ); | 815 | m_stack->addWidget( m_pseudo, EXTENDED ); |
816 | m_stack->raiseWidget( EXTENDED ); | 816 | m_stack->raiseWidget( EXTENDED ); |
817 | m_pseudoLayout->addWidget(m_View ); | 817 | m_pseudoLayout->addWidget(m_View ); |
818 | QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); | 818 | QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); |
819 | // set up the stuff | 819 | // set up the stuff |
820 | // Pixmap Name Date Size mime | 820 | // Pixmap Name Date Size mime |
821 | //(m_View->header() )->hide(); | 821 | //(m_View->header() )->hide(); |
822 | //m_View->setRootIsDecorated(false); | 822 | //m_View->setRootIsDecorated(false); |
823 | m_View->addColumn(" "); | 823 | m_View->addColumn(" "); |
824 | m_View->addColumn(tr("Name"),135 ); | 824 | m_View->addColumn(tr("Name"),135 ); |
825 | m_View->addColumn(tr("Size"),-1 ); | 825 | m_View->addColumn(tr("Size"),-1 ); |
826 | m_View->addColumn(tr("Date"), 60 ); | 826 | m_View->addColumn(tr("Date"), 60 ); |
827 | m_View->addColumn(tr("Mime Type"),-1 ); | 827 | m_View->addColumn(tr("Mime Type"),-1 ); |
828 | QHeader *header = m_View->header(); | 828 | QHeader *header = m_View->header(); |
829 | header->hide(); | 829 | header->hide(); |
830 | m_View->setSorting(1 ); | 830 | m_View->setSorting(1 ); |
831 | m_View->setAllColumnsShowFocus( TRUE); | 831 | m_View->setAllColumnsShowFocus( TRUE); |
832 | // connect now | 832 | // connect now |
833 | connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); | 833 | connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); |
834 | connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); | 834 | connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); |
835 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), | 835 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), |
836 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); | 836 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); |
837 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), | 837 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), |
838 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); | 838 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); |
839 | 839 | ||
840 | 840 | ||
841 | }; | 841 | }; |
842 | 842 | ||
843 | /* If a item is locked depends on the mode | 843 | /* If a item is locked depends on the mode |
844 | if we're in OPEN !isReadable is locked | 844 | if we're in OPEN !isReadable is locked |
845 | if we're in SAVE !isWriteable is locked | 845 | if we're in SAVE !isWriteable is locked |
846 | 846 | ||
847 | 847 | ||
848 | */ | 848 | */ |
849 | 849 | ||
850 | 850 | ||
851 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ | 851 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ |
852 | // qWarning("Add Files" ); | 852 | // qWarning("Add Files" ); |
853 | if( !m_files ){ | 853 | if( !m_files ){ |
854 | // qWarning("not mfiles" ); | 854 | // qWarning("not mfiles" ); |
855 | return; | 855 | return; |
856 | } | 856 | } |
857 | 857 | ||
858 | MimeType type( info->filePath() ); | 858 | MimeType type( info->filePath() ); |
859 | QString name; | 859 | QString name; |
860 | QString dir; | 860 | QString dir; |
861 | bool locked= false; | 861 | bool locked= false; |
862 | if(mime == "All" ){ | 862 | if(mime == "All" ){ |
863 | ; | 863 | ; |
864 | }else if( type.id() != mime ) { | 864 | }else if( type.id() != mime ) { |
865 | return; | 865 | return; |
866 | } | 866 | } |
867 | QPixmap pix = type.pixmap(); | 867 | QPixmap pix = type.pixmap(); |
868 | if(pix.isNull() ) | 868 | if(pix.isNull() ) |
869 | pix = Resource::loadPixmap( "UnknownDocument-14" ); | 869 | pix = Resource::loadPixmap( "UnknownDocument-14" ); |
870 | dir = info->dirPath( true ); | 870 | dir = info->dirPath( true ); |
871 | if( symlink ) { // check if the readLink is readable | 871 | if( symlink ) { // check if the readLink is readable |
872 | // do it right later | 872 | // do it right later |
873 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); | 873 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); |
874 | }else{ // keep track of the icons | 874 | }else{ // keep track of the icons |
875 | name = info->fileName(); | 875 | name = info->fileName(); |
876 | if( m_mode == OPEN ){ | 876 | if( m_mode == OPEN ){ |
877 | if( !info->isReadable() ){ | 877 | if( !info->isReadable() ){ |
878 | locked = true; | 878 | locked = true; |
879 | pix = Resource::loadPixmap("locked" ); | 879 | pix = Resource::loadPixmap("locked" ); |
880 | } | 880 | } |
881 | }else if( m_mode == SAVE ){ | 881 | }else if( m_mode == SAVE ){ |
882 | if( !info->isWritable() ){ | 882 | if( !info->isWritable() ){ |
883 | locked = true; | 883 | locked = true; |
884 | pix = Resource::loadPixmap("locked" ); | 884 | pix = Resource::loadPixmap("locked" ); |
885 | } | 885 | } |
886 | } | 886 | } |
887 | } | 887 | } |
888 | new OFileSelectorItem( m_View, pix, name, | 888 | new OFileSelectorItem( m_View, pix, name, |
889 | info->lastModified().toString(), | 889 | info->lastModified().toString(), |
890 | QString::number( info->size() ), | 890 | QString::number( info->size() ), |
891 | dir, locked ); | 891 | dir, locked ); |
892 | } | 892 | } |
893 | 893 | ||
894 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) | 894 | void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink ) |
895 | { | 895 | { |
896 | if(!m_dir ) | 896 | if(!m_dir ) |
897 | return; | 897 | return; |
898 | //if( showDirs ) | 898 | //if( showDirs ) |
899 | { | 899 | { |
900 | bool locked=false; | 900 | bool locked=false; |
901 | QString name; | 901 | QString name; |
902 | QPixmap pix; | 902 | QPixmap pix; |
903 | if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ | 903 | if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ |
904 | locked = true; | 904 | locked = true; |
905 | if( symlink ){ | 905 | if( symlink ){ |
906 | pix = (*m_pixmaps)["symlinkedlocked"]; | 906 | pix = (*m_pixmaps)["symlinkedlocked"]; |
907 | }else{ | 907 | }else{ |
908 | pix = Resource::loadPixmap("lockedfolder" ); | 908 | pix = Resource::loadPixmap("lockedfolder" ); |
909 | } | 909 | } |
910 | }else{ | 910 | }else{ |
911 | if( symlink ){ | 911 | if( symlink ){ |
912 | pix = (*m_pixmaps)["dirsymlink" ]; | 912 | pix = (*m_pixmaps)["dirsymlink" ]; |
913 | }else{ | 913 | }else{ |
914 | pix = Resource::loadPixmap("folder" ); | 914 | pix = Resource::loadPixmap("folder" ); |
915 | } | 915 | } |
916 | } | 916 | } |
917 | if( symlink){ | 917 | if( symlink){ |
918 | name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); | 918 | name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); |
919 | 919 | ||
920 | }else{ | 920 | }else{ |
921 | //if(info->isReadable() ) | 921 | //if(info->isReadable() ) |
922 | name = info->fileName(); | 922 | name = info->fileName(); |
923 | } | 923 | } |
924 | 924 | ||
925 | new OFileSelectorItem(m_View, pix, | 925 | new OFileSelectorItem(m_View, pix, |
926 | name, info->lastModified().toString(), | 926 | name, info->lastModified().toString(), |
927 | QString::number(info->size() ),info->dirPath(true), locked, true ); | 927 | QString::number(info->size() ),info->dirPath(true), locked, true ); |
928 | 928 | ||
929 | } | 929 | } |
930 | } | 930 | } |
931 | 931 | ||
932 | void OFileSelector::setShowDirs(bool dir ) | 932 | void OFileSelector::setShowDirs(bool dir ) |
933 | { | 933 | { |
934 | m_dir = dir; | 934 | m_dir = dir; |
935 | reparse(); | 935 | reparse(); |
936 | } | 936 | } |
937 | 937 | ||
938 | void OFileSelector::slotFileSelected(const QString &string ) | 938 | void OFileSelector::slotFileSelected(const QString &string ) |
939 | { | 939 | { |
940 | if(m_shLne ) | 940 | if(m_shLne ) |
941 | m_edit->setText( string ); | 941 | m_edit->setText( string ); |
942 | 942 | ||
943 | emit fileSelected( string ); | 943 | emit fileSelected( string ); |
944 | // do AppLnk stuff | 944 | // do AppLnk stuff |
945 | } | 945 | } |
946 | 946 | ||
947 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) | 947 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) |
948 | { | 948 | { |
949 | slotFileSelected(lnk.name() ); | 949 | slotFileSelected(lnk.name() ); |
950 | emit fileSelected( lnk ); | 950 | emit fileSelected( lnk ); |
951 | } | 951 | } |
952 | 952 | ||
953 | void OFileSelector::slotSelectionChanged() // get the current items | 953 | void OFileSelector::slotSelectionChanged() // get the current items |
954 | // fixme | 954 | // fixme |
955 | { | 955 | { |
956 | qWarning("selection changed" ); | 956 | qWarning("selection changed" ); |
957 | } | 957 | } |
958 | 958 | ||
959 | void OFileSelector::slotCurrentChanged(QListViewItem *item ) | 959 | void OFileSelector::slotCurrentChanged(QListViewItem *item ) |
960 | { | 960 | { |
961 | // qWarning("current changed" ); | 961 | // qWarning("current changed" ); |
962 | if( item == 0 ) | 962 | if( item == 0 ) |
963 | return; | 963 | return; |
964 | 964 | ||
965 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 965 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
966 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 966 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
967 | if(!sel->isDir() ){ | 967 | if(!sel->isDir() ){ |
968 | // qWarning("is not dir" ); | 968 | // qWarning("is not dir" ); |
969 | if(m_shLne ){ | 969 | if(m_shLne ){ |
970 | m_edit->setText(sel->text(1) ); | 970 | m_edit->setText(sel->text(1) ); |
971 | // qWarning("setTexy" ); | 971 | // qWarning("setTexy" ); |
972 | } | 972 | } |
973 | } | 973 | } |
974 | }else { | 974 | }else { |
975 | qWarning("mode not extended" ); | 975 | qWarning("mode not extended" ); |
976 | } | 976 | } |
977 | } | 977 | } |
978 | 978 | ||
979 | // either select or change dir | 979 | // either select or change dir |
980 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) | 980 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &/*point*/, int ) |
981 | { | 981 | { |
982 | if( item == 0 ) | 982 | if( item == 0 ) |
983 | return; | 983 | return; |
984 | 984 | ||
985 | if( button != Qt::LeftButton ) | 985 | if( button != Qt::LeftButton ) |
986 | return; | 986 | return; |
987 | 987 | ||
988 | // qWarning("clicked" ); | 988 | // qWarning("clicked" ); |
989 | if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 989 | if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
990 | // qWarning("inside" ); | 990 | // qWarning("inside" ); |
991 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 991 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
992 | if(!sel->isLocked() ){ // not locked either changedir or open | 992 | if(!sel->isLocked() ){ // not locked either changedir or open |
993 | QStringList str = QStringList::split("->", sel->text(1) ); | 993 | QStringList str = QStringList::split("->", sel->text(1) ); |
994 | if(sel->isDir() ){ | 994 | if(sel->isDir() ){ |
995 | cd( sel->directory() + "/" + str[0] ); | 995 | cd( sel->directory() + "/" + str[0] ); |
996 | } else { | 996 | } else { |
997 | // qWarning("file" ); | 997 | // qWarning("file" ); |
998 | if(m_shLne ) | 998 | if(m_shLne ) |
999 | m_edit->setText(str[0] ); | 999 | m_edit->setText(str[0] ); |
1000 | emit fileSelected(str[0] ); | 1000 | emit fileSelected(str[0] ); |
1001 | // emit DocLnk need to do it | 1001 | // emit DocLnk need to do it |
1002 | } | 1002 | } |
1003 | } else { | 1003 | } else { |
1004 | qWarning( "locked" ); | 1004 | qWarning( "locked" ); |
1005 | } | 1005 | } |
1006 | }; | 1006 | }; |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) | 1009 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) |
1010 | { | 1010 | { |
1011 | if (item == 0 ) | 1011 | if (item == 0 ) |
1012 | return; | 1012 | return; |
1013 | 1013 | ||
1014 | if( button != Qt::RightButton ) | 1014 | if( button != Qt::RightButton ) |
1015 | return; | 1015 | return; |
1016 | // qWarning("right button" ); | 1016 | // qWarning("right button" ); |
1017 | slotContextMenu(item); | 1017 | slotContextMenu(item); |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | void OFileSelector::slotContextMenu(QListViewItem *item) | 1020 | void OFileSelector::slotContextMenu(QListViewItem *item) |
1021 | { | 1021 | { |
1022 | // qWarning("context menu" ); | 1022 | // qWarning("context menu" ); |
1023 | if( item ==0 || !m_showPopup ) | 1023 | if( item ==0 || !m_showPopup ) |
1024 | return; | 1024 | return; |
1025 | 1025 | ||
1026 | if( m_custom !=0){ | 1026 | if( m_custom !=0){ |
1027 | m_custom->exec(); | 1027 | m_custom->exec(); |
1028 | }else{ | 1028 | }else{ |
1029 | QPopupMenu menu; | 1029 | QPopupMenu menu; |
1030 | QAction up; | 1030 | QAction up; |
1031 | up.setText("cd up"); | 1031 | up.setText("cd up"); |
1032 | up.addTo( &menu ); | 1032 | up.addTo( &menu ); |
1033 | connect(&up, SIGNAL(activated() ), | 1033 | connect(&up, SIGNAL(activated() ), |
1034 | this, SLOT(cdUP() ) ); | 1034 | this, SLOT(cdUP() ) ); |
1035 | 1035 | ||
1036 | QAction act; | 1036 | QAction act; |
1037 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 1037 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
1038 | if(sel->isDir() ){ | 1038 | if(sel->isDir() ){ |
1039 | act.setText( tr("Change Directory") ); | 1039 | act.setText( tr("Change Directory") ); |
1040 | act.addTo(&menu ); | 1040 | act.addTo(&menu ); |
1041 | connect(&act, SIGNAL(activated() ), | 1041 | connect(&act, SIGNAL(activated() ), |
1042 | this, SLOT(slotChangedDir() ) ); | 1042 | this, SLOT(slotChangedDir() ) ); |
1043 | }else{ | 1043 | }else{ |
1044 | act.setText( tr("Open file" ) ); | 1044 | act.setText( tr("Open file" ) ); |
1045 | act.addTo( &menu ); | 1045 | act.addTo( &menu ); |
1046 | connect(&act, SIGNAL(activated() ), | 1046 | connect(&act, SIGNAL(activated() ), |
1047 | this, SLOT(slotOpen() ) ); | 1047 | this, SLOT(slotOpen() ) ); |
1048 | } | 1048 | } |
1049 | QAction rescan; | 1049 | QAction rescan; |
1050 | rescan.setText( tr("Rescan") ); | 1050 | rescan.setText( tr("Rescan") ); |
1051 | rescan.addTo( &menu ); | 1051 | rescan.addTo( &menu ); |
1052 | connect(&rescan, SIGNAL(activated() ), | 1052 | connect(&rescan, SIGNAL(activated() ), |
1053 | this, SLOT(slotRescan() ) ); | 1053 | this, SLOT(slotRescan() ) ); |
1054 | 1054 | ||
1055 | QAction rename; | 1055 | QAction rename; |
1056 | rename.setText( tr("Rename") ); | 1056 | rename.setText( tr("Rename") ); |
1057 | rename.addTo( &menu ); | 1057 | rename.addTo( &menu ); |
1058 | connect(&rename, SIGNAL(activated() ), | 1058 | connect(&rename, SIGNAL(activated() ), |
1059 | this, SLOT(slotRename() ) ); | 1059 | this, SLOT(slotRename() ) ); |
1060 | 1060 | ||
1061 | menu.insertSeparator(); | 1061 | menu.insertSeparator(); |
1062 | QAction delItem; | 1062 | QAction delItem; |
1063 | delItem.setText( tr("Delete") ); | 1063 | delItem.setText( tr("Delete") ); |
1064 | delItem.addTo(&menu ); | 1064 | delItem.addTo(&menu ); |
1065 | connect(&delItem, SIGNAL(activated() ), | 1065 | connect(&delItem, SIGNAL(activated() ), |
1066 | this, SLOT(slotDelete() ) ); | 1066 | this, SLOT(slotDelete() ) ); |
1067 | 1067 | ||
1068 | menu.exec(QCursor::pos() ); | 1068 | menu.exec(QCursor::pos() ); |
1069 | } | 1069 | } |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | bool OFileSelector::cd(const QString &str ) | 1072 | bool OFileSelector::cd(const QString &str ) |
1073 | { | 1073 | { |
1074 | // qWarning(" dir %s", str.latin1() ); | 1074 | // qWarning(" dir %s", str.latin1() ); |
1075 | QDir dir( str); | 1075 | QDir dir( str); |
1076 | if(dir.exists() ){ | 1076 | if(dir.exists() ){ |
1077 | m_currentDir = dir.absPath(); | 1077 | m_currentDir = dir.absPath(); |
1078 | reparse(); | 1078 | reparse(); |
1079 | if(m_shTool ){ | 1079 | if(m_shTool ){ |
1080 | int count = m_location->count(); | 1080 | int count = m_location->count(); |
1081 | insertLocationPath( str ,count ); | 1081 | insertLocationPath( str ,count ); |
1082 | m_location->setCurrentItem( count ); | 1082 | m_location->setCurrentItem( count ); |
1083 | } | 1083 | } |
1084 | return true; | 1084 | return true; |
1085 | } | 1085 | } |
1086 | return false; | 1086 | return false; |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | void OFileSelector::insertLocationPath(const QString ¤tPath, int count) { | 1089 | void OFileSelector::insertLocationPath(const QString ¤tPath, int count) { |
1090 | QStringList pathList; | 1090 | QStringList pathList; |
1091 | bool underDog = FALSE; | 1091 | bool underDog = FALSE; |
1092 | for(int i=0;i<count;i++) { | 1092 | for(int i=0;i<count;i++) { |
1093 | pathList << m_location->text(i); | 1093 | pathList << m_location->text(i); |
1094 | if( m_location->text(i) == currentPath) | 1094 | if( m_location->text(i) == currentPath) |
1095 | underDog = TRUE; | 1095 | underDog = TRUE; |
1096 | } | 1096 | } |
1097 | if( !underDog) { | 1097 | if( !underDog) { |
1098 | m_location->clear(); | 1098 | m_location->clear(); |
1099 | if( currentPath.left(2)=="//") | 1099 | if( currentPath.left(2)=="//") |
1100 | pathList.append( currentPath.right(currentPath.length()-1) ); | 1100 | pathList.append( currentPath.right(currentPath.length()-1) ); |
1101 | else | 1101 | else |
1102 | pathList.append( currentPath ); | 1102 | pathList.append( currentPath ); |
1103 | m_location->insertStringList( pathList,-1); | 1103 | m_location->insertStringList( pathList,-1); |
1104 | } | 1104 | } |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | void OFileSelector::slotChangedDir() | 1107 | void OFileSelector::slotChangedDir() |
1108 | { | 1108 | { |
1109 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1109 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1110 | if(sel->isDir() ){ | 1110 | if(sel->isDir() ){ |
1111 | QStringList str = QStringList::split("->", sel->text(1) ); | 1111 | QStringList str = QStringList::split("->", sel->text(1) ); |
1112 | cd( sel->directory() + "/" + str[0] ); | 1112 | cd( sel->directory() + "/" + str[0] ); |
1113 | 1113 | ||
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | void OFileSelector::slotOpen() | 1117 | void OFileSelector::slotOpen() |
1118 | { | 1118 | { |
1119 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1119 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1120 | if(!sel->isDir() ){ | 1120 | if(!sel->isDir() ){ |
1121 | QStringList str = QStringList::split("->", sel->text(1) ); | 1121 | QStringList str = QStringList::split("->", sel->text(1) ); |
1122 | slotFileSelected( str[0] ); | 1122 | slotFileSelected( str[0] ); |
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | void OFileSelector::slotRescan() | 1126 | void OFileSelector::slotRescan() |
1127 | { | 1127 | { |
1128 | reparse(); | 1128 | reparse(); |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | void OFileSelector::slotRename() | 1131 | void OFileSelector::slotRename() |
1132 | { | 1132 | { |
1133 | // rename inline | 1133 | // rename inline |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | void OFileSelector::slotDelete() | 1136 | void OFileSelector::slotDelete() |
1137 | { | 1137 | { |
1138 | // qWarning("delete slot" ); | 1138 | // qWarning("delete slot" ); |
1139 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1139 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1140 | QStringList list = QStringList::split("->", sel->text(1) ); | 1140 | QStringList list = QStringList::split("->", sel->text(1) ); |
1141 | if( sel->isDir() ){ | 1141 | if( sel->isDir() ){ |
1142 | QString str = QString::fromLatin1("rm -rf ") + list[0]; //better safe than sorry | 1142 | QString str = QString::fromLatin1("rm -rf ") + list[0]; //better safe than sorry |
1143 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], | 1143 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], |
1144 | tr("Yes"),tr("No"),0,1,1) ) { | 1144 | tr("Yes"),tr("No"),0,1,1) ) { |
1145 | case 0: | 1145 | case 0: |
1146 | ::system(str.utf8().data() ); | 1146 | ::system(str.utf8().data() ); |
1147 | break; | 1147 | break; |
1148 | } | 1148 | } |
1149 | } else { | 1149 | } else { |
1150 | QFile::remove( list[0] ); | 1150 | QFile::remove( list[0] ); |
1151 | } | 1151 | } |
1152 | m_View->takeItem( sel ); | 1152 | m_View->takeItem( sel ); |
1153 | delete sel; | 1153 | delete sel; |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | void OFileSelector::cdUP() | 1156 | void OFileSelector::cdUP() |
1157 | { | 1157 | { |
1158 | QDir dir( m_currentDir ); | 1158 | QDir dir( m_currentDir ); |
1159 | dir.cdUp(); | 1159 | dir.cdUp(); |
1160 | if(dir.exists() ){ | 1160 | if(dir.exists() ){ |
1161 | m_currentDir = dir.absPath(); | 1161 | m_currentDir = dir.absPath(); |
1162 | reparse(); | 1162 | reparse(); |
1163 | int count = m_location->count(); | 1163 | int count = m_location->count(); |
1164 | insertLocationPath( m_currentDir, count); | 1164 | insertLocationPath( m_currentDir, count); |
1165 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); | 1165 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); |
1166 | //this wont work in all instances | 1166 | //this wont work in all instances |
1167 | // FIXME | 1167 | // FIXME |
1168 | } | 1168 | } |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | void OFileSelector::slotHome() | 1171 | void OFileSelector::slotHome() |
1172 | { | 1172 | { |
1173 | cd(QDir::homeDirPath() ); | 1173 | cd(QDir::homeDirPath() ); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | void OFileSelector::slotDoc() | 1176 | void OFileSelector::slotDoc() |
1177 | { | 1177 | { |
1178 | cd(QDir::homeDirPath() + "/Documents" ); | 1178 | cd(QDir::homeDirPath() + "/Documents" ); |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | void OFileSelector::slotNavigate() | 1181 | void OFileSelector::slotNavigate() |
1182 | { | 1182 | { |
1183 | 1183 | ||
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | void OFileSelector::locationComboActivated(const QString & file ) { | 1186 | void OFileSelector::locationComboActivated(const QString & file ) { |
1187 | cd(file.left(file.find("<-",0,TRUE))); | 1187 | cd(file.left(file.find("<-",0,TRUE))); |
1188 | reparse(); | 1188 | reparse(); |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | void OFileSelector::locationComboChanged() { | 1191 | void OFileSelector::locationComboChanged() { |
1192 | cd( m_location->lineEdit()->text()); | 1192 | cd( m_location->lineEdit()->text()); |
1193 | reparse(); | 1193 | reparse(); |
1194 | } | 1194 | } |
diff --git a/libopie/ofileview.h b/libopie/ofileview.h index 48a71ca..ed256f1 100644 --- a/libopie/ofileview.h +++ b/libopie/ofileview.h | |||
@@ -1,79 +1,79 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef ofileview_h | 29 | #ifndef ofileview_h |
30 | #define ofileview_h | 30 | #define ofileview_h |
31 | 31 | ||
32 | #include <qobject.h> | 32 | #include <qobject.h> |
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | 34 | ||
35 | class QFileInfo; | 35 | class QFileInfo; |
36 | class QDir; | 36 | class QDir; |
37 | class DocLnk; | 37 | class DocLnk; |
38 | class OFileSelectorView : public QWidget { | 38 | class OFileSelectorView : public QWidget { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | OFileSelectorView(QWidget *widget, | 41 | OFileSelectorView(QWidget *widget, |
42 | const char *name ) | 42 | const char *name ) |
43 | : QWidget(widget, name ) | 43 | : QWidget(widget, name ) |
44 | { }; | 44 | { }; |
45 | virtual ~OFileSelectorView(); | 45 | virtual ~OFileSelectorView() = 0; |
46 | 46 | ||
47 | virtual void addFile(const QString &mine, | 47 | virtual void addFile(const QString &mine, |
48 | QFileInfo *info, | 48 | QFileInfo *info, |
49 | bool isSymlink = FALSE ) = 0; | 49 | bool isSymlink = FALSE ) = 0; |
50 | 50 | ||
51 | virtual void addDir (const QString &mine, | 51 | virtual void addDir (const QString &mine, |
52 | QFileInfo *info, | 52 | QFileInfo *info, |
53 | bool isSymlink = FALSE ) = 0; | 53 | bool isSymlink = FALSE ) = 0; |
54 | 54 | ||
55 | virtual void addSymlink(const QString &mime, | 55 | virtual void addSymlink(const QString &mime, |
56 | QFileInfo *info, | 56 | QFileInfo *info, |
57 | bool isSymlink = FALSE ) = 0; | 57 | bool isSymlink = FALSE ) = 0; |
58 | 58 | ||
59 | virtual void cd(const QString &path ); | 59 | virtual void cd(const QString &path ) = 0; |
60 | signals: | 60 | signals: |
61 | void fileSelected(const QString &); | 61 | void fileSelected(const QString &); |
62 | void fileSelected(const DocLnk & ); | 62 | void fileSelected(const DocLnk & ); |
63 | void contextMenu(); | 63 | void contextMenu(); |
64 | void changedDir(const QString &); | 64 | void changedDir(const QString &); |
65 | void changedDir(const QDir & ); | 65 | void changedDir(const QDir & ); |
66 | }; | 66 | }; |
67 | 67 | ||
68 | class OFileViewFactory { | 68 | class OFileViewFactory { |
69 | // Q_OBJECT | 69 | // Q_OBJECT |
70 | public: | 70 | public: |
71 | OFileViewFactory() {} ; | 71 | OFileViewFactory() {} ; |
72 | virtual ~OFileViewFactory(); | 72 | virtual ~OFileViewFactory() = 0; |
73 | 73 | ||
74 | OFileSelectorView* newView(QWidget *parent, const char *name ); | 74 | OFileSelectorView* newView(QWidget *parent, const char *name ); |
75 | QString name()const; | 75 | QString name()const; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | #endif | 79 | #endif |