[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/utils
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-12-06 17:07:56
Message-ID: 20101206170756.0D74CAC8A5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204299 by mutz:

Kleo::FileDialog: use KFileDialog in case QFileDialog isn't available

 M  +24 -16    filedialog.cpp  


--- trunk/KDE/kdepim/kleopatra/utils/filedialog.cpp #1204298:1204299
@@ -35,6 +35,11 @@
 
 #include "filedialog.h"
 
+#ifdef QT_NO_FILEDIALOG
+#include <KFileDialog>
+#include <KUrl>
+#endif
+
 #include <QMap>
 
 using namespace Kleo;
@@ -60,52 +65,55 @@
 QString FileDialog::getExistingDirectory( QWidget * parent, const QString & caption, \
const QString & dirID ) {  #ifndef QT_NO_FILEDIALOG
     const QString fname = QFileDialog::getExistingDirectory( parent, caption, dir( \
dirID ) ); +#else
+    const QString fname = KFileDialog::getExistingDirectory( dir( dirID ), parent, \
caption ); +#endif
     update( fname, dirID );
     return fname;
-#else
-    return QString();
-#endif // QT_NO_FILEDIALOG
 }
 
 QString FileDialog::getOpenFileName( QWidget * parent, const QString & caption, \
const QString & dirID, const QString & filter ) {  #ifndef QT_NO_FILEDIALOG
     const QString fname = QFileDialog::getOpenFileName( parent, caption, dir( dirID \
), filter ); +#else
+    Q_UNUSED( filter ); // incompatible syntax
+    const QString fname = KFileDialog::getOpenFileName( dir( dirID ), QString(), \
parent, caption ); +#endif
     update( fname, dirID );
     return fname;
-#else
-    return QString();
-#endif // QT_NO_FILEDIALOG
 }
 
 QStringList FileDialog::getOpenFileNames( QWidget * parent, const QString & caption, \
const QString & dirID, const QString & filter ) {  #ifndef QT_NO_FILEDIALOG
     const QStringList files = QFileDialog::getOpenFileNames( parent, caption, dir( \
dirID ), filter ); +#else
+    Q_UNUSED( filter ); // incompatible syntax
+    const QStringList files = KFileDialog::getOpenFileNames( dir( dirID ), \
QString(), parent, caption ); +#endif
     if ( !files.empty() )
         update( files.front(), dirID );
     return files;
-#else
-    return QStringList();
-#endif // QT_NO_FILEDIALOG
 }
 
 QString FileDialog::getSaveFileName( QWidget * parent, const QString & caption, \
const QString & dirID, const QString & filter ) {  #ifndef QT_NO_FILEDIALOG
     const QString fname = QFileDialog::getSaveFileName( parent, caption, dir( dirID \
), filter ); +#else
+    Q_UNUSED( filter ); // incompatible syntax
+    const QString fname = KFileDialog::getSaveFileName( dir( dirID ), QString(), \
parent, caption ); +#endif
     update( fname, dirID );
     return fname;
-#else
-    return QString();
-#endif // QT_NO_FILEDIALOG
 }
 
 QString FileDialog::getSaveFileNameEx( QWidget * parent, const QString & caption, \
                const QString & dirID, const QString & proposedFileName, const \
                QString & filter ) {
-#ifndef QT_NO_FILEDIALOG
     if ( proposedFileName.isEmpty() )
         return getSaveFileName( parent, caption, dirID, filter );
+#ifndef QT_NO_FILEDIALOG
     const QString fname = QFileDialog::getSaveFileName( parent, caption, QDir( dir( \
dirID ) ).filePath( proposedFileName ), filter ); +#else
+    const QString fname = KFileDialog::getSaveFileName( QDir( dir( dirID ) \
).filePath( proposedFileName ), QString(), parent, caption ); +#endif
     update( fname, dirID );
     return fname;
-#else
-    return QString();
-#endif // QT_NO_FILEDIALOG
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic