From 5c5bbc3f8c4297cfd6862072aa33a45d947fa41b Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Wed, 9 Dec 2015 14:07:07 -0500 Subject: [PATCH 02/10] [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 fdfb657..33184c4 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 bad3071..5b262f1 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.5.0