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

List:       kde-commits
Subject:    [kphotoalbum] Settings: Made the settings dialog work again by fixing the "OK", "Apply" and "Cancel"
From:       Tobias Leupold <tobias.leupold () web ! de>
Date:       2016-08-16 15:35:58
Message-ID: E1bZgPG-0003KW-2B () code ! kde ! org
[Download RAW message or body]

Git commit 4f6af0d5ddf7c0733ca064c8eba92874c963da1c by Tobias Leupold.
Committed on 16/08/2016 at 15:35.
Pushed by tleupold into branch 'master'.

Made the settings dialog work again by fixing the "OK", "Apply" and "Cancel" button.

M  +17   -21   Settings/SettingsDialog.cpp

http://commits.kde.org/kphotoalbum/4f6af0d5ddf7c0733ca064c8eba92874c963da1c

diff --git a/Settings/SettingsDialog.cpp b/Settings/SettingsDialog.cpp
index c9d69fd..cbb54dc 100644
--- a/Settings/SettingsDialog.cpp
+++ b/Settings/SettingsDialog.cpp
@@ -107,33 +107,29 @@ Settings::SettingsDialog::SettingsDialog( QWidget* parent)
         ++i;
     }
 
+    setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | \
QDialogButtonBox::Apply); +    connect(this, &QDialog::accepted,
+            this, &SettingsDialog::slotMyOK);
+    connect(button(QDialogButtonBox::Apply), &QPushButton::clicked,
+            this, &SettingsDialog::slotMyOK);
+    connect(this, &QDialog::rejected, m_birthdayPage, \
&Settings::BirthdayPage::discardChanges);  
-    QDialogButtonBox *buttonBox = new \
QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply);
                
-    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, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
-    connect(buttonBox, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
-    //PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in \
                layout. Please move it.
-    mainLayout->addWidget(buttonBox);
     setWindowTitle( i18n( "Settings" ) );
 
-    connect(m_categoryPage, &Settings::CategoryPage::categoryChangesPending, \
                m_tagGroupsPage, &Settings::TagGroupsPage::categoryChangesPending);
-    connect(this, &SettingsDialog::currentPageChanged, m_tagGroupsPage, \
&Settings::TagGroupsPage::slotPageChange); +    connect(m_categoryPage, \
&Settings::CategoryPage::categoryChangesPending, +            m_tagGroupsPage, \
&Settings::TagGroupsPage::categoryChangesPending); +    connect(this, \
&SettingsDialog::currentPageChanged, +            m_tagGroupsPage, \
&Settings::TagGroupsPage::slotPageChange);  #ifdef HAVE_KFACE
-    connect(this, &SettingsDialog::currentPageChanged, m_faceManagementPage, \
&Settings::FaceManagementPage::slotPageChange); +    connect(this, \
&SettingsDialog::currentPageChanged, +            m_faceManagementPage, \
&Settings::FaceManagementPage::slotPageChange);  #endif
-    connect(this, &SettingsDialog::currentPageChanged, m_birthdayPage, \
                &Settings::BirthdayPage::pageChange);
-    connect(buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, \
                m_birthdayPage, &Settings::BirthdayPage::discardChanges);
-    // slot is protected -> use old style connect:
-    connect(this, SIGNAL(cancelClicked()), m_categoryPage, \
SLOT(resetCategoryLabel())); +    connect(this, &SettingsDialog::currentPageChanged,
+            m_birthdayPage, &Settings::BirthdayPage::pageChange);
 
-    connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, \
                &SettingsDialog::slotMyOK);
-    connect(okButton, &QPushButton::clicked, this, &SettingsDialog::slotMyOK);
+    // slot is protected -> use old style connect:
+    connect(this, SIGNAL(cancelClicked()),
+            m_categoryPage, SLOT(resetCategoryLabel()));
 }
 
 void Settings::SettingsDialog::show()


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

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