From 3cb4e0322f1a921ecc625b0be40c8e1baba0817e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 15 Aug 2013 12:52:37 +0200 Subject: [PATCH] AlternativeWMDialog ported to QDialog --- main.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/main.cpp b/main.cpp index 28029dcae6..8095c97103 100644 --- a/main.cpp +++ b/main.cpp @@ -32,21 +32,23 @@ along with this program. If not, see . #include #include #include +#include #include #include #include #include #include #include -#include #include -#include #include #include #include +#include +#include +#include #include -#include +#include #include #include @@ -147,13 +149,11 @@ bool KWinSelectionOwner::genericReply(xcb_atom_t target_P, xcb_atom_t property_P Atom KWinSelectionOwner::xa_version = None; -class AlternativeWMDialog : public KDialog +class AlternativeWMDialog : public QDialog { public: AlternativeWMDialog() - : KDialog() { - setButtons(KDialog::Ok | KDialog::Cancel); - + : QDialog() { QWidget* mainWidget = new QWidget(this); QVBoxLayout* layout = new QVBoxLayout(mainWidget); QString text = i18n( @@ -162,7 +162,7 @@ public: "You can select another window manager to run:"); QLabel* textLabel = new QLabel(text, mainWidget); layout->addWidget(textLabel); - wmList = new KComboBox(mainWidget); + wmList = new QComboBox(mainWidget); wmList->setEditable(true); layout->addWidget(wmList); @@ -171,10 +171,15 @@ public: addWM(QStringLiteral("fvwm2")); addWM(QStringLiteral(KWIN_NAME)); - setMainWidget(mainWidget); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->addWidget(mainWidget); + QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + buttons->button(QDialogButtonBox::Ok)->setDefault(true); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); + mainLayout->addWidget(buttons); raise(); - centerOnScreen(this); } void addWM(const QString& wm) { @@ -187,7 +192,7 @@ public: } private: - KComboBox* wmList; + QComboBox* wmList; }; int Application::crashes = 0;