author | ar <ar> | 2004-08-14 19:17:39 (UTC) |
---|---|---|
committer | ar <ar> | 2004-08-14 19:17:39 (UTC) |
commit | b7e50e77e0b22b3dd0feee43b15d0152d9ca8abb (patch) (unidiff) | |
tree | 8b1812fe843ecde7b7b12f8697ca4cf8f7444c0b /libopie2/opieui/fileselector/ofileselector.cpp | |
parent | 74363a9e1d5688d65286e7fea156227b68a28002 (diff) | |
download | opie-b7e50e77e0b22b3dd0feee43b15d0152d9ca8abb.zip opie-b7e50e77e0b22b3dd0feee43b15d0152d9ca8abb.tar.gz opie-b7e50e77e0b22b3dd0feee43b15d0152d9ca8abb.tar.bz2 |
- add OFileDialog::getDirectory()
this function open a file dialog to select a directory.
it can show Directories and All Directories.
the first one is without and the second is with hidden directories.
Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 66 |
1 files changed, 48 insertions, 18 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 | |||
@@ -430,6 +430,9 @@ void OFileViewFileListView::reread( bool all ) | |||
430 | int filter; | 430 | int filter; |
431 | if (m_all ) | 431 | filter = QDir::Dirs; |
432 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 432 | if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) |
433 | else | 433 | filter = filter | QDir::Files | QDir::All; |
434 | filter = QDir::Files | QDir::Dirs | QDir::All; | 434 | |
435 | if ( m_all ) | ||
436 | filter = filter | QDir::Hidden; | ||
437 | |||
435 | dir.setFilter( filter ); | 438 | dir.setFilter( filter ); |
@@ -816,3 +819,3 @@ void OFileViewFileSystem::activate( const QString& str) | |||
816 | { | 819 | { |
817 | m_all = (str != QObject::tr("Files") ); | 820 | m_all = ( str.find( "All" ) != -1 ); |
818 | } | 821 | } |
@@ -876,3 +879,6 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
876 | case Normal: | 879 | case Normal: |
877 | str = QObject::tr("Documents"); | 880 | if ( m_mode == DIRECTORYSELECTOR ) |
881 | str = QObject::tr("Directories"); | ||
882 | else | ||
883 | str = QObject::tr("Documents"); | ||
878 | m_cmbView->setCurrentItem( 0 ); | 884 | m_cmbView->setCurrentItem( 0 ); |
@@ -880,8 +886,20 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
880 | case Extended: | 886 | case Extended: |
881 | str = QObject::tr("Files"); | 887 | if ( m_mode == DIRECTORYSELECTOR ) |
882 | m_cmbView->setCurrentItem( 1 ); | 888 | { |
889 | str = QObject::tr("Directories"); | ||
890 | m_cmbView->setCurrentItem( 0 ); | ||
891 | } else { | ||
892 | str = QObject::tr("Files"); | ||
893 | m_cmbView->setCurrentItem( 1 ); | ||
894 | } | ||
883 | break; | 895 | break; |
884 | case ExtendedAll: | 896 | case ExtendedAll: |
885 | str = QObject::tr("All Files"); | 897 | if ( m_mode == DIRECTORYSELECTOR ) |
886 | m_cmbView->setCurrentItem( 2 ); | 898 | { |
899 | str = QObject::tr("All Directories"); | ||
900 | m_cmbView->setCurrentItem( 1 ); | ||
901 | } else { | ||
902 | str = QObject::tr("All Files"); | ||
903 | m_cmbView->setCurrentItem( 2 ); | ||
904 | } | ||
887 | break; | 905 | break; |
@@ -987,5 +1005,12 @@ void OFileSelector::initViews() | |||
987 | { | 1005 | { |
988 | m_cmbView->insertItem( QObject::tr("Documents") ); | 1006 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
989 | m_cmbView->insertItem( QObject::tr("Files") ); | 1007 | { |
990 | m_cmbView->insertItem( QObject::tr("All Files") ); | 1008 | m_cmbView->insertItem( QObject::tr("Directories") ); |
1009 | m_cmbView->insertItem( QObject::tr("All Directories") ); | ||
1010 | } else { | ||
1011 | m_cmbView->insertItem( QObject::tr("Documents") ); | ||
1012 | m_cmbView->insertItem( QObject::tr("Files") ); | ||
1013 | m_cmbView->insertItem( QObject::tr("All Files") ); | ||
1014 | } | ||
1015 | |||
991 | connect(m_cmbView, SIGNAL(activated(const QString&) ), | 1016 | connect(m_cmbView, SIGNAL(activated(const QString&) ), |
@@ -993,9 +1018,14 @@ void OFileSelector::initViews() | |||
993 | 1018 | ||
994 | |||
995 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | ||
996 | |||
997 | /* see above why add both */ | 1019 | /* see above why add both */ |
998 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 1020 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
999 | m_views.insert( QObject::tr("Files"), in ); | 1021 | |
1000 | m_views.insert( QObject::tr("All Files"), in ); | 1022 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
1023 | { | ||
1024 | m_views.insert( QObject::tr("Directories"), in ); | ||
1025 | m_views.insert( QObject::tr("All Directories"), in ); | ||
1026 | } else { | ||
1027 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | ||
1028 | m_views.insert( QObject::tr("Files"), in ); | ||
1029 | m_views.insert( QObject::tr("All Files"), in ); | ||
1030 | } | ||
1001 | } | 1031 | } |