author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:13:15 +0300 | |
changeset 72 | 6f657153cbc5 |
parent 31 | ebfee66fde93 |
permissions | -rw-r--r-- |
31 | 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: Message notification plugin widget. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef MSGNOTIFICATIONDIALOGWIDGET_H |
|
19 |
#define MSGNOTIFICATIONDIALOGWIDGET_H |
|
20 |
||
21 |
#include <QObject> |
|
22 |
#include <QVariantMap> |
|
23 |
#include <QRunnable> |
|
24 |
#include <hbdevicedialoginterface.h> |
|
25 |
#include <hbdevicedialog.h> |
|
26 |
#include <hbnotificationdialog.h> |
|
27 |
||
28 |
||
29 |
/** |
|
30 |
* Class for sending service request |
|
31 |
*/ |
|
72
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
32 |
class ServiceRequestSenderTask :public QObject,public QRunnable |
31 | 33 |
{ |
72
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
34 |
Q_OBJECT |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
35 |
|
31 | 36 |
public: |
37 |
/** |
|
38 |
* Constructor |
|
39 |
*/ |
|
40 |
ServiceRequestSenderTask(qint64 conversationId); |
|
41 |
||
42 |
/** |
|
43 |
* Destructor |
|
44 |
*/ |
|
45 |
~ServiceRequestSenderTask(); |
|
46 |
||
47 |
/** |
|
48 |
* create and send service request |
|
49 |
*/ |
|
50 |
void run(); |
|
51 |
||
72
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
52 |
private slots: |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
53 |
|
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
54 |
/** |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
55 |
* Slot invoked after Conversation view is launched. |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
56 |
*/ |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
57 |
void onRequestCompleted(const QVariant& value); |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
58 |
|
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
59 |
/** |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
60 |
* Slot invoked if error occurred during launch of CV. |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
61 |
*/ |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
62 |
void onRequestError(int errorCode, const QString& errorMessage); |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
63 |
|
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
64 |
signals: |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
65 |
|
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
66 |
/** |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
67 |
* Signal is emitted to indicate that Notification Dialog |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
68 |
* can now be closed. |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
69 |
*/ |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
70 |
void serviceRequestCompleted(); |
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
71 |
|
31 | 72 |
private: |
73 |
qint64 mConvId; |
|
74 |
}; |
|
75 |
||
76 |
/** |
|
77 |
* Message notification widget class. |
|
78 |
* Widget shown for the new message notifications. |
|
79 |
* Part of messagenotificationplugin. |
|
80 |
*/ |
|
81 |
class MsgNotificationDialogWidget : public HbNotificationDialog, |
|
82 |
public HbDeviceDialogInterface |
|
83 |
{ |
|
84 |
Q_OBJECT |
|
85 |
||
86 |
public: |
|
87 |
||
88 |
/** |
|
89 |
* Constructor |
|
90 |
* @param parameters variant map list |
|
91 |
*/ |
|
92 |
MsgNotificationDialogWidget(const QVariantMap ¶meters); |
|
93 |
||
94 |
/** |
|
95 |
* @see HbDeviceDialogInterface |
|
96 |
*/ |
|
97 |
bool setDeviceDialogParameters(const QVariantMap ¶meters); |
|
98 |
||
99 |
/** |
|
100 |
* @see HbDeviceDialogInterface |
|
101 |
*/ |
|
102 |
int deviceDialogError() const; |
|
103 |
||
104 |
/** |
|
105 |
* @see HbDeviceDialogInterface |
|
106 |
*/ |
|
107 |
void closeDeviceDialog(bool byClient); |
|
108 |
||
109 |
/** |
|
110 |
* @see HbDeviceDialogInterface |
|
111 |
*/ |
|
112 |
HbDialog *deviceDialogWidget() const; |
|
113 |
||
114 |
public slots: |
|
115 |
/** |
|
116 |
* Called when the widget is tapped. |
|
117 |
* This launches the conversation view. |
|
118 |
*/ |
|
119 |
void widgetActivated(); |
|
120 |
||
121 |
private: |
|
122 |
/** |
|
123 |
* Prepares the displaname to be shown in the notification. |
|
124 |
* This extracts firsname, lastname, nick name and address |
|
125 |
* and prepares the display name. |
|
126 |
* @param parameters variant map value list |
|
127 |
*/ |
|
128 |
void prepareDisplayName(const QVariantMap ¶meters); |
|
129 |
||
130 |
/** |
|
131 |
* Hide event call back function |
|
132 |
* Called when widget is about to hide. Closing effect has ended. |
|
133 |
* @param event QHideEvent |
|
134 |
*/ |
|
135 |
void hideEvent(QHideEvent *event); |
|
136 |
||
137 |
/** |
|
138 |
* Show event call back function |
|
139 |
* Called when widget is about to show |
|
140 |
* @param event QShowEvent |
|
141 |
*/ |
|
142 |
void showEvent(QShowEvent *event); |
|
143 |
||
144 |
/** |
|
145 |
* Extracts the information and constrcuts the widget |
|
146 |
* @param parameters QVariantMap values |
|
147 |
*/ |
|
148 |
bool constructDialog(const QVariantMap ¶meters); |
|
149 |
signals: |
|
150 |
/** |
|
151 |
* Signal emitted when dialog is closed |
|
152 |
*/ |
|
153 |
void deviceDialogClosed(); |
|
154 |
||
155 |
/** |
|
156 |
* Device dialog data signal |
|
157 |
*/ |
|
158 |
void deviceDialogData(QVariantMap data); |
|
159 |
||
160 |
private: |
|
161 |
Q_DISABLE_COPY(MsgNotificationDialogWidget) |
|
162 |
||
163 |
/** |
|
164 |
* Hold the last error |
|
165 |
*/ |
|
166 |
int mLastError; |
|
167 |
||
168 |
/** |
|
169 |
* Show event has come or not |
|
170 |
*/ |
|
171 |
bool mShowEventReceived; |
|
172 |
||
173 |
/** |
|
174 |
* Current conversation id. |
|
175 |
*/ |
|
176 |
qint64 mConversationId; |
|
177 |
}; |
|
178 |
||
179 |
#endif // MSGNOTIFICATIONDIALOGWIDGET_P_H |