Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index b06defd..346eeae 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp @@ -427,12 +427,15 @@ void OFileViewFileListView::reread( bool all ) return; dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); int filter; + filter = QDir::Dirs; + if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) + filter = filter | QDir::Files | QDir::All; + if (m_all ) - filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; - else - filter = QDir::Files | QDir::Dirs | QDir::All; + filter = filter | QDir::Hidden; + dir.setFilter( filter ); // now go through all files const QFileInfoList *list = dir.entryInfoList(); @@ -813,9 +816,9 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent ) } void OFileViewFileSystem::activate( const QString& str) { - m_all = (str != QObject::tr("Files") ); + m_all = ( str.find( "All" ) != -1 ); } } @@ -873,18 +876,33 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, switch ( m_selector ) { default: case Normal: + if ( m_mode == DIRECTORYSELECTOR ) + str = QObject::tr("Directories"); + else str = QObject::tr("Documents"); m_cmbView->setCurrentItem( 0 ); break; case Extended: + if ( m_mode == DIRECTORYSELECTOR ) + { + str = QObject::tr("Directories"); + m_cmbView->setCurrentItem( 0 ); + } else { str = QObject::tr("Files"); m_cmbView->setCurrentItem( 1 ); + } break; case ExtendedAll: + if ( m_mode == DIRECTORYSELECTOR ) + { + str = QObject::tr("All Directories"); + m_cmbView->setCurrentItem( 1 ); + } else { str = QObject::tr("All Files"); m_cmbView->setCurrentItem( 2 ); + } break; } slotViewChange( str ); @@ -984,22 +1002,34 @@ void OFileSelector::initMime() } void OFileSelector::initViews() { + if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) + { + m_cmbView->insertItem( QObject::tr("Directories") ); + m_cmbView->insertItem( QObject::tr("All Directories") ); + } else { m_cmbView->insertItem( QObject::tr("Documents") ); m_cmbView->insertItem( QObject::tr("Files") ); m_cmbView->insertItem( QObject::tr("All Files") ); + } + connect(m_cmbView, SIGNAL(activated(const QString&) ), this, SLOT(slotViewChange(const QString&) ) ); - - m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); - /* see above why add both */ OFileViewInterface* in = new OFileViewFileSystem( this ); + + if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) + { + m_views.insert( QObject::tr("Directories"), in ); + m_views.insert( QObject::tr("All Directories"), in ); + } 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 ); } +} void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { m_viewsPtr.append( iface ); } |