43 //Build theme list |
44 //Build theme list |
44 mThemeList = CpThemeUtil::buildThemeList(); |
45 mThemeList = CpThemeUtil::buildThemeList(); |
45 |
46 |
46 //Look into theme paths and add a file watcher for it |
47 //Look into theme paths and add a file watcher for it |
47 //to get notified when themes are added. |
48 //to get notified when themes are added. |
48 QStringList themesPathList = CpThemeUtil::themePathList(); |
49 QStringList themePaths = CpThemeUtil::themeDirectories(mThemeList); |
49 foreach (const QString &path, themesPathList) { |
50 if(!themePaths.empty()) { |
50 QDir themeDir; |
51 mFileWatcher->addPaths(themePaths); |
51 themeDir.setPath( path ) ; |
|
52 QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name); |
|
53 if(list.contains("themes", Qt::CaseSensitive )) { |
|
54 mFileWatcher->addPath(themeDir.path() + "/themes/"); |
|
55 } |
|
56 } |
52 } |
57 connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)), |
53 |
|
54 connect(mFileWatcher, SIGNAL(directoryChanged(QString)), |
58 this, SLOT(themeListChanged())); |
55 this, SLOT(themeListChanged())); |
59 |
56 |
60 // data for the list which appears after the themes: |
|
61 CpThemeInfo fetchFromStore; |
|
62 fetchFromStore.setName(hbTrId("txt_cp_list_get_more_tones")); |
|
63 fetchFromStore.setItemType(CpThemeInfo::ThemeListItemType_URL); |
|
64 fetchFromStore.setItemData(QString("http://lr.ovi.mobi/store/themes")); |
|
65 fetchFromStore.setIcon(HbIcon("qtg_large_ovistore")); |
|
66 mBottomThemeList.append(fetchFromStore); |
|
67 } |
57 } |
68 |
58 |
69 /* |
59 /* |
70 Destructor |
60 Destructor |
71 */ |
61 */ |
114 if (list) { |
104 if (list) { |
115 switch (role) { |
105 switch (role) { |
116 case Qt::DisplayRole: |
106 case Qt::DisplayRole: |
117 retVal = list->at(row).name(); |
107 retVal = list->at(row).name(); |
118 break; |
108 break; |
119 |
109 |
120 case Qt::DecorationRole: |
|
121 retVal = list->at(row).icon(); |
|
122 break; |
|
123 |
|
124 case Qt::SizeHintRole: |
110 case Qt::SizeHintRole: |
125 retVal = list->at(row).icon().size(); |
111 retVal = list->at(row).icon().size(); |
126 break; |
112 break; |
127 |
113 |
128 case PortraitPreviewRole: |
|
129 retVal = list->at(row).portraitPreviewIcon(); |
|
130 break; |
|
131 |
|
132 case LandscapePreviewRole: |
|
133 retVal = list->at(row).landscapePreviewIcon(); |
|
134 break; |
|
135 |
|
136 case ItemDataRole: |
114 case ItemDataRole: |
137 retVal = list->at(row).itemData(); |
115 retVal = list->at(row).itemData(); |
138 break; |
116 break; |
139 |
117 |
140 case ItemTypeRole: |
118 case ItemTypeRole: |