controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp
changeset 31 e79ce701c376
parent 25 19394c261aa5
child 37 cb294e641644
--- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -18,6 +18,7 @@
 #include <QDir>
 #include <QStringList>
 #include <QFileSystemWatcher>
+#include <QPair>
 
 #include <HbIcon>
 
@@ -45,18 +46,14 @@
     
     //Look into theme paths and add a file watcher for it
     //to get notified when themes are added.
-    QStringList themesPathList = CpThemeUtil::themePathList();
-    foreach (const QString &path, themesPathList) {
-        QDir themeDir;
-        themeDir.setPath( path ) ;
-        QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
-        if(list.contains("themes", Qt::CaseSensitive )) {
-            mFileWatcher->addPath(themeDir.path() + "/themes/");
-        }
+    QStringList themePaths = CpThemeUtil::themeDirectories(mThemeList);
+    if(!themePaths.empty()) {
+        mFileWatcher->addPaths(themePaths);
     }
-    connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)),
+   
+    connect(mFileWatcher, SIGNAL(directoryChanged(QString)),
            this, SLOT(themeListChanged()));
-       
+    
     // data for the list which appears after the themes:
     CpThemeInfo fetchFromStore;
     fetchFromStore.setName(hbTrId("txt_cp_list_get_more_tones"));
@@ -116,14 +113,10 @@
                 case Qt::DisplayRole:
                     retVal = list->at(row).name();
                     break;
-
+#ifdef CP_THEME_PREVIEW_DEFINED
                 case Qt::DecorationRole:
                     retVal = list->at(row).icon();
                     break;
-
-                case Qt::SizeHintRole:
-                    retVal = list->at(row).icon().size();
-                    break;
                     
                 case PortraitPreviewRole:
           	        retVal = list->at(row).portraitPreviewIcon();
@@ -132,7 +125,11 @@
                 case LandscapePreviewRole:
                     retVal = list->at(row).landscapePreviewIcon();
                     break;
-                    
+#endif                    
+                case Qt::SizeHintRole:
+                    retVal = list->at(row).icon().size();
+                    break;
+                                
                 case ItemDataRole:
                     retVal = list->at(row).itemData();
                     break;