24 #include <xqservicerequest.h> |
24 #include <xqservicerequest.h> |
25 #include <QString> |
25 #include <QString> |
26 #include <w32std.h> |
26 #include <w32std.h> |
27 #include <apgtask.h> |
27 #include <apgtask.h> |
28 #include <XQSettingsManager> |
28 #include <XQSettingsManager> |
|
29 #include <xqaiwrequest.h> |
|
30 #include <xqappmgr.h> |
29 #include <xqpublishandsubscribeutils.h> |
31 #include <xqpublishandsubscribeutils.h> |
30 #include <xqsystemtoneservice.h> |
32 #include <xqsystemtoneservice.h> |
31 #include <xqconversions.h> |
33 #include <xqconversions.h> |
|
34 #include <QThreadPool> |
32 |
35 |
33 //USER INCLUDES |
36 //USER INCLUDES |
34 #include "msgnotifier.h" |
37 #include "msgnotifier.h" |
35 #include "msgnotifier_p.h" |
38 #include "msgnotifier_p.h" |
36 #include "msgstorehandler.h" |
39 #include "msgstorehandler.h" |
46 q_ptr(MsgNotifier), mCvServer(NULL), iMsgStoreHandler(NULL), |
49 q_ptr(MsgNotifier), mCvServer(NULL), iMsgStoreHandler(NULL), |
47 mSettingsManager(NULL),mPSUtils(NULL) |
50 mSettingsManager(NULL),mPSUtils(NULL) |
48 { |
51 { |
49 QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter") |
52 QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter") |
50 |
53 |
51 TRAP_IGNORE(initL()); |
54 initL(); |
52 QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Exit") |
55 QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Exit") |
53 } |
56 } |
54 |
57 |
55 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
56 // MsgNotifierPrivate::~MsgNotifierPrivate |
59 // MsgNotifierPrivate::~MsgNotifierPrivate |
101 mCvServer->RequestConversationListChangeEventL(this); |
104 mCvServer->RequestConversationListChangeEventL(this); |
102 iMsgStoreHandler = new MsgStoreHandler(this, mCvServer); |
105 iMsgStoreHandler = new MsgStoreHandler(this, mCvServer); |
103 updateUnreadIndications(true); |
106 updateUnreadIndications(true); |
104 updateOutboxIndications(); |
107 updateOutboxIndications(); |
105 |
108 |
106 mSettingsManager = new XQSettingsManager(); |
109 QT_TRYCATCH_LEAVING(mSettingsManager = new XQSettingsManager()); |
107 |
110 |
108 // define property |
111 // define property |
109 mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager); |
112 QT_TRYCATCH_LEAVING(mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager)); |
|
113 |
110 XQPublishAndSubscribeSettingsKey convIdKey( |
114 XQPublishAndSubscribeSettingsKey convIdKey( |
111 KMsgCVIdProperty, KMsgCVIdKey); |
115 KMsgCVIdProperty, KMsgCVIdKey); |
112 bool success = mPSUtils->defineProperty(convIdKey, |
116 bool success = mPSUtils->defineProperty(convIdKey, |
113 XQSettingsManager::TypeInt); |
117 XQSettingsManager::TypeInt); |
114 |
118 |
119 success = mSettingsManager->writeItemValue(convIdKey,-1); |
123 success = mSettingsManager->writeItemValue(convIdKey,-1); |
120 |
124 |
121 QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " |
125 QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " |
122 "writing ret value",success) |
126 "writing ret value",success) |
123 |
127 |
124 mSts = new XQSystemToneService(); |
128 QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService()); |
125 |
129 |
126 QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit") |
130 QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit") |
127 } |
131 } |
128 |
132 |
129 // ---------------------------------------------------------------------------- |
133 // ---------------------------------------------------------------------------- |
131 // @see MsgNotifierPrivate.h |
135 // @see MsgNotifierPrivate.h |
132 // ---------------------------------------------------------------------------- |
136 // ---------------------------------------------------------------------------- |
133 void MsgNotifierPrivate::AddConversationList( |
137 void MsgNotifierPrivate::AddConversationList( |
134 const CCsClientConversation& aClientConversation) |
138 const CCsClientConversation& aClientConversation) |
135 { |
139 { |
136 QDEBUG_WRITE("MsgNotifierPrivate::AddConversationList : Enter") |
140 QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Enter") |
137 |
141 |
138 processListEntry(aClientConversation); |
142 processListEntry(aClientConversation); |
139 updateUnreadIndications(); |
143 updateUnreadIndications(); |
140 |
144 |
141 QDEBUG_WRITE("MsgNotifierPrivate::AddConversationList : Exit") |
145 QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Exit") |
142 } |
146 } |
143 |
147 |
144 // ---------------------------------------------------------------------------- |
148 // ---------------------------------------------------------------------------- |
145 // MsgNotifierPrivate::DeleteConversationList |
149 // MsgNotifierPrivate::DeleteConversationList |
146 // @see MsgNotifierPrivate.h |
150 // @see MsgNotifierPrivate.h |
157 // MsgNotifierPrivate::ModifyConversationList |
161 // MsgNotifierPrivate::ModifyConversationList |
158 // @see MsgNotifierPrivate.h |
162 // @see MsgNotifierPrivate.h |
159 // ---------------------------------------------------------------------------- |
163 // ---------------------------------------------------------------------------- |
160 void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation) |
164 void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation) |
161 { |
165 { |
162 QDEBUG_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter") |
166 QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter") |
163 |
167 |
164 processListEntry(aClientConversation); |
168 processListEntry(aClientConversation); |
165 updateUnreadIndications(); |
169 updateUnreadIndications(); |
166 |
170 |
167 QDEBUG_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit") |
171 QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit") |
168 } |
172 } |
169 |
173 |
170 // ---------------------------------------------------------------------------- |
174 // ---------------------------------------------------------------------------- |
171 // MsgNotifierPrivate::RefreshConversationList |
175 // MsgNotifierPrivate::RefreshConversationList |
172 // @see MsgNotifierPrivate.h |
176 // @see MsgNotifierPrivate.h |
181 // @see MsgNotifierPrivate.h |
185 // @see MsgNotifierPrivate.h |
182 // ---------------------------------------------------------------------------- |
186 // ---------------------------------------------------------------------------- |
183 void MsgNotifierPrivate::processListEntry( |
187 void MsgNotifierPrivate::processListEntry( |
184 const CCsClientConversation& aClientConversation) |
188 const CCsClientConversation& aClientConversation) |
185 { |
189 { |
186 QDEBUG_WRITE("MsgNotifierPrivate::processListEntry : Enter") |
190 QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Enter") |
187 |
191 |
188 CCsConversationEntry* convEntry = |
192 CCsConversationEntry* convEntry = |
189 aClientConversation.GetConversationEntry(); |
193 aClientConversation.GetConversationEntry(); |
190 |
194 |
191 QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Direction", |
195 QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Direction", |
382 // ---------------------------------------------------------------------------- |
386 // ---------------------------------------------------------------------------- |
383 // MsgNotifierPrivate::PartialDeleteConversationList |
387 // MsgNotifierPrivate::PartialDeleteConversationList |
384 // @see mcsconversationclientchangeobserver.h |
388 // @see mcsconversationclientchangeobserver.h |
385 // ---------------------------------------------------------------------------- |
389 // ---------------------------------------------------------------------------- |
386 void MsgNotifierPrivate::PartialDeleteConversationList( |
390 void MsgNotifierPrivate::PartialDeleteConversationList( |
387 const CCsClientConversation& aClientConversation){/*empty implementation*/} |
391 const CCsClientConversation& /*aClientConversation*/){/*empty implementation*/} |
|
392 |
|
393 |
|
394 // ---------------------------------------------------------------------------- |
|
395 // MsgNotifierPrivate::ShowClass0Message |
|
396 // @see msgnotifier_p.h |
|
397 // ---------------------------------------------------------------------------- |
|
398 |
|
399 void MsgNotifierPrivate::ShowClass0Message(Class0Info& class0Info) |
|
400 { |
|
401 QCRITICAL_WRITE("flashmsgnotifier BEGIN"); |
|
402 QThreadPool::globalInstance()->start(new Class0SmsServiceTask(class0Info)); |
|
403 QCRITICAL_WRITE("flashmsgnotifier END"); |
|
404 } |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 // ---------------------------------------------------------------------------- |
|
410 // Class0SmsServiceTask::Class0SmsServiceTask |
|
411 // @see msgnotifier_p.h |
|
412 // ---------------------------------------------------------------------------- |
|
413 Class0SmsServiceTask::Class0SmsServiceTask(Class0Info& class0Info): |
|
414 mClass0info(class0Info) |
|
415 { |
|
416 } |
|
417 |
|
418 // ---------------------------------------------------------------------------- |
|
419 // Class0SmsServiceTask::~Class0SmsServiceTask |
|
420 // @see msgnotifier_p.h |
|
421 // ---------------------------------------------------------------------------- |
|
422 Class0SmsServiceTask::~Class0SmsServiceTask() |
|
423 { |
|
424 } |
|
425 |
|
426 // ---------------------------------------------------------------------------- |
|
427 // Class0SmsServiceTask::run |
|
428 // @see msgnotifier_p.h |
|
429 // ---------------------------------------------------------------------------- |
|
430 void Class0SmsServiceTask::run() |
|
431 { |
|
432 QList<QVariant> args; |
|
433 QString serviceName("flashmsgnotifier"); |
|
434 QString interfaceName("com.nokia.symbian.IFlashMsgNotifier"); |
|
435 QString operation("displayFlashMsg(QByteArray)"); |
|
436 XQAiwRequest* request; |
|
437 XQApplicationManager appManager; |
|
438 |
|
439 request = appManager.create(interfaceName, operation, false); //non-embedded |
|
440 |
|
441 if ( request == NULL ) |
|
442 { |
|
443 QCRITICAL_WRITE("flashmsgnotifier request == NULL"); |
|
444 return; |
|
445 } |
|
446 |
|
447 QByteArray ba; |
|
448 QDataStream stream(&ba, QIODevice::ReadWrite); |
|
449 stream << mClass0info.body; |
|
450 stream << mClass0info.address; |
|
451 stream << mClass0info.alias; |
|
452 stream << mClass0info.time; |
|
453 stream << mClass0info.messageId; |
|
454 |
|
455 args << ba; |
|
456 request->setArguments(args); |
|
457 |
|
458 if(!request->send()) |
|
459 { |
|
460 QString lastErr; |
|
461 lastErr = request->lastErrorMessage(); |
|
462 QDEBUG_WRITE_FORMAT("flashmsgnotifier launch failed", lastErr); |
|
463 } |
|
464 |
|
465 QCRITICAL_WRITE("flashmsgnotifier END"); |
|
466 delete request; |
|
467 } |
388 |
468 |
389 //EOF |
469 //EOF |