Bug 409393 - Weather widget should immediately refresh after login or wake from sleep
Summary: Weather widget should immediately refresh after login or wake from sleep
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Weather widget (show other bugs)
Version: 6.2.3
Platform: Other Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: junior-jobs
: 478853 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-07-02 04:40 UTC by Slavi
Modified: 2024-12-17 22:26 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Slavi 2019-07-02 04:40:42 UTC
SUMMARY

It doesn't seem like the weather widget refreshes its data shortly after resuming from suspend.

One needs to wait until the next update interval (default 30 minutes) for new data to come in.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.13.0
Comment 1 Christoph Feck 2019-07-25 11:06:04 UTC
The "time" data engine connects to "resumingFromSuspend". The "weather" engine would need similar code.

https://cgit.kde.org/plasma-workspace.git/tree/dataengines/time/timeengine.cpp

https://cgit.kde.org/plasma-workspace.git/tree/dataengines/weather/weatherengine.cpp
Comment 2 Manuel Alcaraz 2019-08-09 19:11:37 UTC
I could fix this, but I don't know what is the correct name for the weather in /org/kde/kcmshell_clock. Something like /org/kde/kcmshell_weather?
Thanks

My actual diff (not tested):

diff --git a/dataengines/weather/weatherengine.cpp b/dataengines/weather/weatherengine.cpp
index 53189021..301ae3f9 100644
--- a/dataengines/weather/weatherengine.cpp
+++ b/dataengines/weather/weatherengine.cpp
@@ -20,6 +20,7 @@
 
 #include "weatherengine.h"
 
+#include <QDBusConnection>
 #include <QTimer>
 
 #include <KSycoca>
@@ -46,6 +47,14 @@ WeatherEngine::WeatherEngine(QObject *parent, const QVariantList& args)
     // Get the list of available plugins but don't load them
     connect(KSycoca::self(), static_cast<void (KSycoca::*)(const QStringList&)>(&KSycoca::databaseChanged),
             this, &WeatherEngine::updateIonList);
+    
+    dbus.connect(QString(), "/org/kde/kcmshell_clock", "org.kde.kcmshell_clock", "weatherUpdated", this, SLOT(startReconnect()));
+    dbus.connect(QStringLiteral("org.kde.Solid.PowerManagement"),
+                 QStringLiteral("/org/kde/Solid/PowerManagement/Actions/SuspendSession"),
+                 QStringLiteral("org.kde.Solid.PowerManagement.Actions.SuspendSession"),
+                 QStringLiteral("resumingFromSuspend"),
+                 this,
+                 SLOT(startReconnect()));
 
     updateIonList();
 }
Comment 3 Christoph Feck 2019-08-20 21:47:20 UTC
Doesn't it work if you only use the second connect() call?
Comment 4 Nate Graham 2023-12-21 21:33:16 UTC
*** Bug 478853 has been marked as a duplicate of this bug. ***