diff -r bab96b7ed1a4 -r f39ed5e045e0 phonesettings/cpphonesettingsplugins/cptelephonyutils/src/cpphonenotes.cpp --- a/phonesettings/cpphonesettingsplugins/cptelephonyutils/src/cpphonenotes.cpp Tue Jun 15 14:14:38 2010 +0100 +++ b/phonesettings/cpphonesettingsplugins/cptelephonyutils/src/cpphonenotes.cpp Thu Jul 22 16:33:21 2010 +0100 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -72,14 +73,8 @@ DPRINT << ": IN"; delete m_cpSettingsWrapper; - QObject* note(NULL); - foreach (note, *m_notesQueue) { - delete note; - } + qDeleteAll(*m_notesQueue); delete m_notesQueue; - if(m_passwordDialog) { - delete m_passwordDialog; - } DPRINT << ": OUT"; @@ -96,9 +91,12 @@ HbDeviceProgressDialog *note = new HbDeviceProgressDialog(HbProgressDialog::WaitDialog, this); note->setText(text); - QAction *action = new QAction(hbTrId("txt_common_button_hide"), this); - //Ownership of action is not transferred. Deleted when note closes. - note->setAction(action, HbDeviceProgressDialog::CancelButtonRole ); + + if(hbTrId("txt_common_info_requesting") == text){ + QAction *action = new QAction(hbTrId("txt_common_button_hide"), note); + note->setAction(action, HbDeviceProgressDialog::CancelButtonRole ); + } + noteId = reinterpret_cast(note); DPRINT << ", NOTEID: " << noteId; QObject::connect( @@ -143,54 +141,6 @@ DPRINT << ": OUT"; } -/*! - CpPhoneNotes::showBasicServiceList. - */ -void CpPhoneNotes::showBasicServiceList( - const QString &title, - const QList &basicServiceGroupIds) -{ - DPRINT << ": IN"; - - Q_ASSERT(title != ""); - Q_ASSERT(0 < basicServiceGroupIds.count()); - - QScopedPointer serviceListPopup(new HbDialog()); - serviceListPopup->setDismissPolicy(HbDialog::NoDismiss); - serviceListPopup->setTimeout(HbPopup::NoTimeout); - - QScopedPointer heading( - new HbLabel(title, serviceListPopup.data())); - heading->setAlignment(Qt::AlignLeft | Qt::AlignTop); - serviceListPopup->setHeadingWidget(heading.take()); - - QScopedPointer serviceList( - new HbListView(serviceListPopup.data())); - QScopedPointer serviceListModel( - new QStandardItemModel(serviceList.data())); - for (int i = 0; i < basicServiceGroupIds.count(); i++) { - BasicServiceGroups groupId = - static_cast(basicServiceGroupIds.at(i)); - QString groupName = basicServiceGroupName(groupId); - QScopedPointer listItem(new QStandardItem(groupName)); - serviceListModel->appendRow(listItem.take()); - } - serviceList->setModel(serviceListModel.take()); - serviceList->setSelectionMode(HbAbstractItemView::NoSelection); - serviceListPopup->setContentWidget(serviceList.take()); - - HbAction *backAction = - new HbAction(hbTrId("txt_common_button_back"), serviceListPopup.data()); - serviceListPopup->setPrimaryAction(backAction); - - HbDialog *serviceListPopupDialog = serviceListPopup.take(); - QObject::connect( - serviceListPopupDialog, SIGNAL(finished(HbAction*)), - serviceListPopupDialog, SLOT(deleteLater())); - serviceListPopupDialog->show(); - - DPRINT << ": OUT"; -} /*! CpPhoneNotes::cancelNote. @@ -233,77 +183,6 @@ } /*! - CpPhoneNotes::basicServiceGroupName. - Resolves basic service group name by group identifier. - */ -QString CpPhoneNotes::basicServiceGroupName(BasicServiceGroups basicServiceGroupId) const -{ - DPRINT << ": IN"; - - QString string = ""; - switch (basicServiceGroupId) { - case AllTeleAndBearer: - string = hbTrId("All services"); - break; - case AllTele: - string = hbTrId("Voice, fax and messages"); - break; - case Telephony: - string = hbTrId("Voice calls"); - break; - case AllDataTele: - string = hbTrId("Fax and messages"); - break; - case Fax: - string = hbTrId("Fax"); - break; - case Sms: - string = hbTrId("Messages"); - break; - case AllTeleExcSms: - string = hbTrId("Voice calls and fax"); - break; - case AllBearer: - if (Tools::videoSupported()) { - string = hbTrId("Data and video services"); - } else { - string = hbTrId("Data services"); - } - break; - case AllAsync: - string = hbTrId("Asynchronous services"); - break; - case AllSync: - string = hbTrId("Synchronous services"); - break; - case SyncData: - string = hbTrId("Synchronous data services"); - break; - case AsyncData: - string = hbTrId("Asynchronous data services"); - break; - case PacketData: - string = hbTrId("Packet data"); - break; - case PadAccess: - string = hbTrId("PAD access"); - break; - case 30: - string = hbTrId("Video calls"); - break; - case AltTele: - string = hbTrId("Alternate line services"); - break; - default: - DPRINT << ", DEFAULT"; - break; - } - - DPRINT << ": OUT"; - return string; -} - -/*! CpPhoneNotes::showGlobalErrorNote. */ void CpPhoneNotes::showGlobalErrorNote(int ¬eId, int errorcode) @@ -353,7 +232,7 @@ HbAction *backAction = new HbAction( hbTrId("txt_common_button_back"), divertInfoScopedPointer.data()); - divertInfoScopedPointer->setPrimaryAction(backAction); + divertInfoScopedPointer->addAction(backAction); HbMessageBox *divertInfo = divertInfoScopedPointer.take(); QObject::connect( @@ -380,17 +259,18 @@ passwordDialog->setPromptText(title); passwordDialog->setEchoMode(HbLineEdit::Password); passwordDialog->setInputMethodHints(Qt::ImhDigitsOnly); + passwordDialog->actions().at(0)->setEnabled(false); + HbLineEdit *hbLineEdit = passwordDialog->lineEdit(); hbLineEdit->setMaxLength(maxPasswordLength); + HbEditorInterface editorInterface(hbLineEdit); - editorInterface.setMode(HbInputModeNumeric); editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); - editorInterface.setFilter(HbDigitsOnlyFilter::instance()); m_passwordValidator = &validator; - passwordDialog->primaryAction()->setEnabled(false); + connect( hbLineEdit, SIGNAL(contentsChanged()), this, SLOT(passwordTextChanged())); @@ -401,7 +281,7 @@ m_passwordDialog = NULL; } m_passwordDialog = passwordDialog.take(); - + m_passwordDialog->setParent(this); DPRINT << ": OUT"; } @@ -413,7 +293,7 @@ bool ok; QString password; if(m_passwordDialog) { - if (action == m_passwordDialog->secondaryAction()) { + if (action == m_passwordDialog->actions().at(1)) { ok = false; } else { ok = true; @@ -507,9 +387,6 @@ DPRINT << ", delete note: " << reinterpret_cast(note); HbDeviceProgressDialog *pNote = qobject_cast(note); - if(pNote){ - delete pNote->action(); - } note->deleteLater(); } } @@ -543,8 +420,24 @@ bool isPasswordValid = (QValidator::Acceptable == m_passwordValidator->validate( password, position)); - m_passwordDialog->primaryAction()->setEnabled(isPasswordValid); - + m_passwordDialog->actions().at(0)->setEnabled(isPasswordValid); + + DPRINT << ": OUT"; +} + + +/*! + CpPhoneNotes::showNotificationDialog. + */ +void CpPhoneNotes::showNotificationDialog(const QString& text) +{ + DPRINT << ": IN"; + HbNotificationDialog *notifDialog = new HbNotificationDialog(); + notifDialog->setDismissPolicy(HbPopup::TapAnywhere); + notifDialog->setAttribute(Qt::WA_DeleteOnClose, true); + notifDialog->setText(text); + notifDialog->show(); + DPRINT << ": OUT"; }