author | zautrix <zautrix> | 2005-06-11 17:03:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-11 17:03:59 (UTC) |
commit | 81370a5f955c2710b6e9336b6c412c8d630ef72a (patch) (unidiff) | |
tree | 6252851fbafcbc3ff777e1af0171990124beb23e /microkde/kfiledialog.cpp | |
parent | 0cfaf22fc5d8f511320813171be84ce3436990c6 (diff) | |
download | kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.zip kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.tar.gz kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.tar.bz2 |
fixes
-rw-r--r-- | microkde/kfiledialog.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index 6be1580..c64f325 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -1,79 +1,88 @@ | |||
1 | #include <kfiledialog.h> | 1 | #include <kfiledialog.h> |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | #ifndef DESKTOP_VERSION | 8 | #ifndef DESKTOP_VERSION |
9 | //US orig#include <ofileselector.h> | 9 | //US orig#include <ofileselector.h> |
10 | #include <ofileselector_p.h> | 10 | #include <ofileselector_p.h> |
11 | QString KFileDialog::getSaveFileName( const QString & fn, | 11 | QString KFileDialog::getSaveFileName( const QString & fn, |
12 | const QString & cap , QWidget * par ) | 12 | const QString & cap , QWidget * par ) |
13 | { | 13 | { |
14 | QString retfile = ""; | 14 | QString retfile = ""; |
15 | QDialog dia ( par, "input-dialog", true ); | 15 | QDialog dia ( par, "input-dialog", true ); |
16 | QVBoxLayout lay( &dia ); | 16 | QVBoxLayout lay( &dia ); |
17 | lay.setMargin(7); | 17 | lay.setMargin(7); |
18 | lay.setSpacing(7); | 18 | lay.setSpacing(7); |
19 | QString file = fn; | 19 | QString file = fn; |
20 | if ( file.isEmpty() ) | 20 | if ( file.isEmpty() ) |
21 | file = QDir::homeDirPath()+"/*"; | 21 | file = QDir::homeDirPath()+"/*"; |
22 | QFileInfo fi ( file ); | 22 | QFileInfo fi ( file ); |
23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); | 23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); |
24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
25 | lay.addWidget( &o); | 25 | lay.addWidget( &o); |
26 | // o.setNewVisible( true ); | 26 | // o.setNewVisible( true ); |
27 | // o.setNameVisible( true ); | 27 | // o.setNameVisible( true ); |
28 | dia.showMaximized(); | 28 | dia.showMaximized(); |
29 | if ( cap.isEmpty() ) | 29 | if ( cap.isEmpty() ) |
30 | dia.setCaption( file ); | 30 | dia.setCaption( file ); |
31 | else | 31 | else |
32 | dia.setCaption( cap ); | 32 | dia.setCaption( cap ); |
33 | int res = dia.exec(); | 33 | int res = dia.exec(); |
34 | if ( res ) | 34 | if ( res ) |
35 | retfile = o.selectedName(); | 35 | retfile = o.selectedName(); |
36 | return retfile; | 36 | return retfile; |
37 | } | 37 | } |
38 | 38 | ||
39 | QString KFileDialog::getOpenFileName( const QString & fn, | 39 | QString KFileDialog::getOpenFileName( const QString & fn, |
40 | const QString & cap, QWidget * par ) | 40 | const QString & cap, QWidget * par ) |
41 | { | 41 | { |
42 | QString retfile = ""; | 42 | QString retfile = ""; |
43 | QDialog dia ( par, "input-dialog", true ); | 43 | QDialog dia ( par, "input-dialog", true ); |
44 | // QLineEdit lab ( &dia ); | 44 | // QLineEdit lab ( &dia ); |
45 | QVBoxLayout lay( &dia ); | 45 | QVBoxLayout lay( &dia ); |
46 | lay.setMargin(7); | 46 | lay.setMargin(7); |
47 | lay.setSpacing(7); | 47 | lay.setSpacing(7); |
48 | QString file = fn; | 48 | QString file = fn; |
49 | if ( file.isEmpty() ) | 49 | if ( file.isEmpty() ) |
50 | file = QDir::homeDirPath()+"/*";; | 50 | file = QDir::homeDirPath()+"/*";; |
51 | QFileInfo fi ( file ); | 51 | QFileInfo fi ( file ); |
52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
54 | lay.addWidget( &o); | 54 | lay.addWidget( &o); |
55 | dia.showMaximized(); | 55 | dia.showMaximized(); |
56 | dia.setCaption( cap ); | 56 | dia.setCaption( cap ); |
57 | int res = dia.exec(); | 57 | int res = dia.exec(); |
58 | if ( res ) | 58 | if ( res ) |
59 | retfile = o.selectedName(); | 59 | retfile = o.selectedName(); |
60 | return retfile; | 60 | return retfile; |
61 | } | 61 | } |
62 | 62 | QString KFileDialog::getExistingDirectory( const QString & fn, | |
63 | const QString & cap, QWidget * par ) | ||
64 | { | ||
65 | return KFileDialog::getSaveFileName( fn, cap, pr ); | ||
66 | } | ||
63 | #else | 67 | #else |
64 | 68 | ||
65 | #include <qfiledialog.h> | 69 | #include <qfiledialog.h> |
66 | 70 | ||
67 | QString KFileDialog::getSaveFileName( const QString & fn, | 71 | QString KFileDialog::getSaveFileName( const QString & fn, |
68 | const QString & cap , QWidget * par ) | 72 | const QString & cap , QWidget * par ) |
69 | { | 73 | { |
70 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); | 74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); |
71 | } | 75 | } |
72 | QString KFileDialog::getOpenFileName( const QString & fn, | 76 | QString KFileDialog::getOpenFileName( const QString & fn, |
73 | const QString & cap, QWidget * par ) | 77 | const QString & cap, QWidget * par ) |
74 | { | 78 | { |
75 | 79 | ||
76 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); | 80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); |
77 | } | 81 | } |
82 | QString KFileDialog::getExistingDirectory( const QString & fn, | ||
83 | const QString & cap, QWidget * par ) | ||
84 | { | ||
85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); | ||
86 | } | ||
78 | #endif | 87 | #endif |
79 | 88 | ||