-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 26 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 3 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 1 |
3 files changed, 27 insertions, 3 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 346eeae..e8d502f 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -509,48 +509,56 @@ int OFileViewFileListView::fileCount()const | |||
509 | QString OFileViewFileListView::currentDir()const | 509 | QString OFileViewFileListView::currentDir()const |
510 | { | 510 | { |
511 | return m_currentDir; | 511 | return m_currentDir; |
512 | } | 512 | } |
513 | 513 | ||
514 | OFileSelector* OFileViewFileListView::selector() | 514 | OFileSelector* OFileViewFileListView::selector() |
515 | { | 515 | { |
516 | return m_sel; | 516 | return m_sel; |
517 | } | 517 | } |
518 | 518 | ||
519 | bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) | 519 | bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) |
520 | { | 520 | { |
521 | if ( e->type() == QEvent::KeyPress ) | 521 | if ( e->type() == QEvent::KeyPress ) |
522 | { | 522 | { |
523 | QKeyEvent *k = (QKeyEvent *)e; | 523 | QKeyEvent *k = (QKeyEvent *)e; |
524 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) | 524 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) |
525 | { | 525 | { |
526 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 526 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
527 | return true; | 527 | return true; |
528 | } | 528 | } |
529 | } | 529 | } |
530 | return false; | 530 | return false; |
531 | } | 531 | } |
532 | 532 | ||
533 | /** | ||
534 | * @return true if the item show all files or directories | ||
535 | */ | ||
536 | bool OFileViewFileListView::allItem( const QString& item )const | ||
537 | { | ||
538 | return m_sel->allItem( item ); | ||
539 | } | ||
540 | |||
533 | void OFileViewFileListView::connectSlots() | 541 | void OFileViewFileListView::connectSlots() |
534 | { | 542 | { |
535 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 543 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
536 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 544 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
537 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), | 545 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
538 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); | 546 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
539 | } | 547 | } |
540 | 548 | ||
541 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) | 549 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) |
542 | { | 550 | { |
543 | if (!item) | 551 | if (!item) |
544 | return; | 552 | return; |
545 | #if 0 | 553 | #if 0 |
546 | 554 | ||
547 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 555 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
548 | 556 | ||
549 | if (!sel->isDir() ) | 557 | if (!sel->isDir() ) |
550 | { | 558 | { |
551 | selector()->m_lneEdit->setText( sel->text(1) ); | 559 | selector()->m_lneEdit->setText( sel->text(1) ); |
552 | // if in fileselector mode we will emit selected | 560 | // if in fileselector mode we will emit selected |
553 | if ( selector()->mode() == OFileSelector::FileSelector ) | 561 | if ( selector()->mode() == OFileSelector::FileSelector ) |
554 | { | 562 | { |
555 | odebug << "slot Current Changed" << oendl; | 563 | odebug << "slot Current Changed" << oendl; |
556 | QStringList str = QStringList::split("->", sel->text(1) ); | 564 | QStringList str = QStringList::split("->", sel->text(1) ); |
@@ -794,51 +802,51 @@ QString OFileViewFileSystem::directory()const | |||
794 | void OFileViewFileSystem::reread() | 802 | void OFileViewFileSystem::reread() |
795 | { | 803 | { |
796 | if (!m_view) | 804 | if (!m_view) |
797 | return; | 805 | return; |
798 | 806 | ||
799 | m_view->reread( m_all ); | 807 | m_view->reread( m_all ); |
800 | } | 808 | } |
801 | 809 | ||
802 | int OFileViewFileSystem::fileCount()const | 810 | int OFileViewFileSystem::fileCount()const |
803 | { | 811 | { |
804 | if (!m_view ) | 812 | if (!m_view ) |
805 | return -1; | 813 | return -1; |
806 | return m_view->fileCount(); | 814 | return m_view->fileCount(); |
807 | } | 815 | } |
808 | 816 | ||
809 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) | 817 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) |
810 | { | 818 | { |
811 | if (!m_view ) | 819 | if (!m_view ) |
812 | { | 820 | { |
813 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); | 821 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); |
814 | } | 822 | } |
815 | return m_view; | 823 | return m_view; |
816 | } | 824 | } |
817 | 825 | ||
818 | void OFileViewFileSystem::activate( const QString& str) | 826 | void OFileViewFileSystem::activate( const QString& str ) |
819 | { | 827 | { |
820 | m_all = ( str.find( "All" ) != -1 ); | 828 | m_all = m_view->allItem( str ); |
821 | } | 829 | } |
822 | 830 | ||
823 | 831 | ||
824 | } | 832 | } |
825 | /* Selector */ | 833 | /* Selector */ |
826 | /** | 834 | /** |
827 | * @short new and complete c'tor | 835 | * @short new and complete c'tor |
828 | * | 836 | * |
829 | * Create a OFileSelector to let the user select a file. It can | 837 | * Create a OFileSelector to let the user select a file. It can |
830 | * either be used to open a file, select a save name in a dir or | 838 | * either be used to open a file, select a save name in a dir or |
831 | * as a dropin for the FileSelector. | 839 | * as a dropin for the FileSelector. |
832 | * | 840 | * |
833 | * <pre> | 841 | * <pre> |
834 | * QMap<QString, QStringList> mimeTypes; | 842 | * QMap<QString, QStringList> mimeTypes; |
835 | * QStringList types; | 843 | * QStringList types; |
836 | * types << "text@slash* "; | 844 | * types << "text@slash* "; |
837 | * types << "audio@slash*"; | 845 | * types << "audio@slash*"; |
838 | * mimeTypes.insert( tr("Audio and Text"), types ); | 846 | * mimeTypes.insert( tr("Audio and Text"), types ); |
839 | * mimeTypes.insert( tr("All"), "*@slash*); | 847 | * mimeTypes.insert( tr("All"), "*@slash*); |
840 | * | 848 | * |
841 | * now you could create your fileselector | 849 | * now you could create your fileselector |
842 | * </pre> | 850 | * </pre> |
843 | * | 851 | * |
844 | * | 852 | * |
@@ -846,48 +854,50 @@ void OFileViewFileSystem::activate( const QString& str) | |||
846 | * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) | 854 | * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) |
847 | * @param sel The selector to be used | 855 | * @param sel The selector to be used |
848 | * @param dirName The name of the dir to start int | 856 | * @param dirName The name of the dir to start int |
849 | * @param fileName The fileName placed in the fileselector lineedit | 857 | * @param fileName The fileName placed in the fileselector lineedit |
850 | * @param mimetypes The MimeType map of used mimetypes | 858 | * @param mimetypes The MimeType map of used mimetypes |
851 | * @param showNew Show a New Button. Most likely to be used in the FileSelector view. | 859 | * @param showNew Show a New Button. Most likely to be used in the FileSelector view. |
852 | * @param showClose Show a Close Button. Most likely to be used in FileSelector view. | 860 | * @param showClose Show a Close Button. Most likely to be used in FileSelector view. |
853 | * | 861 | * |
854 | */ | 862 | */ |
855 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | 863 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, |
856 | const QString& dirName, const QString& fileName, | 864 | const QString& dirName, const QString& fileName, |
857 | const MimeTypes& mimetypes, | 865 | const MimeTypes& mimetypes, |
858 | bool showNew, bool showClose) | 866 | bool showNew, bool showClose) |
859 | :QWidget( parent, "OFileSelector" ) | 867 | :QWidget( parent, "OFileSelector" ) |
860 | { | 868 | { |
861 | m_current = 0; | 869 | m_current = 0; |
862 | m_shNew = showNew; | 870 | m_shNew = showNew; |
863 | m_shClose = showClose; | 871 | m_shClose = showClose; |
864 | m_mimeType = mimetypes; | 872 | m_mimeType = mimetypes; |
865 | m_startDir = dirName; | 873 | m_startDir = dirName; |
866 | 874 | ||
867 | m_mode = mode; | 875 | m_mode = mode; |
868 | m_selector = sel; | 876 | m_selector = sel; |
869 | 877 | ||
878 | m_allList = new QStringList(); | ||
879 | |||
870 | initUI(); | 880 | initUI(); |
871 | m_lneEdit->setText( fileName ); | 881 | m_lneEdit->setText( fileName ); |
872 | initMime(); | 882 | initMime(); |
873 | initViews(); | 883 | initViews(); |
874 | 884 | ||
875 | QString str; | 885 | QString str; |
876 | switch ( m_selector ) | 886 | switch ( m_selector ) |
877 | { | 887 | { |
878 | default: | 888 | default: |
879 | case Normal: | 889 | case Normal: |
880 | if ( m_mode == DIRECTORYSELECTOR ) | 890 | if ( m_mode == DIRECTORYSELECTOR ) |
881 | str = QObject::tr("Directories"); | 891 | str = QObject::tr("Directories"); |
882 | else | 892 | else |
883 | str = QObject::tr("Documents"); | 893 | str = QObject::tr("Documents"); |
884 | m_cmbView->setCurrentItem( 0 ); | 894 | m_cmbView->setCurrentItem( 0 ); |
885 | break; | 895 | break; |
886 | case Extended: | 896 | case Extended: |
887 | if ( m_mode == DIRECTORYSELECTOR ) | 897 | if ( m_mode == DIRECTORYSELECTOR ) |
888 | { | 898 | { |
889 | str = QObject::tr("Directories"); | 899 | str = QObject::tr("Directories"); |
890 | m_cmbView->setCurrentItem( 0 ); | 900 | m_cmbView->setCurrentItem( 0 ); |
891 | } else { | 901 | } else { |
892 | str = QObject::tr("Files"); | 902 | str = QObject::tr("Files"); |
893 | m_cmbView->setCurrentItem( 1 ); | 903 | m_cmbView->setCurrentItem( 1 ); |
@@ -1002,52 +1012,54 @@ void OFileSelector::initMime() | |||
1002 | } | 1012 | } |
1003 | 1013 | ||
1004 | void OFileSelector::initViews() | 1014 | void OFileSelector::initViews() |
1005 | { | 1015 | { |
1006 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) | 1016 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
1007 | { | 1017 | { |
1008 | m_cmbView->insertItem( QObject::tr("Directories") ); | 1018 | m_cmbView->insertItem( QObject::tr("Directories") ); |
1009 | m_cmbView->insertItem( QObject::tr("All Directories") ); | 1019 | m_cmbView->insertItem( QObject::tr("All Directories") ); |
1010 | } else { | 1020 | } else { |
1011 | m_cmbView->insertItem( QObject::tr("Documents") ); | 1021 | m_cmbView->insertItem( QObject::tr("Documents") ); |
1012 | m_cmbView->insertItem( QObject::tr("Files") ); | 1022 | m_cmbView->insertItem( QObject::tr("Files") ); |
1013 | m_cmbView->insertItem( QObject::tr("All Files") ); | 1023 | m_cmbView->insertItem( QObject::tr("All Files") ); |
1014 | } | 1024 | } |
1015 | 1025 | ||
1016 | connect(m_cmbView, SIGNAL(activated(const QString&) ), | 1026 | connect(m_cmbView, SIGNAL(activated(const QString&) ), |
1017 | this, SLOT(slotViewChange(const QString&) ) ); | 1027 | this, SLOT(slotViewChange(const QString&) ) ); |
1018 | 1028 | ||
1019 | /* see above why add both */ | 1029 | /* see above why add both */ |
1020 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 1030 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
1021 | 1031 | ||
1022 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) | 1032 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
1023 | { | 1033 | { |
1024 | m_views.insert( QObject::tr("Directories"), in ); | 1034 | m_views.insert( QObject::tr("Directories"), in ); |
1025 | m_views.insert( QObject::tr("All Directories"), in ); | 1035 | m_views.insert( QObject::tr("All Directories"), in ); |
1036 | m_allList->append( QObject::tr("All Directories") ); | ||
1026 | } else { | 1037 | } else { |
1027 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | 1038 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); |
1028 | m_views.insert( QObject::tr("Files"), in ); | 1039 | m_views.insert( QObject::tr("Files"), in ); |
1029 | m_views.insert( QObject::tr("All Files"), in ); | 1040 | m_views.insert( QObject::tr("All Files"), in ); |
1041 | m_allList->append( QObject::tr("All Files") ); | ||
1030 | } | 1042 | } |
1031 | } | 1043 | } |
1032 | 1044 | ||
1033 | void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { | 1045 | void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { |
1034 | m_viewsPtr.append( iface ); | 1046 | m_viewsPtr.append( iface ); |
1035 | } | 1047 | } |
1036 | 1048 | ||
1037 | 1049 | ||
1038 | /** | 1050 | /** |
1039 | * d'tor | 1051 | * d'tor |
1040 | */ | 1052 | */ |
1041 | OFileSelector::~OFileSelector() | 1053 | OFileSelector::~OFileSelector() |
1042 | { | 1054 | { |
1043 | m_viewsPtr.setAutoDelete( true ); | 1055 | m_viewsPtr.setAutoDelete( true ); |
1044 | m_viewsPtr.clear(); | 1056 | m_viewsPtr.clear(); |
1045 | } | 1057 | } |
1046 | 1058 | ||
1047 | 1059 | ||
1048 | 1060 | ||
1049 | /** | 1061 | /** |
1050 | * Convience function for the fileselector | 1062 | * Convience function for the fileselector |
1051 | * make sure to delete the DocLnk | 1063 | * make sure to delete the DocLnk |
1052 | * | 1064 | * |
1053 | * @see DocLnk | 1065 | * @see DocLnk |
@@ -1125,86 +1137,94 @@ bool OFileSelector::showClose()const | |||
1125 | } | 1137 | } |
1126 | 1138 | ||
1127 | MimeTypes OFileSelector::mimeTypes()const | 1139 | MimeTypes OFileSelector::mimeTypes()const |
1128 | { | 1140 | { |
1129 | return m_mimeType; | 1141 | return m_mimeType; |
1130 | } | 1142 | } |
1131 | 1143 | ||
1132 | /** | 1144 | /** |
1133 | * @return the Mode of the OFileSelector | 1145 | * @return the Mode of the OFileSelector |
1134 | */ | 1146 | */ |
1135 | int OFileSelector::mode()const | 1147 | int OFileSelector::mode()const |
1136 | { | 1148 | { |
1137 | return m_mode; | 1149 | return m_mode; |
1138 | } | 1150 | } |
1139 | 1151 | ||
1140 | 1152 | ||
1141 | /** | 1153 | /** |
1142 | * @return the Selector of the OFileSelector | 1154 | * @return the Selector of the OFileSelector |
1143 | */ | 1155 | */ |
1144 | int OFileSelector::selector()const | 1156 | int OFileSelector::selector()const |
1145 | { | 1157 | { |
1146 | return m_selector; | 1158 | return m_selector; |
1147 | } | 1159 | } |
1148 | 1160 | ||
1161 | /** | ||
1162 | * @return true if the item show all files or directories | ||
1163 | */ | ||
1164 | bool OFileSelector::allItem( const QString& item )const | ||
1165 | { | ||
1166 | return ( m_allList->findIndex( item ) != -1 ); | ||
1167 | } | ||
1168 | |||
1149 | QStringList OFileSelector::currentMimeType()const | 1169 | QStringList OFileSelector::currentMimeType()const |
1150 | { | 1170 | { |
1151 | return m_mimeType[m_cmbMime->currentText()]; | 1171 | return m_mimeType[m_cmbMime->currentText()]; |
1152 | } | 1172 | } |
1153 | 1173 | ||
1154 | void OFileSelector::slotMimeTypeChanged() | 1174 | void OFileSelector::slotMimeTypeChanged() |
1155 | { | 1175 | { |
1156 | reread(); | 1176 | reread(); |
1157 | } | 1177 | } |
1158 | 1178 | ||
1159 | void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) | 1179 | void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) |
1160 | { | 1180 | { |
1161 | m_lneEdit->setText( lnk.name() ); | 1181 | m_lneEdit->setText( lnk.name() ); |
1162 | emit fileSelected( lnk ); | 1182 | emit fileSelected( lnk ); |
1163 | emit fileSelected( lnk.name() ); | 1183 | emit fileSelected( lnk.name() ); |
1164 | } | 1184 | } |
1165 | 1185 | ||
1166 | void OFileSelector::slotFileBridge( const QString& str) | 1186 | void OFileSelector::slotFileBridge( const QString& str) |
1167 | { | 1187 | { |
1168 | DocLnk lnk( str ); | 1188 | DocLnk lnk( str ); |
1169 | emit fileSelected( lnk ); | 1189 | emit fileSelected( lnk ); |
1170 | } | 1190 | } |
1171 | 1191 | ||
1172 | void OFileSelector::slotViewChange( const QString& view ) | 1192 | void OFileSelector::slotViewChange( const QString& view ) |
1173 | { | 1193 | { |
1174 | OFileViewInterface* interface = m_views[view]; | 1194 | OFileViewInterface* interface = m_views[view]; |
1175 | if (!interface) | 1195 | if (!interface) |
1176 | return; | 1196 | return; |
1177 | 1197 | ||
1178 | interface->activate( view ); | ||
1179 | if (m_current) | 1198 | if (m_current) |
1180 | m_stack->removeWidget( m_current->widget( m_stack ) ); | 1199 | m_stack->removeWidget( m_current->widget( m_stack ) ); |
1181 | 1200 | ||
1182 | static int id = 1; | 1201 | static int id = 1; |
1183 | 1202 | ||
1184 | m_stack->addWidget( interface->widget(m_stack), id ); | 1203 | m_stack->addWidget( interface->widget(m_stack), id ); |
1185 | m_stack->raiseWidget( id ); | 1204 | m_stack->raiseWidget( id ); |
1186 | 1205 | ||
1206 | interface->activate( view ); | ||
1187 | interface->reread(); | 1207 | interface->reread(); |
1188 | m_current = interface; | 1208 | m_current = interface; |
1189 | 1209 | ||
1190 | id++; | 1210 | id++; |
1191 | } | 1211 | } |
1192 | 1212 | ||
1193 | void OFileSelector::setNewVisible( bool b ) | 1213 | void OFileSelector::setNewVisible( bool b ) |
1194 | { | 1214 | { |
1195 | m_shNew = b; | 1215 | m_shNew = b; |
1196 | currentView()->reread(); | 1216 | currentView()->reread(); |
1197 | } | 1217 | } |
1198 | 1218 | ||
1199 | void OFileSelector::setCloseVisible( bool b ) | 1219 | void OFileSelector::setCloseVisible( bool b ) |
1200 | { | 1220 | { |
1201 | m_shClose = b; | 1221 | m_shClose = b; |
1202 | currentView()->reread(); | 1222 | currentView()->reread(); |
1203 | } | 1223 | } |
1204 | 1224 | ||
1205 | void OFileSelector::setNameVisible( bool b ) | 1225 | void OFileSelector::setNameVisible( bool b ) |
1206 | { | 1226 | { |
1207 | if ( b ) | 1227 | if ( b ) |
1208 | m_nameBox->show(); | 1228 | m_nameBox->show(); |
1209 | else | 1229 | else |
1210 | m_nameBox->hide(); | 1230 | m_nameBox->hide(); |
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h index b1cd405..d96712a 100644 --- a/libopie2/opieui/fileselector/ofileselector.h +++ b/libopie2/opieui/fileselector/ofileselector.h | |||
@@ -100,48 +100,49 @@ public: | |||
100 | 100 | ||
101 | OFileSelector(QWidget* parent, int mode, int selector, | 101 | OFileSelector(QWidget* parent, int mode, int selector, |
102 | const QString& dirName, | 102 | const QString& dirName, |
103 | const QString& fileName, | 103 | const QString& fileName, |
104 | const MimeTypes& mimetypes = MimeTypes(), | 104 | const MimeTypes& mimetypes = MimeTypes(), |
105 | bool newVisible = FALSE, bool closeVisible = FALSE ); | 105 | bool newVisible = FALSE, bool closeVisible = FALSE ); |
106 | 106 | ||
107 | OFileSelector(const QString& mimeFilter, QWidget* parent, | 107 | OFileSelector(const QString& mimeFilter, QWidget* parent, |
108 | const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); | 108 | const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); |
109 | ~OFileSelector(); | 109 | ~OFileSelector(); |
110 | 110 | ||
111 | const DocLnk* selected(); | 111 | const DocLnk* selected(); |
112 | 112 | ||
113 | QString selectedName()const; | 113 | QString selectedName()const; |
114 | QString selectedPath()const; | 114 | QString selectedPath()const; |
115 | QString directory()const; | 115 | QString directory()const; |
116 | 116 | ||
117 | DocLnk selectedDocument()const; | 117 | DocLnk selectedDocument()const; |
118 | 118 | ||
119 | int fileCount()const; | 119 | int fileCount()const; |
120 | void reread(); | 120 | void reread(); |
121 | 121 | ||
122 | int mode()const; | 122 | int mode()const; |
123 | int selector()const; | 123 | int selector()const; |
124 | bool allItem( const QString& )const; | ||
124 | 125 | ||
125 | /** | 126 | /** |
126 | * Set the Icon visible | 127 | * Set the Icon visible |
127 | * @param b Show or Hide the New Button | 128 | * @param b Show or Hide the New Button |
128 | */ | 129 | */ |
129 | void setNewVisible( bool b ); | 130 | void setNewVisible( bool b ); |
130 | 131 | ||
131 | /** | 132 | /** |
132 | * Set the Icon visible | 133 | * Set the Icon visible |
133 | */ | 134 | */ |
134 | void setCloseVisible( bool b ); | 135 | void setCloseVisible( bool b ); |
135 | 136 | ||
136 | /** | 137 | /** |
137 | * Set the Name Line visible | 138 | * Set the Name Line visible |
138 | */ | 139 | */ |
139 | void setNameVisible( bool b ); | 140 | void setNameVisible( bool b ); |
140 | 141 | ||
141 | signals: | 142 | signals: |
142 | /** | 143 | /** |
143 | * dirSelected is emitted whenever changed into a different dir | 144 | * dirSelected is emitted whenever changed into a different dir |
144 | */ | 145 | */ |
145 | void dirSelected( const QString& ); | 146 | void dirSelected( const QString& ); |
146 | 147 | ||
147 | /** | 148 | /** |
@@ -191,43 +192,45 @@ private: | |||
191 | * This happens on creation of a OFileViewInterface | 192 | * This happens on creation of a OFileViewInterface |
192 | */ | 193 | */ |
193 | void registerView( const Internal::OFileViewInterface* ); | 194 | void registerView( const Internal::OFileViewInterface* ); |
194 | 195 | ||
195 | private: | 196 | private: |
196 | QLineEdit* m_lneEdit; // the LineEdit for the Name | 197 | QLineEdit* m_lneEdit; // the LineEdit for the Name |
197 | QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType | 198 | QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType |
198 | QWidgetStack* m_stack; // our widget stack which will contain the views | 199 | QWidgetStack* m_stack; // our widget stack which will contain the views |
199 | Internal::OFileViewInterface* currentView() const; // returns the currentView | 200 | Internal::OFileViewInterface* currentView() const; // returns the currentView |
200 | Internal::OFileViewInterface* m_current; // here is the view saved | 201 | Internal::OFileViewInterface* m_current; // here is the view saved |
201 | bool m_shNew : 1; // should we show New? | 202 | bool m_shNew : 1; // should we show New? |
202 | bool m_shClose : 1; // should we show Close? | 203 | bool m_shClose : 1; // should we show Close? |
203 | MimeTypes m_mimeType; // list of mimetypes | 204 | MimeTypes m_mimeType; // list of mimetypes |
204 | 205 | ||
205 | QMap<QString, Internal::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr | 206 | QMap<QString, Internal::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr |
206 | /* views register themselves automatically */ | 207 | /* views register themselves automatically */ |
207 | QList<Internal::OFileViewInterface> m_viewsPtr; | 208 | QList<Internal::OFileViewInterface> m_viewsPtr; |
208 | QHBox* m_nameBox; // the LineEdit + Label is hold here | 209 | QHBox* m_nameBox; // the LineEdit + Label is hold here |
209 | QHBox* m_cmbBox; // this holds the two combo boxes | 210 | QHBox* m_cmbBox; // this holds the two combo boxes |
210 | 211 | ||
211 | QString m_startDir; | 212 | QString m_startDir; |
212 | int m_mode; | 213 | int m_mode; |
213 | int m_selector; | 214 | int m_selector; |
214 | 215 | ||
216 | QStringList* m_allList; | ||
217 | |||
215 | struct Data; // used for future versions | 218 | struct Data; // used for future versions |
216 | Data *d; | 219 | Data *d; |
217 | 220 | ||
218 | private slots: | 221 | private slots: |
219 | void slotMimeTypeChanged(); | 222 | void slotMimeTypeChanged(); |
220 | 223 | ||
221 | /* will set the text of the lineedit and emit a fileChanged signal */ | 224 | /* will set the text of the lineedit and emit a fileChanged signal */ |
222 | void slotDocLnkBridge( const DocLnk& ); | 225 | void slotDocLnkBridge( const DocLnk& ); |
223 | void slotFileBridge( const QString& ); | 226 | void slotFileBridge( const QString& ); |
224 | void slotViewChange( const QString& ); | 227 | void slotViewChange( const QString& ); |
225 | 228 | ||
226 | bool eventFilter (QObject *o, QEvent *e); | 229 | bool eventFilter (QObject *o, QEvent *e); |
227 | 230 | ||
228 | }; | 231 | }; |
229 | 232 | ||
230 | } | 233 | } |
231 | } | 234 | } |
232 | 235 | ||
233 | #endif | 236 | #endif |
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index a3ef8e2..252a7f5 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h | |||
@@ -131,48 +131,49 @@ public: | |||
131 | ~OFileSelectorItem(); | 131 | ~OFileSelectorItem(); |
132 | bool isLocked()const; | 132 | bool isLocked()const; |
133 | bool isDir()const; | 133 | bool isDir()const; |
134 | QString directory()const; | 134 | QString directory()const; |
135 | QString path()const; | 135 | QString path()const; |
136 | QString key(int id, bool )const; | 136 | QString key(int id, bool )const; |
137 | 137 | ||
138 | private: | 138 | private: |
139 | bool m_locked : 1; | 139 | bool m_locked : 1; |
140 | bool m_isDir : 1; | 140 | bool m_isDir : 1; |
141 | QString m_dir; | 141 | QString m_dir; |
142 | }; | 142 | }; |
143 | 143 | ||
144 | class OFileViewFileListView : public QWidget | 144 | class OFileViewFileListView : public QWidget |
145 | { | 145 | { |
146 | Q_OBJECT | 146 | Q_OBJECT |
147 | public: | 147 | public: |
148 | OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); | 148 | OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); |
149 | ~OFileViewFileListView(); | 149 | ~OFileViewFileListView(); |
150 | 150 | ||
151 | OFileSelectorItem* currentItem()const; | 151 | OFileSelectorItem* currentItem()const; |
152 | void reread( bool all = false ); | 152 | void reread( bool all = false ); |
153 | int fileCount()const; | 153 | int fileCount()const; |
154 | QString currentDir()const; | 154 | QString currentDir()const; |
155 | bool allItem( const QString& )const; | ||
155 | protected: | 156 | protected: |
156 | bool eventFilter (QObject *o, QEvent *e); | 157 | bool eventFilter (QObject *o, QEvent *e); |
157 | private slots: | 158 | private slots: |
158 | void slotNew(); // will emit newSelected | 159 | void slotNew(); // will emit newSelected |
159 | void cdUP(); | 160 | void cdUP(); |
160 | void cdHome(); | 161 | void cdHome(); |
161 | void cdDoc(); | 162 | void cdDoc(); |
162 | void changeDir( const QString& ); | 163 | void changeDir( const QString& ); |
163 | void slotCurrentChanged( QListViewItem* ); | 164 | void slotCurrentChanged( QListViewItem* ); |
164 | void slotClicked(int, QListViewItem*, const QPoint&, int ); | 165 | void slotClicked(int, QListViewItem*, const QPoint&, int ); |
165 | void slotFSActivated(int); | 166 | void slotFSActivated(int); |
166 | 167 | ||
167 | protected: | 168 | protected: |
168 | OFileSelector* selector(); | 169 | OFileSelector* selector(); |
169 | 170 | ||
170 | private: | 171 | private: |
171 | QMap<QString, QString> m_dev; | 172 | QMap<QString, QString> m_dev; |
172 | bool m_all : 1; | 173 | bool m_all : 1; |
173 | OFileSelector* m_sel; | 174 | OFileSelector* m_sel; |
174 | QPopupMenu* m_fsPop; | 175 | QPopupMenu* m_fsPop; |
175 | bool compliesMime( const QString& ); | 176 | bool compliesMime( const QString& ); |
176 | QStringList m_mimes; // used in compy mime | 177 | QStringList m_mimes; // used in compy mime |
177 | QString m_currentDir; | 178 | QString m_currentDir; |
178 | QToolButton *m_btnNew, *m_btnClose; | 179 | QToolButton *m_btnNew, *m_btnClose; |