author | zecke <zecke> | 2002-09-29 16:57:33 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-29 16:57:33 (UTC) |
commit | 0d4b54af104dadbff57804e5e6f8ac309aa36fc4 (patch) (unidiff) | |
tree | c157fa2a49c3b545d4e7c4a2fbdaabe043dde20a | |
parent | 33ebc68a530393697724428f0e0db3a4807f3a9e (diff) | |
download | opie-0d4b54af104dadbff57804e5e6f8ac309aa36fc4.zip opie-0d4b54af104dadbff57804e5e6f8ac309aa36fc4.tar.gz opie-0d4b54af104dadbff57804e5e6f8ac309aa36fc4.tar.bz2 |
Hide the TypeCombo/CategorySelect we provide our own stuff
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index c52aa62..458d432 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp | |||
@@ -631,392 +631,394 @@ void OFileSelector::initializeYes() | |||
631 | * out that combobox | 631 | * out that combobox |
632 | * if automime we need to update the mimetypes | 632 | * if automime we need to update the mimetypes |
633 | */ | 633 | */ |
634 | void OFileSelector::updateMimeCheck() { | 634 | void OFileSelector::updateMimeCheck() { |
635 | m_mimeCheck->clear(); | 635 | m_mimeCheck->clear(); |
636 | if (m_autoMime ) { | 636 | if (m_autoMime ) { |
637 | //m_mimeCheck->insertItem( tr("All") ); | 637 | //m_mimeCheck->insertItem( tr("All") ); |
638 | updateMimes(); | 638 | updateMimes(); |
639 | } | 639 | } |
640 | 640 | ||
641 | QMap<QString, QStringList>::Iterator it; | 641 | QMap<QString, QStringList>::Iterator it; |
642 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { | 642 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { |
643 | m_mimeCheck->insertItem( it.key() ); | 643 | m_mimeCheck->insertItem( it.key() ); |
644 | } | 644 | } |
645 | } | 645 | } |
646 | 646 | ||
647 | void OFileSelector::initializeChooser() | 647 | void OFileSelector::initializeChooser() |
648 | { | 648 | { |
649 | if( m_boxView == 0 ){ | 649 | if( m_boxView == 0 ){ |
650 | m_boxView = new QHBox( this ); | 650 | m_boxView = new QHBox( this ); |
651 | m_viewCheck = new QComboBox( m_boxView, "view check"); | 651 | m_viewCheck = new QComboBox( m_boxView, "view check"); |
652 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); | 652 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); |
653 | m_boxView->setSpacing( 8 ); | 653 | m_boxView->setSpacing( 8 ); |
654 | m_lay->addWidget(m_boxView, 0 ); | 654 | m_lay->addWidget(m_boxView, 0 ); |
655 | 655 | ||
656 | m_viewCheck->insertItem( tr("Documents") ); | 656 | m_viewCheck->insertItem( tr("Documents") ); |
657 | m_viewCheck->insertItem( tr("Files") ); | 657 | m_viewCheck->insertItem( tr("Files") ); |
658 | m_viewCheck->insertItem( tr("All Files") ); | 658 | m_viewCheck->insertItem( tr("All Files") ); |
659 | /* update to custom views */ | 659 | /* update to custom views */ |
660 | 660 | ||
661 | updateMimeCheck(); | 661 | updateMimeCheck(); |
662 | 662 | ||
663 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), | 663 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), |
664 | this, SLOT( slotViewCheck(const QString & ) ) ); | 664 | this, SLOT( slotViewCheck(const QString & ) ) ); |
665 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), | 665 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), |
666 | this, SLOT( slotMimeCheck( const QString & ) ) ); | 666 | this, SLOT( slotMimeCheck( const QString & ) ) ); |
667 | } | 667 | } |
668 | } | 668 | } |
669 | /* generate the buttons for the toolbar */ | 669 | /* generate the buttons for the toolbar */ |
670 | void OFileSelector::initToolbar() { | 670 | void OFileSelector::initToolbar() { |
671 | m_mainView = new OFileSelectorMain( this ); | 671 | m_mainView = new OFileSelectorMain( this ); |
672 | 672 | ||
673 | /* now generate the tool bar */ | 673 | /* now generate the tool bar */ |
674 | qWarning( "toolbar" ); | 674 | qWarning( "toolbar" ); |
675 | m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); | 675 | m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); |
676 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); | 676 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); |
677 | 677 | ||
678 | m_boxToolbar = new QHBox( m_pseudo ); | 678 | m_boxToolbar = new QHBox( m_pseudo ); |
679 | m_boxToolbar->setSpacing( 0 ); | 679 | m_boxToolbar->setSpacing( 0 ); |
680 | 680 | ||
681 | // tool bar members now | 681 | // tool bar members now |
682 | m_location = new QComboBox( m_boxToolbar ); | 682 | m_location = new QComboBox( m_boxToolbar ); |
683 | m_location->setEditable( TRUE ); | 683 | m_location->setEditable( TRUE ); |
684 | m_location->setDuplicatesEnabled( FALSE ); | 684 | m_location->setDuplicatesEnabled( FALSE ); |
685 | connect( m_location, SIGNAL(activated(const QString& ) ), | 685 | connect( m_location, SIGNAL(activated(const QString& ) ), |
686 | this, SLOT(slotLocationActivated(const QString& )) ); | 686 | this, SLOT(slotLocationActivated(const QString& )) ); |
687 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , | 687 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , |
688 | this, SLOT(locationComboChanged() ) ); | 688 | this, SLOT(locationComboChanged() ) ); |
689 | 689 | ||
690 | // UP Button | 690 | // UP Button |
691 | m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, | 691 | m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, |
692 | m_boxToolbar, "cdUpButton" ); | 692 | m_boxToolbar, "cdUpButton" ); |
693 | m_up->setFixedSize( QSize(20, 20 ) ); | 693 | m_up->setFixedSize( QSize(20, 20 ) ); |
694 | connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); | 694 | connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); |
695 | m_up->setFlat( TRUE ); | 695 | m_up->setFlat( TRUE ); |
696 | 696 | ||
697 | // Home Button | 697 | // Home Button |
698 | m_homeButton = new QPushButton(Resource::loadIconSet("home"), | 698 | m_homeButton = new QPushButton(Resource::loadIconSet("home"), |
699 | QString::null, m_boxToolbar ); | 699 | QString::null, m_boxToolbar ); |
700 | m_homeButton->setFixedSize( QSize(20, 20 ) ); | 700 | m_homeButton->setFixedSize( QSize(20, 20 ) ); |
701 | connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); | 701 | connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); |
702 | m_homeButton->setFlat( TRUE ); | 702 | m_homeButton->setFlat( TRUE ); |
703 | 703 | ||
704 | // Documents Button | 704 | // Documents Button |
705 | m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), | 705 | m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), |
706 | QString::null, m_boxToolbar, | 706 | QString::null, m_boxToolbar, |
707 | "docsButton" ); | 707 | "docsButton" ); |
708 | m_docButton->setFixedSize( QSize(20, 20 ) ); | 708 | m_docButton->setFixedSize( QSize(20, 20 ) ); |
709 | m_docButton->setFlat( true ); | 709 | m_docButton->setFlat( true ); |
710 | connect( m_docButton, SIGNAL(clicked() ), | 710 | connect( m_docButton, SIGNAL(clicked() ), |
711 | this, SLOT(slotDoc() ) ); | 711 | this, SLOT(slotDoc() ) ); |
712 | 712 | ||
713 | // close button | 713 | // close button |
714 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", | 714 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", |
715 | m_boxToolbar ); | 715 | m_boxToolbar ); |
716 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); | 716 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); |
717 | m_close->setFixedSize( 20, 20 ); | 717 | m_close->setFixedSize( 20, 20 ); |
718 | 718 | ||
719 | m_boxToolbar->setFixedHeight( 20 ); | 719 | m_boxToolbar->setFixedHeight( 20 ); |
720 | m_pseudoLayout->addWidget(m_boxToolbar ); | 720 | m_pseudoLayout->addWidget(m_boxToolbar ); |
721 | 721 | ||
722 | /* init the locations */ | 722 | /* init the locations */ |
723 | initLocations(); | 723 | initLocations(); |
724 | 724 | ||
725 | if( !m_shTool ){ | 725 | if( !m_shTool ){ |
726 | m_location->hide( ); | 726 | m_location->hide( ); |
727 | m_up->hide( ); | 727 | m_up->hide( ); |
728 | m_homeButton->hide( ); | 728 | m_homeButton->hide( ); |
729 | m_docButton->hide( ); | 729 | m_docButton->hide( ); |
730 | } | 730 | } |
731 | if(!m_shClose ) | 731 | if(!m_shClose ) |
732 | m_close->hide(); | 732 | m_close->hide(); |
733 | 733 | ||
734 | m_mainView->setToolbar( m_pseudo ); | 734 | m_mainView->setToolbar( m_pseudo ); |
735 | m_lay->addWidget( m_mainView, 100 ); | 735 | m_lay->addWidget( m_mainView, 100 ); |
736 | } | 736 | } |
737 | /* initialize the OLocalLister */ | 737 | /* initialize the OLocalLister */ |
738 | void OFileSelector::initLister() { | 738 | void OFileSelector::initLister() { |
739 | m_lister = new OLocalLister(this); | 739 | m_lister = new OLocalLister(this); |
740 | } | 740 | } |
741 | /* put default locations into the bar */ | 741 | /* put default locations into the bar */ |
742 | void OFileSelector::initLocations () { | 742 | void OFileSelector::initLocations () { |
743 | 743 | ||
744 | // let;s fill the Location ComboBox | 744 | // let;s fill the Location ComboBox |
745 | StorageInfo storage; | 745 | StorageInfo storage; |
746 | const QList<FileSystem> &fs = storage.fileSystems(); | 746 | const QList<FileSystem> &fs = storage.fileSystems(); |
747 | QListIterator<FileSystem> it ( fs ); | 747 | QListIterator<FileSystem> it ( fs ); |
748 | for( ; it.current(); ++it ){ | 748 | for( ; it.current(); ++it ){ |
749 | const QString disk = (*it)->name(); | 749 | const QString disk = (*it)->name(); |
750 | const QString path = (*it)->path(); | 750 | const QString path = (*it)->path(); |
751 | m_location->insertItem(path+ "<-"+disk ); | 751 | m_location->insertItem(path+ "<-"+disk ); |
752 | } | 752 | } |
753 | int count = m_location->count(); | 753 | int count = m_location->count(); |
754 | m_location->insertItem( m_currentDir ); | 754 | m_location->insertItem( m_currentDir ); |
755 | m_location->setCurrentItem( count ); | 755 | m_location->setCurrentItem( count ); |
756 | 756 | ||
757 | } | 757 | } |
758 | void OFileSelector::initializePerm() | 758 | void OFileSelector::initializePerm() |
759 | { | 759 | { |
760 | if( m_checkPerm == 0 ){ | 760 | if( m_checkPerm == 0 ){ |
761 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm"); | 761 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm"); |
762 | m_checkPerm->setChecked( false ); | 762 | m_checkPerm->setChecked( false ); |
763 | m_lay->addWidget( m_checkPerm ); | 763 | m_lay->addWidget( m_checkPerm ); |
764 | } | 764 | } |
765 | } | 765 | } |
766 | void OFileSelector::initPics() | 766 | void OFileSelector::initPics() |
767 | { | 767 | { |
768 | m_pixmaps = new QMap<QString,QPixmap>; | 768 | m_pixmaps = new QMap<QString,QPixmap>; |
769 | QPixmap pm = Resource::loadPixmap( "folder" ); | 769 | QPixmap pm = Resource::loadPixmap( "folder" ); |
770 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 770 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
771 | 771 | ||
772 | QPainter painter( &pm ); | 772 | QPainter painter( &pm ); |
773 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 773 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
774 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 774 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
775 | m_pixmaps->insert("dirsymlink", pm ); | 775 | m_pixmaps->insert("dirsymlink", pm ); |
776 | 776 | ||
777 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); | 777 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); |
778 | QPainter pen(&pm2 ); | 778 | QPainter pen(&pm2 ); |
779 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); | 779 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); |
780 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); | 780 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); |
781 | m_pixmaps->insert("symlinkedlocked", pm2 ); | 781 | m_pixmaps->insert("symlinkedlocked", pm2 ); |
782 | } | 782 | } |
783 | // if a mime complies with the m_mimeCheck->currentItem | 783 | // if a mime complies with the m_mimeCheck->currentItem |
784 | bool OFileSelector::compliesMime( const QString &path, const QString &mime ) | 784 | bool OFileSelector::compliesMime( const QString &path, const QString &mime ) |
785 | { | 785 | { |
786 | if( mime == "All" ) | 786 | if( mime == "All" ) |
787 | return true; | 787 | return true; |
788 | MimeType type( path ); | 788 | MimeType type( path ); |
789 | if( type.id() == mime ) | 789 | if( type.id() == mime ) |
790 | return true; | 790 | return true; |
791 | return false; | 791 | return false; |
792 | } | 792 | } |
793 | /* check if the mimetype in mime | 793 | /* check if the mimetype in mime |
794 | * complies with the one which is current | 794 | * complies with the one which is current |
795 | */ | 795 | */ |
796 | /* | 796 | /* |
797 | * We've the mimetype of the file | 797 | * We've the mimetype of the file |
798 | * We need to get the stringlist of the current mimetype | 798 | * We need to get the stringlist of the current mimetype |
799 | * | 799 | * |
800 | * mime = image/jpeg | 800 | * mime = image/jpeg |
801 | * QStringList = 'image/*' | 801 | * QStringList = 'image/*' |
802 | * or QStringList = image/jpeg;image/png;application/x-ogg | 802 | * or QStringList = image/jpeg;image/png;application/x-ogg |
803 | * or QStringList = application/x-ogg;image/*; | 803 | * or QStringList = application/x-ogg;image/*; |
804 | * with all these mime filters it should get acceptes | 804 | * with all these mime filters it should get acceptes |
805 | * to do so we need to look if mime is contained inside | 805 | * to do so we need to look if mime is contained inside |
806 | * the stringlist | 806 | * the stringlist |
807 | * if it's contained return true | 807 | * if it's contained return true |
808 | * if not ( I'm no RegExp expert at all ) we'll look if a '/*' | 808 | * if not ( I'm no RegExp expert at all ) we'll look if a '/*' |
809 | * is contained in the mimefilter and then we will | 809 | * is contained in the mimefilter and then we will |
810 | * look if both are equal until the '/' | 810 | * look if both are equal until the '/' |
811 | */ | 811 | */ |
812 | bool OFileSelector::compliesMime( const QString& mime ) { | 812 | bool OFileSelector::compliesMime( const QString& mime ) { |
813 | qWarning("mimetype is %s", mime.latin1() ); | 813 | qWarning("mimetype is %s", mime.latin1() ); |
814 | QString currentText; | 814 | QString currentText; |
815 | if (m_shChooser ) | 815 | if (m_shChooser ) |
816 | currentText = m_mimeCheck->currentText(); | 816 | currentText = m_mimeCheck->currentText(); |
817 | 817 | ||
818 | qWarning("current text is %s", currentText.latin1() ); | 818 | qWarning("current text is %s", currentText.latin1() ); |
819 | QMap<QString, QStringList>::Iterator it; | 819 | QMap<QString, QStringList>::Iterator it; |
820 | QStringList list; | 820 | QStringList list; |
821 | if ( currentText == tr("All") ) return true; | 821 | if ( currentText == tr("All") ) return true; |
822 | else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { | 822 | else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { |
823 | it = m_mimetypes.begin(); | 823 | it = m_mimetypes.begin(); |
824 | list = it.data(); | 824 | list = it.data(); |
825 | }else if ( currentText.isEmpty() ) return true; | 825 | }else if ( currentText.isEmpty() ) return true; |
826 | else{ | 826 | else{ |
827 | it = m_mimetypes.find(currentText ); | 827 | it = m_mimetypes.find(currentText ); |
828 | if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; | 828 | if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; |
829 | else qWarning("found"), list = it.data(); | 829 | else qWarning("found"), list = it.data(); |
830 | } | 830 | } |
831 | 831 | ||
832 | 832 | ||
833 | if ( list.contains(mime) ) return true; | 833 | if ( list.contains(mime) ) return true; |
834 | qWarning("list doesn't contain it "); | 834 | qWarning("list doesn't contain it "); |
835 | QStringList::Iterator it2; | 835 | QStringList::Iterator it2; |
836 | int pos; | 836 | int pos; |
837 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { | 837 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { |
838 | pos = (*it2).findRev("/*"); | 838 | pos = (*it2).findRev("/*"); |
839 | if ( pos >= 0 ) { | 839 | if ( pos >= 0 ) { |
840 | if ( mime.contains( (*it2).left(pos) ) ) return true; | 840 | if ( mime.contains( (*it2).left(pos) ) ) return true; |
841 | } | 841 | } |
842 | } | 842 | } |
843 | return false; | 843 | return false; |
844 | } | 844 | } |
845 | void OFileSelector::slotFileSelected( const QString &string ) | 845 | void OFileSelector::slotFileSelected( const QString &string ) |
846 | { | 846 | { |
847 | if( m_shLne ) | 847 | if( m_shLne ) |
848 | m_edit->setText( string ); | 848 | m_edit->setText( string ); |
849 | emit fileSelected( string ); | 849 | emit fileSelected( string ); |
850 | } | 850 | } |
851 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) | 851 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) |
852 | { | 852 | { |
853 | slotFileSelected( lnk.name() ); | 853 | slotFileSelected( lnk.name() ); |
854 | // emit fileSelected( lnk ); | 854 | // emit fileSelected( lnk ); |
855 | } | 855 | } |
856 | 856 | ||
857 | 857 | ||
858 | void OFileSelector::slotDelete() | 858 | void OFileSelector::slotDelete() |
859 | { | 859 | { |
860 | /* | 860 | /* |
861 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 861 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
862 | QStringList list = QStringList::split("->", sel->text(1) ); | 862 | QStringList list = QStringList::split("->", sel->text(1) ); |
863 | if( sel->isDir() ){ | 863 | if( sel->isDir() ){ |
864 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry | 864 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry |
865 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], | 865 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], |
866 | tr("Yes"),tr("No"),0,1,1) ) { | 866 | tr("Yes"),tr("No"),0,1,1) ) { |
867 | case 0: | 867 | case 0: |
868 | ::system(str.utf8().data() ); | 868 | ::system(str.utf8().data() ); |
869 | break; | 869 | break; |
870 | } | 870 | } |
871 | } else { | 871 | } else { |
872 | QFile::remove( list[0] ); | 872 | QFile::remove( list[0] ); |
873 | } | 873 | } |
874 | m_View->takeItem( sel ); | 874 | m_View->takeItem( sel ); |
875 | delete sel; | 875 | delete sel; |
876 | */ | 876 | */ |
877 | } | 877 | } |
878 | void OFileSelector::cdUP() | 878 | void OFileSelector::cdUP() |
879 | { | 879 | { |
880 | QDir dir( m_currentDir ); | 880 | QDir dir( m_currentDir ); |
881 | dir.cdUp(); | 881 | dir.cdUp(); |
882 | if(dir.exists() ){ | 882 | if(dir.exists() ){ |
883 | m_currentDir = dir.absPath(); | 883 | m_currentDir = dir.absPath(); |
884 | reparse(); | 884 | reparse(); |
885 | int count = m_location->count(); | 885 | int count = m_location->count(); |
886 | slotInsertLocationPath( m_currentDir, count); | 886 | slotInsertLocationPath( m_currentDir, count); |
887 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); | 887 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); |
888 | //this wont work in all instances | 888 | //this wont work in all instances |
889 | // FIXME | 889 | // FIXME |
890 | } | 890 | } |
891 | } | 891 | } |
892 | void OFileSelector::slotHome() | 892 | void OFileSelector::slotHome() |
893 | { | 893 | { |
894 | cd(QDir::homeDirPath() ); | 894 | cd(QDir::homeDirPath() ); |
895 | } | 895 | } |
896 | void OFileSelector::slotDoc() | 896 | void OFileSelector::slotDoc() |
897 | { | 897 | { |
898 | cd(QPEApplication::documentDir() ); | 898 | cd(QPEApplication::documentDir() ); |
899 | } | 899 | } |
900 | void OFileSelector::slotNavigate( ) | 900 | void OFileSelector::slotNavigate( ) |
901 | { | 901 | { |
902 | 902 | ||
903 | } | 903 | } |
904 | // fill the View with life | 904 | // fill the View with life |
905 | void OFileSelector::reparse() | 905 | void OFileSelector::reparse() |
906 | { | 906 | { |
907 | if( m_selector == Normal ) | 907 | if( m_selector == Normal ) |
908 | return; | 908 | return; |
909 | 909 | ||
910 | currentView()->clear(); | 910 | currentView()->clear(); |
911 | 911 | ||
912 | if( m_shChooser) | 912 | if( m_shChooser) |
913 | qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); | 913 | qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); |
914 | 914 | ||
915 | QString currentMimeType; | 915 | QString currentMimeType; |
916 | 916 | ||
917 | // let's update the mimetype | 917 | // let's update the mimetype |
918 | if( m_autoMime ){ | 918 | if( m_autoMime ){ |
919 | m_mimetypes.clear(); | 919 | m_mimetypes.clear(); |
920 | // ok we can change mimetype so we need to be able to give a selection | 920 | // ok we can change mimetype so we need to be able to give a selection |
921 | if( m_shChooser ) { | 921 | if( m_shChooser ) { |
922 | currentMimeType = m_mimeCheck->currentText(); | 922 | currentMimeType = m_mimeCheck->currentText(); |
923 | m_mimeCheck->clear(); | 923 | m_mimeCheck->clear(); |
924 | 924 | ||
925 | // let's find possible mimetypes | 925 | // let's find possible mimetypes |
926 | m_mimetypes = currentLister()->mimeTypes( m_currentDir ); | 926 | m_mimetypes = currentLister()->mimeTypes( m_currentDir ); |
927 | 927 | ||
928 | // add them to the chooser | 928 | // add them to the chooser |
929 | updateMimeCheck(); | 929 | updateMimeCheck(); |
930 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); | 930 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); |
931 | currentMimeType = m_mimeCheck->currentText(); | 931 | currentMimeType = m_mimeCheck->currentText(); |
932 | } | 932 | } |
933 | }else { // no autoMime | 933 | }else { // no autoMime |
934 | // let the mimetype be set from out side the m_mimeCheck FEATURE | 934 | // let the mimetype be set from out side the m_mimeCheck FEATURE |
935 | 935 | ||
936 | if( m_shChooser ) | 936 | if( m_shChooser ) |
937 | currentMimeType = m_mimeCheck->currentText(); | 937 | currentMimeType = m_mimeCheck->currentText(); |
938 | 938 | ||
939 | } | 939 | } |
940 | // now we got our mimetypes we can add the files | 940 | // now we got our mimetypes we can add the files |
941 | 941 | ||
942 | currentLister()->reparse( m_currentDir ); | 942 | currentLister()->reparse( m_currentDir ); |
943 | /* we're done with adding let's sort */ | 943 | /* we're done with adding let's sort */ |
944 | currentView()->sort(); | 944 | currentView()->sort(); |
945 | 945 | ||
946 | 946 | ||
947 | if( m_shTool ){ | 947 | if( m_shTool ){ |
948 | m_location->insertItem( m_currentDir ); | 948 | m_location->insertItem( m_currentDir ); |
949 | 949 | ||
950 | } | 950 | } |
951 | // reenable painting and updates | 951 | // reenable painting and updates |
952 | } | 952 | } |
953 | 953 | ||
954 | 954 | ||
955 | OFileView* OFileSelector::currentView() { | 955 | OFileView* OFileSelector::currentView() { |
956 | return m_fileView; | 956 | return m_fileView; |
957 | } | 957 | } |
958 | OFileView* OFileSelector::currentView() const{ | 958 | OFileView* OFileSelector::currentView() const{ |
959 | return m_fileView; | 959 | return m_fileView; |
960 | } | 960 | } |
961 | int OFileSelector::filter() { | 961 | int OFileSelector::filter() { |
962 | int filter; | 962 | int filter; |
963 | if ( m_selector == ExtendedAll ) | 963 | if ( m_selector == ExtendedAll ) |
964 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 964 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
965 | else | 965 | else |
966 | filter = QDir::Files | QDir::Dirs | QDir::All ; | 966 | filter = QDir::Files | QDir::Dirs | QDir::All ; |
967 | 967 | ||
968 | return filter; | 968 | return filter; |
969 | } | 969 | } |
970 | int OFileSelector::sorting() { | 970 | int OFileSelector::sorting() { |
971 | int sort; | 971 | int sort; |
972 | 972 | ||
973 | if (m_case ) | 973 | if (m_case ) |
974 | sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 974 | sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
975 | else | 975 | else |
976 | sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 976 | sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
977 | 977 | ||
978 | return sort; | 978 | return sort; |
979 | } | 979 | } |
980 | void OFileSelector::internFileSelected( const QString& s) { | 980 | void OFileSelector::internFileSelected( const QString& s) { |
981 | emit fileSelected( s ); | 981 | emit fileSelected( s ); |
982 | } | 982 | } |
983 | void OFileSelector::internFileSelected( const DocLnk& d ) { | 983 | void OFileSelector::internFileSelected( const DocLnk& d ) { |
984 | emit fileSelected( d ); | 984 | emit fileSelected( d ); |
985 | } | 985 | } |
986 | void OFileSelector::internContextMenu() { | 986 | void OFileSelector::internContextMenu() { |
987 | emit contextMenu(); | 987 | emit contextMenu(); |
988 | } | 988 | } |
989 | void OFileSelector::internChangedDir( const QString& s) { | 989 | void OFileSelector::internChangedDir( const QString& s) { |
990 | emit dirSelected( s ); | 990 | emit dirSelected( s ); |
991 | cd(s ); | 991 | cd(s ); |
992 | } | 992 | } |
993 | void OFileSelector::internChangedDir( const QDir& s) { | 993 | void OFileSelector::internChangedDir( const QDir& s) { |
994 | emit dirSelected( s ); | 994 | emit dirSelected( s ); |
995 | } | 995 | } |
996 | QPixmap OFileSelector::pixmap( const QString& s ) { | 996 | QPixmap OFileSelector::pixmap( const QString& s ) { |
997 | 997 | ||
998 | return (*m_pixmaps)[s]; | 998 | return (*m_pixmaps)[s]; |
999 | } | 999 | } |
1000 | OLister* OFileSelector::currentLister()const { | 1000 | OLister* OFileSelector::currentLister()const { |
1001 | return m_lister; | 1001 | return m_lister; |
1002 | } | 1002 | } |
1003 | void OFileSelector::initializeOldSelector() { | 1003 | void OFileSelector::initializeOldSelector() { |
1004 | qWarning("initializeOldSelector"); | 1004 | qWarning("initializeOldSelector"); |
1005 | 1005 | ||
1006 | delete m_select; | 1006 | delete m_select; |
1007 | 1007 | ||
1008 | // we need to initialize but keep the selected mimetype | 1008 | // we need to initialize but keep the selected mimetype |
1009 | /* we default not to show close and new buttons */ | 1009 | /* we default not to show close and new buttons */ |
1010 | QString mime = currentMimeType(); | 1010 | QString mime = currentMimeType(); |
1011 | qWarning("MimeType " + mime ); | 1011 | qWarning("MimeType " + mime ); |
1012 | m_select = new FileSelector( mime , | 1012 | m_select = new FileSelector( mime , |
1013 | m_mainView, "fileselector", | 1013 | m_mainView, "fileselector", |
1014 | FALSE, FALSE); | 1014 | FALSE, FALSE); |
1015 | m_select->setCategorySelectVisible( FALSE ); | ||
1016 | m_select->setTypeComboVisible( FALSE ); | ||
1015 | 1017 | ||
1016 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 1018 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
1017 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 1019 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
1018 | connect(m_select, SIGNAL(closeMe() ), | 1020 | connect(m_select, SIGNAL(closeMe() ), |
1019 | this, SIGNAL(closeMe() ) ); | 1021 | this, SIGNAL(closeMe() ) ); |
1020 | //connect to close me and other signals as well | 1022 | //connect to close me and other signals as well |
1021 | m_mainView->setWidget( m_select ); | 1023 | m_mainView->setWidget( m_select ); |
1022 | } | 1024 | } |