author | hgs |
Tue, 05 Oct 2010 13:58:47 +0530 | |
changeset 73 | ecf6a73a9186 |
parent 62 | fdbe8253b596 |
child 76 | 60a8a215b0ec |
permissions | -rw-r--r-- |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Listen to conversation server events and parse the |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* events. These parse infomation passed to notifications and indications. |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
// SYSTEM INCLUDES |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <msvapi.h> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <ccsclientconversation.h> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <ccsrequesthandler.h> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <ccsconversationentry.h> |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
24 |
#include <xqservicerequest.h> |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
25 |
#include <QString> |
37 | 26 |
#include <w32std.h> |
27 |
#include <apgtask.h> |
|
28 |
#include <XQSettingsManager> |
|
51 | 29 |
#include <xqaiwrequest.h> |
30 |
#include <xqappmgr.h> |
|
37 | 31 |
#include <xqpublishandsubscribeutils.h> |
32 |
#include <xqsystemtoneservice.h> |
|
33 |
#include <xqconversions.h> |
|
51 | 34 |
#include <QThreadPool> |
62 | 35 |
#include <ProfileEngineInternalCRKeys.h> |
36 |
#include <hwrmvibra.h> |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
//USER INCLUDES |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
#include "msgnotifier.h" |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
#include "msgnotifier_p.h" |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
41 |
#include "msgstorehandler.h" |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
42 |
#include "msginfodefs.h" |
37 | 43 |
#include "conversationidpsconsts.h" |
44 |
#include "debugtraces.h" |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
|
62 | 46 |
const XQCentralRepositorySettingsKey silenceModeKey(KCRUidProfileEngine.iUid, KProEngSilenceMode); |
47 |
||
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
// MsgNotifierPrivate::MsgNotifierPrivate |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
// ---------------------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
52 |
MsgNotifierPrivate::MsgNotifierPrivate(MsgNotifier* MsgNotifier) : |
37 | 53 |
q_ptr(MsgNotifier), mCvServer(NULL), iMsgStoreHandler(NULL), |
54 |
mSettingsManager(NULL),mPSUtils(NULL) |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
56 |
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter") |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
57 |
|
48 | 58 |
initL(); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
59 |
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Exit") |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
// MsgNotifierPrivate::~MsgNotifierPrivate |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
MsgNotifierPrivate::~MsgNotifierPrivate() |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
68 |
QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Enter") |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
69 |
if (mCvServer) { |
48 | 70 |
TRAP_IGNORE(mCvServer->RemoveConversationListChangeEventL(this)); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
71 |
delete mCvServer; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
72 |
mCvServer = NULL; |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
} |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
74 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
75 |
if (iMsgStoreHandler) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
76 |
delete iMsgStoreHandler; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
77 |
iMsgStoreHandler = NULL; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
78 |
} |
37 | 79 |
|
80 |
if(mPSUtils) |
|
81 |
{ |
|
82 |
delete mPSUtils; |
|
83 |
} |
|
84 |
||
85 |
if(mSettingsManager) |
|
86 |
{ |
|
87 |
delete mSettingsManager; |
|
88 |
} |
|
89 |
||
90 |
if(mSts) |
|
91 |
{ |
|
92 |
delete mSts; |
|
93 |
mSts = NULL; |
|
94 |
} |
|
95 |
||
62 | 96 |
if(mVibra) |
97 |
{ |
|
98 |
delete mVibra; |
|
99 |
mVibra = NULL; |
|
100 |
} |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
101 |
QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit") |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
// MsgNotifierPrivate::initL |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
void MsgNotifierPrivate::initL() |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
109 |
{ |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
QDEBUG_WRITE("MsgNotifierPrivate::initL : Enter") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
111 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
mCvServer = CCSRequestHandler::NewL(); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
mCvServer->RequestConversationListChangeEventL(this); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
114 |
iMsgStoreHandler = new MsgStoreHandler(this, mCvServer); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
115 |
updateUnreadIndications(true); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
116 |
updateOutboxIndications(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
117 |
|
48 | 118 |
QT_TRYCATCH_LEAVING(mSettingsManager = new XQSettingsManager()); |
37 | 119 |
|
120 |
// define property |
|
48 | 121 |
QT_TRYCATCH_LEAVING(mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager)); |
122 |
||
37 | 123 |
XQPublishAndSubscribeSettingsKey convIdKey( |
124 |
KMsgCVIdProperty, KMsgCVIdKey); |
|
125 |
bool success = mPSUtils->defineProperty(convIdKey, |
|
126 |
XQSettingsManager::TypeInt); |
|
127 |
||
128 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " |
|
129 |
"property creation ret value",success) |
|
130 |
||
131 |
// write -1 initially |
|
132 |
success = mSettingsManager->writeItemValue(convIdKey,-1); |
|
133 |
||
134 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " |
|
135 |
"writing ret value",success) |
|
136 |
||
48 | 137 |
QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService()); |
37 | 138 |
|
62 | 139 |
mVibra = CHWRMVibra::NewL(); |
140 |
||
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
142 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
// MsgNotifierPrivate::AddConversationList |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
void MsgNotifierPrivate::AddConversationList( |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
149 |
const CCsClientConversation& aClientConversation) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
150 |
{ |
51 | 151 |
QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Enter") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
152 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
processListEntry(aClientConversation); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
154 |
updateUnreadIndications(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
155 |
|
51 | 156 |
QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Exit") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
157 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
158 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
159 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
160 |
// MsgNotifierPrivate::DeleteConversationList |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
// ---------------------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
163 |
void MsgNotifierPrivate::DeleteConversationList( |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
164 |
const CCsClientConversation& /*aClientConversation*/) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
165 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
166 |
QDEBUG_WRITE("MsgNotifierPrivate::DeleteConversationList : Enter") |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
167 |
updateUnreadIndications(); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
QDEBUG_WRITE("MsgNotifierPrivate::DeleteConversationList : Exit") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
169 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
// MsgNotifierPrivate::ModifyConversationList |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
173 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
174 |
// ---------------------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
175 |
void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
176 |
{ |
51 | 177 |
QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
178 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
processListEntry(aClientConversation); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
180 |
updateUnreadIndications(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
181 |
|
51 | 182 |
QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit") |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
183 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
184 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
// MsgNotifierPrivate::RefreshConversationList |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
void MsgNotifierPrivate::RefreshConversationList() |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
190 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
191 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
192 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
// MsgNotifierPrivate::processListEntry |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
// ---------------------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
void MsgNotifierPrivate::processListEntry( |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
const CCsClientConversation& aClientConversation) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
{ |
51 | 201 |
QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Enter") |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
CCsConversationEntry* convEntry = |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
aClientConversation.GetConversationEntry(); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Direction", |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
convEntry->ConversationDir()) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry New Entry Attribute", |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
convEntry->IsAttributeSet(ECsAttributeNewEntryAdded)) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Unread Attribute", |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
convEntry->IsAttributeSet(ECsAttributeUnread)) |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
212 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
if((convEntry->ConversationDir() == ECsDirectionIncoming) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
&& convEntry->IsAttributeSet(ECsAttributeNewEntryAdded) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
&& convEntry->IsAttributeSet(ECsAttributeUnread)) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
{ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
QDEBUG_WRITE("processListEntry : Processing data for Notification") |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
NotificationData notifData; |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
220 |
notifData.msvEntryId = convEntry->EntryId(); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
notifData.mConversationId = aClientConversation.GetConversationEntryId(); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
222 |
notifData.mMsgType = static_cast<int>(convEntry->GetType()); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
224 |
HBufC* displayName = aClientConversation.GetDisplayName(); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
HBufC* number = convEntry->Contact(); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
HBufC* descrp = convEntry->Description(); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
228 |
if(displayName) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
230 |
notifData.mDisplayName = |
37 | 231 |
XQConversions::s60DescToQString(*displayName); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
232 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
if(number) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
{ |
37 | 235 |
notifData.mContactNum = XQConversions::s60DescToQString(*number); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
if(descrp) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
{ |
37 | 239 |
notifData.mDescription = XQConversions::s60DescToQString(*descrp); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
241 |
|
62 | 242 |
QVariant silenceMode = mSettingsManager->readItemValue(silenceModeKey, XQSettingsManager::TypeInt); |
243 |
int silent = silenceMode.toInt(); |
|
244 |
if(silent < 1) |
|
245 |
{ |
|
246 |
//Play new message alert tone. |
|
247 |
mSts->playTone(XQSystemToneService::SmsAlertTone); |
|
248 |
} |
|
249 |
// Execute the vibra effect. |
|
250 |
if (mVibra) |
|
251 |
{ |
|
252 |
TInt err = KErrNone; |
|
253 |
TRAP(err,mVibra->StartVibraL(1000)); |
|
254 |
} |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
|
37 | 256 |
// check whether opened cv id and received |
257 |
// cv id are same and show notification |
|
258 |
if( showNotification(notifData.mConversationId )) |
|
259 |
{ |
|
260 |
q_ptr->displayNewMessageNotification(notifData); |
|
261 |
QDEBUG_WRITE("processListEntry : Notification display called") |
|
262 |
} |
|
263 |
||
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
|
51 | 266 |
QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Exit") |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
// ---------------------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
270 |
// MsgNotifierPrivate::updateUnreadIndications |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
271 |
// @see MsgNotifierPrivate.h |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
272 |
// ---------------------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
273 |
void MsgNotifierPrivate::updateUnreadIndications(bool bootup) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
274 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
275 |
QDEBUG_WRITE("MsgNotifierPrivate::updateIndicationsL : Enter") |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
276 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
277 |
int unreadCount(0); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
278 |
if(bootup) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
279 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
280 |
TRAP_IGNORE(unreadCount = iMsgStoreHandler->GetUnreadMessageCountL()); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
281 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
282 |
else |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
283 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
284 |
TRAP_IGNORE(unreadCount = mCvServer->GetTotalUnreadCountL()); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
285 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
286 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
287 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::" |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
288 |
"updateIndications unreadCount = ",unreadCount ); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
289 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
290 |
//activate or deactivate indications based on unread count |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
291 |
q_ptr->updateUnreadIndications(unreadCount); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
292 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
293 |
QDEBUG_WRITE("MsgNotifierPrivate::updateIndicationsL : Exit") |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
294 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
295 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
296 |
// ---------------------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
297 |
// MsgNotifierPrivate::updateOutboxIndications |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
298 |
// @see MsgNotifierPrivate.h |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
299 |
// ---------------------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
300 |
void MsgNotifierPrivate::updateOutboxIndications() |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
301 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
302 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
303 |
MsgInfo failedIndicatorData; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
304 |
MsgInfo pendingIndicatorData; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
305 |
TInt err = KErrNone; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
306 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
307 |
TRAP(err, iMsgStoreHandler->GetOutboxEntriesL(failedIndicatorData,pendingIndicatorData)); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
309 |
q_ptr->updateOutboxIndications(failedIndicatorData); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
310 |
q_ptr->updateOutboxIndications(pendingIndicatorData); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
311 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
312 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
313 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
314 |
// ---------------------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
315 |
// MsgNotifierPrivate::displayOutboxIndications |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
316 |
// @see MsgNotifierPrivate.h |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
317 |
// ---------------------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
318 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
319 |
void MsgNotifierPrivate::displayOutboxIndications(MsgInfo data) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
320 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
321 |
q_ptr->updateOutboxIndications(data); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
322 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
323 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
324 |
// ---------------------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
325 |
// MsgNotifierPrivate::displayFailedNote |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
326 |
// @see MsgNotifierPrivate.h |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
327 |
// ---------------------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
328 |
void MsgNotifierPrivate::displayFailedNote(MsgInfo info) |
37 | 329 |
{ |
330 |
QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote start.") |
|
331 |
||
332 |
// check whether opened cv id and received |
|
333 |
// cv id are same then dont show failed note |
|
334 |
if (!showNotification(info.mConversationId)) |
|
335 |
{ |
|
336 |
return; |
|
337 |
} |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
338 |
|
37 | 339 |
//Even if name string is empty we shall add name into args |
340 |
QString nameString; |
|
341 |
||
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
342 |
info.mDisplayName.removeDuplicates(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
343 |
info.mDisplayName.sort(); |
37 | 344 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
345 |
nameString.append(info.mDisplayName.at(0)); |
37 | 346 |
for (int i = 1; i < info.mDisplayName.count(); ++i) |
347 |
{ |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
348 |
nameString.append(", "); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
349 |
nameString.append(info.mDisplayName.at(i)); |
37 | 350 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
|
37 | 352 |
// create request arguments |
353 |
QVariantList args; |
|
354 |
args << QVariant(nameString); |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
355 |
args << info.mConversationId; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
356 |
args << info.mMessageType; |
37 | 357 |
|
358 |
// TODO: use XQAiwRequest |
|
359 |
XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier", |
|
360 |
"displayErrorNote(QVariantList)", false); |
|
361 |
||
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
362 |
snd << args; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
363 |
snd.send(); |
37 | 364 |
|
365 |
QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote end.") |
|
366 |
} |
|
367 |
||
368 |
// ---------------------------------------------------------------------------- |
|
369 |
// MsgNotifierPrivate::showNotification |
|
370 |
// @see MsgNotifierPrivate.h |
|
371 |
// ---------------------------------------------------------------------------- |
|
372 |
bool MsgNotifierPrivate::showNotification(int receivedMsgConvId) |
|
373 |
{ |
|
73 | 374 |
bool showNotification = false; |
37 | 375 |
|
376 |
RWsSession wsSession ; |
|
73 | 377 |
int err = wsSession.Connect(); |
37 | 378 |
|
73 | 379 |
if ( KErrNone == err ) |
37 | 380 |
{ |
73 | 381 |
showNotification = true; |
382 |
TApaTaskList taskList(wsSession); |
|
383 |
TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running |
|
384 |
||
385 |
if (task.Exists()) |
|
37 | 386 |
{ |
73 | 387 |
TApaTask foregndtask = taskList.FindByPos(0); // foreground app |
388 |
// compare window group id |
|
389 |
// if application is in foregorund, then check the currently |
|
390 |
// opened conversation is same as received one. |
|
391 |
if (task.WgId() == foregndtask.WgId()) |
|
392 |
{ |
|
393 |
// get the current conversation ID |
|
394 |
XQPublishAndSubscribeSettingsKey convIdKey(KMsgCVIdProperty, |
|
395 |
KMsgCVIdKey); |
|
396 |
QVariant value = mSettingsManager->readItemValue(convIdKey, |
|
397 |
XQSettingsManager::TypeInt); |
|
37 | 398 |
|
73 | 399 |
int openedConvId = value.toInt(); |
400 |
if (openedConvId == receivedMsgConvId) |
|
401 |
{ |
|
402 |
showNotification = false; |
|
403 |
QDEBUG_WRITE("processListEntry : Notification not shown") |
|
404 |
} |
|
37 | 405 |
} |
406 |
} |
|
73 | 407 |
|
408 |
wsSession.Close(); |
|
37 | 409 |
} |
410 |
return showNotification; |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
411 |
} |
37 | 412 |
// ---------------------------------------------------------------------------- |
413 |
// MsgNotifierPrivate::PartialDeleteConversationList |
|
414 |
// @see mcsconversationclientchangeobserver.h |
|
415 |
// ---------------------------------------------------------------------------- |
|
416 |
void MsgNotifierPrivate::PartialDeleteConversationList( |
|
51 | 417 |
const CCsClientConversation& /*aClientConversation*/){/*empty implementation*/} |
418 |
||
419 |
||
420 |
// ---------------------------------------------------------------------------- |
|
421 |
// MsgNotifierPrivate::ShowClass0Message |
|
422 |
// @see msgnotifier_p.h |
|
423 |
// ---------------------------------------------------------------------------- |
|
424 |
||
425 |
void MsgNotifierPrivate::ShowClass0Message(Class0Info& class0Info) |
|
426 |
{ |
|
427 |
QCRITICAL_WRITE("flashmsgnotifier BEGIN"); |
|
428 |
QThreadPool::globalInstance()->start(new Class0SmsServiceTask(class0Info)); |
|
429 |
QCRITICAL_WRITE("flashmsgnotifier END"); |
|
430 |
} |
|
431 |
||
432 |
||
433 |
||
434 |
||
435 |
// ---------------------------------------------------------------------------- |
|
436 |
// Class0SmsServiceTask::Class0SmsServiceTask |
|
437 |
// @see msgnotifier_p.h |
|
438 |
// ---------------------------------------------------------------------------- |
|
439 |
Class0SmsServiceTask::Class0SmsServiceTask(Class0Info& class0Info): |
|
440 |
mClass0info(class0Info) |
|
441 |
{ |
|
442 |
} |
|
443 |
||
444 |
// ---------------------------------------------------------------------------- |
|
445 |
// Class0SmsServiceTask::~Class0SmsServiceTask |
|
446 |
// @see msgnotifier_p.h |
|
447 |
// ---------------------------------------------------------------------------- |
|
448 |
Class0SmsServiceTask::~Class0SmsServiceTask() |
|
449 |
{ |
|
450 |
} |
|
451 |
||
452 |
// ---------------------------------------------------------------------------- |
|
453 |
// Class0SmsServiceTask::run |
|
454 |
// @see msgnotifier_p.h |
|
455 |
// ---------------------------------------------------------------------------- |
|
456 |
void Class0SmsServiceTask::run() |
|
457 |
{ |
|
458 |
QList<QVariant> args; |
|
459 |
QString serviceName("flashmsgnotifier"); |
|
460 |
QString interfaceName("com.nokia.symbian.IFlashMsgNotifier"); |
|
461 |
QString operation("displayFlashMsg(QByteArray)"); |
|
462 |
XQAiwRequest* request; |
|
463 |
XQApplicationManager appManager; |
|
464 |
||
465 |
request = appManager.create(interfaceName, operation, false); //non-embedded |
|
466 |
||
467 |
if ( request == NULL ) |
|
468 |
{ |
|
469 |
QCRITICAL_WRITE("flashmsgnotifier request == NULL"); |
|
470 |
return; |
|
471 |
} |
|
472 |
||
473 |
QByteArray ba; |
|
474 |
QDataStream stream(&ba, QIODevice::ReadWrite); |
|
475 |
stream << mClass0info.body; |
|
476 |
stream << mClass0info.address; |
|
477 |
stream << mClass0info.alias; |
|
478 |
stream << mClass0info.time; |
|
479 |
stream << mClass0info.messageId; |
|
480 |
||
481 |
args << ba; |
|
482 |
request->setArguments(args); |
|
483 |
||
484 |
if(!request->send()) |
|
485 |
{ |
|
486 |
QString lastErr; |
|
487 |
lastErr = request->lastErrorMessage(); |
|
488 |
QDEBUG_WRITE_FORMAT("flashmsgnotifier launch failed", lastErr); |
|
489 |
} |
|
490 |
||
491 |
QCRITICAL_WRITE("flashmsgnotifier END"); |
|
492 |
delete request; |
|
493 |
} |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
494 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
495 |
//EOF |