185 |
184 |
186 iSetupUid = PublishDescriptorL( |
185 iSetupUid = PublishDescriptorL( |
187 KPubId, KContTypeSetupText, |
186 KPubId, KContTypeSetupText, |
188 iInstIdList[instance]->Des(), |
187 iInstIdList[instance]->Des(), |
189 *setupEmail, |
188 *setupEmail, |
190 KKeySetupText, KTriggerWizard8, NULL, mailBoxId, folderId); |
189 KKeySetupText, KTriggerWizard8); |
191 |
190 |
192 PublishImageL( |
191 PublishImageL( |
193 iInstIdList[instance]->Des(), |
192 iInstIdList[instance]->Des(), |
194 KContTypeSetupIcon, |
193 KContTypeSetupIcon, |
195 KKeySetupIcon, |
194 KKeySetupIcon, |
196 EMbmCmailhandlerpluginQgn_prop_cmail_new_mailbox, |
195 EMbmCmailhandlerpluginQgn_prop_cmail_new_mailbox, |
197 EMbmCmailhandlerpluginQgn_prop_cmail_new_mailbox_mask, |
196 EMbmCmailhandlerpluginQgn_prop_cmail_new_mailbox_mask, |
198 mailBoxId); |
197 mailBoxId, |
|
198 KNullDes); |
|
199 |
|
200 PublishImageL( |
|
201 iInstIdList[instance]->Des(), |
|
202 KContTypeSetupBrandIcon1, |
|
203 KKeySetupBrandIcon1, |
|
204 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
205 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
206 mailBoxId, |
|
207 KSetupBrand1); |
|
208 |
|
209 PublishImageL( |
|
210 iInstIdList[instance]->Des(), |
|
211 KContTypeSetupBrandIcon2, |
|
212 KKeySetupBrandIcon2, |
|
213 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
214 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
215 mailBoxId, |
|
216 KSetupBrand2); |
|
217 |
|
218 PublishImageL( |
|
219 iInstIdList[instance]->Des(), |
|
220 KContTypeSetupBrandIcon3, |
|
221 KKeySetupBrandIcon3, |
|
222 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
223 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
224 mailBoxId, |
|
225 KSetupBrand3); |
|
226 |
|
227 PublishImageL( |
|
228 iInstIdList[instance]->Des(), |
|
229 KContTypeSetupBrandIcon4, |
|
230 KKeySetupBrandIcon4, |
|
231 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
232 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
233 mailBoxId, |
|
234 KSetupBrand4); |
199 |
235 |
200 CleanupStack::PopAndDestroy(setupEmail); |
236 CleanupStack::PopAndDestroy(setupEmail); |
201 } |
237 } |
202 |
238 |
203 // --------------------------------------------------------------------------- |
239 // --------------------------------------------------------------------------- |
205 // --------------------------------------------------------------------------- |
241 // --------------------------------------------------------------------------- |
206 // |
242 // |
207 void CMailCpsIf::PublishActiveMailboxNameL( |
243 void CMailCpsIf::PublishActiveMailboxNameL( |
208 const TInt aInstance, |
244 const TInt aInstance, |
209 const TInt aRowNumber, |
245 const TInt aRowNumber, |
210 const TDesC& aMailboxName, |
246 const TDesC& aMailboxName) |
211 const TInt aMailBoxCount, |
|
212 TFSMailMsgId aMailBoxId, |
|
213 TFSMailMsgId aFolderId) |
|
214 { |
247 { |
215 FUNC_LOG; |
248 FUNC_LOG; |
216 |
249 |
217 TBuf<KMaxDescLen> row; |
250 TBuf<KMaxDescLen> row; |
218 row.Num(aRowNumber); |
251 row.Num(aRowNumber); |
227 |
260 |
228 iMailboxNameUid = PublishDescriptorL( |
261 iMailboxNameUid = PublishDescriptorL( |
229 KPubId, contentType, |
262 KPubId, contentType, |
230 iInstIdList[aInstance]->Des(), |
263 iInstIdList[aInstance]->Des(), |
231 aMailboxName, |
264 aMailboxName, |
232 textKey, KTriggerEmailUi8, aMailBoxCount, |
265 textKey, KTriggerEmailUi8); |
233 aMailBoxId, aFolderId); |
|
234 } |
266 } |
235 |
267 |
236 // --------------------------------------------------------------------------- |
268 // --------------------------------------------------------------------------- |
237 // CMailCpsIf::PublishActiveMailboxNameL |
269 // CMailCpsIf::PublishActiveMailboxNameL |
238 // --------------------------------------------------------------------------- |
270 // --------------------------------------------------------------------------- |
253 textKey.Append(_L("1")); |
285 textKey.Append(_L("1")); |
254 |
286 |
255 TFSMailMsgId dummy; |
287 TFSMailMsgId dummy; |
256 |
288 |
257 PublishDescriptorL( KPubId, contentType, iInstIdList[aInstance]->Des(), |
289 PublishDescriptorL( KPubId, contentType, iInstIdList[aInstance]->Des(), |
258 aMailboxName, textKey, aAction, 0, dummy, dummy ); |
290 aMailboxName, textKey, aAction); |
259 } |
291 } |
260 |
292 |
261 // --------------------------------------------------------------------------- |
293 // --------------------------------------------------------------------------- |
262 // CMailCpsIf::PublishIndicatorIconL |
294 // CMailCpsIf::PublishIndicatorIconL |
263 // --------------------------------------------------------------------------- |
295 // --------------------------------------------------------------------------- |
408 TBuf<KMaxDescLen> contentType; |
442 TBuf<KMaxDescLen> contentType; |
409 if (aDetail == ETime) |
443 if (aDetail == ETime) |
410 { |
444 { |
411 contentType.Copy(KContTypeTime); |
445 contentType.Copy(KContTypeTime); |
412 } |
446 } |
413 else |
447 else if (aDetail == ESubject) |
|
448 { |
|
449 contentType.Copy(KContTypeSubjectText); |
|
450 } |
|
451 else //aDetail == ESender |
414 { |
452 { |
415 contentType.Copy(KContTypeBodyText); |
453 contentType.Copy(KContTypeBodyText); |
416 } |
454 } |
417 contentType.Append(row); |
455 contentType.Append(row); |
418 |
456 |
419 TBuf<KMaxDescLen> textKey; |
457 TBuf<KMaxDescLen> textKey; |
420 if (aDetail == ETime) |
458 if (aDetail == ETime) |
421 { |
459 { |
422 textKey.Copy(KKeyTime); |
460 textKey.Copy(KKeyTime); |
423 } |
461 } |
|
462 else if (aDetail == ESubject) |
|
463 { |
|
464 textKey.Copy(KKeySubjectText); |
|
465 } |
424 else |
466 else |
425 { |
467 { |
426 textKey.Copy(KKeyBodyText); |
468 textKey.Copy(KKeyBodyText); |
427 } |
469 } |
428 textKey.Append(row); |
470 textKey.Append(row); |
432 |
474 |
433 iMailboxNameUid = PublishDescriptorL( |
475 iMailboxNameUid = PublishDescriptorL( |
434 KPubId, contentType, |
476 KPubId, contentType, |
435 iInstIdList[aInstance]->Des(), |
477 iInstIdList[aInstance]->Des(), |
436 aText, |
478 aText, |
437 textKey, KNullDes8, NULL, |
479 textKey, KNullDes8); |
438 mailBoxId, folderId); |
|
439 } |
480 } |
440 |
481 |
441 // --------------------------------------------------------------------------- |
482 // --------------------------------------------------------------------------- |
442 // CMailCpsIf::ResetMessageL |
483 // CMailCpsIf::ResetMessageL |
443 // --------------------------------------------------------------------------- |
484 // --------------------------------------------------------------------------- |
476 const TDesC& aPublisherId, |
517 const TDesC& aPublisherId, |
477 const TDesC& aContentType, |
518 const TDesC& aContentType, |
478 const TDesC& aContentId, |
519 const TDesC& aContentId, |
479 const TDesC& aTextToAdd, |
520 const TDesC& aTextToAdd, |
480 const TDesC& aKey, |
521 const TDesC& aKey, |
481 const TDesC8& aTrigger, |
522 const TDesC8& aTrigger) |
482 const TInt /*aMailBoxCount*/, |
|
483 TFSMailMsgId /*aMailBoxId*/, |
|
484 TFSMailMsgId /*aFolderId*/ ) |
|
485 { |
523 { |
486 FUNC_LOG; |
524 FUNC_LOG; |
487 |
525 |
488 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
526 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
489 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
527 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
556 // This is mailbox icon. Try finding branded mailbox icon. |
595 // This is mailbox icon. Try finding branded mailbox icon. |
557 TInt error(KErrNone); |
596 TInt error(KErrNone); |
558 TBuf<KMaxDescLen> brandedIconIds(KNullDesC); |
597 TBuf<KMaxDescLen> brandedIconIds(KNullDesC); |
559 |
598 |
560 MFSMailBrandManager& brandManager = iMailCpsHandler->MailClient().GetBrandManagerL(); |
599 MFSMailBrandManager& brandManager = iMailCpsHandler->MailClient().GetBrandManagerL(); |
561 TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aMailBoxId, brandedIconIds ) ); |
600 TInt err2(KErrNone); |
562 |
601 if (aBrandId.Length() > 0) |
563 if ( err == KErrNone && error == KErrNone ) |
602 { |
|
603 TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aBrandId, brandedIconIds ) ); |
|
604 err2 = err; |
|
605 } |
|
606 else |
|
607 { |
|
608 TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aMailBoxId, brandedIconIds ) ); |
|
609 err2 = err; |
|
610 } |
|
611 |
|
612 if ( err2 == KErrNone && error == KErrNone ) |
564 { |
613 { |
565 iconIds.Copy(KMifPrefix); |
614 iconIds.Copy(KMifPrefix); |
566 iconIds.Append(brandedIconIds); |
615 iconIds.Append(brandedIconIds); |
567 } |
616 } |
568 } |
617 } |
675 publishermap->InsertL( KContentId, TLiwVariant( KCPAll )); |
724 publishermap->InsertL( KContentId, TLiwVariant( KCPAll )); |
676 publishermap->InsertL( KContentType, TLiwVariant( KCPAll )); |
725 publishermap->InsertL( KContentType, TLiwVariant( KCPAll )); |
677 |
726 |
678 // Create the action map for publisher registry |
727 // Create the action map for publisher registry |
679 CLiwDefaultMap* mapAction = CLiwDefaultMap::NewLC(); |
728 CLiwDefaultMap* mapAction = CLiwDefaultMap::NewLC(); |
680 mapAction->InsertL(KActive, TLiwVariant( KData )); |
729 mapAction->InsertL(KPluginStartup, TLiwVariant( KData )); |
681 mapAction->InsertL(KDeActive, TLiwVariant( KData )); |
730 mapAction->InsertL(KPluginShutdown, TLiwVariant( KData )); |
682 mapAction->InsertL(KSuspend, TLiwVariant( KData )); |
731 mapAction->InsertL(KSuspend, TLiwVariant( KData )); |
683 mapAction->InsertL(KResume, TLiwVariant( KData )); |
732 mapAction->InsertL(KResume, TLiwVariant( KData )); |
684 mapAction->InsertL(KInactive, TLiwVariant( KData )); |
|
685 |
733 |
686 publishermap->InsertL( KActionMap, TLiwVariant(mapAction)); |
734 publishermap->InsertL( KActionMap, TLiwVariant(mapAction)); |
687 CleanupStack::PopAndDestroy(mapAction); |
735 CleanupStack::PopAndDestroy(mapAction); |
688 |
736 |
689 TLiwGenericParam item( KItem, TLiwVariant( publishermap )); |
737 TLiwGenericParam item( KItem, TLiwVariant( publishermap )); |
815 variant.Reset(); |
863 variant.Reset(); |
816 if( map->FindL( KActionTrigger, variant) ) |
864 if( map->FindL( KActionTrigger, variant) ) |
817 { |
865 { |
818 variant.Get(trigger ); |
866 variant.Get(trigger ); |
819 } |
867 } |
820 if (trigger.Compare(KInactive16) == 0) |
868 if (trigger.Compare(KSuspend16) == 0) |
821 { |
|
822 // Homescreen page is about to change. |
|
823 // Ignore next deactivate event of this particular widget instance. |
|
824 HBufC* cid = contentid.AllocLC(); |
|
825 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
|
826 iInactive[widgetInstance] = ETrue; |
|
827 CleanupStack::PopAndDestroy( cid ); |
|
828 } |
|
829 else if (trigger.Compare(KSuspend16) == 0) |
|
830 { |
869 { |
831 // Publishing to homescreen suspended. |
870 // Publishing to homescreen suspended. |
832 HBufC* cid = contentid.AllocLC(); |
871 HBufC* cid = contentid.AllocLC(); |
833 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
872 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
834 iAllowedToPublish[widgetInstance] = EFalse; |
873 iAllowedToPublish[widgetInstance] = EFalse; |
842 iInstIdList.AppendL( contentid.AllocL() ); |
881 iInstIdList.AppendL( contentid.AllocL() ); |
843 } |
882 } |
844 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
883 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
845 PublishSetupWizardL(widgetInstance); |
884 PublishSetupWizardL(widgetInstance); |
846 iMailCpsHandler->UpdateMailboxesL(widgetInstance, cid->Des()); |
885 iMailCpsHandler->UpdateMailboxesL(widgetInstance, cid->Des()); |
847 iMailCpsHandler->UpdateExtAccountL( cid->Des() ); |
|
848 // Widget visible on the homescreen. Publishing allowed. |
886 // Widget visible on the homescreen. Publishing allowed. |
849 iAllowedToPublish[widgetInstance] = ETrue; |
887 iAllowedToPublish[widgetInstance] = ETrue; |
850 iInactive[widgetInstance] = EFalse; |
|
851 CleanupStack::PopAndDestroy( cid ); |
888 CleanupStack::PopAndDestroy( cid ); |
852 } |
889 } |
853 else if (trigger.Compare(KActive16) == 0) |
890 else if (trigger.Compare(KPluginStartup16) == 0) |
854 { |
891 { |
855 // Widget added to homescreen (or already on the screen when boot completes). |
892 // Widget added to homescreen |
856 HBufC* cid = contentid.AllocLC(); |
893 HBufC* cid = contentid.AllocLC(); |
857 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
894 iInstIdList.AppendL( contentid.AllocL() ); |
858 if (iInactive[widgetInstance]) |
895 if ( iMailCpsHandler->TotalMailboxCountL() ) |
859 { |
896 { |
860 iInactive[widgetInstance] = EFalse; |
897 iMailCpsHandler->LaunchWidgetSettingsL(cid->Des()); |
861 } |
898 } |
862 else |
899 else |
863 { |
900 { |
864 iInstIdList.AppendL( contentid.AllocL() ); |
901 iMailCpsHandler->LaunchEmailWizardL(cid->Des()); |
865 iMailCpsHandler->ManualAccountSelectionL(cid->Des()); |
|
866 } |
902 } |
867 CleanupStack::PopAndDestroy( cid ); |
903 CleanupStack::PopAndDestroy( cid ); |
868 } |
904 } |
869 else if (trigger.Compare(KDeActive16) == 0) |
905 else if (trigger.Compare(KPluginShutdown16) == 0) |
870 { |
906 { |
871 // Widget removed from homescreen. |
907 // Widget removed from homescreen. |
872 HBufC* cid = contentid.AllocLC(); |
908 HBufC* cid = contentid.AllocLC(); |
873 ResetPublishedDataL( cid->Des() ); |
909 ResetPublishedDataL( cid->Des() ); |
874 TInt widgetInstance = FindWidgetInstanceId(cid->Des()); |
910 iMailCpsHandler->DissociateWidgetFromSettingL( cid->Des() ); |
|
911 TInt widgetInstance = FindWidgetInstanceId( cid->Des() ); |
875 if (widgetInstance != KErrNotFound ) |
912 if (widgetInstance != KErrNotFound ) |
876 { |
913 { |
877 if (!iInactive[widgetInstance]) |
914 iInstIdList.Remove(widgetInstance); |
878 { |
915 } |
879 iMailCpsHandler->DissociateWidgetFromSettingL( cid->Des() ); |
|
880 iInstIdList.Remove(widgetInstance); |
|
881 } |
|
882 iAllowedToPublish[widgetInstance] = EFalse; |
|
883 } |
|
884 CleanupStack::PopAndDestroy( cid ); |
916 CleanupStack::PopAndDestroy( cid ); |
885 } |
917 } |
886 else if (trigger.Compare(KTriggerEmailUi) == 0) |
918 else if (trigger.Compare(KTriggerEmailUi) == 0) |
887 { |
919 { |
888 HBufC* cid = contentid.AllocLC(); |
920 HBufC* cid = contentid.AllocLC(); |
891 } |
923 } |
892 else if ((trigger.Compare(KTriggerWizard) == 0) || |
924 else if ((trigger.Compare(KTriggerWizard) == 0) || |
893 ( trigger.Compare(KSettings16) == 0)) |
925 ( trigger.Compare(KSettings16) == 0)) |
894 { |
926 { |
895 // If no accounts are created launch email wizard |
927 // If no accounts are created launch email wizard |
896 // otherwice launch widget settings app |
928 // otherwice launch widget settings app |
|
929 HBufC* cid = contentid.AllocLC(); |
897 if ( iMailCpsHandler->TotalMailboxCountL() ) |
930 if ( iMailCpsHandler->TotalMailboxCountL() ) |
898 { |
931 { |
899 HBufC* cid = contentid.AllocLC(); |
|
900 iMailCpsHandler->LaunchWidgetSettingsL(cid->Des()); |
932 iMailCpsHandler->LaunchWidgetSettingsL(cid->Des()); |
901 CleanupStack::PopAndDestroy( cid ); |
|
902 } |
933 } |
903 else |
934 else |
904 { |
935 { |
905 iMailCpsHandler->LaunchEmailWizardL(); |
936 iMailCpsHandler->LaunchEmailWizardL(cid->Des()); |
906 } |
937 } |
|
938 CleanupStack::PopAndDestroy( cid ); |
907 } |
939 } |
908 } |
940 } |
909 } |
941 } |
910 } |
942 } |
911 } |
943 } |