author | ar <ar> | 2004-09-15 21:11:32 (UTC) |
---|---|---|
committer | ar <ar> | 2004-09-15 21:11:32 (UTC) |
commit | 6a60be54b98f1eb50df5a37454bb71bd52475f43 (patch) (unidiff) | |
tree | b14d617d0108f9612ce16e95d03c9b55b5d0cbd7 /libopie2/opieui/fileselector | |
parent | e3709ce5db7f07cbac94900cb7b66ad3e7a6f791 (diff) | |
download | opie-6a60be54b98f1eb50df5a37454bb71bd52475f43.zip opie-6a60be54b98f1eb50df5a37454bb71bd52475f43.tar.gz opie-6a60be54b98f1eb50df5a37454bb71bd52475f43.tar.bz2 |
- implement a QStringList* m_allList for show all files/directories if a "All Item" is selected. (hope the description is not too confused ;) )
Diffstat (limited to 'libopie2/opieui/fileselector') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -529,8 +529,16 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) | |||
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*) ) ); |
@@ -814,11 +822,11 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent ) | |||
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 | } |
@@ -866,8 +874,10 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
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(); |
@@ -1022,12 +1032,14 @@ void OFileSelector::initViews() | |||
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 ) { |
@@ -1145,8 +1157,16 @@ 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 | } |
@@ -1174,17 +1194,17 @@ void OFileSelector::slotViewChange( const QString& view ) | |||
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++; |
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 | |||
@@ -120,8 +120,9 @@ public: | |||
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 |
@@ -211,8 +212,10 @@ private: | |||
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: |
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 | |||
@@ -151,8 +151,9 @@ public: | |||
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 |