26 #include <hbmessagebox.h> |
26 #include <hbmessagebox.h> |
27 #include <QStandardItemModel> |
27 #include <QStandardItemModel> |
28 #include <QItemSelectionModel> |
28 #include <QItemSelectionModel> |
29 #include <hbstringutil.h> |
29 #include <hbstringutil.h> |
30 #include <hbextendedlocale.h> |
30 #include <hbextendedlocale.h> |
|
31 #include <HbInputDialog> |
|
32 #include <HbEditorInterface> |
|
33 #include <hbinputdef.h> |
|
34 #include <hbinputstandardfilters.h> |
31 |
35 |
32 /*! |
36 /*! |
33 CpPhoneNotes::instance. |
37 CpPhoneNotes::instance. |
34 */ |
38 */ |
35 CpPhoneNotes* CpPhoneNotes::instance() |
39 CpPhoneNotes* CpPhoneNotes::instance() |
165 serviceList->setModel(serviceListModel.take()); |
171 serviceList->setModel(serviceListModel.take()); |
166 serviceList->setSelectionMode(HbAbstractItemView::NoSelection); |
172 serviceList->setSelectionMode(HbAbstractItemView::NoSelection); |
167 serviceListPopup->setContentWidget(serviceList.take()); |
173 serviceListPopup->setContentWidget(serviceList.take()); |
168 |
174 |
169 HbAction *backAction = |
175 HbAction *backAction = |
170 new HbAction(hbTrId("Back"), serviceListPopup.data()); |
176 new HbAction(hbTrId("txt_common_button_back"), serviceListPopup.data()); |
171 serviceListPopup->setPrimaryAction(backAction); |
177 serviceListPopup->setPrimaryAction(backAction); |
172 serviceListPopup->exec(); |
178 serviceListPopup->exec(); |
173 |
|
174 DPRINT << ": OUT"; |
|
175 } |
|
176 |
|
177 /*! |
|
178 CpPhoneNotes::showBasicServiceCallDivertList. |
|
179 */ |
|
180 void CpPhoneNotes::showBasicServiceCallDivertList( |
|
181 const QString &title, |
|
182 const QList<PSCallDivertingStatus*> &divertStatuses, |
|
183 int &selectionIndex, |
|
184 CallDivertType divertType, |
|
185 CallDivertType &divertDetailType) |
|
186 { |
|
187 DPRINT << ": IN"; |
|
188 |
|
189 Q_ASSERT(title != ""); |
|
190 Q_ASSERT(0 < divertStatuses.size()); |
|
191 |
|
192 HbDialog *serviceListPopup = new HbDialog(); |
|
193 serviceListPopup->setDismissPolicy(HbDialog::NoDismiss); |
|
194 serviceListPopup->setTimeout(HbPopup::NoTimeout); |
|
195 |
|
196 HbLabel *heading = new HbLabel(title, serviceListPopup); |
|
197 heading->setAlignment(Qt::AlignLeft | Qt::AlignTop); |
|
198 serviceListPopup->setHeadingWidget(heading); |
|
199 |
|
200 HbListView *serviceList = new HbListView(serviceListPopup); |
|
201 QStandardItemModel *serviceListModel = new QStandardItemModel(serviceList); |
|
202 for (int i = 0; i < divertStatuses.size(); i++) { |
|
203 PSCallDivertingStatus *divertStatus = divertStatuses.at(i); |
|
204 QString groupName = |
|
205 basicServiceGroupName( |
|
206 convertEtelMobileServiceCode(divertStatus->iServiceGroup) ); |
|
207 QStandardItem *listItem = new QStandardItem(groupName); |
|
208 serviceListModel->appendRow(listItem); |
|
209 } |
|
210 serviceList->setModel(serviceListModel); |
|
211 serviceList->setSelectionMode(HbAbstractItemView::SingleSelection); |
|
212 if (0 != serviceListModel->rowCount()) { |
|
213 QModelIndex firstItem = serviceList->nextIndex(QModelIndex()); |
|
214 serviceList->setCurrentIndex(firstItem, QItemSelectionModel::Select); |
|
215 } |
|
216 serviceListPopup->setContentWidget(serviceList); |
|
217 |
|
218 HbAction *backAction = new HbAction(hbTrId("Back"), serviceListPopup); |
|
219 HbAction *numberQueryAction = new HbAction(hbTrId("Number"), serviceListPopup); |
|
220 HbAction *detailsAction = new HbAction(hbTrId("Details"), serviceListPopup); |
|
221 serviceListPopup->setSecondaryAction(backAction); |
|
222 |
|
223 switch (divertType) { |
|
224 case NoCallDivert: |
|
225 break; |
|
226 case CallDivertWithNumber: |
|
227 serviceListPopup->setPrimaryAction(numberQueryAction); |
|
228 break; |
|
229 case CallDivertWithNumberAndTimeout: |
|
230 serviceListPopup->setPrimaryAction(detailsAction); |
|
231 break; |
|
232 default: |
|
233 DPRINT << ", DEFAULT"; |
|
234 Q_ASSERT(false); |
|
235 break; |
|
236 } |
|
237 |
|
238 HbAction *userAction = serviceListPopup->exec(); |
|
239 if (userAction == numberQueryAction) { |
|
240 divertDetailType = CallDivertWithNumber; |
|
241 } else if (userAction == detailsAction) { |
|
242 divertDetailType = CallDivertWithNumberAndTimeout; |
|
243 } else if (userAction == backAction) { |
|
244 divertDetailType = NoCallDivert; |
|
245 } else { |
|
246 DPRINT << ", WEIRD ACTION"; |
|
247 Q_ASSERT(false); |
|
248 } |
|
249 |
|
250 selectionIndex = serviceList->currentIndex().row(); |
|
251 delete serviceListPopup; |
|
252 |
179 |
253 DPRINT << ": OUT"; |
180 DPRINT << ": OUT"; |
254 } |
181 } |
255 |
182 |
256 /*! |
183 /*! |
295 { |
222 { |
296 return !m_notesQueue->isEmpty(); |
223 return !m_notesQueue->isEmpty(); |
297 } |
224 } |
298 |
225 |
299 /*! |
226 /*! |
300 CpPhoneNotes::activeNoteAboutToClose. |
|
301 */ |
|
302 void CpPhoneNotes::activeNoteAboutToClose() |
|
303 { |
|
304 DPRINT << ": IN"; |
|
305 |
|
306 if (m_isNoteShowingOngoing) { |
|
307 m_isNoteShowingOngoing = false; |
|
308 QObject* note(NULL); |
|
309 if (!m_notesQueue->isEmpty()) { |
|
310 note = m_notesQueue->dequeue(); |
|
311 } |
|
312 if(note) { |
|
313 launchNextNoteIfReady(); |
|
314 note->disconnect(this); |
|
315 DPRINT << ", delete note: " << reinterpret_cast<int>(note); |
|
316 note->deleteLater(); |
|
317 } |
|
318 } |
|
319 |
|
320 DPRINT << ": OUT"; |
|
321 } |
|
322 |
|
323 /*! |
|
324 CpPhoneNotes::basicServiceGroupName. |
227 CpPhoneNotes::basicServiceGroupName. |
325 Resolves basic service group name by group identifier. |
228 Resolves basic service group name by group identifier. |
326 */ |
229 */ |
327 QString CpPhoneNotes::basicServiceGroupName(BasicServiceGroups basicServiceGroupId) const |
230 QString CpPhoneNotes::basicServiceGroupName(BasicServiceGroups basicServiceGroupId) const |
328 { |
231 { |
437 divertInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
331 divertInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
438 |
332 |
439 // TODO: Orbit layout support is insufficient currently and all text |
333 // TODO: Orbit layout support is insufficient currently and all text |
440 // is not shown. |
334 // is not shown. |
441 QString content = ""; |
335 QString content = ""; |
442 content.append(hbTrId("To number: ")); |
336 content.append(hbTrId("txt_phone_info_number")); |
443 content.append(formatPhoneNumber(divertStatus.iNumber)); |
337 content.append(formatPhoneNumber(divertStatus.iNumber)); |
444 if (0 < divertStatus.iTimeout) { |
338 if (0 < divertStatus.iTimeout) { |
445 content.append(hbTrId(" Delay time: ")); |
339 content.append(hbTrId("txt_phone_setlabel_delay")); |
446 content.append(QString::number(divertStatus.iTimeout)); |
340 content.append(QString::number(divertStatus.iTimeout)); |
447 content.append(hbTrId(" seconds")); |
341 content.append(hbTrId(" seconds")); |
448 } |
342 } |
449 divertInfo->setText(content); |
343 divertInfo->setText(content); |
450 HbAction *backAction = new HbAction(hbTrId("Back"), divertInfo); |
344 HbAction *backAction = new HbAction(hbTrId("txt_common_button_back"), divertInfo); |
451 divertInfo->setPrimaryAction(backAction); |
345 divertInfo->setPrimaryAction(backAction); |
452 divertInfo->exec(); |
346 divertInfo->exec(); |
453 delete divertInfo; |
347 delete divertInfo; |
|
348 |
|
349 DPRINT << ": OUT"; |
|
350 } |
|
351 |
|
352 /*! |
|
353 CpPhoneNotes::showPasswordQueryDialog. |
|
354 */ |
|
355 void CpPhoneNotes::showPasswordQueryDialog( |
|
356 const QString &title, |
|
357 const QValidator &validator, |
|
358 int maxPasswordLength, |
|
359 QString &password, |
|
360 bool &ok) |
|
361 { |
|
362 DPRINT << ": IN"; |
|
363 |
|
364 QScopedPointer<HbInputDialog> passwordDialog(new HbInputDialog()); |
|
365 |
|
366 // configure editor so that only digits can be inputted |
|
367 passwordDialog->setPromptText(title); |
|
368 passwordDialog->setEchoMode(HbLineEdit::Password); |
|
369 passwordDialog->setInputMethodHints(Qt::ImhDigitsOnly); |
|
370 HbLineEdit *hbLineEdit = passwordDialog->lineEdit(); |
|
371 hbLineEdit->setMaxLength(maxPasswordLength); |
|
372 HbEditorInterface editorInterface(hbLineEdit); |
|
373 editorInterface.setInputMode(HbInputModeNumeric); |
|
374 editorInterface.setConstraints(HbEditorConstraintFixedInputMode); |
|
375 editorInterface.setFilter(HbDigitsOnlyFilter::instance()); |
|
376 |
|
377 m_passwordDialog = passwordDialog.data(); |
|
378 m_passwordValidator = &validator; |
|
379 passwordDialog->primaryAction()->setEnabled(false); |
|
380 connect( |
|
381 hbLineEdit, SIGNAL(contentsChanged()), |
|
382 this, SLOT(passwordTextChanged())); |
|
383 |
|
384 HbAction* action = passwordDialog->exec(); |
|
385 if (action == passwordDialog->secondaryAction()) { |
|
386 ok = false; |
|
387 } else { |
|
388 ok = true; |
|
389 password = passwordDialog->value().toString(); |
|
390 } |
|
391 |
|
392 m_passwordDialog = NULL; |
|
393 m_passwordValidator = NULL; |
|
394 disconnect( |
|
395 hbLineEdit, SIGNAL(contentsChanged()), |
|
396 this, SLOT(passwordTextChanged())); |
454 |
397 |
455 DPRINT << ": OUT"; |
398 DPRINT << ": OUT"; |
456 } |
399 } |
457 |
400 |
458 /*! |
401 /*! |