plasma5-workspace/0002-notifications-Move-reading-globalConfig-from-ctor-to.patch

63 lines
2.3 KiB
Diff

From 5c5bbc3f8c4297cfd6862072aa33a45d947fa41b Mon Sep 17 00:00:00 2001
From: Martin Klapetek <mklapetek@kde.org>
Date: Wed, 9 Dec 2015 14:07:07 -0500
Subject: [PATCH 2/4] [notifications] Move reading globalConfig() from ctor to
init()
The globalConfig() in ctor returns a non-(yet-)existing KConfigGroup
which makes it always return the default value. So the config access
must be delayed for init().
Custom notification position is now correctly remembered.
BUG: 356419
FIXED-IN: 5.5.1
---
applets/notifications/lib/notificationsapplet.cpp | 10 +++++++---
applets/notifications/lib/notificationsapplet.h | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/applets/notifications/lib/notificationsapplet.cpp b/applets/notifications/lib/notificationsapplet.cpp
index fdfb6578f9abeca6067db45fea9f4ec6f5857eec..33184c4fdd9d091f2ba39f354c7c9d2a66b2b48b 100644
--- a/applets/notifications/lib/notificationsapplet.cpp
+++ b/applets/notifications/lib/notificationsapplet.cpp
@@ -28,16 +28,20 @@
NotificationsApplet::NotificationsApplet(QObject *parent, const QVariantList &data)
: Plasma::Applet(parent, data)
{
- KConfigGroup globalGroup = globalConfig();
- m_popupPosition = (NotificationsHelper::PositionOnScreen)globalGroup.readEntry("popupPosition", 0); //0 is default
-
connect(this, &Plasma::Applet::locationChanged,
this, &NotificationsApplet::onAppletLocationChanged);
}
NotificationsApplet::~NotificationsApplet()
{
+}
+
+void NotificationsApplet::init()
+{
+ KConfigGroup globalGroup = globalConfig();
+ m_popupPosition = (NotificationsHelper::PositionOnScreen)globalGroup.readEntry("popupPosition", 0); //0 is default
+ Plasma::Applet::init();
}
void NotificationsApplet::onAppletLocationChanged(Plasma::Types::Location location)
diff --git a/applets/notifications/lib/notificationsapplet.h b/applets/notifications/lib/notificationsapplet.h
index bad3071a29d3a341f4b16609398443e7a9925bf9..5b262f1b4d33119b1f8032fbd26cc5dfb2ebeb36 100644
--- a/applets/notifications/lib/notificationsapplet.h
+++ b/applets/notifications/lib/notificationsapplet.h
@@ -38,6 +38,7 @@ public:
Q_INVOKABLE uint screenPosition() const;
public Q_SLOTS:
+ void init() Q_DECL_OVERRIDE;
void onScreenPositionChanged(uint position);
void onAppletLocationChanged(Plasma::Types::Location location);
--
2.6.2