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

List:       kde-commits
Subject:    [kdepim/frameworks] /: Port to QDialog
From:       Montel Laurent <montel () kde ! org>
Date:       2014-07-31 19:15:45
Message-ID: E1XCvpJ-0001iK-QG () scm ! kde ! org
[Download RAW message or body]

Git commit 778f97ddb69cc752229c4efefa88172442481c72 by Montel Laurent.
Committed on 31/07/2014 at 19:15.
Pushed by mlaurent into branch 'frameworks'.

Port to QDialog

M  +2    -0    agents/followupreminderagent/followupremindermanager.cpp
M  +19   -4    agents/followupreminderagent/followupremindernoanswerdialog.cpp
M  +2    -2    agents/followupreminderagent/followupremindernoanswerdialog.h
M  +14   -13   examples/kabc/kabcviewer.cpp
M  +1    -1    examples/kabc/kabcviewer.h
M  +18   -6    libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.cpp
M  +2    -2    libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.h
M  +1    -0    libksieve/ksieveui/editor/sieveeditortextmodewidget.cpp
M  +12   -12   mailcommon/collectionpage/collectiongeneralpage.cpp
M  +17   -10   messagecomposer/imagescaling/imagescalingselectformat.cpp
M  +2    -2    messagecomposer/imagescaling/imagescalingselectformat.h

http://commits.kde.org/kdepim/778f97ddb69cc752229c4efefa88172442481c72

diff --git a/agents/followupreminderagent/followupremindermanager.cpp \
b/agents/followupreminderagent/followupremindermanager.cpp index d357360..c1526bf \
                100644
--- a/agents/followupreminderagent/followupremindermanager.cpp
+++ b/agents/followupreminderagent/followupremindermanager.cpp
@@ -21,6 +21,8 @@
 #include "jobs/followupreminderjob.h"
 #include "jobs/followupreminderfinishtaskjob.h"
 
+#include <QIcon>
+
 #include <KConfigGroup>
 #include <KConfig>
 #include <KSharedConfig>
diff --git a/agents/followupreminderagent/followupremindernoanswerdialog.cpp \
b/agents/followupreminderagent/followupremindernoanswerdialog.cpp index \
                c44006d..abb7d9a 100644
--- a/agents/followupreminderagent/followupremindernoanswerdialog.cpp
+++ b/agents/followupreminderagent/followupremindernoanswerdialog.cpp
@@ -28,14 +28,27 @@
 #include <QTreeWidget>
 #include <QHeaderView>
 #include <QLabel>
+#include <QDialogButtonBox>
+#include <KConfigGroup>
+#include <QPushButton>
+#include <QVBoxLayout>
 
 
 FollowUpReminderNoAnswerDialog::FollowUpReminderNoAnswerDialog(QWidget *parent)
-    : KDialog(parent)
+    : QDialog(parent)
 {
-    setCaption( i18n("Follow Up Mail") );
+    setWindowTitle( i18n("Follow Up Mail") );
     setWindowIcon( QIcon::fromTheme( QLatin1String("kmail") ) );
-    setButtons( Ok|Cancel );
+    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()));
     setAttribute(Qt::WA_DeleteOnClose);
     QWidget *w = new QWidget;
     QVBoxLayout *vbox = new QVBoxLayout;
@@ -45,7 +58,9 @@ FollowUpReminderNoAnswerDialog::FollowUpReminderNoAnswerDialog(QWidget \
*parent)  
     mWidget = new FollowUpReminderInfoWidget;
     vbox->addWidget(mWidget);
-    setMainWidget(w);
+    mainLayout->addWidget(w);
+    mainLayout->addWidget(buttonBox);
+
     readConfig();
 }
 
diff --git a/agents/followupreminderagent/followupremindernoanswerdialog.h \
b/agents/followupreminderagent/followupremindernoanswerdialog.h index \
                d6292c9..1a5ef97 100644
