From eae9278d98ff6a24ca296a267d8e2672a30a72f1 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Wed, 23 Jul 2014 22:27:19 +0200 Subject: [PATCH] Port++ --- dialog/kmknotify.cpp | 23 ++++++++++++++++++----- dialog/kmknotify.h | 4 ++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/dialog/kmknotify.cpp b/dialog/kmknotify.cpp index 62e2bb4d7..90d33ef8c 100644 --- a/dialog/kmknotify.cpp +++ b/dialog/kmknotify.cpp @@ -38,17 +38,29 @@ #include #include #include +#include +#include +#include using namespace KMail; KMKnotify::KMKnotify( QWidget * parent ) - :KDialog( parent ), m_changed( false ) + :QDialog( parent ), m_changed( false ) { - setCaption( i18n("Notification") ); - setButtons( Ok|Cancel ); + setWindowTitle( i18n("Notification") ); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + QWidget *mainWidget = new QWidget(this); + QVBoxLayout *mainLayout = new QVBoxLayout; + setLayout(mainLayout); + mainLayout->addWidget(mainWidget); + 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())); QWidget *page = new QWidget( this ); - setMainWidget( page ); + mainLayout->addWidget(page); QVBoxLayout *layout = new QVBoxLayout( page ); layout->setMargin( 0 ); @@ -65,9 +77,10 @@ KMKnotify::KMKnotify( QWidget * parent ) layout->addWidget(new KSeparator); + mainLayout->addWidget(buttonBox); connect( m_comboNotify, SIGNAL(activated(int)), SLOT(slotComboChanged(int)) ); - connect( this, SIGNAL(okClicked()), SLOT(slotOk()) ); + connect(okButton, SIGNAL(clicked()), SLOT(slotOk()) ); connect( m_notifyWidget ,SIGNAL(changed(bool)) , this , SLOT(slotConfigChanged(bool))); initCombobox(); readConfig(); diff --git a/dialog/kmknotify.h b/dialog/kmknotify.h index 1bf5765ed..a95d457d4 100644 --- a/dialog/kmknotify.h +++ b/dialog/kmknotify.h @@ -29,12 +29,12 @@ #ifndef KMKNOTIFY_H #define KMKNOTIFY_H -#include +#include class KComboBox; class KNotifyConfigWidget; namespace KMail { -class KMKnotify : public KDialog +class KMKnotify : public QDialog { Q_OBJECT public: