summaryrefslogtreecommitdiffabout
path: root/microkde/kfiledialog.cpp
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (side-by-side diff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kfiledialog.cpp
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'microkde/kfiledialog.cpp') (more/less context) (show 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 @@
+#include <kfiledialog.h>
+#include <qdialog.h>
+#include <qlayout.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qapplication.h>
+
+#ifndef DESKTOP_VERSION
+//US orig#include <ofileselector.h>
+#include <ofileselector_p.h>
+QString KFileDialog::getSaveFileName( const QString & fn,
+ const QString & cap , QWidget * par )
+{
+ QString retfile = "";
+ QDialog dia ( par, "input-dialog", true );
+ QVBoxLayout lay( &dia );
+ lay.setMargin(7);
+ lay.setSpacing(7);
+ dia.setCaption( cap );
+ QString file = fn;
+ if ( file.isEmpty() )
+ file = QDir::homeDirPath()+"/*";
+ QFileInfo fi ( file );
+ OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
+ lay.addWidget( &o);
+ // o.setNewVisible( true );
+ // o.setNameVisible( true );
+ dia.showMaximized();
+ int res = dia.exec();
+ if ( res )
+ retfile = o.selectedName();
+ return retfile;
+}
+
+QString KFileDialog::getOpenFileName( const QString & fn,
+ const QString & cap, QWidget * par )
+{
+ QString retfile = "";
+ QDialog dia ( par, "input-dialog", true );
+ // QLineEdit lab ( &dia );
+ QVBoxLayout lay( &dia );
+ lay.setMargin(7);
+ lay.setSpacing(7);
+ dia.setCaption( cap );
+ QString file = fn;
+ if ( file.isEmpty() )
+ file = QDir::homeDirPath()+"/*";;
+ QFileInfo fi ( file );
+ OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
+ lay.addWidget( &o);
+ dia.showMaximized();
+ int res = dia.exec();
+ if ( res )
+ retfile = o.selectedName();
+ return retfile;
+}
+
+#else
+
+#include <qfiledialog.h>
+
+QString KFileDialog::getSaveFileName( const QString & fn,
+ const QString & cap , QWidget * par )
+{
+ return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
+}
+QString KFileDialog::getOpenFileName( const QString & fn,
+ const QString & cap, QWidget * par )
+{
+
+ return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
+}
+#endif
+