-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 24 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 3 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 1 |
3 files changed, 26 insertions, 2 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 @@ -530,6 +530,14 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) return false; } +/** + * @return true if the item show all files or directories + */ +bool OFileViewFileListView::allItem( const QString& item )const +{ + return m_sel->allItem( item ); +} + void OFileViewFileListView::connectSlots() { connect(m_view, SIGNAL(clicked(QListViewItem*) ), @@ -817,7 +825,7 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent ) void OFileViewFileSystem::activate( const QString& str) { - m_all = ( str.find( "All" ) != -1 ); + m_all = m_view->allItem( str ); } @@ -867,6 +875,8 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, m_mode = mode; m_selector = sel; + m_allList = new QStringList(); + initUI(); m_lneEdit->setText( fileName ); initMime(); @@ -1023,10 +1033,12 @@ void OFileSelector::initViews() { m_views.insert( QObject::tr("Directories"), in ); m_views.insert( QObject::tr("All Directories"), in ); + m_allList->append( QObject::tr("All Directories") ); } else { m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); m_views.insert( QObject::tr("Files"), in ); m_views.insert( QObject::tr("All Files"), in ); + m_allList->append( QObject::tr("All Files") ); } } @@ -1146,6 +1158,14 @@ int OFileSelector::selector()const return m_selector; } +/** + * @return true if the item show all files or directories + */ +bool OFileSelector::allItem( const QString& item )const +{ + return ( m_allList->findIndex( item ) != -1 ); +} + QStringList OFileSelector::currentMimeType()const { return m_mimeType[m_cmbMime->currentText()]; @@ -1175,7 +1195,6 @@ void OFileSelector::slotViewChange( const QString& view ) if (!interface) return; - interface->activate( view ); if (m_current) m_stack->removeWidget( m_current->widget( m_stack ) ); @@ -1184,6 +1203,7 @@ void OFileSelector::slotViewChange( const QString& view ) m_stack->addWidget( interface->widget(m_stack), id ); m_stack->raiseWidget( id ); + interface->activate( view ); interface->reread(); m_current = interface; 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 @@ -121,6 +121,7 @@ public: int mode()const; int selector()const; + bool allItem( const QString& )const; /** * Set the Icon visible @@ -212,6 +213,8 @@ private: int m_mode; int m_selector; + QStringList* m_allList; + struct Data; // used for future versions Data *d; 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 @@ -152,6 +152,7 @@ public: void reread( bool all = false ); int fileCount()const; QString currentDir()const; + bool allItem( const QString& )const; protected: bool eventFilter (QObject *o, QEvent *e); private slots: |