[rkward/frameworks] rkward: Now fix the cases, where function was overriding in KDE4, but is no longer.
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Nov 20 12:54:12 UTC 2015
Git commit 715113b0a1ae2e74d699e4ac3a83df58bcf7142a by Thomas Friedrichsmeier.
Committed on 20/11/2015 at 12:54.
Pushed by tfry into branch 'frameworks'.
Now fix the cases, where function was overriding in KDE4, but is no longer.
M +15 -18 rkward/settings/rksettings.cpp
M +5 -3 rkward/settings/rksettings.h
M +6 -3 rkward/windows/rkmdiwindow.cpp
M +1 -1 rkward/windows/rkmdiwindow.h
http://commits.kde.org/rkward/715113b0a1ae2e74d699e4ac3a83df58bcf7142a
diff --git a/rkward/settings/rksettings.cpp b/rkward/settings/rksettings.cpp
index 84de73b..54fc89c 100644
--- a/rkward/settings/rksettings.cpp
+++ b/rkward/settings/rksettings.cpp
@@ -72,6 +72,8 @@ RKSettings::RKSettings (QWidget *parent) : KPageDialog (parent) {
buttonBox ()->setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
// KF5 TODO: connect buttons
button (QDialogButtonBox::Apply)->setEnabled (false);
+ connect (button (QDialogButtonBox::Apply), SIGNAL (clicked()), this, SLOT(applyAll()));
+ connect (button (QDialogButtonBox::Help), SIGNAL (clicked()), this, SLOT(helpClicked()));
setAttribute (Qt::WA_DeleteOnClose, true);
@@ -136,28 +138,23 @@ void RKSettings::pageChange (KPageWidgetItem *current, KPageWidgetItem *) {
button (QDialogButtonBox::Help)->setEnabled (has_help);
}
-void RKSettings::slotButtonClicked (int button) {
+void RKSettings::done (int result) {
RK_TRACE (SETTINGS);
- if (button == KDialog::Apply) {
- applyAll ();
- } else if (button == KDialog::Ok) {
- applyAll ();
- accept ();
- close ();
- } else if (button == KDialog::Cancel) {
- reject ();
- } else if (button == KDialog::Help) {
- RKSettingsModule *current_module = dynamic_cast<RKSettingsModule*> (currentPage ()->widget ());
- if (!current_module) {
- RK_ASSERT (false);
- return;
- }
-
- RKWorkplace::mainWorkplace ()->openHelpWindow (current_module->helpURL ());
- } else {
+ if (result == Accepted) applyAll ();
+ QDialog::done (result);
+}
+
+void RKSettings::helpClicked () {
+ RK_TRACE (SETTINGS);
+
+ RKSettingsModule *current_module = dynamic_cast<RKSettingsModule*> (currentPage ()->widget ());
+ if (!current_module) {
RK_ASSERT (false);
+ return;
}
+
+ RKWorkplace::mainWorkplace ()->openHelpWindow (current_module->helpURL ());
}
void RKSettings::applyAll () {
diff --git a/rkward/settings/rksettings.h b/rkward/settings/rksettings.h
index 8109599..80980a0 100644
--- a/rkward/settings/rksettings.h
+++ b/rkward/settings/rksettings.h
@@ -62,12 +62,14 @@ public:
public slots:
void pageChange (KPageWidgetItem *current, KPageWidgetItem *before);
protected:
- void slotButtonClicked (int button) override;
-protected:
RKSettings (QWidget *parent = 0);
~RKSettings ();
-private:
+
+ void done (int result) override;
+private slots:
void applyAll ();
+ void helpClicked ();
+private:
void initModules ();
void raisePage (SettingsPage page);
static void dialogClosed ();
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index 21023f3..b3bbae0 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -254,11 +254,14 @@ void RKMDIWindow::paintEvent (QPaintEvent *e) {
}
}
-void RKMDIWindow::windowActivationChange (bool) {
+void RKMDIWindow::changeEvent (QEvent *event) {
RK_TRACE (APP);
- // NOTE: active is NOT the same as isActive(). Active just means that this window *would* be active, if its toplevel window is active.
- if (active || (!isAttached ())) update ();
+ if (event->type () == QEvent::ActivationChange) {
+ // NOTE: active is NOT the same as isActive(). Active just means that this window *would* be active, if its toplevel window is active.
+ if (active || (!isAttached ())) update ();
+ }
+ QFrame::changeEvent (event);
}
void RKMDIWindow::slotActivate () {
diff --git a/rkward/windows/rkmdiwindow.h b/rkward/windows/rkmdiwindow.h
index 5d9387b..4a718c1 100644
--- a/rkward/windows/rkmdiwindow.h
+++ b/rkward/windows/rkmdiwindow.h
@@ -124,7 +124,7 @@ protected:
void setMetaInfo (const QString& generic_window_name, const QString& help_url, RKSettings::SettingsPage settings_page=RKSettings::NoPage);
void initializeActivationSignals ();
void paintEvent (QPaintEvent *e) override;
- void windowActivationChange (bool) override;
+ void changeEvent (QEvent *event) override;
/** reimplemented from QWidget to emulate focus-follows-mouse behavior */
void enterEvent (QEvent *event) override;
More information about the rkward-tracker
mailing list