summaryrefslogtreecommitdiff
path: root/libopie2
authorar <ar>2004-08-14 19:17:39 (UTC)
committer ar <ar>2004-08-14 19:17:39 (UTC)
commitb7e50e77e0b22b3dd0feee43b15d0152d9ca8abb (patch) (unidiff)
tree8b1812fe843ecde7b7b12f8697ca4cf8f7444c0b /libopie2
parent74363a9e1d5688d65286e7fea156227b68a28002 (diff)
downloadopie-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') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp35
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.h5
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp66
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h3
4 files changed, 89 insertions, 20 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index beb4d6c..ebce0ef 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -49,49 +49,52 @@ namespace
49 * helper to extract the dir out of a file name 49 * helper to extract the dir out of a file name
50 */ 50 */
51/** 51/**
52 * This method will use Config( argv[0] ); 52 * This method will use Config( argv[0] );
53 * @param key The group key used 53 * @param key The group key used
54 */ 54 */
55QString lastUsedDir( const QString& key ) 55QString lastUsedDir( const QString& key )
56{ 56{
57 if ( qApp->argc() < 1 ) 57 if ( qApp->argc() < 1 )
58 return QString::null; 58 return QString::null;
59 59
60 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname 60 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname
61 cfg.setGroup( key ); 61 cfg.setGroup( key );
62 return cfg.readEntry("LastDir", QPEApplication::documentDir() ); 62 return cfg.readEntry("LastDir", QPEApplication::documentDir() );
63} 63}
64 64
65void saveLastDir( const QString& key, const QString& file ) 65void saveLastDir( const QString& key, const QString& file )
66{ 66{
67 if ( qApp->argc() < 1 ) 67 if ( qApp->argc() < 1 )
68 return; 68 return;
69 69
70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); 70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() );
71 cfg.setGroup( key ); 71 cfg.setGroup( key );
72 QFileInfo inf( file ); 72 QFileInfo inf( file );
73 cfg.writeEntry("LastDir", inf.dirPath( true ) ); 73 if ( inf.isFile() )
74 cfg.writeEntry("LastDir", inf.dirPath( true ) );
75 else
76 cfg.writeEntry("LastDir", file );
74} 77}
75}; 78};
76 79
77/** 80/**
78 * This constructs a modal dialog 81 * This constructs a modal dialog
79 * 82 *
80 * @param caption The caption of the dialog 83 * @param caption The caption of the dialog
81 * @param wid The parent widget 84 * @param wid The parent widget
82 * @param mode The mode of the OFileSelector @see OFileSelector 85 * @param mode The mode of the OFileSelector @see OFileSelector
83 * @param selector The selector of the OFileSelector 86 * @param selector The selector of the OFileSelector
84 * @param dirName the dir or resource to start from 87 * @param dirName the dir or resource to start from
85 * @param fileName a proposed or existing filename 88 * @param fileName a proposed or existing filename
86 * @param mimetypes The mimeTypes 89 * @param mimetypes The mimeTypes
87 */ 90 */
88OFileDialog::OFileDialog(const QString &caption, 91OFileDialog::OFileDialog(const QString &caption,
89 QWidget *wid, int mode, int selector, 92 QWidget *wid, int mode, int selector,
90 const QString &dirName, 93 const QString &dirName,
91 const QString &fileName, 94 const QString &fileName,
92 const QMap<QString,QStringList>& mimetypes ) 95 const QMap<QString,QStringList>& mimetypes )
93 : QDialog( wid, "OFileDialog", true ) 96 : QDialog( wid, "OFileDialog", true )
94{ 97{
95 // QVBoxLayout *lay = new QVBoxLayout(this); 98 // QVBoxLayout *lay = new QVBoxLayout(this);
96 //showMaximized(); 99 //showMaximized();
97 QVBoxLayout *lay = new QVBoxLayout(this ); 100 QVBoxLayout *lay = new QVBoxLayout(this );
@@ -183,40 +186,70 @@ QString OFileDialog::getOpenFileName(int selector,
183QString OFileDialog::getSaveFileName(int selector, 186QString OFileDialog::getSaveFileName(int selector,
184 const QString &_startDir, 187 const QString &_startDir,
185 const QString &file, 188 const QString &file,
186 const MimeTypes &mimes, 189 const MimeTypes &mimes,
187 QWidget *wid, 190 QWidget *wid,
188 const QString &caption ) 191 const QString &caption )
189{ 192{
190 QString ret; 193 QString ret;
191 QString startDir = _startDir; 194 QString startDir = _startDir;
192 if (startDir.isEmpty() ) 195 if (startDir.isEmpty() )
193 startDir = lastUsedDir( "FileDialog-SAVE" ); 196 startDir = lastUsedDir( "FileDialog-SAVE" );
194 197
195 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, 198 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption,
196 wid, OFileSelector::Save, selector, startDir, file, mimes); 199 wid, OFileSelector::Save, selector, startDir, file, mimes);
197 dlg.showMaximized(); 200 dlg.showMaximized();
198 if( dlg.exec() ) 201 if( dlg.exec() )
199 { 202 {
200 ret = dlg.fileName(); 203 ret = dlg.fileName();
201 saveLastDir( "FileDialog-SAVE", ret ); 204 saveLastDir( "FileDialog-SAVE", ret );
202 } 205 }
203 206
204 return ret; 207 return ret;
205} 208}
206 209
210/**
211 * This opens up a filedialog in select directory mode
212 *
213 * @param selector the Selector Mode
214 * @param startDir Where to start from
215 * @param wid the parent
216 * @param caption of the dialog if QString::null tr("Open") will be used
217 * @return the directoryName or QString::null
218 */
219QString OFileDialog::getDirectory(int selector,
220 const QString &_startDir,
221 QWidget *wid,
222 const QString &caption )
223{
224 QString ret;
225 QString startDir = _startDir;
226 if ( startDir.isEmpty() )
227 startDir = lastUsedDir( "FileDialog-SELECTDIR" );
228
229 OFileDialog dlg( caption.isEmpty() ? tr( "Select Directory" ) : caption,
230 wid, OFileSelector::DirectorySelector, selector, startDir );
231 dlg.showMaximized();
232 if ( dlg.exec() )
233 {
234 ret = dlg.fileName();
235 saveLastDir( "FileDialog-SELECTDIR", ret );
236 }
237 return ret;
238}
239
207void OFileDialog::slotFileSelected(const QString & ) 240void OFileDialog::slotFileSelected(const QString & )
208{ 241{
209 accept(); 242 accept();
210} 243}
211 244
212void OFileDialog::slotSelectorOk( ) 245void OFileDialog::slotSelectorOk( )
213{ 246{
214 accept(); 247 accept();
215} 248}
216 249
217void OFileDialog::slotDirSelected(const QString &dir ) 250void OFileDialog::slotDirSelected(const QString &dir )
218{ 251{
219 setCaption( dir ); 252 setCaption( dir );
220 // if mode 253 // if mode
221 //accept(); 254 //accept();
222} 255}
diff --git a/libopie2/opieui/fileselector/ofiledialog.h b/libopie2/opieui/fileselector/ofiledialog.h
index dfecf3d..569f45c 100644
--- a/libopie2/opieui/fileselector/ofiledialog.h
+++ b/libopie2/opieui/fileselector/ofiledialog.h
@@ -68,43 +68,48 @@ public:
68 OFileDialog(const QString &caption, 68 OFileDialog(const QString &caption,
69 QWidget *, int mode, int selector, 69 QWidget *, int mode, int selector,
70 const QString &dirName, 70 const QString &dirName,
71 const QString &fileName = QString::null, 71 const QString &fileName = QString::null,
72 const MimeTypes &mimetypes = MimeTypes() ); 72 const MimeTypes &mimetypes = MimeTypes() );
73 QString mimetype() const; 73 QString mimetype() const;
74 QString fileName() const; 74 QString fileName() const;
75 DocLnk selectedDocument()const; 75 DocLnk selectedDocument()const;
76 76
77 // static methods 77 // static methods
78 static QString getOpenFileName(int selector, 78 static QString getOpenFileName(int selector,
79 const QString& startDir = QString::null, 79 const QString& startDir = QString::null,
80 const QString &fileName = QString::null, 80 const QString &fileName = QString::null,
81 const MimeTypes& mime = MimeTypes(), 81 const MimeTypes& mime = MimeTypes(),
82 QWidget *wid = 0, 82 QWidget *wid = 0,
83 const QString &caption = QString::null ); 83 const QString &caption = QString::null );
84 84
85 static QString getSaveFileName(int selector, 85 static QString getSaveFileName(int selector,
86 const QString& startDir = QString::null, 86 const QString& startDir = QString::null,
87 const QString& fileName = QString::null, 87 const QString& fileName = QString::null,
88 const MimeTypes& mimefilter = MimeTypes(), 88 const MimeTypes& mimefilter = MimeTypes(),
89 QWidget *wid = 0, 89 QWidget *wid = 0,
90 const QString &caption = QString::null ); 90 const QString &caption = QString::null );
91 91
92 static QString getDirectory(int selector,
93 const QString &startDir = QString::null,
94 QWidget *wid = 0,
95 const QString &caption = QString::null );
96
92 //let's OFileSelector catch up first 97 //let's OFileSelector catch up first
93 //static QString getExistingDirectory(const QString& startDir = QString::null, 98 //static QString getExistingDirectory(const QString& startDir = QString::null,
94 //QWidget *parent = 0, const QString& caption = QString::null ); 99 //QWidget *parent = 0, const QString& caption = QString::null );
95 100
96private: 101private:
97 class OFileDialogPrivate; 102 class OFileDialogPrivate;
98 OFileDialogPrivate *d; 103 OFileDialogPrivate *d;
99 OFileSelector *file; 104 OFileSelector *file;
100 105
101private slots: 106private slots:
102 void slotFileSelected( const QString & ); 107 void slotFileSelected( const QString & );
103 void slotDirSelected(const QString & ); 108 void slotDirSelected(const QString & );
104 void slotSelectorOk(); 109 void slotSelectorOk();
105}; 110};
106 111
107} 112}
108} 113}
109 114
110#endif 115#endif
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
@@ -407,52 +407,55 @@ OFileSelectorItem* OFileViewFileListView::currentItem()const
407 407
408void OFileViewFileListView::reread( bool all ) 408void OFileViewFileListView::reread( bool all )
409{ 409{
410 m_view->clear(); 410 m_view->clear();
411 411
412 if (selector()->showClose() ) 412 if (selector()->showClose() )
413 m_btnClose->show(); 413 m_btnClose->show();
414 else 414 else
415 m_btnClose->hide(); 415 m_btnClose->hide();
416 416
417 if (selector()->showNew() ) 417 if (selector()->showNew() )
418 m_btnNew->show(); 418 m_btnNew->show();
419 else 419 else
420 m_btnNew->hide(); 420 m_btnNew->hide();
421 421
422 m_mimes = selector()->currentMimeType(); 422 m_mimes = selector()->currentMimeType();
423 m_all = all; 423 m_all = all;
424 424
425 QDir dir( m_currentDir ); 425 QDir dir( m_currentDir );
426 if (!dir.exists() ) 426 if (!dir.exists() )
427 return; 427 return;
428 428
429 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 429 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed );
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 );
436 439
437 // now go through all files 440 // now go through all files
438 const QFileInfoList *list = dir.entryInfoList(); 441 const QFileInfoList *list = dir.entryInfoList();
439 if (!list) 442 if (!list)
440 { 443 {
441 cdUP(); 444 cdUP();
442 return; 445 return;
443 } 446 }
444 447
445 QFileInfoListIterator it( *list ); 448 QFileInfoListIterator it( *list );
446 QFileInfo *fi; 449 QFileInfo *fi;
447 while( (fi=it.current() ) ) 450 while( (fi=it.current() ) )
448 { 451 {
449 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) 452 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") )
450 { 453 {
451 ++it; 454 ++it;
452 continue; 455 continue;
453 } 456 }
454 457
455 /* 458 /*
456 * It is a symlink we try to resolve it now but don't let us attack by DOS 459 * It is a symlink we try to resolve it now but don't let us attack by DOS
457 * 460 *
458 */ 461 */
@@ -793,49 +796,49 @@ void OFileViewFileSystem::reread()
793 if (!m_view) 796 if (!m_view)
794 return; 797 return;
795 798
796 m_view->reread( m_all ); 799 m_view->reread( m_all );
797} 800}
798 801
799int OFileViewFileSystem::fileCount()const 802int OFileViewFileSystem::fileCount()const
800{ 803{
801 if (!m_view ) 804 if (!m_view )
802 return -1; 805 return -1;
803 return m_view->fileCount(); 806 return m_view->fileCount();
804} 807}
805 808
806QWidget* OFileViewFileSystem::widget( QWidget* parent ) 809QWidget* OFileViewFileSystem::widget( QWidget* parent )
807{ 810{
808 if (!m_view ) 811 if (!m_view )
809 { 812 {
810 m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); 813 m_view = new OFileViewFileListView( parent, startDirectory(), selector() );
811 } 814 }
812 return m_view; 815 return m_view;
813} 816}
814 817
815void OFileViewFileSystem::activate( const QString& str) 818void OFileViewFileSystem::activate( const QString& str)
816{ 819{
817 m_all = (str != QObject::tr("Files") ); 820 m_all = ( str.find( "All" ) != -1 );
818} 821}
819 822
820 823
821} 824}
822/* Selector */ 825/* Selector */
823/** 826/**
824 * @short new and complete c'tor 827 * @short new and complete c'tor
825 * 828 *
826 * Create a OFileSelector to let the user select a file. It can 829 * Create a OFileSelector to let the user select a file. It can
827 * either be used to open a file, select a save name in a dir or 830 * either be used to open a file, select a save name in a dir or
828 * as a dropin for the FileSelector. 831 * as a dropin for the FileSelector.
829 * 832 *
830 * <pre> 833 * <pre>
831 * QMap<QString, QStringList> mimeTypes; 834 * QMap<QString, QStringList> mimeTypes;
832 * QStringList types; 835 * QStringList types;
833 * types << "text@slash* "; 836 * types << "text@slash* ";
834 * types << "audio@slash*"; 837 * types << "audio@slash*";
835 * mimeTypes.insert( tr("Audio and Text"), types ); 838 * mimeTypes.insert( tr("Audio and Text"), types );
836 * mimeTypes.insert( tr("All"), "*@slash*); 839 * mimeTypes.insert( tr("All"), "*@slash*);
837 * 840 *
838 * now you could create your fileselector 841 * now you could create your fileselector
839 * </pre> 842 * </pre>
840 * 843 *
841 * 844 *
@@ -853,58 +856,73 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
853 const QString& dirName, const QString& fileName, 856 const QString& dirName, const QString& fileName,
854 const MimeTypes& mimetypes, 857 const MimeTypes& mimetypes,
855 bool showNew, bool showClose) 858 bool showNew, bool showClose)
856 :QWidget( parent, "OFileSelector" ) 859 :QWidget( parent, "OFileSelector" )
857{ 860{
858 m_current = 0; 861 m_current = 0;
859 m_shNew = showNew; 862 m_shNew = showNew;
860 m_shClose = showClose; 863 m_shClose = showClose;
861 m_mimeType = mimetypes; 864 m_mimeType = mimetypes;
862 m_startDir = dirName; 865 m_startDir = dirName;
863 866
864 m_mode = mode; 867 m_mode = mode;
865 m_selector = sel; 868 m_selector = sel;
866 869
867 initUI(); 870 initUI();
868 m_lneEdit->setText( fileName ); 871 m_lneEdit->setText( fileName );
869 initMime(); 872 initMime();
870 initViews(); 873 initViews();
871 874
872 QString str; 875 QString str;
873 switch ( m_selector ) 876 switch ( m_selector )
874 { 877 {
875 default: 878 default:
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 );
879 break; 885 break;
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;
888 } 906 }
889 slotViewChange( str ); 907 slotViewChange( str );
890 908
891} 909}
892 910
893 911
894/** 912/**
895 * This a convience c'tor to just substitute the use of FileSelector 913 * This a convience c'tor to just substitute the use of FileSelector
896 */ 914 */
897OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, 915OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name,
898 bool showNew, bool showClose ) 916 bool showNew, bool showClose )
899 : QWidget( parent, name ) 917 : QWidget( parent, name )
900{ 918{
901 m_current = 0; 919 m_current = 0;
902 m_shNew = showNew; 920 m_shNew = showNew;
903 m_shClose = showClose; 921 m_shClose = showClose;
904 m_startDir = QPEApplication::documentDir(); 922 m_startDir = QPEApplication::documentDir();
905 923
906 if (!mimeFilter.isEmpty() ) 924 if (!mimeFilter.isEmpty() )
907 m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); 925 m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) );
908 926
909 m_mode = OFileSelector::FileSelector; 927 m_mode = OFileSelector::FileSelector;
910 m_selector = OFileSelector::Normal; 928 m_selector = OFileSelector::Normal;
@@ -964,61 +982,73 @@ bool OFileSelector::eventFilter (QObject *, QEvent *e)
964} 982}
965 983
966/* 984/*
967 * This will insert the MimeTypes into the Combo Box 985 * This will insert the MimeTypes into the Combo Box
968 * And also connect the changed signal 986 * And also connect the changed signal
969 * 987 *
970 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes 988 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes
971 */ 989 */
972void OFileSelector::initMime() 990void OFileSelector::initMime()
973{ 991{
974 MimeTypes::Iterator it; 992 MimeTypes::Iterator it;
975 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) 993 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it )
976 { 994 {
977 m_cmbMime->insertItem( it.key() ); 995 m_cmbMime->insertItem( it.key() );
978 } 996 }
979 m_cmbMime->setCurrentItem( 0 ); 997 m_cmbMime->setCurrentItem( 0 );
980 998
981 connect( m_cmbMime, SIGNAL(activated(int) ), 999 connect( m_cmbMime, SIGNAL(activated(int) ),
982 this, SLOT(slotMimeTypeChanged() ) ); 1000 this, SLOT(slotMimeTypeChanged() ) );
983 1001
984} 1002}
985 1003
986void OFileSelector::initViews() 1004void 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&) ),
992 this, SLOT(slotViewChange(const QString&) ) ); 1017 this, SLOT(slotViewChange(const QString&) ) );
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}
1002 1032
1003void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { 1033void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) {
1004 m_viewsPtr.append( iface ); 1034 m_viewsPtr.append( iface );
1005} 1035}
1006 1036
1007 1037
1008/** 1038/**
1009 * d'tor 1039 * d'tor
1010 */ 1040 */
1011OFileSelector::~OFileSelector() 1041OFileSelector::~OFileSelector()
1012{ 1042{
1013 m_viewsPtr.setAutoDelete( true ); 1043 m_viewsPtr.setAutoDelete( true );
1014 m_viewsPtr.clear(); 1044 m_viewsPtr.clear();
1015} 1045}
1016 1046
1017 1047
1018 1048
1019/** 1049/**
1020 * Convience function for the fileselector 1050 * Convience function for the fileselector
1021 * make sure to delete the DocLnk 1051 * make sure to delete the DocLnk
1022 * 1052 *
1023 * @see DocLnk 1053 * @see DocLnk
1024 * @todo remove in ODP 1054 * @todo remove in ODP
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index de2b98a..b1cd405 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -64,50 +64,51 @@ class OFileViewFileListView;
64 64
65/** 65/**
66 * @short a dropin replacement for the FileSelector 66 * @short a dropin replacement for the FileSelector
67 * 67 *
68 * This class is first used insert the OFileDialog. 68 * This class is first used insert the OFileDialog.
69 * It supports multiple view and mimetype filtering for now. 69 * It supports multiple view and mimetype filtering for now.
70 * 70 *
71 * @see OFileDialog 71 * @see OFileDialog
72 * @see FileSelector 72 * @see FileSelector
73 * @author zecke 73 * @author zecke
74 * @version 0.1 74 * @version 0.1
75 */ 75 */
76class OFileSelector : public QWidget 76class OFileSelector : public QWidget
77{ 77{
78 Q_OBJECT 78 Q_OBJECT
79 friend class Internal::OFileViewInterface; 79 friend class Internal::OFileViewInterface;
80 friend class Internal::OFileViewFileListView; 80 friend class Internal::OFileViewFileListView;
81 81
82public: 82public:
83 /** 83 /**
84 * The Mode of the Fileselector 84 * The Mode of the Fileselector
85 * Open = Open A File 85 * Open = Open A File
86 * Save = Save a File 86 * Save = Save a File
87 * FILESELECTOR = As A GUI in a screen to select a file 87 * FILESELECTOR = As A GUI in a screen to select a file
88 * SelectDir = Select a Directory
88 */ 89 */
89 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 90 enum Mode { Open = 1, Save = 2, DirectorySelector = 3, FileSelector = 4, OPEN = 1, SAVE = 2, DIRECTORYSELECTOR = 3, FILESELECTOR = 4 };
90 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 91 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
91 /** 92 /**
92 * Normal = The old FileSelector 93 * Normal = The old FileSelector
93 * Extended = Dir View 94 * Extended = Dir View
94 * ExtendedAll = Dir View with all hidden files 95 * ExtendedAll = Dir View with all hidden files
95 * Default = What the vendor considers best 96 * Default = What the vendor considers best
96 */ 97 */
97 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; 98 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
98 // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; 99 // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2};
99 100
100 OFileSelector(QWidget* parent, int mode, int selector, 101 OFileSelector(QWidget* parent, int mode, int selector,
101 const QString& dirName, 102 const QString& dirName,
102 const QString& fileName, 103 const QString& fileName,
103 const MimeTypes& mimetypes = MimeTypes(), 104 const MimeTypes& mimetypes = MimeTypes(),
104 bool newVisible = FALSE, bool closeVisible = FALSE ); 105 bool newVisible = FALSE, bool closeVisible = FALSE );
105 106
106 OFileSelector(const QString& mimeFilter, QWidget* parent, 107 OFileSelector(const QString& mimeFilter, QWidget* parent,
107 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); 108 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE );
108 ~OFileSelector(); 109 ~OFileSelector();
109 110
110 const DocLnk* selected(); 111 const DocLnk* selected();
111 112
112 QString selectedName()const; 113 QString selectedName()const;
113 QString selectedPath()const; 114 QString selectedPath()const;