author | zecke <zecke> | 2002-09-15 17:52:30 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-15 17:52:30 (UTC) |
commit | 1c5780f34ec9b4dc004714488b46997fe1a0909b (patch) (unidiff) | |
tree | 524719fe92e4738dbcebf4bc792d6901cf215df9 /libopie/ofileselector/ofiledialog.cpp | |
parent | 8c161a2699a842e527ade4410189fd18964d1c31 (diff) | |
download | opie-1c5780f34ec9b4dc004714488b46997fe1a0909b.zip opie-1c5780f34ec9b4dc004714488b46997fe1a0909b.tar.gz opie-1c5780f34ec9b4dc004714488b46997fe1a0909b.tar.bz2 |
Ok the demand for filters, listers and views were great so I'm currently
implementing it
This OFileSelector will be in a different subdir but it'll be still
linked into libopie. This makes it more easy to find all files which
belong to the OFileSelector
an OLister is able to list
for example files and dirs ( OLocalLister )
a ftp lister
a bluetooth lister whcich would show available devices
a DocLnkSet lister for the Documents Tab
a CrossReference lister
a View is responsible for showing files to the user...
and I renamed *.cc to *.cpp
Diffstat (limited to 'libopie/ofileselector/ofiledialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofiledialog.cpp | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/libopie/ofileselector/ofiledialog.cpp b/libopie/ofileselector/ofiledialog.cpp new file mode 100644 index 0000000..4783004 --- a/dev/null +++ b/libopie/ofileselector/ofiledialog.cpp | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 <> | ||
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 | #include <qpe/applnk.h> | ||
30 | #include <qstring.h> | ||
31 | #include <qapplication.h> | ||
32 | #include <qlayout.h> | ||
33 | |||
34 | #include "ofiledialog.h" | ||
35 | |||
36 | OFileDialog::OFileDialog(const QString &caption, | ||
37 | QWidget *wid, int mode, int selector, | ||
38 | const QString &dirName, | ||
39 | const QString &fileName, | ||
40 | const QMap<QString,QStringList>& mimetypes ) | ||
41 | : QDialog( wid, "OFileDialog", true ) | ||
42 | { | ||
43 | // QVBoxLayout *lay = new QVBoxLayout(this); | ||
44 | //showMaximized(); | ||
45 | QVBoxLayout *lay = new QVBoxLayout(this ); | ||
46 | file = new OFileSelector(this , mode, selector, | ||
47 | dirName, fileName, | ||
48 | mimetypes ); | ||
49 | lay->addWidget( file ); | ||
50 | |||
51 | //lay->addWidget( file ); | ||
52 | //showFullScreen(); | ||
53 | setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); | ||
54 | connect(file, SIGNAL(fileSelected(const QString&) ), | ||
55 | this, SLOT(slotFileSelected(const QString&) ) ); | ||
56 | |||
57 | connect(file, SIGNAL(dirSelected(const QString &) ), | ||
58 | this, SLOT(slotDirSelected(const QString &) ) ); | ||
59 | |||
60 | |||
61 | file->setYesCancelVisible( false ); // relayout | ||
62 | } | ||
63 | QString OFileDialog::mimetype()const | ||
64 | { | ||
65 | return QString::null; | ||
66 | } | ||
67 | QString OFileDialog::fileName()const | ||
68 | { | ||
69 | return file->selectedName(); | ||
70 | } | ||
71 | DocLnk OFileDialog::selectedDocument()const | ||
72 | { | ||
73 | return file->selectedDocument(); | ||
74 | } | ||
75 | QString OFileDialog::getOpenFileName(int selector, | ||
76 | const QString &startDir, | ||
77 | const QString &file, | ||
78 | const MimeTypes &mimes, | ||
79 | QWidget *wid, | ||
80 | const QString &caption ) | ||
81 | { | ||
82 | QString ret; | ||
83 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, | ||
84 | wid, OFileSelector::OPEN, selector, startDir, file, mimes); | ||
85 | dlg.showMaximized(); | ||
86 | if( dlg.exec() ) | ||
87 | ret = dlg.fileName(); | ||
88 | |||
89 | return ret; | ||
90 | } | ||
91 | QString OFileDialog::getSaveFileName(int selector, | ||
92 | const QString &startDir, | ||
93 | const QString &file, | ||
94 | const MimeTypes &mimes, | ||
95 | QWidget *wid, | ||
96 | const QString &caption ) | ||
97 | { | ||
98 | QString ret; | ||
99 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, | ||
100 | wid, OFileSelector::SAVE, selector, startDir, file, mimes); | ||
101 | dlg.showMaximized(); | ||
102 | if( dlg.exec() ) | ||
103 | ret = dlg.fileName(); | ||
104 | |||
105 | return ret; | ||
106 | } | ||
107 | |||
108 | void OFileDialog::slotFileSelected(const QString & ) | ||
109 | { | ||
110 | accept(); | ||
111 | } | ||
112 | void OFileDialog::slotDirSelected(const QString & ) | ||
113 | { | ||
114 | // if mode | ||
115 | //accept(); | ||
116 | } | ||