25 #include <debugtraces.h> |
25 #include <debugtraces.h> |
26 #include <xqconversions.h> |
26 #include <xqconversions.h> |
27 #include <xqapplicationmanager.h> |
27 #include <xqapplicationmanager.h> |
28 #include <xqaiwrequest.h> |
28 #include <xqaiwrequest.h> |
29 #include <xqsystemtoneservice.h> |
29 #include <xqsystemtoneservice.h> |
|
30 #include <XQSettingsManager> |
|
31 #include <ProfileEngineInternalCRKeys.h> |
|
32 #include <hwrmvibra.h> |
30 #include "flashmsgnotifier_p.h" |
33 #include "flashmsgnotifier_p.h" |
31 |
34 |
32 #define LOC_NOTIFICATION_MSG_TITLE hbTrId("txt_messaging_title_notification_message") |
35 #define LOC_NOTIFICATION_MSG_TITLE hbTrId("txt_messaging_title_notification_message") |
33 #define LOC_BUTTON_SAVE hbTrId("txt_common_menu_save") |
36 #define LOC_BUTTON_SAVE hbTrId("txt_common_menu_save") |
34 #define LOC_BUTTON_DELETE hbTrId("txt_common_menu_delete") |
37 #define LOC_BUTTON_DELETE hbTrId("txt_common_menu_delete") |
35 |
38 |
|
39 const XQCentralRepositorySettingsKey silenceModeKey(KCRUidProfileEngine.iUid, KProEngSilenceMode); |
|
40 |
36 //------------------------------------------------------- |
41 //------------------------------------------------------- |
37 // FlashMsgNotifier::FlashMsgNotifier() |
42 // FlashMsgNotifier::FlashMsgNotifier() |
38 // Constructor |
43 // Constructor |
39 //------------------------------------------------------- |
44 //------------------------------------------------------- |
40 FlashMsgNotifier::FlashMsgNotifier(QObject *parent) : |
45 FlashMsgNotifier::FlashMsgNotifier(QObject *parent) : |
42 parent) |
47 parent) |
43 { |
48 { |
44 publishAll(); |
49 publishAll(); |
45 mSts = new XQSystemToneService; |
50 mSts = new XQSystemToneService; |
46 d_ptr = q_check_ptr(new FlashMsgNotifierPrivate(this)); |
51 d_ptr = q_check_ptr(new FlashMsgNotifierPrivate(this)); |
|
52 QT_TRYCATCH_LEAVING(mSettingsManager = new XQSettingsManager()); |
|
53 mVibra = CHWRMVibra::NewL(); |
47 } |
54 } |
48 |
55 |
49 //------------------------------------------------------- |
56 //------------------------------------------------------- |
50 // FlashMsgNotifier::~FlashMsgNotifier() |
57 // FlashMsgNotifier::~FlashMsgNotifier() |
51 // Destructor |
58 // Destructor |
52 //------------------------------------------------------- |
59 //------------------------------------------------------- |
53 FlashMsgNotifier::~FlashMsgNotifier() |
60 FlashMsgNotifier::~FlashMsgNotifier() |
54 { |
61 { |
55 delete d_ptr; |
62 delete d_ptr; |
56 delete mSts; |
63 delete mSts; |
|
64 if(mSettingsManager) |
|
65 { |
|
66 delete mSettingsManager; |
|
67 mSettingsManager = NULL; |
|
68 } |
|
69 if(mVibra) |
|
70 { |
|
71 delete mVibra; |
|
72 mVibra = NULL; |
|
73 } |
57 } |
74 } |
58 |
75 |
59 //------------------------------------------------------- |
76 //------------------------------------------------------- |
60 // FlashMsgNotifier::displayFlashMsg() |
77 // FlashMsgNotifier::displayFlashMsg() |
61 // @see header |
78 // @see header |
118 |
135 |
119 QAction* actionQuit = new QAction(LOC_BUTTON_DELETE, this); |
136 QAction* actionQuit = new QAction(LOC_BUTTON_DELETE, this); |
120 notificationDialog.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole); |
137 notificationDialog.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole); |
121 |
138 |
122 //Play audio alert when flash msg is shown |
139 //Play audio alert when flash msg is shown |
123 mSts->playTone(XQSystemToneService::SmsAlertTone); |
140 QVariant silenceMode = mSettingsManager->readItemValue(silenceModeKey, XQSettingsManager::TypeInt); |
|
141 int silent = silenceMode.toInt(); |
|
142 if(silent < 1) |
|
143 { |
|
144 //Play new message alert tone. |
|
145 mSts->playTone(XQSystemToneService::SmsAlertTone); |
|
146 } |
|
147 // Execute the vibra effect. |
|
148 if (mVibra) |
|
149 { |
|
150 TInt err = KErrNone; |
|
151 TRAP(err,mVibra->StartVibraL(1000)); |
|
152 } |
124 |
153 |
125 const QAction* result = notificationDialog.exec(); |
154 const QAction* result = notificationDialog.exec(); |
126 // if accepted launch view else quit |
155 // if accepted launch view else quit |
127 if (notificationDialog.isAcceptAction(result)) |
156 if (notificationDialog.isAcceptAction(result)) |
128 { |
157 { |