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