--- a/agents/followupreminderagent/followupremindernoanswerdialog.h
+++ b/agents/followupreminderagent/followupremindernoanswerdialog.h
@@ -18,12 +18,12 @@
 #ifndef FOLLOWUPREMINDERNOANSWERDIALOG_H
 #define FOLLOWUPREMINDERNOANSWERDIALOG_H
 
-#include <KDialog>
+#include <QDialog>
 namespace FollowUpReminder {
 class FollowUpReminderInfo;
 }
 class FollowUpReminderInfoWidget;
-class FollowUpReminderNoAnswerDialog : public KDialog
+class FollowUpReminderNoAnswerDialog : public QDialog
 {
     Q_OBJECT
 public:
diff --git a/examples/kabc/kabcviewer.cpp b/examples/kabc/kabcviewer.cpp
index 741f4ba..a7b0a19 100644
--- a/examples/kabc/kabcviewer.cpp
+++ b/examples/kabc/kabcviewer.cpp
@@ -28,22 +28,23 @@
 #include <klocale.h>
 
 #include <Akonadi/Contact/ContactViewer>
+#include <QDialogButtonBox>
+#include <KConfigGroup>
+#include <QPushButton>
 
 Dialog::Dialog( QWidget *parent )
-  : KDialog( parent )
+  : QDialog( parent )
 {
-  setCaption( i18n("Contact Viewer") );
-  setButtons( Close );
-  showButtonSeparator( true );
-
-  QWidget *wdg = new QWidget( this );
-  QVBoxLayout *layout = new QVBoxLayout( wdg );
-
-  mBrowser = new Akonadi::ContactViewer( wdg );
-  layout->addWidget( mBrowser );
-
-  setMainWidget( wdg );
-
+  setWindowTitle( i18n("Contact Viewer") );
+  QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+  QVBoxLayout *mainLayout = new QVBoxLayout;
+  setLayout(mainLayout);
+  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+  mBrowser = new Akonadi::ContactViewer( this );
+  mainLayout->addWidget(mBrowser);
+  mainLayout->addWidget(buttonBox);
   resize( 520, 580 );
 }
 
diff --git a/examples/kabc/kabcviewer.h b/examples/kabc/kabcviewer.h
index 71c0ded..5cc5e36 100644
--- a/examples/kabc/kabcviewer.h
+++ b/examples/kabc/kabcviewer.h
@@ -30,7 +30,7 @@ namespace Akonadi {
   class ContactViewer;
 }
 
-class Dialog : public KDialog
+class Dialog : public QDialog
 {
   Q_OBJECT
 
diff --git a/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.cpp \
b/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.cpp index \
                9da26f7..606e21e 100644
--- a/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.cpp
+++ b/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.cpp
@@ -24,17 +24,29 @@
 #include <KLocalizedString>
 #include <KSharedConfig>
 #include <QKeyEvent>
+#include <QDialogButtonBox>
+#include <KConfigGroup>
+#include <QPushButton>
+#include <QVBoxLayout>
 
 using namespace KSieveUi;
 
 AutoCreateScriptDialog::AutoCreateScriptDialog(QWidget *parent)
-    : KDialog(parent)
+    : QDialog(parent)
 {
-    setCaption( i18n( "Create sieve filter" ) );
-    setButtons( Ok|Cancel );
-    setButtonFocus( Ok );
+    setWindowTitle( i18n( "Create sieve filter" ) );
+    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->setFocus();
     mEditor = new SieveEditorGraphicalModeWidget;
-    setMainWidget( mEditor );
+    mainLayout->addWidget(mEditor);
+    mainLayout->addWidget(buttonBox);
     readConfig();
 }
 
@@ -83,6 +95,6 @@ bool AutoCreateScriptDialog::event(QEvent* e)
             return true;
         }
     }
-    return KDialog::event(e);
+    return QDialog::event(e);
 }
 
diff --git a/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.h \
b/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.h index \
                368ba69..75c60f8 100644
--- a/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.h
+++ b/libksieve/ksieveui/autocreatescripts/autocreatescriptdialog.h
@@ -20,13 +20,13 @@
 
 #include "ksieveui_export.h"
 
