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

List:       kde-commits
Subject:    [kactivities/ivan/libkactivities-stats] src/imports: Return empty string rather than default-constru
From:       Ivan Čukić <ivan.cukic () kde ! org>
Date:       2015-01-31 17:52:59
Message-ID: E1YHcE7-0003zO-Qm () scm ! kde ! org
[Download RAW message or body]

Git commit bbc9e399667ba11a951189819a8250b69365e460 by Ivan Čukić, on behalf of Kai Uwe Broulik.
Committed on 25/01/2015 at 15:39.
Pushed by ivan into branch 'ivan/libkactivities-stats'.

Return empty string rather than default-constructed value if config is empty

For the view to properly fall back to the default theme wallpaper it needs to get an
empty string rather than the color black if neither Image nor Color keys are present
in the config which is the case for newly created activities.

Changelog: Fix activity preview showing wrong wallpaper occasionally

REVIEW: 122244

M  +11   -7    src/imports/activitymodel.cpp

http://commits.kde.org/kactivities/bbc9e399667ba11a951189819a8250b69365e460

diff --git a/src/imports/activitymodel.cpp b/src/imports/activitymodel.cpp
index 7be6292..2b14a10 100644
--- a/src/imports/activitymodel.cpp
+++ b/src/imports/activitymodel.cpp
@@ -194,15 +194,19 @@ public:
             auto wallpaperPlugin = config.readEntry("wallpaperplugin");
             auto wallpaperConfig = config.group("Wallpaper").group(wallpaperPlugin).group("General");
 
-            // Trying for the wallpaper
-            auto wallpaper = wallpaperConfig.readEntry("Image", QString());
-
-            if (!wallpaper.isEmpty()) {
-                return wallpaper;
+            if (wallpaperConfig.hasKey("Image")) {
+                // Trying for the wallpaper
+                auto wallpaper = wallpaperConfig.readEntry("Image", QString());
+                if (!wallpaper.isEmpty()) {
+                    return wallpaper;
+                }
+            }
+            if (wallpaperConfig.hasKey("Color")) {
+                auto backgroundColor = wallpaperConfig.readEntry("Color", QColor(0, 0, 0));
+                return backgroundColor.name();
             }
 
-            auto backgroundColor = wallpaperConfig.readEntry("Color", QColor(0, 0, 0));
-            return backgroundColor.name();
+            return QString();
         }
 
         void reload(bool fullReload)

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

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