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 | |||
@@ -823,200 +823,202 @@ bool OFileSelector::compliesMime( const QString& mime ) { | |||
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 | } |