-#include <KDialog>
+#include <QDialog>
 
 class QDomDocument;
 
 namespace KSieveUi {
 class SieveEditorGraphicalModeWidget;
-class KSIEVEUI_EXPORT AutoCreateScriptDialog : public KDialog
+class KSIEVEUI_EXPORT AutoCreateScriptDialog : public QDialog
 {
     Q_OBJECT
 public:
diff --git a/libksieve/ksieveui/editor/sieveeditortextmodewidget.cpp \
b/libksieve/ksieveui/editor/sieveeditortextmodewidget.cpp index 438c4c8..fb5d909 \
                100644
--- a/libksieve/ksieveui/editor/sieveeditortextmodewidget.cpp
+++ b/libksieve/ksieveui/editor/sieveeditortextmodewidget.cpp
@@ -39,6 +39,7 @@
 
 #include <KLocalizedString>
 #include <KSharedConfig>
+#include <KConfigGroup>
 
 #include <QSplitter>
 #include <QShortcut>
diff --git a/mailcommon/collectionpage/collectiongeneralpage.cpp \
b/mailcommon/collectionpage/collectiongeneralpage.cpp index b474eb9..3a2c484 100644
--- a/mailcommon/collectionpage/collectiongeneralpage.cpp
+++ b/mailcommon/collectionpage/collectiongeneralpage.cpp
@@ -34,7 +34,7 @@
 
 #include <KColorScheme>
 #include <KComboBox>
-#include <KDialog>
+#include <QDialog>
 #include <QLineEdit>
 #include <KLocale>
 #include <KMessageBox>
@@ -254,7 +254,7 @@ void CollectionGeneralPage::init( const Akonadi::Collection \
&collection )  QLabel *label;
 
     QVBoxLayout *topLayout = new QVBoxLayout( this );
-    topLayout->setSpacing( KDialog::spacingHint() );
+//TODO PORT QT5     topLayout->setSpacing( QDialog::spacingHint() );
     topLayout->setMargin( 0 );
 
     // Musn't be able to edit details for a non-resource, system folder.
@@ -263,8 +263,8 @@ void CollectionGeneralPage::init( const Akonadi::Collection \
&collection )  
         QHBoxLayout *hl = new QHBoxLayout();
         topLayout->addItem( hl );
-        hl->setSpacing( KDialog::spacingHint() );
-        hl->setMargin( KDialog::marginHint() );
+//TODO PORT QT5         hl->setSpacing( QDialog::spacingHint() );
+//TODO PORT QT5         hl->setMargin( QDialog::marginHint() );
         label = new QLabel( i18nc( "@label:textbox Name of the folder.", "&Name:" ), \
this );  hl->addWidget( label );
 
@@ -277,8 +277,8 @@ void CollectionGeneralPage::init( const Akonadi::Collection \
&collection )  // should new mail in this folder be ignored?
     QHBoxLayout *hbl = new QHBoxLayout();
     topLayout->addItem( hbl );
-    hbl->setSpacing( KDialog::spacingHint() );
-    hbl->setMargin( KDialog::marginHint() );
+//TODO PORT QT5     hbl->setSpacing( QDialog::spacingHint() );
+//TODO PORT QT5     hbl->setMargin( QDialog::marginHint() );
     mNotifyOnNewMailCheckBox =
             new QCheckBox( i18n( "Act on new/unread mail in this folder" ), this );
     mNotifyOnNewMailCheckBox->setWhatsThis(
@@ -295,8 +295,8 @@ void CollectionGeneralPage::init( const Akonadi::Collection \
                &collection )
     // should replies to mails in this folder be kept in this same folder?
     hbl = new QHBoxLayout();
     topLayout->addItem( hbl );
-    hbl->setSpacing( KDialog::spacingHint() );
-    hbl->setMargin( KDialog::marginHint() );
+//TODO PORT QT5     hbl->setSpacing( QDialog::spacingHint() );
+//TODO PORT QT5     hbl->setMargin( QDialog::marginHint() );
     mKeepRepliesInSameFolderCheckBox =
             new QCheckBox( i18n( "Keep replies in this folder" ), this );
     mKeepRepliesInSameFolderCheckBox->setWhatsThis(
@@ -308,8 +308,8 @@ void CollectionGeneralPage::init( const Akonadi::Collection \
&collection )  // should this folder be shown in the folder selection dialog?
     hbl = new QHBoxLayout();
     topLayout->addItem( hbl );
-    hbl->setSpacing( KDialog::spacingHint() );
-    hbl->setMargin( KDialog::marginHint() );
+//TODO PORT QT5     hbl->setSpacing( QDialog::spacingHint() );
+//TODO PORT QT5     hbl->setMargin( QDialog::marginHint() );
     mHideInSelectionDialogCheckBox =
             new QCheckBox( i18n( "Hide this folder in the folder selection dialog" \
), this );  mHideInSelectionDialogCheckBox->setWhatsThis(
@@ -323,9 +323,9 @@ void CollectionGeneralPage::init( const Akonadi::Collection \
&collection )  addLine( this, topLayout );
     // use grid layout for the following combobox settings
     QGridLayout *gl = new QGridLayout();
-    gl->setMargin( KDialog::marginHint() );
+//TODO PORT QT5     gl->setMargin( QDialog::marginHint() );
     topLayout->addItem( gl );
-    gl->setSpacing( KDialog::spacingHint() );
+//TODO PORT QT5     gl->setSpacing( QDialog::spacingHint() );
     gl->setColumnStretch( 1, 100 ); // make the second column use all available \
space  int row = -1;
 
diff --git a/messagecomposer/imagescaling/imagescalingselectformat.cpp \
b/messagecomposer/imagescaling/imagescalingselectformat.cpp index acce572..a009df4 \
                100644
--- a/messagecomposer/imagescaling/imagescalingselectformat.cpp
+++ b/messagecomposer/imagescaling/imagescalingselectformat.cpp
@@ -24,22 +24,29 @@
 #include <QListWidget>
 #include <QHBoxLayout>
 #include <QPointer>
+#include <QDialogButtonBox>
+#include <KConfigGroup>
+#include <QVBoxLayout>
 
 using namespace MessageComposer;
 
 ImageScalingSelectFormatDialog::ImageScalingSelectFormatDialog(QWidget *parent)
-    : KDialog(parent)
+    : QDialog(parent)
 {
-    QWidget *w = new QWidget( this );
-    setMainWidget( w );
-    setCaption( i18nc("@title:window", "Select Image Format") );
-    setButtons( Ok | Cancel );
-    setDefaultButton( Ok );
-
-    QBoxLayout *topLayout = new QVBoxLayout( w );
-    topLayout->setSpacing( spacingHint() );
+    setWindowTitle( i18nc("@title:window", "Select Image Format") );
+    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);
     mListWidget = new QListWidget;
-    topLayout->addWidget(mListWidget);
+    mainLayout->addWidget(mListWidget);
+    mainLayout->addWidget(buttonBox);
+
     initialize();
 }
 
diff --git a/messagecomposer/imagescaling/imagescalingselectformat.h \
b/messagecomposer/imagescaling/imagescalingselectformat.h index 5815b93..c5ae506 \
                100644
--- a/messagecomposer/imagescaling/imagescalingselectformat.h
+++ b/messagecomposer/imagescaling/imagescalingselectformat.h
@@ -17,7 +17,7 @@
 #ifndef IMAGESCALINGSELECTFORMAT_H
 #define IMAGESCALINGSELECTFORMAT_H
 
-#include <KDialog>
+#include <QDialog>
 
 class QLineEdit;
 class QPushButton;
@@ -25,7 +25,7 @@ class QListWidget;
 
 namespace MessageComposer {
 
-class ImageScalingSelectFormatDialog : public KDialog
+class ImageScalingSelectFormatDialog : public QDialog
 {
     Q_OBJECT
 public:


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

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