-rw-r--r-- | libopie/ofiledialog.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libopie/ofiledialog.h b/libopie/ofiledialog.h index e14253c..309086b 100644 --- a/libopie/ofiledialog.h +++ b/libopie/ofiledialog.h | |||
@@ -1,77 +1,100 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #ifndef OpieFileDialog_h | 30 | #ifndef OpieFileDialog_h |
31 | #define OpieFileDialog_h | 31 | #define OpieFileDialog_h |
32 | 32 | ||
33 | #include <qdialog.h> | 33 | #include <qdialog.h> |
34 | 34 | ||
35 | #include <opie/ofileselector.h> | 35 | #include <opie/ofileselector.h> |
36 | 36 | ||
37 | /** | ||
38 | * This class places a OFileSelector inside a QDialog. | ||
39 | * It provides static method for letting a user chose | ||
40 | * a file for either opening or saving. | ||
41 | * Most of the time the c'tor will not be used instead using | ||
42 | * the static member functions is prefered. | ||
43 | * | ||
44 | * <pre> | ||
45 | * QMap<QString, QStringList> mimeTypes; | ||
46 | * QStringList types; | ||
47 | * types << "text/* "; | ||
48 | * mimeTypes.insert( tr("Text"), types ); | ||
49 | * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment | ||
50 | * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | ||
51 | * "foo","bar", mimeTypes); | ||
52 | * </pre> | ||
53 | * | ||
54 | * @short A small QDialog swalloing a FileSelector | ||
55 | * @see QDialog | ||
56 | * @see OFileSelector | ||
57 | * @version 0.1-unfinished | ||
58 | * @author Holger Freyther ( zecke@handhelds.org ) | ||
59 | */ | ||
37 | class OFileDialog : public QDialog { | 60 | class OFileDialog : public QDialog { |
38 | Q_OBJECT | 61 | Q_OBJECT |
39 | public: | 62 | public: |
40 | OFileDialog(const QString &caption, | 63 | OFileDialog(const QString &caption, |
41 | QWidget *, int mode, int selector, | 64 | QWidget *, int mode, int selector, |
42 | const QString &dirName, | 65 | const QString &dirName, |
43 | const QString &fileName = QString::null, | 66 | const QString &fileName = QString::null, |
44 | const MimeTypes &mimetypes = MimeTypes() ); | 67 | const MimeTypes &mimetypes = MimeTypes() ); |
45 | QString mimetype() const; | 68 | QString mimetype() const; |
46 | QString fileName() const; | 69 | QString fileName() const; |
47 | DocLnk selectedDocument()const; | 70 | DocLnk selectedDocument()const; |
48 | 71 | ||
49 | // static methods | 72 | // static methods |
50 | static QString getOpenFileName(int selector, | 73 | static QString getOpenFileName(int selector, |
51 | const QString& startDir = QString::null, | 74 | const QString& startDir = QString::null, |
52 | const QString &fileName = QString::null, | 75 | const QString &fileName = QString::null, |
53 | const MimeTypes& mime = MimeTypes(), | 76 | const MimeTypes& mime = MimeTypes(), |
54 | QWidget *wid = 0, | 77 | QWidget *wid = 0, |
55 | const QString &caption = QString::null ); | 78 | const QString &caption = QString::null ); |
56 | 79 | ||
57 | static QString getSaveFileName(int selector, | 80 | static QString getSaveFileName(int selector, |
58 | const QString& startDir = QString::null, | 81 | const QString& startDir = QString::null, |
59 | const QString& fileName = QString::null, | 82 | const QString& fileName = QString::null, |
60 | const MimeTypes& mimefilter = MimeTypes(), | 83 | const MimeTypes& mimefilter = MimeTypes(), |
61 | QWidget *wid = 0, | 84 | QWidget *wid = 0, |
62 | const QString &caption = QString::null ); | 85 | const QString &caption = QString::null ); |
63 | 86 | ||
64 | //let's OFileSelector catch up first | 87 | //let's OFileSelector catch up first |
65 | //static QString getExistingDirectory(const QString& startDir = QString::null, | 88 | //static QString getExistingDirectory(const QString& startDir = QString::null, |
66 | // QWidget *parent = 0, | 89 | // QWidget *parent = 0, |
67 | // const QString& caption = QString::null ); | 90 | // const QString& caption = QString::null ); |
68 | private: | 91 | private: |
69 | class OFileDialogPrivate; | 92 | class OFileDialogPrivate; |
70 | OFileDialogPrivate *d; | 93 | OFileDialogPrivate *d; |
71 | OFileSelector *file; | 94 | OFileSelector *file; |
72 | 95 | ||
73 | private slots: | 96 | private slots: |
74 | void slotFileSelected( const QString & ); | 97 | void slotFileSelected( const QString & ); |
75 | void slotDirSelected(const QString & ); | 98 | void slotDirSelected(const QString & ); |
76 | }; | 99 | }; |
77 | #endif | 100 | #endif |