src/hbcore/theme/hbtheme.cpp
changeset 5 627c4a0fd0e7
parent 3 11d3954df52a
child 6 c3690ec91ef8
--- a/src/hbcore/theme/hbtheme.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbcore/theme/hbtheme.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -85,7 +85,7 @@
 */
 QString HbTheme::name() const
 {
-    return d_ptr->currentTheme;
+    return d_ptr->iconTheme.name();
 }
 
 /*!
@@ -145,10 +145,16 @@
 */
 void HbThemePrivate::fetchCurrentThemeFromSettings()
 {
+    HbThemeIndexInfo info = HbThemeUtils::getThemeIndexInfo(ActiveTheme);
+    if (info.themeIndexOffset > 0) {
+        currentTheme = info.name;
+        return;
+    }
+    
+    // Fallback to settings
     currentTheme = HbThemeUtils::getThemeSetting(HbThemeUtils::CurrentThemeSetting);
     if (currentTheme.trimmed().isEmpty()){
         currentTheme = HbThemeUtils::defaultTheme().name;
-        HbThemeUtils::setThemeSetting(HbThemeUtils::CurrentThemeSetting, currentTheme);
     }
 }
 
@@ -160,10 +166,15 @@
     Q_Q(HbTheme);
     QString newTheme;
     if (str.isEmpty()) {
-        newTheme = HbThemeUtils::getThemeSetting(HbThemeUtils::CurrentThemeSetting);
+        HbThemeIndexInfo info = HbThemeUtils::getThemeIndexInfo(ActiveTheme);
+        if (info.themeIndexOffset > 0) {
+            newTheme = info.name;
+        } else {
+            newTheme = HbThemeUtils::getThemeSetting(HbThemeUtils::CurrentThemeSetting);
+        }
     } else {
         newTheme = str;
-        // Update the new currentTheme setting in HbThemeUtils.
+        // Update the new currentTheme to local settings in HbThemeUtils.
         HbThemeUtils::updateThemeSetting(HbThemeUtils::CurrentThemeSetting, newTheme);
     }
 
@@ -173,16 +184,14 @@
     
     // The server sends the signal only if the theme is changed from the previous theme
     // Hence here, we need not check whether the theme differs from currentTheme or not.
-    if(currentTheme != newTheme) {
-        currentTheme = newTheme;
-        // This should be used to replace pixmaps from the old theme with the pixmaps from the new theme
-        // In application side this is needed only when icon size can be different in different theme.
-        iconTheme.emitUpdateIcons();
+    currentTheme = newTheme;
+    // This should be used to replace pixmaps from the old theme with the pixmaps from the new theme
+    // In application side this is needed only when icon size can be different in different theme.
+    iconTheme.emitUpdateIcons();
 
-        emit q->changed();
-        // This signal should be used to update the screen after the theme change - it's handled by HbInstance.
-        emit q->changeFinished();
-    }
+    emit q->changed();
+    // This signal should be used to update the screen after the theme change - it's handled by HbInstance.
+    emit q->changeFinished();
 }
 
 /*!