summaryrefslogtreecommitdiffabout
path: root/microkde/kfiledialog.cpp
Unidiff
Diffstat (limited to 'microkde/kfiledialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kfiledialog.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
new file mode 100644
index 0000000..977499e
--- a/dev/null
+++ b/microkde/kfiledialog.cpp
@@ -0,0 +1,74 @@
1#include <kfiledialog.h>
2#include <qdialog.h>
3#include <qlayout.h>
4#include <qdir.h>
5#include <qfileinfo.h>
6#include <qapplication.h>
7
8#ifndef DESKTOP_VERSION
9//US orig#include <ofileselector.h>
10#include <ofileselector_p.h>
11QString KFileDialog::getSaveFileName( const QString & fn,
12 const QString & cap , QWidget * par )
13{
14 QString retfile = "";
15 QDialog dia ( par, "input-dialog", true );
16 QVBoxLayout lay( &dia );
17 lay.setMargin(7);
18 lay.setSpacing(7);
19 dia.setCaption( cap );
20 QString file = fn;
21 if ( file.isEmpty() )
22 file = QDir::homeDirPath()+"/*";
23 QFileInfo fi ( file );
24 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
25 lay.addWidget( &o);
26 // o.setNewVisible( true );
27 // o.setNameVisible( true );
28 dia.showMaximized();
29 int res = dia.exec();
30 if ( res )
31 retfile = o.selectedName();
32 return retfile;
33}
34
35QString KFileDialog::getOpenFileName( const QString & fn,
36 const QString & cap, QWidget * par )
37{
38 QString retfile = "";
39 QDialog dia ( par, "input-dialog", true );
40 // QLineEdit lab ( &dia );
41 QVBoxLayout lay( &dia );
42 lay.setMargin(7);
43 lay.setSpacing(7);
44 dia.setCaption( cap );
45 QString file = fn;
46 if ( file.isEmpty() )
47 file = QDir::homeDirPath()+"/*";;
48 QFileInfo fi ( file );
49 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
50 lay.addWidget( &o);
51 dia.showMaximized();
52 int res = dia.exec();
53 if ( res )
54 retfile = o.selectedName();
55 return retfile;
56}
57
58#else
59
60#include <qfiledialog.h>
61
62QString KFileDialog::getSaveFileName( const QString & fn,
63 const QString & cap , QWidget * par )
64{
65 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
66}
67QString KFileDialog::getOpenFileName( const QString & fn,
68 const QString & cap, QWidget * par )
69{
70
71 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
72}
73#endif
74