equal
deleted
inserted
replaced
126 |
126 |
127 setActiveThemeIndex(); |
127 setActiveThemeIndex(); |
128 |
128 |
129 |
129 |
130 //connect to signal for selecting a list item. |
130 //connect to signal for selecting a list item. |
131 connect(mThemeListView,SIGNAL(newThemeSelected(const QModelIndex&)), |
131 connect(mThemeListView,SIGNAL(newThemeSelected(QModelIndex)), |
132 this,SLOT(newThemeSelected(const QModelIndex&))); |
132 this,SLOT(newThemeSelected(QModelIndex))); |
133 |
133 |
134 //handle signal for list view closing. (e.g Back softkey pressed) |
134 //handle signal for list view closing. (e.g Back softkey pressed) |
135 connect(mThemeListView,SIGNAL(aboutToClose()), |
135 connect(mThemeListView,SIGNAL(aboutToClose()), |
136 this,SLOT(themeListClosed())); |
136 this,SLOT(themeListClosed())); |
137 } |
137 } |
223 data = index.data(Qt::DisplayRole); |
223 data = index.data(Qt::DisplayRole); |
224 if(data.isValid()) { |
224 if(data.isValid()) { |
225 themeInfo.setName(data.toString()); |
225 themeInfo.setName(data.toString()); |
226 } |
226 } |
227 |
227 |
|
228 data = index.data(CpThemeListModel::ItemDataRole); |
|
229 if(data.isValid()) { |
|
230 themeInfo.setItemData(data.toString()); |
|
231 } |
|
232 |
228 //get theme icon. |
233 //get theme icon. |
229 data = index.data(Qt::DecorationRole); |
234 data = index.data(Qt::DecorationRole); |
230 if(data.isValid()) { |
235 if(data.isValid()) { |
231 themeInfo.setIcon(data.value<HbIcon>()); |
236 themeInfo.setIcon(data.value<HbIcon>()); |
232 } |
237 } |
238 |
243 |
239 data = index.data(CpThemeListModel::LandscapePreviewRole); |
244 data = index.data(CpThemeListModel::LandscapePreviewRole); |
240 if(data.isValid()) { |
245 if(data.isValid()) { |
241 themeInfo.setLandscapePreviewIcon(data.value<HbIcon>()); |
246 themeInfo.setLandscapePreviewIcon(data.value<HbIcon>()); |
242 } |
247 } |
|
248 |
|
249 |
243 |
250 |
244 //Set up the theme preview and set it to |
251 //Set up the theme preview and set it to |
245 //the current view of main window. |
252 //the current view of main window. |
246 |
253 |
247 HbMainWindow* mWindow = ::mainWindow(); |
254 HbMainWindow* mWindow = ::mainWindow(); |
251 mWindow->addView(mThemePreview); |
258 mWindow->addView(mThemePreview); |
252 |
259 |
253 connect(mThemePreview,SIGNAL(aboutToClose()), |
260 connect(mThemePreview,SIGNAL(aboutToClose()), |
254 this, SLOT(previewClosed())); |
261 this, SLOT(previewClosed())); |
255 |
262 |
256 connect(mThemePreview, SIGNAL(applyTheme(const QString&)), |
263 connect(mThemePreview, SIGNAL(applyTheme(CpThemeInfo)), |
257 this, SLOT(themeApplied(const QString&))); |
264 this, SLOT(themeApplied(CpThemeInfo))); |
258 } else { |
265 } else { |
259 mThemePreview->setThemeInfo(themeInfo); |
266 mThemePreview->setThemeInfo(themeInfo); |
260 } |
267 } |
261 mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel")); |
268 mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel")); |
262 |
269 |
265 } |
272 } |
266 |
273 |
267 /*! |
274 /*! |
268 Slot called when a Select key is pressed in theme preview view. |
275 Slot called when a Select key is pressed in theme preview view. |
269 */ |
276 */ |
270 void CpThemeControl::themeApplied(const QString& theme) |
277 void CpThemeControl::themeApplied(const CpThemeInfo& theme) |
271 { |
278 { |
272 QThread::currentThread()->setPriority(QThread::HighPriority); |
279 QThread::currentThread()->setPriority(QThread::HighPriority); |
273 |
280 |
274 if(mThemeChanger->changeTheme(theme)) { |
281 if(mThemeChanger->changeTheme(theme)) { |
275 |
282 |
391 if(themeListModel && currentTheme) { |
398 if(themeListModel && currentTheme) { |
392 QModelIndex sourceIndex = mListModel->index(themeListModel->indexOf(*currentTheme),0); |
399 QModelIndex sourceIndex = mListModel->index(themeListModel->indexOf(*currentTheme),0); |
393 //set current index. |
400 //set current index. |
394 mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent); |
401 mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent); |
395 } |
402 } |
396 } |
403 else { |
397 |
404 mThemeListView->themeList()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear); |
398 |
405 } |
399 |
406 } |
400 |
407 |
401 |
408 |
402 |
409 |
|
410 |
|
411 |
|
412 |