summaryrefslogtreecommitdiffabout
path: root/microkde/kfiledialog.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kfiledialog.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kfiledialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kfiledialog.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 383e711..c1bfdef 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -1,88 +1,90 @@
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//Added by qt3to4:
8#include <Q3VBoxLayout>
7 9
8#ifndef DESKTOP_VERSION 10#ifndef DESKTOP_VERSION
9//US orig#include <ofileselector.h> 11//US orig#include <ofileselector.h>
10#include <ofileselector_p.h> 12#include <ofileselector_p.h>
11QString KFileDialog::getSaveFileName( const QString & fn, 13QString KFileDialog::getSaveFileName( const QString & fn,
12 const QString & cap , QWidget * par ) 14 const QString & cap , QWidget * par )
13{ 15{
14 QString retfile = ""; 16 QString retfile = "";
15 QDialog dia ( par, "input-dialog", true ); 17 QDialog dia ( par, "input-dialog", true );
16 QVBoxLayout lay( &dia ); 18 Q3VBoxLayout lay( &dia );
17 lay.setMargin(7); 19 lay.setMargin(7);
18 lay.setSpacing(7); 20 lay.setSpacing(7);
19 QString file = fn; 21 QString file = fn;
20 if ( file.isEmpty() ) 22 if ( file.isEmpty() )
21 file = QDir::homeDirPath()+"/*"; 23 file = QDir::homeDirPath()+"/*";
22 QFileInfo fi ( file ); 24 QFileInfo fi ( file );
23 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); 25 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
24 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); 26 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
25 lay.addWidget( &o); 27 lay.addWidget( &o);
26 // o.setNewVisible( true ); 28 // o.setNewVisible( true );
27 // o.setNameVisible( true ); 29 // o.setNameVisible( true );
28 dia.showMaximized(); 30 dia.showMaximized();
29 if ( cap.isEmpty() ) 31 if ( cap.isEmpty() )
30 dia.setCaption( file ); 32 dia.setCaption( file );
31 else 33 else
32 dia.setCaption( cap ); 34 dia.setCaption( cap );
33 int res = dia.exec(); 35 int res = dia.exec();
34 if ( res ) 36 if ( res )
35 retfile = o.selectedName(); 37 retfile = o.selectedName();
36 return retfile; 38 return retfile;
37} 39}
38 40
39QString KFileDialog::getOpenFileName( const QString & fn, 41QString KFileDialog::getOpenFileName( const QString & fn,
40 const QString & cap, QWidget * par ) 42 const QString & cap, QWidget * par )
41{ 43{
42 QString retfile = ""; 44 QString retfile = "";
43 QDialog dia ( par, "input-dialog", true ); 45 QDialog dia ( par, "input-dialog", true );
44 // QLineEdit lab ( &dia ); 46 // QLineEdit lab ( &dia );
45 QVBoxLayout lay( &dia ); 47 Q3VBoxLayout lay( &dia );
46 lay.setMargin(7); 48 lay.setMargin(7);
47 lay.setSpacing(7); 49 lay.setSpacing(7);
48 QString file = fn; 50 QString file = fn;
49 if ( file.isEmpty() ) 51 if ( file.isEmpty() )
50 file = QDir::homeDirPath()+"/*";; 52 file = QDir::homeDirPath()+"/*";;
51 QFileInfo fi ( file ); 53 QFileInfo fi ( file );
52 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); 54 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
53 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); 55 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
54 lay.addWidget( &o); 56 lay.addWidget( &o);
55 dia.showMaximized(); 57 dia.showMaximized();
56 dia.setCaption( cap ); 58 dia.setCaption( cap );
57 int res = dia.exec(); 59 int res = dia.exec();
58 if ( res ) 60 if ( res )
59 retfile = o.selectedName(); 61 retfile = o.selectedName();
60 return retfile; 62 return retfile;
61} 63}
62QString KFileDialog::getExistingDirectory( const QString & fn, 64QString KFileDialog::getExistingDirectory( const QString & fn,
63 const QString & cap, QWidget * par ) 65 const QString & cap, QWidget * par )
64{ 66{
65 return KFileDialog::getSaveFileName( fn, cap, par ); 67 return KFileDialog::getSaveFileName( fn, cap, par );
66} 68}
67#else 69#else
68 70
69#include <qfiledialog.h> 71#include <q3filedialog.h>
70 72
71QString KFileDialog::getSaveFileName( const QString & fn, 73QString KFileDialog::getSaveFileName( const QString & fn,
72 const QString & cap , QWidget * par ) 74 const QString & cap , QWidget * par )
73{ 75{
74 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); 76 return Q3FileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
75} 77}
76QString KFileDialog::getOpenFileName( const QString & fn, 78QString KFileDialog::getOpenFileName( const QString & fn,
77 const QString & cap, QWidget * par ) 79 const QString & cap, QWidget * par )
78{ 80{
79 81
80 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); 82 return Q3FileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
81} 83}
82QString KFileDialog::getExistingDirectory( const QString & fn, 84QString KFileDialog::getExistingDirectory( const QString & fn,
83 const QString & cap, QWidget * par ) 85 const QString & cap, QWidget * par )
84{ 86{
85 return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); 87 return Q3FileDialog::getExistingDirectory( fn, par, "exidtingdir", cap );
86} 88}
87#endif 89#endif
88 90