summaryrefslogtreecommitdiff
path: root/libopie/ofiledialog.cc
authorzecke <zecke>2002-04-12 13:07:35 (UTC)
committer zecke <zecke>2002-04-12 13:07:35 (UTC)
commit3973cf42c778055ab81a9ee254eaf8829464f936 (patch) (unidiff)
tree4ae4fc512c9e37657ea9f4e05f28d1ea57a855d3 /libopie/ofiledialog.cc
parentc1c9ac64f7f4871642d645ac1da1a2f36853ccb2 (diff)
downloadopie-3973cf42c778055ab81a9ee254eaf8829464f936.zip
opie-3973cf42c778055ab81a9ee254eaf8829464f936.tar.gz
opie-3973cf42c778055ab81a9ee254eaf8829464f936.tar.bz2
Add OFileDialog to the .pro
OFileDialog is now working resize it when not used by the static methods OFileSelector some bugfixes. Some bugs are not yet fixed (the switching from views can segfault )
Diffstat (limited to 'libopie/ofiledialog.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofiledialog.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/libopie/ofiledialog.cc b/libopie/ofiledialog.cc
index 92b0d0a..164fadd 100644
--- a/libopie/ofiledialog.cc
+++ b/libopie/ofiledialog.cc
@@ -1,110 +1,116 @@
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 <> 3             .=l. Copyright (c) 2002 <>
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#include <qpe/applnk.h> 29#include <qpe/applnk.h>
30#include <qstring.h> 30#include <qstring.h>
31#include <qapplication.h> 31#include <qapplication.h>
32#include <qlayout.h> 32#include <qlayout.h>
33 33
34#include "ofiledialog.h" 34#include "ofiledialog.h"
35 35
36OFileDialog::OFileDialog(const QString &caption, 36OFileDialog::OFileDialog(const QString &caption,
37 QWidget *wid, int mode, int selector, 37 QWidget *wid, int mode, int selector,
38 const QString &dirName, 38 const QString &dirName,
39 const QString &fileName, 39 const QString &fileName,
40 const QStringList &mimetypes ) 40 const QStringList &mimetypes )
41 : QDialog( wid, "OFileDialog", true ) 41 : QDialog( wid, "OFileDialog", true )
42{ 42{
43 QVBoxLayout *lay = new QVBoxLayout(this); 43 // QVBoxLayout *lay = new QVBoxLayout(this);
44 44 //showMaximized();
45 file = new OFileSelector(0 , mode, selector, 45 QVBoxLayout *lay = new QVBoxLayout(this );
46 file = new OFileSelector(this , mode, selector,
46 dirName, fileName, 47 dirName, fileName,
47 mimetypes ); 48 mimetypes );
48 lay->addWidget( file ); 49 lay->addWidget( file );
50
51 //lay->addWidget( file );
49 //showFullScreen(); 52 //showFullScreen();
50 setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); 53 setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
51 connect(file, SIGNAL(fileSelected(const QString&) ), 54 connect(file, SIGNAL(fileSelected(const QString&) ),
52 this, SLOT(slotFileSelected(const QString&) ) ); 55 this, SLOT(slotFileSelected(const QString&) ) );
53 56
54 connect(file, SIGNAL(dirSelected(const QString &) ), 57 connect(file, SIGNAL(dirSelected(const QString &) ),
55 this, SLOT(slotDirSelected(const QString &) ) ); 58 this, SLOT(slotDirSelected(const QString &) ) );
56 showMaximized(); 59
60
57 file->setYesCancelVisible( false ); // relayout 61 file->setYesCancelVisible( false ); // relayout
58} 62}
59QString OFileDialog::mimetype()const 63QString OFileDialog::mimetype()const
60{ 64{
61 return QString::null; 65 return QString::null;
62} 66}
63QString OFileDialog::fileName()const 67QString OFileDialog::fileName()const
64{ 68{
65 return file->selectedName(); 69 return file->selectedName();
66} 70}
67DocLnk OFileDialog::selectedDocument()const 71DocLnk OFileDialog::selectedDocument()const
68{ 72{
69 return file->selectedDocument(); 73 return file->selectedDocument();
70} 74}
71QString OFileDialog::getOpenFileName(int selector, 75QString OFileDialog::getOpenFileName(int selector,
72 const QString &startDir, 76 const QString &startDir,
73 const QString &file, 77 const QString &file,
74 const QStringList &mimes, 78 const QStringList &mimes,
75 QWidget *wid, 79 QWidget *wid,
76 const QString &caption ) 80 const QString &caption )
77{ 81{
78 QString ret; 82 QString ret;
79 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, 83 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption,
80 wid, OFileSelector::OPEN, selector, startDir, file, mimes); 84 wid, OFileSelector::OPEN, selector, startDir, file, mimes);
85 dlg.showMaximized();
81 if( dlg.exec() ) 86 if( dlg.exec() )
82 ret = dlg.fileName(); 87 ret = dlg.fileName();
83 88
84 return ret; 89 return ret;
85} 90}
86QString OFileDialog::getSaveFileName(int selector, 91QString OFileDialog::getSaveFileName(int selector,
87 const QString &startDir, 92 const QString &startDir,
88 const QString &file, 93 const QString &file,
89 const QStringList &mimes, 94 const QStringList &mimes,
90 QWidget *wid, 95 QWidget *wid,
91 const QString &caption ) 96 const QString &caption )
92{ 97{
93 QString ret; 98 QString ret;
94 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, 99 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption,
95 wid, OFileSelector::SAVE, selector, startDir, file, mimes); 100 wid, OFileSelector::SAVE, selector, startDir, file, mimes);
101 dlg.showMaximized();
96 if( dlg.exec() ) 102 if( dlg.exec() )
97 ret = dlg.fileName(); 103 ret = dlg.fileName();
98 104
99 return ret; 105 return ret;
100} 106}
101 107
102void OFileDialog::slotFileSelected(const QString & ) 108void OFileDialog::slotFileSelected(const QString & )
103{ 109{
104 accept(); 110 accept();
105} 111}
106void OFileDialog::slotDirSelected(const QString & ) 112void OFileDialog::slotDirSelected(const QString & )
107{ 113{
108 // if mode 114 // if mode
109 //accept(); 115 //accept();
110} 116}