|
1 /* |
|
2 * Copyright (c) 2006-2008 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: MsgIndicatorPlugin plugin implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <bautils.h> // BaflUtils |
|
21 #include <eikdll.h> |
|
22 #include <apgcli.h> // for RApaLsSession |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <coemain.h> // CCoeEnv |
|
26 #include <coeaui.h> // CCoeAppUi |
|
27 #include <vwsdef.h> // TVwsViewId |
|
28 #include <e32property.h> // RPropert |
|
29 #include <msgindicator.rsg> // MsgIndicator resources |
|
30 #include <StringLoader.h> // Stringloader |
|
31 #include <AknUtils.h> |
|
32 #include <msvids.h> // KMsvGlobalInBoxIndexEntryIdValue |
|
33 #include "msgindicatorpluginimplementation.h" |
|
34 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR |
|
35 #include <ConeResLoader.h> // RConeResourceLoader |
|
36 #include <NcnListDomainCRKeys.h> // CenRepKeys |
|
37 #include <centralrepository.h> //CRepository |
|
38 #include <muiumsvuiserviceutilitiesinternal.h> // MsvUiServiceUtilitiesInternal |
|
39 #include <messaginginternalpskeys.h> |
|
40 #include "msgindicatorpluginlog.h" //Logging |
|
41 #include <messaginginternalcrkeys.h> |
|
42 |
|
43 #include <AknDlgShut.h> // for AknDialogShutter |
|
44 // CONSTANTS |
|
45 _LIT( KIndicatorResourceFile,"msgindicator.rsc" ); |
|
46 const TUid KMceShowMail = { 0x01 }; |
|
47 const TInt KMaxMessageNumberLength = 4; // 9999 = 4 numbers |
|
48 const TUid KMCEAppUid = { 0x100058C5 }; |
|
49 const TUid KMCEMessageListViewUid = { 0x02 }; |
|
50 const TUid KMCEMainViewUid = { 0x01 }; |
|
51 const TInt KListgranularity = 22; |
|
52 const TInt KTextLength = 150; |
|
53 /* Maximum number of voice mails */ |
|
54 const TInt EVMMaximumNumber = 255; |
|
55 const TUid KVmBxUid = { 0x100058F5 }; |
|
56 const TInt KRestartTimer = 100000 ; |
|
57 #define KSpeeddialVmbxDialUidView TVwsViewId( TUid::Uid( 0x1000590A ),TUid::Uid( 0x02 ) ) |
|
58 _LIT8( KExternalLaunch, "outside" ); |
|
59 |
|
60 const TUid KConversationAppUid = { 0x2002A540 }; |
|
61 const TUid KConversationListViewUid = { 0x01 }; |
|
62 const TMsvId KConversationListViewid = 0x01; |
|
63 |
|
64 // ======== MEMBER FUNCTIONS ======== |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CMsgIndicatorPluginImplementation::CMsgIndicatorPluginImplementation |
|
68 // C++ default constructor can NOT contain any code, that |
|
69 // might leave. |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CMsgIndicatorPluginImplementation::CMsgIndicatorPluginImplementation() |
|
73 { |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CMsgIndicatorPluginImplementation::ConstructL |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CMsgIndicatorPluginImplementation::ConstructL() |
|
82 { |
|
83 MSGPLUGINLOGGER_CREATE |
|
84 |
|
85 //CRepository |
|
86 iStorage = CRepository::NewL( KCRUidNcnList ); |
|
87 |
|
88 //Get the ALS status |
|
89 iIsALSSupported = UpdateALSStatus(); |
|
90 |
|
91 //RVmbxNumber |
|
92 iSVmbxOpen = EFalse; |
|
93 |
|
94 // Read resource strings |
|
95 // Resource loader |
|
96 CEikonEnv* env = CEikonEnv::Static(); |
|
97 RConeResourceLoader resourceLoader( *env ); |
|
98 |
|
99 iObserver = CWaitingObserver::NewL( iMobilePhone, *this ); |
|
100 |
|
101 TParse fp; |
|
102 fp.Set( KIndicatorResourceFile, &KDC_RESOURCE_FILES_DIR , NULL ); |
|
103 TFileName filename = fp.FullName(); |
|
104 |
|
105 resourceLoader.OpenL( filename ); |
|
106 |
|
107 BaflUtils::NearestLanguageFile(env->FsSession(), filename); |
|
108 |
|
109 env->AddResourceFileL(filename); |
|
110 |
|
111 iMessagesStrings = new(ELeave)CDesCArrayFlat( KListgranularity ); |
|
112 iMessagesStrings->Reset(); |
|
113 TBuf<KTextLength> tmpBuf; |
|
114 |
|
115 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_ITEM_IN_INBOX, env ); |
|
116 iMessagesStrings->AppendL( tmpBuf ); |
|
117 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_ITEMS_IN_INBOX, env ); |
|
118 iMessagesStrings->AppendL( tmpBuf ); |
|
119 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_ITEM_IN_OUTBOX, env ); |
|
120 iMessagesStrings->AppendL( tmpBuf ); |
|
121 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_ITEMS_IN_OUTBOX, env ); |
|
122 iMessagesStrings->AppendL( tmpBuf ); |
|
123 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_OTHER_MESSAGES, env ); |
|
124 iMessagesStrings->AppendL( tmpBuf ); |
|
125 |
|
126 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_EMAIL, env ); |
|
127 iMessagesStrings->AppendL( tmpBuf ); |
|
128 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAIL_INDICATOR, env ); |
|
129 iMessagesStrings->AppendL( tmpBuf ); |
|
130 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAILS_INDICATOR, env ); |
|
131 iMessagesStrings->AppendL( tmpBuf ); |
|
132 StringLoader::Load( tmpBuf, R_QTN_GEN_UNK_AMOUNT_VOICE_MAILS_INDICATOR, env ); |
|
133 iMessagesStrings->AppendL( tmpBuf ); |
|
134 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAIL_ON_LINE1, env ); |
|
135 iMessagesStrings->AppendL( tmpBuf ); |
|
136 |
|
137 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAIL_INDICATOR_ON_LINE1, env ); |
|
138 iMessagesStrings->AppendL( tmpBuf ); |
|
139 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAILS_INDICATOR_ON_LINE1, env ); |
|
140 iMessagesStrings->AppendL( tmpBuf ); |
|
141 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAIL_ON_LINE2, env ); |
|
142 iMessagesStrings->AppendL( tmpBuf ); |
|
143 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAIL_INDICATOR_ON_LINE2, env ); |
|
144 iMessagesStrings->AppendL( tmpBuf ); |
|
145 StringLoader::Load( tmpBuf, R_QTN_GEN_VOICE_MAILS_INDICATOR_ON_LINE2, env ); |
|
146 iMessagesStrings->AppendL( tmpBuf ); |
|
147 |
|
148 |
|
149 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_FAX, env ); |
|
150 iMessagesStrings->AppendL( tmpBuf ); |
|
151 StringLoader::Load( tmpBuf, R_QTN_GEN_NEW_FAXES, env ); |
|
152 iMessagesStrings->AppendL( tmpBuf ); |
|
153 StringLoader::Load( tmpBuf, R_QTN_GEN_UKN_AMOUNT_NEW_FAXES, env ); |
|
154 iMessagesStrings->AppendL( tmpBuf ); |
|
155 |
|
156 StringLoader::Load( tmpBuf, R_QTN_GEN_SIM_MSG_FULL, env ); |
|
157 iMessagesStrings->AppendL( tmpBuf ); |
|
158 |
|
159 iRepository = CRepository::NewL(KCRUidMuiuSettings); |
|
160 resourceLoader.Close(); |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CMsgIndicatorPluginImplementation::NewL |
|
165 // Two-phased constructor. |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 CMsgIndicatorPluginImplementation* CMsgIndicatorPluginImplementation::NewL() |
|
169 { |
|
170 CMsgIndicatorPluginImplementation* self = |
|
171 new( ELeave ) CMsgIndicatorPluginImplementation; |
|
172 CleanupStack::PushL( self ); |
|
173 self->ConstructL(); |
|
174 CleanupStack::Pop( self ); |
|
175 return self; |
|
176 } |
|
177 |
|
178 |
|
179 // Destructor |
|
180 CMsgIndicatorPluginImplementation::~CMsgIndicatorPluginImplementation() |
|
181 { |
|
182 delete iMessagesStrings; |
|
183 delete iStorage; |
|
184 iVmbx.Close(); |
|
185 // iObserver->Cancel(); |
|
186 delete iObserver; |
|
187 if(iRepository) |
|
188 { |
|
189 delete iRepository; |
|
190 iRepository = NULL; |
|
191 } |
|
192 MSGPLUGINLOGGER_DELETE |
|
193 } |
|
194 |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // CMsgIndicatorPluginImplementation::HandleIndicatorTapL |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 void CMsgIndicatorPluginImplementation::HandleIndicatorTapL( const TInt aUid ) |
|
201 { |
|
202 |
|
203 MSGPLUGINLOGGER_WRITE_FORMAT("HandleIndicatorTapL: Indicator: %d", aUid); |
|
204 |
|
205 |
|
206 const TVwsViewId KMessagingCentreView( KMCEAppUid, KMCEMessageListViewUid ); |
|
207 const TVwsViewId KMessagingCentreMainView( KMCEAppUid, KMCEMainViewUid ); |
|
208 const TVwsViewId KConversationView( KConversationAppUid, KConversationListViewUid ); |
|
209 |
|
210 #ifdef OFFLINE_TESTING // See msgindicatorpluginlog.h |
|
211 TInt testaUid; |
|
212 if ( aUid == EAknIndicatorOutbox ) // Change outbox id to .... |
|
213 { |
|
214 testaUid = KOffLineId; |
|
215 } |
|
216 else |
|
217 { |
|
218 testaUid = aUid; // Other indicators should be same |
|
219 } |
|
220 switch ( testaUid ) |
|
221 #else |
|
222 switch ( aUid ) |
|
223 #endif // OFFLINE_TESTING |
|
224 { |
|
225 // SMS/MMS Envelope |
|
226 case EAknIndicatorEnvelope: |
|
227 { |
|
228 // Launch "Inbox view" |
|
229 TInt conversationview = 0; |
|
230 if ( iRepository ) |
|
231 { |
|
232 iRepository->Get(KMuiuMceDefaultView,conversationview); |
|
233 } |
|
234 if (conversationview == 1 ) |
|
235 { |
|
236 CCoeEnv::Static()->AppUi()->CreateActivateViewEventL( |
|
237 KConversationView, TUid::Uid( KConversationListViewid ), |
|
238 KNullDesC8 ); |
|
239 } |
|
240 else |
|
241 { |
|
242 CCoeEnv::Static()->AppUi()->CreateActivateViewEventL( |
|
243 KMessagingCentreView, TUid::Uid( KMsvGlobalInBoxIndexEntryIdValue ), |
|
244 KNullDesC8 ); |
|
245 } |
|
246 } |
|
247 break; |
|
248 // Email |
|
249 case EAknIndicatorEmailMessage: |
|
250 // Launch "Email Inbox view" or mce mainview |
|
251 CCoeEnv::Static()->AppUi()->CreateActivateViewEventL( |
|
252 KMessagingCentreMainView, KMceShowMail, |
|
253 KNullDesC8 ); |
|
254 break; |
|
255 // Outbox |
|
256 case EAknIndicatorOutbox: |
|
257 { |
|
258 TInt closedEntryId = 0; |
|
259 TInt r = RProperty::Get( KPSUidMuiu, KMceTemplatesDialog, closedEntryId ); |
|
260 if ( r != KErrNone ) |
|
261 { |
|
262 closedEntryId = 0; |
|
263 } |
|
264 |
|
265 if ( closedEntryId ) |
|
266 { |
|
267 TFindProcess findProc(_L("*[100058C5]*")); // by MCE UID3 |
|
268 TFullName result; |
|
269 |
|
270 RProcess processHandle; |
|
271 while ( findProc.Next(result) == KErrNone) |
|
272 { |
|
273 TInt err; |
|
274 TRAP (err,processHandle.Open( findProc, EOwnerThread)); |
|
275 //Kernel opened the process successfully |
|
276 //Call Terminate on that process,to check the Cancel API. |
|
277 //Calling the processHandle.Terminate. |
|
278 if ( err == KErrNone ) |
|
279 { |
|
280 processHandle.Terminate(KErrCancel); |
|
281 processHandle.Close(); |
|
282 } |
|
283 } |
|
284 // After termination of the process KMceTemplatesDialog key should be set to '0' |
|
285 r = RProperty::Set( KPSUidMuiu, KMceTemplatesDialog, 0 ); |
|
286 User::After(KRestartTimer); |
|
287 } |
|
288 // Launch "Outbox view" |
|
289 CCoeEnv::Static()->AppUi()->CreateActivateViewEventL( |
|
290 KMessagingCentreView, TUid::Uid( KMsvGlobalOutBoxIndexEntryIdValue ), |
|
291 KNullDesC8 ); |
|
292 } |
|
293 break; |
|
294 // Other message |
|
295 case EAknIndicatorOtherMessage: |
|
296 // Hide popup. Closes the stylus activated popup in this case |
|
297 break; |
|
298 // Voicemail General |
|
299 case EAknIndicatorVoiceMailWaiting: |
|
300 LaunchNewVoiceMailAppL ( EMsgIndicatorLine1 ); |
|
301 break; |
|
302 // Voicemail Line1 |
|
303 case EAknIndicatorVoiceMailWaitingOnLine1: |
|
304 LaunchNewVoiceMailAppL ( EMsgIndicatorLine1 ); |
|
305 break; |
|
306 // Voicemail Line2 |
|
307 case EAknIndicatorVoiceMailWaitingOnLine2: |
|
308 LaunchNewVoiceMailAppL( EMsgIndicatorLine2 ); |
|
309 break; |
|
310 // Remote mail |
|
311 case EAknIndicatorRemoteMailboxEmailMessage: |
|
312 //None |
|
313 break; |
|
314 // Fax |
|
315 case EAknIndicatorFaxMessage: |
|
316 break; |
|
317 // Default |
|
318 default: |
|
319 break; |
|
320 } |
|
321 } |
|
322 |
|
323 |
|
324 void CMsgIndicatorPluginImplementation::LaunchNewVoiceMailAppL(TInt aType) |
|
325 { |
|
326 TUid uid = {1}; // als line 1 or no als (TVmbxNumberEntry::EAlsLine1Entry) |
|
327 if ( aType == EMsgIndicatorLine2 ) |
|
328 { |
|
329 uid.iUid = 2; // (TVmbxNumberEntry::EAlsLine2Entry) |
|
330 } |
|
331 |
|
332 LaunchViewL( KSpeeddialVmbxDialUidView, uid, KExternalLaunch ); |
|
333 } |
|
334 |
|
335 void CMsgIndicatorPluginImplementation::LaunchViewL(const TVwsViewId& aViewId, TUid aCustomMessageId, |
|
336 const TDesC8& aCustomMessage) |
|
337 { |
|
338 CCoeEnv::Static()->AppUi()->CreateActivateViewEventL(aViewId, aCustomMessageId, aCustomMessage); |
|
339 } |
|
340 |
|
341 |
|
342 // --------------------------------------------------------------------------- |
|
343 // CMsgIndicatorPluginImplementation::HandlePreviewPopUpEventL |
|
344 // Virtual function from MAknPreviewPopUpObserver, not used |
|
345 // --------------------------------------------------------------------------- |
|
346 // |
|
347 void CMsgIndicatorPluginImplementation::HandlePreviewPopUpEventL( |
|
348 CAknPreviewPopUpController* /*aController*/, |
|
349 TPreviewPopUpEvent /*aEvent*/ ) |
|
350 { |
|
351 } |
|
352 |
|
353 |
|
354 // --------------------------------------------------------------------------- |
|
355 // CMsgIndicatorPluginImplementation::ProcessCommandL |
|
356 // Virtual function from MEikCommandObserver, not used |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 |
|
360 void CMsgIndicatorPluginImplementation::ProcessCommandL( TInt /*aCommandId*/ ) |
|
361 { |
|
362 } |
|
363 |
|
364 |
|
365 // --------------------------------------------------------------------------- |
|
366 // CMsgIndicatorPluginImplementation::CreatePopupContentEnvelopeMessageL() |
|
367 // --------------------------------------------------------------------------- |
|
368 // |
|
369 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentEnvelopeMessageL(TBool& aMsgCountZero) |
|
370 { |
|
371 |
|
372 // Get unread message count |
|
373 // Create storage KNcnNewMessageCountInInbox |
|
374 // Construct proper popup message (singular or plural) |
|
375 HBufC* dynStringBuf = NULL; |
|
376 TInt messageCount = 0; |
|
377 |
|
378 if ( iStorage->Get( KNcnNewMessageCountInInbox, messageCount ) == KErrNone ) |
|
379 { |
|
380 if ( messageCount > 1 ) |
|
381 { |
|
382 dynStringBuf = HBufC::NewL( ( *iMessagesStrings )[ENewItemsInInbox].Length() + |
|
383 KMaxMessageNumberLength ); |
|
384 TPtr dynString = dynStringBuf->Des(); |
|
385 StringLoader::Format( dynString, |
|
386 ( *iMessagesStrings )[ENewItemsInInbox], //"%N New messages" |
|
387 -1, //No index code in source string |
|
388 messageCount ); |
|
389 } |
|
390 else if ( messageCount == 1 ) |
|
391 { |
|
392 dynStringBuf = ( *iMessagesStrings )[ENewItemInInbox].AllocL() ; //"1 New message" |
|
393 } |
|
394 else if ( messageCount == 0 ) |
|
395 { |
|
396 dynStringBuf = ( *iMessagesStrings )[ESimMemoryFull].AllocL() ; //"Sim Messages Full" |
|
397 // Msg count is zero and indicator is blinking. |
|
398 aMsgCountZero = ETrue; |
|
399 } |
|
400 } |
|
401 return dynStringBuf; |
|
402 } |
|
403 |
|
404 // --------------------------------------------------------------------------- |
|
405 // CMsgIndicatorPluginImplementation::CreatePopupContentFaxMessageL() |
|
406 // --------------------------------------------------------------------------- |
|
407 // |
|
408 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentFaxMessageL() |
|
409 { |
|
410 // Get EIndicatorMessageTypeFax count |
|
411 // Construct proper popup message (singular or plural) |
|
412 HBufC* dynStringBuf = NULL; |
|
413 TInt messageCount = iObserver->GetMsgCount(EIndicatorMessageTypeFax); |
|
414 |
|
415 if ( messageCount > 1 && messageCount < EVMMaximumNumber) |
|
416 { |
|
417 dynStringBuf = HBufC::NewL( ( *iMessagesStrings )[ENewItemsInInbox].Length() + |
|
418 KMaxMessageNumberLength ); |
|
419 TPtr dynString = dynStringBuf->Des(); |
|
420 StringLoader::Format( dynString, |
|
421 ( *iMessagesStrings )[ENewFaxes], //"%N New Faxes" |
|
422 -1, //No index code in source string |
|
423 messageCount ); |
|
424 } |
|
425 else if ( messageCount == 1 ) |
|
426 { |
|
427 dynStringBuf = ( *iMessagesStrings )[ENewFax].AllocL() ; //"1 New Fax" |
|
428 } |
|
429 else |
|
430 { |
|
431 dynStringBuf = ( *iMessagesStrings )[ENewUknFaxes].AllocL(); //"New Faxes" |
|
432 } |
|
433 return dynStringBuf; |
|
434 } |
|
435 |
|
436 // --------------------------------------------------------------------------- |
|
437 // CMsgIndicatorPluginImplementation::CreatePopupContentOutboxMessageL() |
|
438 // --------------------------------------------------------------------------- |
|
439 // |
|
440 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentOutboxMessageL() |
|
441 { |
|
442 // Get message count |
|
443 // Create storage KNcnMessageCountInOutbox |
|
444 // Construct proper popup message (singular or plural) |
|
445 HBufC* dynStringBuf = NULL; |
|
446 TInt messageCount = 0; |
|
447 |
|
448 if ( iStorage->Get( KNcnMessageCountInOutbox, messageCount ) == KErrNone ) |
|
449 { |
|
450 if ( messageCount > 1 ) |
|
451 { |
|
452 dynStringBuf = HBufC::NewL( ( *iMessagesStrings )[ENewItemsInOutbox].Length() + |
|
453 KMaxMessageNumberLength ); |
|
454 TPtr dynString = dynStringBuf->Des(); |
|
455 StringLoader::Format( dynString, |
|
456 ( *iMessagesStrings )[ENewItemsInOutbox], //"%N msgs in outbox" |
|
457 -1, //No index code in source string |
|
458 messageCount ); |
|
459 |
|
460 } |
|
461 else if ( messageCount == 1 ) |
|
462 { |
|
463 dynStringBuf = ( *iMessagesStrings )[ENewItemInOutbox].AllocL(); //"1 message in outbox" |
|
464 } |
|
465 } |
|
466 return dynStringBuf; |
|
467 } |
|
468 |
|
469 // --------------------------------------------------------------------------- |
|
470 // CMsgIndicatorPluginImplementation::CreatePopupContentEmailMessageL() |
|
471 // --------------------------------------------------------------------------- |
|
472 // |
|
473 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentEmailMessageL() |
|
474 { |
|
475 // Construct proper popup message (singular) |
|
476 HBufC* dynStringBuf = NULL; |
|
477 dynStringBuf = ( *iMessagesStrings )[ENewEmail].AllocL(); //"New e-mail" |
|
478 return dynStringBuf; |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // CMsgIndicatorPluginImplementation::CreatePopupContentOtherMessageL() |
|
483 // --------------------------------------------------------------------------- |
|
484 // |
|
485 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentOtherMessageL() |
|
486 { |
|
487 // Construct proper popup message (singular) |
|
488 HBufC* dynStringBuf = NULL; |
|
489 //"New messages available." |
|
490 dynStringBuf = ( *iMessagesStrings )[ENewOtherMessages].AllocL(); //"New msgs available" |
|
491 return dynStringBuf; |
|
492 } |
|
493 |
|
494 // --------------------------------------------------------------------------- |
|
495 // CMsgIndicatorPluginImplementation::CreatePopupContentVoiceMailGeneralL() |
|
496 // --------------------------------------------------------------------------- |
|
497 // |
|
498 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentVoiceMailGeneralL() |
|
499 { |
|
500 // Get message count EIndicatorMessageTypeVMLine1 |
|
501 // Construct proper popup message (singular or plural) |
|
502 HBufC* dynStringBuf = NULL; |
|
503 TInt messageCount = iObserver->GetMsgCount(EIndicatorMessageTypeVMLine1); |
|
504 |
|
505 if ( messageCount > 1 && messageCount < EVMMaximumNumber ) |
|
506 { |
|
507 dynStringBuf = HBufC::NewL( ( *iMessagesStrings )[ENewVoiceMails].Length() + |
|
508 KMaxMessageNumberLength ); |
|
509 TPtr dynString = dynStringBuf->Des(); |
|
510 StringLoader::Format( dynString, |
|
511 ( *iMessagesStrings )[ENewVoiceMails], //"%N new voice msgs" |
|
512 -1, //No index code in source string |
|
513 messageCount ); |
|
514 } |
|
515 else if ( messageCount == 1 ) |
|
516 { |
|
517 dynStringBuf = ( *iMessagesStrings )[ENewVoiceMail].AllocL(); //"New Voice msg" |
|
518 } |
|
519 else |
|
520 { |
|
521 dynStringBuf = ( *iMessagesStrings )[ENewUnkVoiceMails].AllocL(); //"New voice msgs" |
|
522 } |
|
523 return dynStringBuf; |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------------------------- |
|
527 // CMsgIndicatorPluginImplementation::CreatePopupContentVoiceMailLineOneL() |
|
528 // --------------------------------------------------------------------------- |
|
529 // |
|
530 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentVoiceMailLineOneL() |
|
531 { |
|
532 // Get message count EIndicatorMessageTypeVMLine1 |
|
533 // Construct proper popup message |
|
534 HBufC* dynStringBuf = NULL; |
|
535 TInt messageCount = iObserver->GetMsgCount(EIndicatorMessageTypeVMLine1); |
|
536 |
|
537 if ( messageCount > 1 && messageCount < EVMMaximumNumber ) |
|
538 { |
|
539 dynStringBuf = HBufC::NewL( ( *iMessagesStrings )[ENewVoiceMailsOnLine1].Length() + |
|
540 KMaxMessageNumberLength ); |
|
541 TPtr dynString = dynStringBuf->Des(); |
|
542 StringLoader::Format( dynString, |
|
543 ( *iMessagesStrings )[ENewVoiceMailsOnLine1], //"%N new msgs, line 1" |
|
544 -1, //No index code in source string |
|
545 messageCount ); |
|
546 } |
|
547 else if ( messageCount == 1 ) |
|
548 { |
|
549 dynStringBuf = ( *iMessagesStrings )[ENewVoiceMailOnLine1].AllocL(); //"New msg, line 1" |
|
550 } |
|
551 else |
|
552 { |
|
553 dynStringBuf = ( *iMessagesStrings )[ENewUnkVoiceMailsOnLine1].AllocL(); //"New msgs, line 1" |
|
554 } |
|
555 return dynStringBuf; |
|
556 } |
|
557 |
|
558 // --------------------------------------------------------------------------- |
|
559 // CMsgIndicatorPluginImplementation::CreatePopupContentVoiceMailLineTwoL() |
|
560 // --------------------------------------------------------------------------- |
|
561 // |
|
562 HBufC* CMsgIndicatorPluginImplementation::CreatePopupContentVoiceMailLineTwoL() |
|
563 { |
|
564 // Get message count EIndicatorMessageTypeVMLine2 |
|
565 // Construct proper popup message |
|
566 HBufC* dynStringBuf = NULL; |
|
567 TInt messageCount = iObserver->GetMsgCount(EIndicatorMessageTypeVMLine2); |
|
568 |
|
569 if ( messageCount > 1 && messageCount < EVMMaximumNumber ) |
|
570 { |
|
571 dynStringBuf = HBufC::NewL( ( *iMessagesStrings )[ENewVoiceMailsOnLine2].Length() + |
|
572 KMaxMessageNumberLength ); |
|
573 TPtr dynString = dynStringBuf->Des(); |
|
574 StringLoader::Format( dynString, |
|
575 ( *iMessagesStrings )[ENewVoiceMailsOnLine2], //"%N new msgs, line 2" |
|
576 -1, //No index code in source string |
|
577 messageCount ); |
|
578 } |
|
579 else if ( messageCount == 1 ) |
|
580 { |
|
581 dynStringBuf = ( *iMessagesStrings )[ENewVoiceMailOnLine2].AllocL(); //"New msg, line 2" |
|
582 } |
|
583 else |
|
584 { |
|
585 dynStringBuf = ( *iMessagesStrings )[ENewUnkVoiceMailsOnLine2].AllocL(); //"New msgs, line 2" |
|
586 } |
|
587 return dynStringBuf; |
|
588 } |
|
589 |
|
590 // --------------------------------------------------------------------------- |
|
591 // CMsgIndicatorPluginImplementation::CheckVMBNumberAndCallL( TMsgLine aLine ) |
|
592 // --------------------------------------------------------------------------- |
|
593 // |
|
594 void CMsgIndicatorPluginImplementation::CheckVMBNumberAndCallL( TMsgLine aLine ) |
|
595 { |
|
596 |
|
597 TPhCltTelephoneNumber vmbxNumber; |
|
598 vmbxNumber.Zero(); |
|
599 |
|
600 if ( !iSVmbxOpen ) |
|
601 { |
|
602 if ( iVmbx.Open() == KErrNone ) |
|
603 { |
|
604 iSVmbxOpen = ETrue; |
|
605 } |
|
606 else |
|
607 { |
|
608 User::Leave( KLeaveWithoutAlert ); //No vmbx available, so nothing we can do |
|
609 } |
|
610 } |
|
611 if ( aLine == EMsgIndicatorGeneral ) |
|
612 { |
|
613 if ( ( iVmbx.GetVmbxNumber( vmbxNumber, EAlsActiveLineEntry ) == KErrNotFound ) ) |
|
614 { |
|
615 // Launching the VmBx application - User need to call manually after entring VmBx number |
|
616 LaunchVmBxAppL() ; |
|
617 } |
|
618 else |
|
619 { |
|
620 CallL(vmbxNumber); // If VmBx number is already defined |
|
621 } |
|
622 } |
|
623 else if ( aLine == EMsgIndicatorLine1 ) |
|
624 { |
|
625 if ( ( iVmbx.GetVmbxNumber( vmbxNumber, EAlsLine1Entry ) == KErrNotFound ) ) |
|
626 { |
|
627 // Launching the VmBx application - User need to call manually after entring VmBx number |
|
628 LaunchVmBxAppL() ; |
|
629 } |
|
630 else |
|
631 { |
|
632 CallL(vmbxNumber); // If VmBx number is already defined |
|
633 } |
|
634 } |
|
635 else if ( aLine == EMsgIndicatorLine2 ) |
|
636 { |
|
637 if ( ( iVmbx.GetVmbxNumber( vmbxNumber, EAlsLine2Entry ) == KErrNotFound ) ) |
|
638 { |
|
639 // Launching the VmBx application - User need to call manually after entring VmBx number |
|
640 LaunchVmBxAppL() ; |
|
641 } |
|
642 else |
|
643 { |
|
644 CallL(vmbxNumber); // If VmBx number is already defined |
|
645 } |
|
646 } |
|
647 } |
|
648 |
|
649 // --------------------------------------------------------------------------- |
|
650 // CMsgIndicatorPluginImplementation::LaunchVmBxApp () |
|
651 // Launches voice mailbox application |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 void CMsgIndicatorPluginImplementation::LaunchVmBxAppL() |
|
655 { |
|
656 TInt err = KErrNone ; |
|
657 RApaLsSession appArcSession; |
|
658 User::LeaveIfError( appArcSession.Connect() ); |
|
659 CleanupClosePushL( appArcSession ); |
|
660 |
|
661 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
662 TApaAppInfo info; |
|
663 User::LeaveIfError( appArcSession.GetAppInfo( info, KVmBxUid ) ); |
|
664 #ifdef RD_APPS_TO_EXES |
|
665 cmdLine->SetExecutableNameL( info.iFullName ); |
|
666 #else |
|
667 cmdLine->SetLibraryNameL( info.iFullName ); |
|
668 #endif |
|
669 cmdLine->SetCommandL( EApaCommandOpen ); |
|
670 err = appArcSession.StartApp( *cmdLine ); |
|
671 User::LeaveIfError( err ); |
|
672 CleanupStack::PopAndDestroy( cmdLine ); |
|
673 CleanupStack::PopAndDestroy(); // appArcSession |
|
674 } |
|
675 |
|
676 // --------------------------------------------------------------------------- |
|
677 // CMsgIndicatorPluginImplementation::CallL( TPhCltTelephoneNumber aTelNumber ) |
|
678 // --------------------------------------------------------------------------- |
|
679 // |
|
680 void CMsgIndicatorPluginImplementation::CallL( TPhCltTelephoneNumber aTelNumber ) |
|
681 { |
|
682 TPhCltNameBuffer recipientstring; |
|
683 recipientstring = KNullDesC; // No need to show voicemailbox name |
|
684 // ETrue = No query |
|
685 MsvUiServiceUtilitiesInternal::CallToSenderQueryL( aTelNumber, recipientstring, ETrue ); |
|
686 } |
|
687 |
|
688 // --------------------------------------------------------------------------- |
|
689 // CMsgIndicatorPluginImplementation::TextL( const TInt aUid, TInt& aTextType ) |
|
690 // --------------------------------------------------------------------------- |
|
691 // |
|
692 HBufC* CMsgIndicatorPluginImplementation::TextL( const TInt aUid, |
|
693 TInt& aTextType ) |
|
694 { |
|
695 |
|
696 HBufC* textBuf = NULL; |
|
697 |
|
698 #ifdef OFFLINE_TESTING // See msgindicatorpluginlog.h |
|
699 TInt testaUid; |
|
700 if ( aUid == EAknIndicatorOutbox ) // Change outbox id to .... |
|
701 { |
|
702 testaUid = KOffLineId; |
|
703 } |
|
704 else |
|
705 { |
|
706 testaUid = aUid; // Other indicators should be same |
|
707 } |
|
708 switch ( testaUid ) // OFFLINE TESTING |
|
709 #else |
|
710 switch ( aUid ) |
|
711 #endif //OFFLINE_TESTING |
|
712 { |
|
713 // SMS/MMS Envelope |
|
714 case EAknIndicatorEnvelope: |
|
715 { |
|
716 TBool isMsgCountZero = EFalse; |
|
717 textBuf = CreatePopupContentEnvelopeMessageL( isMsgCountZero ); |
|
718 if ( isMsgCountZero ) // Sim Memory case |
|
719 { |
|
720 // If indicator is visible and msg count is zero |
|
721 // we can't show link. |
|
722 aTextType = EAknIndicatorPluginInformationText; |
|
723 } |
|
724 else |
|
725 { |
|
726 aTextType = EAknIndicatorPluginLinkText; |
|
727 } |
|
728 } |
|
729 break; |
|
730 // Email |
|
731 case EAknIndicatorEmailMessage: |
|
732 textBuf = CreatePopupContentEmailMessageL(); |
|
733 aTextType = EAknIndicatorPluginLinkText; |
|
734 break; |
|
735 // Outbox |
|
736 case EAknIndicatorOutbox: |
|
737 textBuf = CreatePopupContentOutboxMessageL(); |
|
738 aTextType = EAknIndicatorPluginLinkText; |
|
739 break; |
|
740 // Other message |
|
741 case EAknIndicatorOtherMessage: |
|
742 textBuf = CreatePopupContentOtherMessageL(); |
|
743 aTextType = EAknIndicatorPluginInformationText; |
|
744 break; |
|
745 // Voicemail General |
|
746 case EAknIndicatorVoiceMailWaiting: |
|
747 textBuf = CreatePopupContentVoiceMailGeneralL(); |
|
748 aTextType = EAknIndicatorPluginLinkText; |
|
749 break; |
|
750 // Voicemail Line1 |
|
751 case EAknIndicatorVoiceMailWaitingOnLine1: |
|
752 textBuf = CreatePopupContentVoiceMailLineOneL(); |
|
753 aTextType = EAknIndicatorPluginLinkText; |
|
754 break; |
|
755 // Voicemail Line2 |
|
756 case EAknIndicatorVoiceMailWaitingOnLine2: |
|
757 textBuf = CreatePopupContentVoiceMailLineTwoL(); |
|
758 aTextType = EAknIndicatorPluginLinkText; |
|
759 break; |
|
760 // Remotemail |
|
761 case EAknIndicatorRemoteMailboxEmailMessage: |
|
762 aTextType = EAknIndicatorPluginInformationText; |
|
763 break; |
|
764 // Fax |
|
765 case EAknIndicatorFaxMessage: |
|
766 textBuf = CreatePopupContentFaxMessageL(); |
|
767 aTextType = EAknIndicatorPluginInformationText; |
|
768 break; |
|
769 // Default |
|
770 default: |
|
771 break; |
|
772 |
|
773 } |
|
774 return textBuf; |
|
775 } |
|
776 |
|
777 // --------------------------------------------------------------------------- |
|
778 // CMsgIndicatorPluginImplementation::IsALSSupported() |
|
779 // --------------------------------------------------------------------------- |
|
780 // |
|
781 TBool CMsgIndicatorPluginImplementation::IsALSSupported() |
|
782 { |
|
783 return iIsALSSupported; |
|
784 } |
|
785 |
|
786 // --------------------------------------------------------------------------- |
|
787 // CMsgIndicatorPluginImplementation::UpdateALSStatus() |
|
788 // Find out if alternative line subscription is active in the terminal |
|
789 // --------------------------------------------------------------------------- |
|
790 // |
|
791 |
|
792 TBool CMsgIndicatorPluginImplementation::UpdateALSStatus() |
|
793 { |
|
794 //Open the information settings |
|
795 RSSSettings settings; |
|
796 TInt status = settings.Open(); |
|
797 |
|
798 if ( status == KErrNone ) |
|
799 { |
|
800 // Get the ALS information, |
|
801 // ALS is supported, if: |
|
802 // 1. supported by the device (ALS PP enabled) |
|
803 // 2. CSP enabled and SIM supports alternative service line (line2) |
|
804 TInt alsValue = KErrUnknown; |
|
805 status = settings.Get( ESSSettingsAls, alsValue ); |
|
806 |
|
807 //Close the settings, they are no longer needed |
|
808 settings.Close(); |
|
809 |
|
810 // Meaning of the ALS values |
|
811 // ESSSettingsAlsNotSupported - ALS not supported, always primary line. |
|
812 // ESSSettingsAlsPrimary - ALS supported, primary line selected. |
|
813 // ESSSettingsAlsAlternate - ALS supported, alternate line selected. |
|
814 |
|
815 //Value read OK and ALS not supported |
|
816 if( status == KErrNone && alsValue == ESSSettingsAlsNotSupported ) |
|
817 { |
|
818 return EFalse; |
|
819 } |
|
820 //Value read OK and ALS is supported |
|
821 else if( status == KErrNone && |
|
822 ( alsValue == ESSSettingsAlsPrimary || alsValue == ESSSettingsAlsAlternate ) ) |
|
823 { |
|
824 return ETrue; |
|
825 } |
|
826 //Default value. ALS not supported. Returned if ALS status can't be read properly! |
|
827 else |
|
828 { |
|
829 return EFalse; |
|
830 } |
|
831 } |
|
832 else |
|
833 { |
|
834 return EFalse; |
|
835 } |
|
836 } |
|
837 |
|
838 |
|
839 // End of File |