From 5557598b470e9a68f2b33e7c33673fb45d399220 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Mon, 6 Oct 2014 07:39:24 +0200 Subject: [PATCH] Port to QDialog --- core/chooseenginedialog.cpp | 23 +++++++++++++++++------ core/chooseenginedialog_p.h | 4 ++-- generators/dvi/psgs.cpp | 1 - 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/core/chooseenginedialog.cpp b/core/chooseenginedialog.cpp index 358b94621..8f433cc8e 100644 --- a/core/chooseenginedialog.cpp +++ b/core/chooseenginedialog.cpp @@ -13,20 +13,31 @@ #include #include +#include +#include +#include +#include #include "ui_chooseenginewidget.h" ChooseEngineDialog::ChooseEngineDialog( const QStringList &generators, const QMimeType &mime, QWidget * parent ) - : KDialog( parent ) + : QDialog( parent ) { - setCaption( i18n( "Backend Selection" ) ); - setButtons( Ok | Cancel ); - setDefaultButton( Ok ); + setWindowTitle( i18n( "Backend Selection" ) ); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + QVBoxLayout *mainLayout = new QVBoxLayout; + setLayout(mainLayout); + QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); + okButton->setDefault(true); + okButton->setShortcut(Qt::CTRL | Qt::Key_Return); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + okButton->setDefault(true); QWidget *main = new QWidget( this ); - setMainWidget( main ); m_widget = new Ui_ChooseEngineWidget(); m_widget->setupUi( main ); - + mainLayout->addWidget(main); + mainLayout->addWidget(buttonBox); m_widget->engineList->addItems(generators); m_widget->description->setText( diff --git a/core/chooseenginedialog_p.h b/core/chooseenginedialog_p.h index 1eb035634..0d55ff50f 100644 --- a/core/chooseenginedialog_p.h +++ b/core/chooseenginedialog_p.h @@ -12,13 +12,13 @@ #include -#include +#include #include #include class Ui_ChooseEngineWidget; -class ChooseEngineDialog : public KDialog +class ChooseEngineDialog : public QDialog { public: ChooseEngineDialog( const QStringList &generators, const QMimeType &mime, QWidget * parent = 0 ); diff --git a/generators/dvi/psgs.cpp b/generators/dvi/psgs.cpp index a6df7279c..969123ef9 100644 --- a/generators/dvi/psgs.cpp +++ b/generators/dvi/psgs.cpp @@ -351,4 +351,3 @@ QString ghostscript_interface::locateEPSfile(const QString &filename, const KUrl return QString::fromLocal8Bit(proc.readLine().trimmed()); } -#include "psgs.moc"