|
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 |
|
29 #define LOC_VIEW hbTrId("txt_messaging_button_view") |
|
30 #define LOC_CANCEL hbTrId("txt_common_button_cancel") |
|
31 #define LOC_SEND_FAILURE hbTrId("txt_messaging_list_message_sending_failed") |
|
32 |
|
33 //--------------------------------------------------------- |
|
34 // Constructor |
|
35 //--------------------------------------------------------- |
|
36 MsgErrorNotifierSvc::MsgErrorNotifierSvc(QObject* parent) : |
|
37 XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.MsgErrorNotifier"), parent) |
|
38 { |
|
39 publishAll(); |
|
40 |
|
41 } |
|
42 //--------------------------------------------------------- |
|
43 // Destructor |
|
44 //--------------------------------------------------------- |
|
45 MsgErrorNotifierSvc::~MsgErrorNotifierSvc() |
|
46 { |
|
47 |
|
48 } |
|
49 |
|
50 //--------------------------------------------------------- |
|
51 // displayErrorNote |
|
52 // @see msgerrornotifiersvc.h |
|
53 //--------------------------------------------------------- |
|
54 void MsgErrorNotifierSvc::displayErrorNote(QVariantList displayParams) |
|
55 { |
|
56 |
|
57 HbDeviceMessageBox messageBox(HbMessageBox::MessageTypeWarning); |
|
58 QVariant first = displayParams[0]; |
|
59 QVariant second = displayParams[1]; |
|
60 QVariant third = displayParams[2]; |
|
61 |
|
62 int convId = second.toInt(); |
|
63 qint64 id = convId; |
|
64 QString errorNote; |
|
65 |
|
66 int msgType = third.toInt(); |
|
67 if (msgType == ECsMmsNotification) |
|
68 { |
|
69 errorNote.append("Message Retrieval Failed!");//TODO: use logical str name |
|
70 } |
|
71 else |
|
72 { |
|
73 errorNote.append(LOC_SEND_FAILURE); |
|
74 errorNote.append(QChar(QChar::LineSeparator)); |
|
75 |
|
76 QString contactName = first.toString(); |
|
77 errorNote.append(contactName); |
|
78 } |
|
79 |
|
80 messageBox.setTimeout(HbPopup::NoTimeout); |
|
81 messageBox.setText(errorNote); |
|
82 HbAction* actionView = new HbAction(LOC_VIEW); |
|
83 messageBox.setPrimaryAction(actionView); |
|
84 |
|
85 HbAction* actionQuit = new HbAction(LOC_CANCEL); |
|
86 actionQuit->setCommandRole(HbAction::QuitRole); |
|
87 messageBox.setSecondaryAction(actionQuit); |
|
88 |
|
89 setCurrentRequestAsync(); |
|
90 |
|
91 HbAction* result = messageBox.exec(); |
|
92 |
|
93 // TODO: use XQAiwrequest |
|
94 if (result->commandRole() != HbAction::QuitRole) { |
|
95 QList<QVariant> args; |
|
96 QString serviceName("com.nokia.services.hbserviceprovider"); |
|
97 QString operation("open(qint64)"); |
|
98 XQAiwRequest* request; |
|
99 XQApplicationManager appManager; |
|
100 request = appManager.create(serviceName, "conversationview", operation, false); // embedded |
|
101 if (request == NULL) { |
|
102 return; |
|
103 } |
|
104 args << QVariant(id); |
|
105 request->setArguments(args); |
|
106 request->send(); |
|
107 delete request; |
|
108 } |
|
109 } |