summaryrefslogtreecommitdiff
path: root/libopie/ofiledialog.cc
authorzecke <zecke>2002-04-11 20:30:22 (UTC)
committer zecke <zecke>2002-04-11 20:30:22 (UTC)
commit2599e347d9444cfa6282fec9f2bfb9df4743d6d2 (patch) (unidiff)
treef7459dc0763e2023a4cbc9171241fa3e37b3731a /libopie/ofiledialog.cc
parent4db8a0f808c4fd931d10af203d94f693e92519f5 (diff)
downloadopie-2599e347d9444cfa6282fec9f2bfb9df4743d6d2.zip
opie-2599e347d9444cfa6282fec9f2bfb9df4743d6d2.tar.gz
opie-2599e347d9444cfa6282fec9f2bfb9df4743d6d2.tar.bz2
OFileSelector const QStringList -> const QSTringList&
OFileDialog initial version the layout is broken but don't ask me. I played with the parent played with manual relayouting. Currently the setYesCancelVisisble crashes but that's ok for now OFileDialog provides static methods for OpenFileName, SaveFileName and DIrFileName Multiple selection will follow Maybe a dwarf fixes the problems for me overnight
Diffstat (limited to 'libopie/ofiledialog.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofiledialog.cc110
1 files changed, 110 insertions, 0 deletions
diff --git a/libopie/ofiledialog.cc b/libopie/ofiledialog.cc
new file mode 100644
index 0000000..92b0d0a
--- a/dev/null
+++ b/libopie/ofiledialog.cc
@@ -0,0 +1,110 @@
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
36OFileDialog::OFileDialog(const QString &caption,
37 QWidget *wid, int mode, int selector,
38 const QString &dirName,
39 const QString &fileName,
40 const QStringList &mimetypes )
41 : QDialog( wid, "OFileDialog", true )
42{
43 QVBoxLayout *lay = new QVBoxLayout(this);
44
45 file = new OFileSelector(0 , mode, selector,
46 dirName, fileName,
47 mimetypes );
48 lay->addWidget( file );
49 //showFullScreen();
50 setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
51 connect(file, SIGNAL(fileSelected(const QString&) ),
52 this, SLOT(slotFileSelected(const QString&) ) );
53
54 connect(file, SIGNAL(dirSelected(const QString &) ),
55 this, SLOT(slotDirSelected(const QString &) ) );
56 showMaximized();
57 file->setYesCancelVisible( false ); // relayout
58}
59QString OFileDialog::mimetype()const
60{
61 return QString::null;
62}
63QString OFileDialog::fileName()const
64{
65 return file->selectedName();
66}
67DocLnk OFileDialog::selectedDocument()const
68{
69 return file->selectedDocument();
70}
71QString OFileDialog::getOpenFileName(int selector,
72 const QString &startDir,
73 const QString &file,
74 const QStringList &mimes,
75 QWidget *wid,
76 const QString &caption )
77{
78 QString ret;
79 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption,
80 wid, OFileSelector::OPEN, selector, startDir, file, mimes);
81 if( dlg.exec() )
82 ret = dlg.fileName();
83
84 return ret;
85}
86QString OFileDialog::getSaveFileName(int selector,
87 const QString &startDir,
88 const QString &file,
89 const QStringList &mimes,
90 QWidget *wid,
91 const QString &caption )
92{
93 QString ret;
94 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption,
95 wid, OFileSelector::SAVE, selector, startDir, file, mimes);
96 if( dlg.exec() )
97 ret = dlg.fileName();
98
99 return ret;
100}
101
102void OFileDialog::slotFileSelected(const QString & )
103{
104 accept();
105}
106void OFileDialog::slotDirSelected(const QString & )
107{
108 // if mode
109 //accept();
110}