17 |
17 |
18 |
18 |
19 #include "ftuwizardmenustate.h" |
19 #include "ftuwizardmenustate.h" |
20 #include "ftucontentservice.h" |
20 #include "ftucontentservice.h" |
21 #include <ftuwizard.h> |
21 #include <ftuwizard.h> |
22 |
22 #include "ftustateprovider_global.h" |
23 #include <hbmainwindow.h> |
23 #include <hbmainwindow.h> |
24 #include <hbview.h> |
24 #include <hbview.h> |
25 #include <hblabel.h> |
25 #include <hblabel.h> |
26 #include <hbicon.h> |
26 #include <hbicon.h> |
27 #include <hbinstance.h> |
27 #include <hbinstance.h> |
28 #include <hblistview.h> |
28 #include <hblistview.h> |
29 #include <hbdocumentloader.h> |
29 #include <hbdocumentloader.h> |
30 |
30 |
31 #include <QStandardItemModel> |
31 #include <QStandardItemModel> |
32 #include <QDate> |
32 #include <QDate> |
33 |
33 #include <QTime> |
34 #include <xqsettingsmanager.h> |
34 #include <xqsettingsmanager.h> |
35 |
35 |
36 #include "ftustatecenrephandler.h" |
36 #include "ftustatecenrephandler.h" |
37 |
37 |
38 const int progressCompelete = 100; |
38 const int progressCompelete = 100; |
39 const char* emptyLine = " "; |
39 const char* emptyLine = " "; |
40 |
|
41 #define WMS_LOG qDebug() << "ftu:FtuWizardMenuState" |
|
42 |
40 |
43 const char *FTUSTATEPROVIDER_DOCML = ":/xml/ftustateprovider.docml"; |
41 const char *FTUSTATEPROVIDER_DOCML = ":/xml/ftustateprovider.docml"; |
44 const char *TOC_VIEW = "tocView"; |
42 const char *TOC_VIEW = "tocView"; |
45 const char *TOC_INFOTEXT_LABEL = "tocInfoTextLabel"; |
43 const char *TOC_INFOTEXT_LABEL = "tocInfoTextLabel"; |
46 const char *TOC_LIST_VIEW = "tocListView"; |
44 const char *TOC_LIST_VIEW = "tocListView"; |
60 mModel(NULL) |
58 mModel(NULL) |
61 { |
59 { |
62 mMainWindow = hbInstance->allMainWindows().at(0); |
60 mMainWindow = hbInstance->allMainWindows().at(0); |
63 mModel = new QStandardItemModel(this); |
61 mModel = new QStandardItemModel(this); |
64 |
62 |
65 //TODO Read number of wizards supported and init the following list |
63 mDocumentLoader = new HbDocumentLoader(); |
66 //mCompletedWizardList << false << false << false << false << false <<false; |
|
67 |
|
68 mDocumentLoader = new HbDocumentLoader(); |
|
69 bool ok = false; |
64 bool ok = false; |
70 mDocumentLoader->load(FTUSTATEPROVIDER_DOCML, &ok); |
65 mDocumentLoader->load(FTUSTATEPROVIDER_DOCML, &ok); |
71 QGraphicsWidget *widget = mDocumentLoader->findWidget(TOC_VIEW); |
66 QGraphicsWidget *widget = mDocumentLoader->findWidget(TOC_VIEW); |
72 Q_ASSERT_X(ok && (widget != 0), "ftustateprovider", "invalid DocML file"); |
67 Q_ASSERT_X(ok && (widget != 0), "ftustateprovider", "invalid DocML file"); |
73 mTocView = qobject_cast<HbView*>(widget); |
68 mTocView = qobject_cast<HbView*>(widget); |
74 |
69 |
75 mTocView->setTitle(qtTrId("txt_ftu_title_setup")); |
70 mTocView->setTitle(qtTrId("txt_long_caption_FTU_widget")); |
76 |
71 |
77 mMainWindow->addView(mTocView); |
72 mMainWindow->addView(mTocView); |
78 // Set as initial view. |
73 // Set as initial view. |
79 mMainWindow->setCurrentView(mTocView); |
74 mMainWindow->setCurrentView(mTocView); |
80 mCenrepHandler = new FtuStateCenrepHandler(NULL); |
75 mCenrepHandler = new FtuStateCenrepHandler(NULL); |
169 // FtuWizardMenuState::addWizardToListModel |
164 // FtuWizardMenuState::addWizardToListModel |
170 // --------------------------------------------------------------------------- |
165 // --------------------------------------------------------------------------- |
171 // |
166 // |
172 void FtuWizardMenuState::addWizardToListModel(int aIndex) |
167 void FtuWizardMenuState::addWizardToListModel(int aIndex) |
173 { |
168 { |
174 WMS_LOG << "::addWizardToListModel idx : " << aIndex; |
169 |
|
170 QDEBUG("FtuWizardMenuState::addWizardToListModel idx : " << aIndex;) |
175 FtuContentService* ftuContentService = content(); |
171 FtuContentService* ftuContentService = content(); |
176 |
172 |
177 FtuWizard* addedWizard = ftuContentService->wizard(aIndex); |
173 FtuWizard* addedWizard = ftuContentService->wizard(aIndex); |
178 if(addedWizard) |
174 if(addedWizard) |
179 { |
175 { |
180 // Connect for progress updates. |
176 // Connect for progress updates. |
181 connect(addedWizard, SIGNAL(progressUpdated(FtuWizard *, bool, int)), |
177 connect(addedWizard, SIGNAL(progressUpdated(FtuWizard *, bool, int)), |
182 this, SLOT(updateProgress(FtuWizard *, bool, int))); |
178 this, SLOT(updateProgress(FtuWizard *, bool, int))); |
183 |
179 |
184 const FtuWizardSetting& settings = addedWizard->wizardSettings(); |
180 const FtuWizardSetting& settings = addedWizard->wizardSettings(); |
185 QStandardItem* newItem = new QStandardItem(); |
181 QStandardItem* newItem = new QStandardItem(); |
186 HbIcon icon (settings.mTocDefaultIcon.absoluteFilePath()); |
182 QList<QVariant> iconList; |
|
183 HbIcon icon (settings.mTocDefaultIcon.filePath() ); |
|
184 iconList.append(icon); |
|
185 HbIcon rightIcon(QString(qtTrId("qtg_small_tick"))); |
|
186 |
187 QStringList data; |
187 QStringList data; |
188 data << settings.mTocLabel; |
188 data << settings.mTocLabel; |
189 QDate date = addedWizard->wizardCompletedDate(); |
189 QDate date = addedWizard->wizardCompletedDate(); |
190 if(date.isNull()) |
190 if(date.isNull()) |
191 { |
191 { |
192 data << emptyLine; |
192 data << emptyLine; |
193 } |
193 } |
194 else |
194 else |
195 { |
195 { |
|
196 //Plugin has already completed, Append tick mark on right side |
|
197 iconList.append(rightIcon); |
196 data << updatedAsString(date); |
198 data << updatedAsString(date); |
197 } |
199 } |
198 |
200 |
199 newItem->setBackground(QBrush(Qt::lightGray)); |
201 newItem->setData(iconList, Qt::DecorationRole); |
200 newItem->setData(icon, Qt::DecorationRole); |
|
201 newItem->setData(QVariant(data), Qt::DisplayRole); |
202 newItem->setData(QVariant(data), Qt::DisplayRole); |
202 |
203 |
203 mModel->appendRow(newItem); |
204 mModel->appendRow(newItem); |
204 } |
205 } |
205 } |
206 } |
218 SIGNAL(activated(const QModelIndex)), |
219 SIGNAL(activated(const QModelIndex)), |
219 this, |
220 this, |
220 SLOT(activateWizard(const QModelIndex))); |
221 SLOT(activateWizard(const QModelIndex))); |
221 |
222 |
222 mListView->setModel(mModel); |
223 mListView->setModel(mModel); |
|
224 QDEBUG("FtuWizardMenuState.cpp Model is set"<<__FUNCTION__<<"~~~~~~~"<<QTime::currentTime().toString("hh:mm:ss.zzz");) |
223 } |
225 } |
224 } |
226 } |
225 |
227 |
226 // --------------------------------------------------------------------------- |
228 // --------------------------------------------------------------------------- |
227 // FtWizardMenuState::createInfoText |
229 // FtWizardMenuState::createInfoText |
228 // --------------------------------------------------------------------------- |
230 // --------------------------------------------------------------------------- |
229 // |
231 // |
230 void FtuWizardMenuState::createInfoText() |
232 void FtuWizardMenuState::createInfoText() |
231 { |
233 { |
232 mInfoText = qobject_cast<HbLabel *>(mDocumentLoader->findWidget(TOC_INFOTEXT_LABEL)); |
234 mInfoText = qobject_cast<HbLabel *>(mDocumentLoader->findWidget(TOC_INFOTEXT_LABEL)); |
233 mInfoText->setPlainText(qtTrId("txt_ftu_subtitle_toc")); |
235 mInfoText->setPlainText(qtTrId("txt_ftu_subhead_select_setting_you_want_to_edit")); |
234 } |
236 } |
235 |
237 |
236 // --------------------------------------------------------------------------- |
238 // --------------------------------------------------------------------------- |
237 // FtuWizardMenuState::activateWizard |
239 // FtuWizardMenuState::activateWizard |
238 // --------------------------------------------------------------------------- |
240 // --------------------------------------------------------------------------- |
263 // Get the index of the wizard |
265 // Get the index of the wizard |
264 for(int i = 0 ; i < wizards.size() ; ++i) |
266 for(int i = 0 ; i < wizards.size() ; ++i) |
265 { |
267 { |
266 if(caller == wizards[i]) |
268 if(caller == wizards[i]) |
267 { |
269 { |
268 WMS_LOG << "::updateProgress wizard found at: " << i; |
270 QDEBUG("::updateProgress wizard found at: " << i;) |
269 index = i; |
271 index = i; |
270 } |
272 } |
271 } |
273 } |
272 if(index != -1) |
274 if(index != -1) |
273 { |
275 { |
274 QStringList data; |
276 QStringList data; |
275 data << wizards[index]->wizardSettings().mTocLabel; |
277 data << wizards[index]->wizardSettings().mTocLabel; |
|
278 QList<QVariant> iconList; |
|
279 HbIcon icon (wizards[index]->wizardSettings().mTocDefaultIcon.filePath()); |
|
280 iconList.append(icon); |
|
281 HbIcon rightIcon(QString(qtTrId("qtg_small_tick"))); |
276 |
282 |
277 if(progress < progressCompelete) |
283 if(progress < progressCompelete) |
278 { |
284 { |
279 QString progressStr; |
285 QString progressStr; |
280 QString progressNumber; |
286 QString progressNumber; |