diff -r ba76fc04e6c2 -r 6b911d05207e phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp --- a/phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp Fri Jun 04 10:19:18 2010 +0100 +++ b/phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp Wed Jun 23 18:12:20 2010 +0300 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -53,55 +54,12 @@ TPhoneCmdParamGlobalNote* globalNoteParam = static_cast( commandParam ); - - HbMessageBox::MessageBoxType type; - - switch( globalNoteParam->Type() ) { - case EAknGlobalInformationNote: - type = HbMessageBox::MessageTypeInformation; - break; - case EAknGlobalWarningNote: - default: - type = HbMessageBox::MessageTypeWarning; - break; + if (globalNoteParam->NotificationDialog()) { + showDeviceNotificationDialog(globalNoteParam); + } else { + showDeviceMessageBox(globalNoteParam); } - QString noteString = globalNoteText(globalNoteParam); - - if (false == noteString.isNull()) { - bool showNote(true); - for (int i = 0; i < m_messageBoxList.count(); ++i) { - // Do not show same note/text several times, e.g when user hits - // the end button several times we should show only one "not allowed" - // note. - if (noteString == m_messageBoxList.at(i)->text()) { - showNote = false; - break; - } - } - - if (showNote) { - QScopedPointer messageBox( - new HbDeviceMessageBox(noteString, type)); - - int timeout = globalNoteParam->Timeout(); - if (timeout == 0) { - messageBox->setTimeout(HbDialog::StandardTimeout); - } else { - messageBox->setTimeout(timeout); - } - - HbDeviceMessageBox *messageBoxPtr = messageBox.data(); - m_messageBoxList.append(messageBoxPtr); - messageBox.take(); - - if (1 == m_messageBoxList.size()) { - QObject::connect(messageBoxPtr, SIGNAL(aboutToClose()), - this, SLOT(destroyDialog())); - messageBoxPtr->show(); - } - } - } } void PhoneNoteController::showNote(TPhoneCommandParam *commandParam) @@ -186,6 +144,22 @@ } } +void PhoneNoteController::destroyNotification() +{ + PHONE_DEBUG("PhoneNoteController::destroyDialog"); + HbDeviceNotificationDialog *notification = m_notificationList.takeFirst(); + notification->deleteLater(); + notification = 0; + + if ( 0 < m_notificationList.size() ) { + PHONE_DEBUG("PhoneNoteController::show pending note"); + HbDeviceNotificationDialog *notificationTemp = m_notificationList[0]; + QObject::connect(notificationTemp, SIGNAL(aboutToClose()), + this, SLOT(destroyNotification())); + notificationTemp->show(); + } +} + void PhoneNoteController::removeMappings() { foreach (HbAction *action, m_actions ) { @@ -378,4 +352,104 @@ } } +void PhoneNoteController::showDeviceMessageBox( + TPhoneCmdParamGlobalNote* params) +{ + PHONE_DEBUG("PhoneNoteController::showDeviceMessageBox"); + HbMessageBox::MessageBoxType type; + + switch( params->Type() ) { + case EAknGlobalInformationNote: + type = HbMessageBox::MessageTypeInformation; + break; + case EAknGlobalWarningNote: + default: + type = HbMessageBox::MessageTypeWarning; + break; + } + + QString noteString = globalNoteText(params); + + if (false == noteString.isNull()) { + bool showNote(true); + for (int i = 0; i < m_messageBoxList.count(); ++i) { + // Do not show same note/text several times, e.g when user hits + // the end button several times we should show only one "not allowed" + // note. + if (noteString == m_messageBoxList.at(i)->text()) { + showNote = false; + break; + } + } + + if (showNote) { + QScopedPointer messageBox( + new HbDeviceMessageBox(noteString, type)); + + int timeout = params->Timeout(); + if (timeout <= 0) { + messageBox->setTimeout(HbDialog::StandardTimeout); + } else { + messageBox->setTimeout(timeout); + } + + HbDeviceMessageBox *messageBoxPtr = messageBox.data(); + m_messageBoxList.append(messageBoxPtr); + messageBox.take(); + + if (1 == m_messageBoxList.size()) { + QObject::connect(messageBoxPtr, SIGNAL(aboutToClose()), + this, SLOT(destroyDialog())); + messageBoxPtr->show(); + } + } + } +} + +void PhoneNoteController::showDeviceNotificationDialog( + TPhoneCmdParamGlobalNote* params) +{ + PHONE_DEBUG("PhoneNoteController::showDeviceNotificationDialog"); + + QString noteString = globalNoteText(params); + + if (false == noteString.isNull()) { + bool showNote(true); + for (int i = 0; i < m_notificationList.count(); ++i) { + // Do not show same note/text several times, e.g when user hits + // the end button several times we should show only one "not allowed" + // note. + if (noteString == m_notificationList.at(i)->text()) { + showNote = false; + break; + } + } + + if (showNote) { + QScopedPointer notification( + new HbDeviceNotificationDialog()); + + notification->setTitle(noteString); + + int timeout = params->Timeout(); + if (timeout > 0) { + // If timeout not set we use default timeout. + // Default value is HbPopup::StandardTimeout (3000 ms) + notification->setTimeout(timeout); + } + + HbDeviceNotificationDialog *notificationPtr = notification.data(); + m_notificationList.append(notificationPtr); + notification.take(); + + if (1 == m_notificationList.size()) { + QObject::connect(notificationPtr, SIGNAL(aboutToClose()), + this, SLOT(destroyNotification())); + notificationPtr->show(); + } + } + } +} + +