author | ar <ar> | 2004-09-17 22:30:48 (UTC) |
---|---|---|
committer | ar <ar> | 2004-09-17 22:30:48 (UTC) |
commit | 081f8a3c3a6c6d45743f451cd9dc966a135b8156 (patch) (unidiff) | |
tree | 69fc48dd6a07c4510d46118e92bc72796247de67 /libopie2/opieui/fileselector/ofileselector.cpp | |
parent | 8f14f56495dbef9dc760869da872513527cd7f91 (diff) | |
download | opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.zip opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.tar.gz opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.tar.bz2 |
- cleanup allItem handling
Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index e8d502f..01a51a2 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -153,12 +153,18 @@ QString OFileViewInterface::currentFileName()const | |||
153 | 153 | ||
154 | QString OFileViewInterface::startDirectory()const | 154 | QString OFileViewInterface::startDirectory()const |
155 | { | 155 | { |
156 | return selector()->m_startDir; | 156 | return selector()->m_startDir; |
157 | } | 157 | } |
158 | 158 | ||
159 | bool OFileViewInterface::allItem( const QString& item )const | ||
160 | { | ||
161 | return selector()->m_allList.contains( item ); | ||
162 | } | ||
163 | |||
164 | |||
159 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) | 165 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) |
160 | :OFileViewInterface( selector ) | 166 | :OFileViewInterface( selector ) |
161 | { | 167 | { |
162 | m_selector = 0; | 168 | m_selector = 0; |
163 | setName( QObject::tr("Documents") ); | 169 | setName( QObject::tr("Documents") ); |
164 | } | 170 | } |
@@ -527,20 +533,12 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) | |||
527 | return true; | 533 | return true; |
528 | } | 534 | } |
529 | } | 535 | } |
530 | return false; | 536 | return false; |
531 | } | 537 | } |
532 | 538 | ||
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 | |||
541 | void OFileViewFileListView::connectSlots() | 539 | void OFileViewFileListView::connectSlots() |
542 | { | 540 | { |
543 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 541 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
544 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 542 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
545 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), | 543 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
546 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); | 544 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
@@ -822,13 +820,13 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent ) | |||
822 | } | 820 | } |
823 | return m_view; | 821 | return m_view; |
824 | } | 822 | } |
825 | 823 | ||
826 | void OFileViewFileSystem::activate( const QString& str ) | 824 | void OFileViewFileSystem::activate( const QString& str ) |
827 | { | 825 | { |
828 | m_all = m_view->allItem( str ); | 826 | m_all = allItem( str ); |
829 | } | 827 | } |
830 | 828 | ||
831 | 829 | ||
832 | } | 830 | } |
833 | /* Selector */ | 831 | /* Selector */ |
834 | /** | 832 | /** |
@@ -872,13 +870,13 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
872 | m_mimeType = mimetypes; | 870 | m_mimeType = mimetypes; |
873 | m_startDir = dirName; | 871 | m_startDir = dirName; |
874 | 872 | ||
875 | m_mode = mode; | 873 | m_mode = mode; |
876 | m_selector = sel; | 874 | m_selector = sel; |
877 | 875 | ||
878 | m_allList = new QStringList(); | 876 | m_allList = QStringList(); |
879 | 877 | ||
880 | initUI(); | 878 | initUI(); |
881 | m_lneEdit->setText( fileName ); | 879 | m_lneEdit->setText( fileName ); |
882 | initMime(); | 880 | initMime(); |
883 | initViews(); | 881 | initViews(); |
884 | 882 | ||
@@ -1030,18 +1028,18 @@ void OFileSelector::initViews() | |||
1030 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 1028 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
1031 | 1029 | ||
1032 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) | 1030 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
1033 | { | 1031 | { |
1034 | m_views.insert( QObject::tr("Directories"), in ); | 1032 | m_views.insert( QObject::tr("Directories"), in ); |
1035 | m_views.insert( QObject::tr("All Directories"), in ); | 1033 | m_views.insert( QObject::tr("All Directories"), in ); |
1036 | m_allList->append( QObject::tr("All Directories") ); | 1034 | m_allList.append( QObject::tr("All Directories") ); |
1037 | } else { | 1035 | } else { |
1038 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | 1036 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); |
1039 | m_views.insert( QObject::tr("Files"), in ); | 1037 | m_views.insert( QObject::tr("Files"), in ); |
1040 | m_views.insert( QObject::tr("All Files"), in ); | 1038 | m_views.insert( QObject::tr("All Files"), in ); |
1041 | m_allList->append( QObject::tr("All Files") ); | 1039 | m_allList.append( QObject::tr("All Files") ); |
1042 | } | 1040 | } |
1043 | } | 1041 | } |
1044 | 1042 | ||
1045 | void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { | 1043 | void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { |
1046 | m_viewsPtr.append( iface ); | 1044 | m_viewsPtr.append( iface ); |
1047 | } | 1045 | } |
@@ -1155,20 +1153,12 @@ int OFileSelector::mode()const | |||
1155 | */ | 1153 | */ |
1156 | int OFileSelector::selector()const | 1154 | int OFileSelector::selector()const |
1157 | { | 1155 | { |
1158 | return m_selector; | 1156 | return m_selector; |
1159 | } | 1157 | } |
1160 | 1158 | ||
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 | |||
1169 | QStringList OFileSelector::currentMimeType()const | 1159 | QStringList OFileSelector::currentMimeType()const |
1170 | { | 1160 | { |
1171 | return m_mimeType[m_cmbMime->currentText()]; | 1161 | return m_mimeType[m_cmbMime->currentText()]; |
1172 | } | 1162 | } |
1173 | 1163 | ||
1174 | void OFileSelector::slotMimeTypeChanged() | 1164 | void OFileSelector::slotMimeTypeChanged() |