|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "msgerrornotifiersvc.h" |
|
19 #include <QVariant> |
|
20 #include <HbMessageBox> |
|
21 #include <HbDialog> |
|
22 #include <hbdevicemessagebox.h> |
|
23 #include <HbAction> |
|
24 #include <xqservicerequest.h> |
|
25 #include <xqaiwrequest.h> |
|
26 #include <xqappmgr.h> |
|
27 #include <ccsdefs.h> |
|
28 #include <qaction.h> |
|
29 #include <xqsystemtoneservice.h> |
|
30 |
|
31 #define LOC_VIEW hbTrId("txt_messaging_button_view") |
|
32 #define LOC_CANCEL hbTrId("txt_common_button_cancel") |
|
33 #define LOC_SEND_FAILURE hbTrId("txt_messaging_list_message_sending_failed") |
|
34 #define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed") |
|
35 //--------------------------------------------------------- |
|
36 // Constructor |
|
37 //--------------------------------------------------------- |
|
38 MsgErrorNotifierSvc::MsgErrorNotifierSvc(QObject* parent) : |
|
39 XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.MsgErrorNotifier"), parent) |
|
40 { |
|
41 mSts = new XQSystemToneService(); |
|
42 publishAll(); |
|
43 |
|
44 } |
|
45 //--------------------------------------------------------- |
|
46 // Destructor |
|
47 //--------------------------------------------------------- |
|
48 MsgErrorNotifierSvc::~MsgErrorNotifierSvc() |
|
49 { |
|
50 if(mSts) |
|
51 { |
|
52 delete mSts; |
|
53 mSts = NULL; |
|
54 } |
|
55 } |
|
56 |
|
57 //--------------------------------------------------------- |
|
58 // displayErrorNote |
|
59 // @see msgerrornotifiersvc.h |
|
60 //--------------------------------------------------------- |
|
61 void MsgErrorNotifierSvc::displayErrorNote(QVariantList displayParams) |
|
62 { |
|
63 |
|
64 HbDeviceMessageBox messageBox(HbMessageBox::MessageTypeWarning); |
|
65 QVariant first = displayParams[0]; |
|
66 QVariant second = displayParams[1]; |
|
67 QVariant third = displayParams[2]; |
|
68 |
|
69 int convId = second.toInt(); |
|
70 qint64 id = convId; |
|
71 QString errorNote; |
|
72 |
|
73 int msgType = third.toInt(); |
|
74 if (msgType == ECsMmsNotification) |
|
75 { |
|
76 errorNote.append(LOC_MMS_RETRIEVAL_FAILED); |
|
77 } |
|
78 else |
|
79 { |
|
80 errorNote.append(LOC_SEND_FAILURE); |
|
81 errorNote.append(QChar(QChar::LineSeparator)); |
|
82 |
|
83 QString contactName = first.toString(); |
|
84 errorNote.append(contactName); |
|
85 } |
|
86 |
|
87 messageBox.setTimeout(HbPopup::NoTimeout); |
|
88 messageBox.setText(errorNote); |
|
89 QAction* actionView = new QAction(LOC_VIEW,this); |
|
90 messageBox.setAction(actionView,HbDeviceMessageBox::AcceptButtonRole); |
|
91 |
|
92 QAction* actionQuit = new QAction(LOC_CANCEL,this); |
|
93 messageBox.setAction(actionQuit,HbDeviceMessageBox::RejectButtonRole); |
|
94 |
|
95 setCurrentRequestAsync(); |
|
96 |
|
97 //Play audio alert when error notification is shown |
|
98 mSts->playTone(XQSystemToneService::MessageSendFailureTone); |
|
99 |
|
100 // launch Messagebox |
|
101 const QAction* result = messageBox.exec(); |
|
102 |
|
103 // if accepted launch view else quit |
|
104 if (messageBox.isAcceptAction(result)) { |
|
105 QList<QVariant> args; |
|
106 QString serviceName("com.nokia.services.hbserviceprovider"); |
|
107 QString operation("open(qint64)"); |
|
108 XQAiwRequest* request; |
|
109 XQApplicationManager appManager; |
|
110 request = appManager.create(serviceName, "conversationview", operation, false); // embedded |
|
111 if (request == NULL) { |
|
112 return; |
|
113 } |
|
114 args << QVariant(id); |
|
115 request->setArguments(args); |
|
116 request->send(); |
|
117 delete request; |
|
118 } |
|
119 } |