use a QFileDialog

platform plugin will make it use KFileDialog anyways
This commit is contained in:
Marco Martin 2014-02-26 15:27:41 +01:00
parent 9f2c38c66f
commit f995cf5b90
2 changed files with 11 additions and 11 deletions

View File

@ -29,7 +29,7 @@
#include <QToolButton> #include <QToolButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <KFileDialog> #include <QFileDialog>
#include <KLocale> #include <KLocale>
#include <QAction> #include <QAction>
#include <KShell> #include <KShell>
@ -293,13 +293,13 @@ void InteractiveConsole::openScriptFile()
{ {
delete m_fileDialog; delete m_fileDialog;
m_fileDialog = new KFileDialog(QUrl(), QString(), 0); m_fileDialog = new QFileDialog();
m_fileDialog->setOperationMode(KFileDialog::Opening); m_fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
m_fileDialog->setWindowTitle(i18n("Open Script File")); m_fileDialog->setWindowTitle(i18n("Open Script File"));
QStringList mimetypes; QStringList mimetypes;
mimetypes << "application/javascript"; mimetypes << "application/javascript";
m_fileDialog->setMimeFilter(mimetypes); m_fileDialog->setMimeTypeFilters(mimetypes);
connect(m_fileDialog, SIGNAL(finished(int)), this, SLOT(openScriptUrlSelected(int))); connect(m_fileDialog, SIGNAL(finished(int)), this, SLOT(openScriptUrlSelected(int)));
m_fileDialog->show(); m_fileDialog->show();
@ -312,7 +312,7 @@ void InteractiveConsole::openScriptUrlSelected(int result)
} }
if (result == QDialog::Accepted) { if (result == QDialog::Accepted) {
const QUrl url = m_fileDialog->selectedUrl(); const QUrl url = m_fileDialog->selectedUrls().first();
if (!url.isEmpty()) { if (!url.isEmpty()) {
loadScriptFromUrl(url); loadScriptFromUrl(url);
} }
@ -424,13 +424,13 @@ void InteractiveConsole::saveScript()
delete m_fileDialog; delete m_fileDialog;
m_fileDialog = new KFileDialog(QUrl(), QString(), 0); m_fileDialog = new QFileDialog();
m_fileDialog->setOperationMode(KFileDialog::Saving); m_fileDialog->setAcceptMode(QFileDialog::AcceptSave);
m_fileDialog->setWindowTitle(i18n("Save Script File")); m_fileDialog->setWindowTitle(i18n("Save Script File"));
QStringList mimetypes; QStringList mimetypes;
mimetypes << "application/javascript"; mimetypes << "application/javascript";
m_fileDialog->setMimeFilter(mimetypes); m_fileDialog->setMimeTypeFilters(mimetypes);
connect(m_fileDialog, SIGNAL(finished(int)), this, SLOT(saveScriptUrlSelected(int))); connect(m_fileDialog, SIGNAL(finished(int)), this, SLOT(saveScriptUrlSelected(int)));
m_fileDialog->show(); m_fileDialog->show();
@ -443,7 +443,7 @@ void InteractiveConsole::saveScriptUrlSelected(int result)
} }
if (result == QDialog::Accepted) { if (result == QDialog::Accepted) {
const QUrl url = m_fileDialog->selectedUrl(); const QUrl url = m_fileDialog->selectedUrls().first();
if (!url.isEmpty()) { if (!url.isEmpty()) {
saveScript(url); saveScript(url);
} }

View File

@ -30,7 +30,7 @@
class QSplitter; class QSplitter;
class QAction; class QAction;
class KFileDialog; class QFileDialog;
class QMenu; class QMenu;
class KTextEdit; class KTextEdit;
class KTextBrowser; class KTextBrowser;
@ -105,7 +105,7 @@ private:
QAction *m_kwinAction; QAction *m_kwinAction;
QMenu *m_snippetsMenu; QMenu *m_snippetsMenu;
KFileDialog *m_fileDialog; QFileDialog *m_fileDialog;
QWeakPointer<KIO::Job> m_job; QWeakPointer<KIO::Job> m_job;
bool m_closeWhenCompleted; bool m_closeWhenCompleted;
ConsoleMode m_mode; ConsoleMode m_mode;