author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:11:15 +0300 | |
branch | RCL_3 |
changeset 80 | 726fba06891a |
parent 64 | 3533d4323edc |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2008 - 2010 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: handles interface to LIW and Content Publishing Service |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <cmailhandlerplugin.mbg> |
|
19 |
#include <AknUtils.h> |
|
20 |
#include <gulicon.h> |
|
21 |
#include <bautils.h> |
|
22 |
#include <StringLoader.h> |
|
23 |
#include <emailwidget.rsg> |
|
24 |
||
25 |
#include "emailtrace.h" |
|
26 |
#include "cfsmailclient.h" |
|
27 |
#include "cmailcpsif.h" |
|
28 |
#include "cmailcpsifconsts.h" |
|
29 |
#include "FreestyleEmailUiConstants.h" |
|
30 |
#include "cmailwidgetcenrepkeysinternal.h" |
|
31 |
||
32 |
// ======== MEMBER FUNCTIONS ======== |
|
33 |
||
34 |
// --------------------------------------------------------------------------- |
|
35 |
// CMailCpsIf::NewL |
|
36 |
// --------------------------------------------------------------------------- |
|
37 |
// |
|
38 |
CMailCpsIf* CMailCpsIf::NewL( CMailCpsHandler* aMailCpsHandler ) |
|
39 |
{ |
|
40 |
FUNC_LOG; |
|
41 |
CMailCpsIf* self = new(ELeave) CMailCpsIf( aMailCpsHandler ); |
|
42 |
CleanupStack::PushL( self ); |
|
43 |
self->ConstructL(); |
|
44 |
CleanupStack::Pop( self ); |
|
45 |
return self; |
|
46 |
} |
|
47 |
||
48 |
// --------------------------------------------------------------------------- |
|
49 |
// CMailCpsIf::CMailCpsIf |
|
50 |
// --------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
CMailCpsIf::CMailCpsIf( CMailCpsHandler* aMailCpsHandler ) : |
|
53 |
iMailCpsHandler( aMailCpsHandler ), |
|
54 |
iMsgInterface ( NULL ), |
|
55 |
iIgnoreHsNotifications( EFalse ) |
|
56 |
{ |
|
57 |
FUNC_LOG; |
|
58 |
} |
|
59 |
||
60 |
// --------------------------------------------------------------------------- |
|
61 |
// CMailCpsIf::ConstructL |
|
62 |
// --------------------------------------------------------------------------- |
|
63 |
// |
|
64 |
void CMailCpsIf::ConstructL() |
|
65 |
{ |
|
66 |
FUNC_LOG; |
|
67 |
for (TInt i=0; i<KMaxMailboxCount; i++) |
|
68 |
{ |
|
69 |
iAllowedToPublish[i] = EFalse; |
|
70 |
} |
|
71 |
||
72 |
AllocateResourcesL(); |
|
73 |
iMsgInterface = GetMessagingInterfaceL(); |
|
74 |
RegisterForObserverL(); |
|
75 |
PublisherRegisteryActionL(); |
|
76 |
||
77 |
ResetPublishedDataL( KCPAll ); |
|
78 |
||
79 |
iContentControlClient = CHsCcApiClient::NewL( this ); |
|
80 |
} |
|
81 |
||
82 |
// --------------------------------------------------------------------------- |
|
83 |
// CMailCpsIf::~CMailCpsIf |
|
84 |
// --------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
CMailCpsIf::~CMailCpsIf() |
|
87 |
{ |
|
88 |
FUNC_LOG; |
|
89 |
||
90 |
TRAP_IGNORE(UnRegisterForObserverL()); |
|
91 |
||
92 |
if ( iMsgInterface ) |
|
93 |
{ |
|
94 |
iMsgInterface->Close(); |
|
95 |
iMsgInterface = NULL; |
|
96 |
} |
|
97 |
delete iServiceHandler; |
|
98 |
for ( TInt i = 0; i < iInstIdList.Count(); i++ ) |
|
99 |
{ |
|
100 |
iInstIdList.Remove(i); |
|
101 |
} |
|
102 |
CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
103 |
if ( iContentControlClient ) |
|
104 |
{ |
|
105 |
delete iContentControlClient; |
|
106 |
} |
|
107 |
} |
|
108 |
||
109 |
// --------------------------------------------------------- |
|
110 |
// CMailCpsIf::AllocateResourcesL |
|
111 |
// --------------------------------------------------------- |
|
112 |
// |
|
113 |
void CMailCpsIf::AllocateResourcesL() |
|
114 |
{ |
|
115 |
FUNC_LOG; |
|
116 |
// create resourcefile |
|
117 |
CCoeEnv* env = CCoeEnv::Static(); |
|
118 |
||
119 |
// Load resource file from the same drive where this dll is loaded from |
|
120 |
TFileName dllFileName; |
|
121 |
Dll::FileName( dllFileName ); |
|
122 |
TParse parse; |
|
123 |
User::LeaveIfError( parse.Set( KResourceFile, &dllFileName, NULL ) ); |
|
124 |
TFileName resourceFile( parse.FullName() ); |
|
125 |
||
126 |
BaflUtils::NearestLanguageFile( env->FsSession(), resourceFile ); |
|
127 |
iResourceFileOffset = env->AddResourceFileL( resourceFile ); |
|
128 |
} |
|
129 |
||
130 |
||
131 |
// --------------------------------------------------------------------------- |
|
132 |
// CMailCpsIf::GetMessagingInterfaceL |
|
133 |
// --------------------------------------------------------------------------- |
|
134 |
// |
|
135 |
MLiwInterface* CMailCpsIf::GetMessagingInterfaceL() |
|
136 |
{ |
|
137 |
FUNC_LOG; |
|
138 |
if ( !iServiceHandler ) |
|
139 |
{ |
|
140 |
iServiceHandler = CLiwServiceHandler::NewL(); |
|
141 |
} |
|
142 |
||
143 |
CLiwGenericParamList* inParam = CLiwGenericParamList::NewL(); |
|
144 |
CleanupStack::PushL( inParam ); |
|
145 |
CLiwGenericParamList* outParam = CLiwGenericParamList::NewL(); |
|
146 |
CleanupStack::PushL( outParam ); |
|
147 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL( KLiwCmdAsStr, KCPInterface, |
|
148 |
KCPService ); |
|
149 |
crit->SetServiceClass( TUid::Uid(KLiwClassBase) ); |
|
150 |
||
151 |
RCriteriaArray criteriaArray; |
|
152 |
criteriaArray.AppendL( crit ); |
|
153 |
||
154 |
iServiceHandler->AttachL( criteriaArray ); |
|
155 |
iServiceHandler->ExecuteServiceCmdL( *crit, *inParam, *outParam ); |
|
156 |
||
157 |
delete crit; |
|
158 |
crit = NULL; |
|
159 |
criteriaArray.Reset(); |
|
160 |
||
161 |
// find service interface |
|
162 |
TInt pos = 0; |
|
163 |
MLiwInterface* msgInterface = NULL; |
|
164 |
outParam->FindFirst( pos, KCPInterface ); |
|
165 |
if ( pos != KErrNotFound ) |
|
166 |
{ |
|
167 |
msgInterface = (*outParam)[pos].Value().AsInterface(); // indexing should be safe |
|
168 |
} |
|
169 |
outParam->Reset(); |
|
170 |
inParam->Reset(); |
|
171 |
||
172 |
if( !msgInterface ) |
|
173 |
{ |
|
174 |
User::Leave( KErrNotFound ); |
|
175 |
} |
|
176 |
||
177 |
CleanupStack::PopAndDestroy( outParam ); |
|
178 |
CleanupStack::PopAndDestroy( inParam ); |
|
179 |
return msgInterface; |
|
180 |
} |
|
181 |
||
182 |
// --------------------------------------------------------------------------- |
|
183 |
// CMailCpsIf::PublishSetupWizardL |
|
184 |
// --------------------------------------------------------------------------- |
|
185 |
// |
|
186 |
void CMailCpsIf::PublishSetupWizardL(TInt aInstance) |
|
187 |
{ |
|
188 |
FUNC_LOG; |
|
189 |
if (!iInstIdList[aInstance].iWizardPublished) |
|
190 |
{ |
|
191 |
TFSMailMsgId mailBoxId; |
|
192 |
TFSMailMsgId folderId; |
|
193 |
||
194 |
HBufC* setupEmail = StringLoader::LoadLC(R_EMAILWIDGET_TEXT_SETUP_EMAIL); |
|
195 |
||
196 |
iSetupUid = PublishDescriptorL( |
|
197 |
KPubId, KContTypeSetupText, |
|
198 |
iInstIdList[aInstance].iCid, |
|
199 |
*setupEmail, |
|
200 |
KKeySetupText, KTriggerWizard8); |
|
201 |
||
202 |
PublishImageL( |
|
203 |
iInstIdList[aInstance].iCid, |
|
204 |
KContTypeSetupIcon, |
|
205 |
KKeySetupIcon, |
|
206 |
EMbmCmailhandlerpluginQgn_prop_cmail_new_mailbox, |
|
207 |
EMbmCmailhandlerpluginQgn_prop_cmail_new_mailbox_mask, |
|
208 |
mailBoxId, |
|
209 |
KNullDes); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
210 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
211 |
TInt widgetSetupVariant = iMailCpsHandler->GetWidgetSetupBrandIconVariant(); |
64 | 212 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
213 |
if ( widgetSetupVariant == KWidgetSetupBrandDefault ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
214 |
{ |
64 | 215 |
PublishImageL( |
216 |
iInstIdList[aInstance].iCid, |
|
217 |
KContTypeSetupBrandIcon2, |
|
218 |
KKeySetupBrandIcon2, |
|
219 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
220 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
221 |
mailBoxId, |
|
222 |
KSetupBrand2); |
|
223 |
||
224 |
PublishImageL( |
|
225 |
iInstIdList[aInstance].iCid, |
|
226 |
KContTypeSetupBrandIcon3, |
|
227 |
KKeySetupBrandIcon3, |
|
228 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
229 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
230 |
mailBoxId, |
|
231 |
KSetupBrand3); |
|
232 |
||
233 |
PublishImageL( |
|
234 |
iInstIdList[aInstance].iCid, |
|
235 |
KContTypeSetupBrandIcon4, |
|
236 |
KKeySetupBrandIcon4, |
|
237 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
|
238 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
|
239 |
mailBoxId, |
|
240 |
KSetupBrand4); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
241 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
242 |
PublishImageL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
243 |
iInstIdList[aInstance].iCid, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
244 |
KContTypeSetupBrandIcon5, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
245 |
KKeySetupBrandIcon5, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
246 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
247 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
248 |
mailBoxId, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
249 |
KSetupBrand5); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
250 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
251 |
else if ( widgetSetupVariant == KWidgetSetupBrandChina ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
252 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
253 |
PublishImageL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
254 |
iInstIdList[aInstance].iCid, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
255 |
KContTypeSetupBrandIcon1, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
256 |
KKeySetupBrandIcon1, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
257 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
258 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
259 |
mailBoxId, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
260 |
KSetupBrandChn1); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
261 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
262 |
PublishImageL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
263 |
iInstIdList[aInstance].iCid, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
264 |
KContTypeSetupBrandIcon2, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
265 |
KKeySetupBrandIcon2, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
266 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
267 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
268 |
mailBoxId, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
269 |
KSetupBrandChn2); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
270 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
271 |
PublishImageL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
272 |
iInstIdList[aInstance].iCid, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
273 |
KContTypeSetupBrandIcon3, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
274 |
KKeySetupBrandIcon3, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
275 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
276 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
277 |
mailBoxId, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
278 |
KSetupBrandChn3); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
279 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
280 |
PublishImageL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
281 |
iInstIdList[aInstance].iCid, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
282 |
KContTypeSetupBrandIcon4, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
283 |
KKeySetupBrandIcon4, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
284 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
285 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
286 |
mailBoxId, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
287 |
KSetupBrandChn4); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
288 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
289 |
PublishImageL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
290 |
iInstIdList[aInstance].iCid, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
291 |
KContTypeSetupBrandIcon5, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
292 |
KKeySetupBrandIcon5, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
293 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
294 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
295 |
mailBoxId, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
296 |
KSetupBrandChn5); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
297 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
298 |
|
64 | 299 |
iInstIdList[aInstance].iWizardPublished = ETrue; |
300 |
CleanupStack::PopAndDestroy(setupEmail); |
|
301 |
} |
|
302 |
} |
|
303 |
||
304 |
// --------------------------------------------------------------------------- |
|
305 |
// CMailCpsIf::PublishActiveMailboxNameL |
|
306 |
// --------------------------------------------------------------------------- |
|
307 |
// |
|
308 |
void CMailCpsIf::PublishActiveMailboxNameL( |
|
309 |
const TInt aInstance, |
|
310 |
const TInt aRowNumber, |
|
311 |
const TDesC& aMailboxName) |
|
312 |
{ |
|
313 |
FUNC_LOG; |
|
314 |
||
315 |
TBuf<KMaxDescLen> row; |
|
316 |
row.Num(aRowNumber); |
|
317 |
||
318 |
TBuf<KMaxDescLen> contentType; |
|
319 |
contentType.Copy(KContTypeBodyText); |
|
320 |
contentType.Append(row); |
|
321 |
||
322 |
TBuf<KMaxDescLen> textKey; |
|
323 |
textKey.Copy(KKeyBodyText); |
|
324 |
textKey.Append(row); |
|
325 |
||
326 |
iMailboxNameUid = PublishDescriptorL( |
|
327 |
KPubId, contentType, |
|
328 |
iInstIdList[aInstance].iCid, |
|
329 |
aMailboxName, |
|
330 |
textKey, KTriggerEmailUi8); |
|
331 |
} |
|
332 |
||
333 |
// --------------------------------------------------------------------------- |
|
334 |
// CMailCpsIf::PublishActiveMailboxNameL |
|
335 |
// --------------------------------------------------------------------------- |
|
336 |
// |
|
337 |
void CMailCpsIf::PublishMailboxNameL( |
|
338 |
const TInt aInstance, |
|
339 |
const TDesC& aMailboxName, |
|
340 |
const TDesC8& aAction ) |
|
341 |
{ |
|
342 |
FUNC_LOG; |
|
343 |
||
344 |
TBuf<KMaxDescLen> contentType; |
|
345 |
contentType.Copy(KContTypeBodyText); |
|
346 |
contentType.Append(_L("1")); |
|
347 |
||
348 |
TBuf<KMaxDescLen> textKey; |
|
349 |
textKey.Copy(KKeyBodyText); |
|
350 |
textKey.Append(_L("1")); |
|
351 |
||
352 |
TFSMailMsgId dummy; |
|
353 |
||
354 |
PublishDescriptorL( KPubId, contentType, iInstIdList[aInstance].iCid, |
|
355 |
aMailboxName, textKey, aAction); |
|
356 |
} |
|
357 |
||
358 |
// --------------------------------------------------------------------------- |
|
359 |
// CMailCpsIf::PublishIndicatorIconL |
|
360 |
// --------------------------------------------------------------------------- |
|
361 |
// |
|
362 |
void CMailCpsIf::PublishIndicatorIconL( const TInt aInstance, |
|
363 |
const TInt aRowNumber, |
|
364 |
const TInt aIcon ) |
|
365 |
{ |
|
366 |
FUNC_LOG; |
|
367 |
TFSMailMsgId mailBoxId; |
|
368 |
||
369 |
TBuf<KMaxDescLen> row; |
|
370 |
row.Num(aRowNumber); |
|
371 |
||
372 |
TBuf<KMaxDescLen> contentType; |
|
373 |
contentType.Copy(KContTypeIndicatorIcon); |
|
374 |
contentType.Append(row); |
|
375 |
||
376 |
TBuf8<KMaxDescLen> row8; |
|
377 |
row8.Num(aRowNumber); |
|
378 |
||
379 |
TBuf8<KMaxDescLen> key; |
|
380 |
key.Copy(KKeyIndicatorIcon); |
|
381 |
key.Append(row8); |
|
382 |
||
383 |
PublishImageL( |
|
384 |
iInstIdList[aInstance].iCid, |
|
385 |
contentType, |
|
386 |
key, |
|
387 |
aIcon, |
|
388 |
aIcon + 1, |
|
389 |
mailBoxId, |
|
390 |
KNullDes); |
|
391 |
} |
|
392 |
||
393 |
// --------------------------------------------------------------------------- |
|
394 |
// CMailCpsIf::PublishMailboxIconL |
|
395 |
// --------------------------------------------------------------------------- |
|
396 |
// |
|
397 |
void CMailCpsIf::PublishMailboxIconL( const TInt aInstance, |
|
398 |
const TInt aRowNumber, |
|
399 |
const TInt aIcon, |
|
400 |
TFSMailMsgId aMailBoxId ) |
|
401 |
{ |
|
402 |
FUNC_LOG; |
|
403 |
||
404 |
TBuf<KMaxDescLen> row; |
|
405 |
row.Num(aRowNumber); |
|
406 |
||
407 |
TBuf<KMaxDescLen> contentType; |
|
408 |
contentType.Copy(KContTypeMailboxIcons); |
|
409 |
contentType.Append(row); |
|
410 |
||
411 |
TBuf8<KMaxDescLen> row8; |
|
412 |
row8.Num(aRowNumber); |
|
413 |
||
414 |
TBuf8<KMaxDescLen> key; |
|
415 |
key.Copy(KKeyMailboxIcons); |
|
416 |
key.Append(row8); |
|
417 |
||
418 |
PublishImageL( |
|
419 |
iInstIdList[aInstance].iCid, |
|
420 |
contentType, |
|
421 |
key, |
|
422 |
aIcon, |
|
423 |
aIcon + 1, |
|
424 |
aMailBoxId, |
|
425 |
KNullDes); |
|
426 |
} |
|
427 |
||
428 |
// --------------------------------------------------------------------------- |
|
429 |
// CMailCpsIf::PublishMailboxIconL |
|
430 |
// --------------------------------------------------------------------------- |
|
431 |
// |
|
432 |
void CMailCpsIf::PublishMailboxIconL( const TInt aInstance, const TDesC& aIconPath ) |
|
433 |
{ |
|
434 |
FUNC_LOG; |
|
435 |
||
436 |
TBuf<KMaxDescLen> contentType; |
|
437 |
contentType.Copy(KContTypeMailboxIcons); |
|
438 |
contentType.Append(_L("1")); |
|
439 |
||
440 |
TBuf8<KMaxDescLen> key; |
|
441 |
key.Copy(KKeyMailboxIcons); |
|
442 |
key.Append(_L8("1")); |
|
443 |
||
444 |
if ( GetWidgetInstanceCount() <= aInstance ) User::LeaveIfError( KErrNotFound ); |
|
445 |
||
446 |
PublishIconReferenceL( |
|
447 |
iInstIdList[aInstance].iCid, |
|
448 |
contentType, |
|
449 |
key, |
|
450 |
aIconPath ); |
|
451 |
} |
|
452 |
||
453 |
// --------------------------------------------------------------------------- |
|
454 |
// CMailCpsIf::PublishIconReferenceL |
|
455 |
// --------------------------------------------------------------------------- |
|
456 |
// |
|
457 |
void CMailCpsIf::PublishIconReferenceL( |
|
458 |
const TDesC& aContentId, |
|
459 |
const TDesC& aContentType, |
|
460 |
const TDesC8& aKey, |
|
461 |
const TDesC& aIconPath ) |
|
462 |
{ |
|
463 |
FUNC_LOG; |
|
464 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
465 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
466 |
||
467 |
TLiwGenericParam type( KType, TLiwVariant( KCpData ) ); |
|
468 |
inparam->AppendL( type ); |
|
469 |
||
470 |
CLiwDefaultMap* pdatamap = CLiwDefaultMap::NewLC(); |
|
471 |
CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC(); |
|
472 |
||
473 |
pdatamap->InsertL( KPublisherId, TLiwVariant( KPubId ) ); |
|
474 |
pdatamap->InsertL( KContentType, TLiwVariant( aContentType ) ); |
|
475 |
pdatamap->InsertL( KContentId, TLiwVariant( aContentId ) ); |
|
476 |
||
477 |
datamap->InsertL( aKey, TLiwVariant( aIconPath ) ); |
|
478 |
||
479 |
pdatamap->InsertL( KDataMap, TLiwVariant(datamap) ); |
|
480 |
TLiwGenericParam item( KItem, TLiwVariant( pdatamap ) ); |
|
481 |
inparam->AppendL( item ); |
|
482 |
||
483 |
iMsgInterface->ExecuteCmdL( KAdd, *inparam, *outparam ); |
|
484 |
||
485 |
CleanupStack::PopAndDestroy( datamap ); |
|
486 |
CleanupStack::PopAndDestroy( pdatamap ); |
|
487 |
||
488 |
item.Reset(); |
|
489 |
type.Reset(); |
|
490 |
outparam->Reset(); |
|
491 |
inparam->Reset(); |
|
492 |
} |
|
493 |
||
494 |
// --------------------------------------------------------------------------- |
|
495 |
// CMailCpsIf::PublishMailDetailL |
|
496 |
// --------------------------------------------------------------------------- |
|
497 |
// |
|
498 |
void CMailCpsIf::PublishMailDetailL( const TInt aInstance, |
|
499 |
const TInt aRowNumber, |
|
500 |
const TDesC& aText, |
|
501 |
TWidgetMailDetails aDetail) |
|
502 |
{ |
|
503 |
FUNC_LOG; |
|
504 |
||
505 |
TBuf<KMaxDescLen> row; |
|
506 |
row.Num(aRowNumber); |
|
507 |
||
508 |
TBuf<KMaxDescLen> contentType; |
|
509 |
if (aDetail == ETime) |
|
510 |
{ |
|
511 |
contentType.Copy(KContTypeTime); |
|
512 |
} |
|
513 |
else if (aDetail == ESubject) |
|
514 |
{ |
|
515 |
contentType.Copy(KContTypeSubjectText); |
|
516 |
} |
|
517 |
else //aDetail == ESender |
|
518 |
{ |
|
519 |
contentType.Copy(KContTypeBodyText); |
|
520 |
} |
|
521 |
contentType.Append(row); |
|
522 |
||
523 |
TBuf<KMaxDescLen> textKey; |
|
524 |
if (aDetail == ETime) |
|
525 |
{ |
|
526 |
textKey.Copy(KKeyTime); |
|
527 |
} |
|
528 |
else if (aDetail == ESubject) |
|
529 |
{ |
|
530 |
textKey.Copy(KKeySubjectText); |
|
531 |
} |
|
532 |
else |
|
533 |
{ |
|
534 |
textKey.Copy(KKeyBodyText); |
|
535 |
} |
|
536 |
textKey.Append(row); |
|
537 |
||
538 |
TFSMailMsgId mailBoxId; |
|
539 |
TFSMailMsgId folderId; |
|
540 |
||
541 |
iMailboxNameUid = PublishDescriptorL( |
|
542 |
KPubId, contentType, |
|
543 |
iInstIdList[aInstance].iCid, |
|
544 |
aText, |
|
545 |
textKey, KNullDes8); |
|
546 |
} |
|
547 |
||
548 |
// --------------------------------------------------------------------------- |
|
549 |
// CMailCpsIf::ResetMessageL |
|
550 |
// --------------------------------------------------------------------------- |
|
551 |
// |
|
552 |
void CMailCpsIf::ResetMessageL( TInt /*aRowNumber*/ ) |
|
553 |
{ |
|
554 |
FUNC_LOG; |
|
555 |
RemoveL( iMsgUid ); |
|
556 |
iMsgUid = 0; |
|
557 |
} |
|
558 |
||
559 |
// --------------------------------------------------------------------------- |
|
560 |
// CMailCpsIf::ExtractItemId |
|
561 |
// --------------------------------------------------------------------------- |
|
562 |
// |
|
563 |
TUint CMailCpsIf::ExtractItemId( |
|
564 |
const CLiwGenericParamList& aInParamList ) |
|
565 |
{ |
|
566 |
FUNC_LOG; |
|
567 |
TUint result ( 0 ); |
|
568 |
TInt pos( 0 ); |
|
569 |
aInParamList.FindFirst( pos, KItemId ); |
|
570 |
if ( pos != KErrNotFound ) |
|
571 |
{ |
|
572 |
// item id present - extract and return |
|
573 |
aInParamList[pos].Value().Get( result ); // indexing should be safe |
|
574 |
} |
|
575 |
return result; |
|
576 |
} |
|
577 |
||
578 |
// --------------------------------------------------------------------------- |
|
579 |
// CMailCpsIf::PublishDescriptorL |
|
580 |
// --------------------------------------------------------------------------- |
|
581 |
// |
|
582 |
TUint CMailCpsIf::PublishDescriptorL( |
|
583 |
const TDesC& aPublisherId, |
|
584 |
const TDesC& aContentType, |
|
585 |
const TDesC& aContentId, |
|
586 |
const TDesC& aTextToAdd, |
|
587 |
const TDesC& aKey, |
|
588 |
const TDesC8& aTrigger) |
|
589 |
{ |
|
590 |
FUNC_LOG; |
|
591 |
||
592 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
593 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
594 |
TUint id(0); |
|
595 |
TBuf8<KMaxDescLen> key; |
|
596 |
key.Copy(aKey); |
|
597 |
if ( iMsgInterface ) |
|
598 |
{ |
|
599 |
TLiwGenericParam cptype( KType, TLiwVariant( KCpData )); |
|
600 |
inparam->AppendL( cptype ); |
|
601 |
CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC(); |
|
602 |
CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); |
|
603 |
map->InsertL( key, TLiwVariant( aTextToAdd ) ); |
|
604 |
cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId )); |
|
605 |
cpdatamap->InsertL( KContentType, TLiwVariant( aContentType )); |
|
606 |
cpdatamap->InsertL( KContentId, TLiwVariant( aContentId )); |
|
607 |
cpdatamap->InsertL( KDataMap, TLiwVariant( map ) ); |
|
608 |
||
609 |
if( aTrigger.Length() > 0 ) |
|
610 |
{ |
|
611 |
CLiwDefaultMap* mapAction = CLiwDefaultMap::NewLC(); |
|
612 |
CLiwDefaultMap* mapInterface = CLiwDefaultMap::NewLC(); |
|
613 |
CLiwDefaultMap* mapPlugin = CLiwDefaultMap::NewLC(); |
|
614 |
mapInterface ->InsertL( KDataForActionHandler, TLiwVariant( mapPlugin ) ); |
|
615 |
mapAction->InsertL( aTrigger, TLiwVariant( mapInterface ) ); |
|
616 |
cpdatamap->InsertL( KActionMap, TLiwVariant(mapAction) ); |
|
617 |
} |
|
618 |
||
619 |
TLiwGenericParam item( KItem, TLiwVariant( cpdatamap )); |
|
620 |
inparam->AppendL( item ); |
|
621 |
||
622 |
// Execute command |
|
623 |
iMsgInterface->ExecuteCmdL( KAdd , *inparam, *outparam ); |
|
624 |
||
625 |
id = ExtractItemId(*outparam ); |
|
626 |
||
627 |
if( aTrigger.Length() > 0 ) |
|
628 |
{ |
|
629 |
CleanupStack::PopAndDestroy( 3 ); // action |
|
630 |
} |
|
631 |
||
632 |
CleanupStack::PopAndDestroy( map ); |
|
633 |
CleanupStack::PopAndDestroy( cpdatamap ); |
|
634 |
item.Reset(); |
|
635 |
cptype.Reset(); |
|
636 |
} |
|
637 |
outparam->Reset(); |
|
638 |
inparam->Reset(); |
|
639 |
return id; |
|
640 |
} |
|
641 |
||
642 |
// --------------------------------------------------------- |
|
643 |
// CMailCpsIf::PublishImageL |
|
644 |
// --------------------------------------------------------- |
|
645 |
// |
|
646 |
void CMailCpsIf::PublishImageL( |
|
647 |
const TDesC& aContentId, |
|
648 |
const TDesC& aContentType, |
|
649 |
const TDesC8& aKey, |
|
650 |
TInt aBitmapId, |
|
651 |
TInt aBitmapMaskId, |
|
652 |
TFSMailMsgId aMailBoxId, |
|
653 |
const TDesC& aBrandId ) |
|
654 |
{ |
|
655 |
FUNC_LOG; |
|
656 |
||
657 |
TBuf<KMaxDescLen> iconIds(KNullDesC); |
|
658 |
||
659 |
if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account ) |
|
660 |
{ |
|
661 |
// This is mailbox icon. Try finding branded mailbox icon. |
|
662 |
TInt error(KErrNone); |
|
663 |
TBuf<KMaxDescLen> brandedIconIds(KNullDesC); |
|
664 |
||
665 |
MFSMailBrandManager& brandManager = iMailCpsHandler->MailClient().GetBrandManagerL(); |
|
666 |
TInt err2(KErrNone); |
|
667 |
if (aBrandId.Length() > 0) |
|
668 |
{ |
|
669 |
TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aBrandId, brandedIconIds ) ); |
|
670 |
err2 = err; |
|
671 |
} |
|
672 |
else |
|
673 |
{ |
|
674 |
TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aMailBoxId, brandedIconIds ) ); |
|
675 |
err2 = err; |
|
676 |
} |
|
677 |
||
678 |
if ( err2 == KErrNone && error == KErrNone ) |
|
679 |
{ |
|
680 |
iconIds.Copy(KMifPrefix); |
|
681 |
iconIds.Append(brandedIconIds); |
|
682 |
} |
|
683 |
} |
|
684 |
||
685 |
// Parse mif file full path by own dll drive letter |
|
686 |
TFileName dllFileName; |
|
687 |
Dll::FileName( dllFileName ); |
|
688 |
TParse mifParse; |
|
689 |
User::LeaveIfError( mifParse.Set( KMifPath, &dllFileName, NULL ) ); |
|
690 |
||
691 |
if (!iconIds.Length()) |
|
692 |
{ |
|
693 |
TBuf<KMaxDescLen> id; |
|
694 |
if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg ) |
|
695 |
{ |
|
696 |
iconIds.Append( KSkinPrefix ); |
|
697 |
id.Num( EAknsMajorGeneric ); |
|
698 |
iconIds.Append( id ); |
|
699 |
iconIds.Append( KSpace ); |
|
700 |
id.Num( EAknsMinorGenericQgnIndiCmailUnseenMsg ); |
|
701 |
iconIds.Append( id ); |
|
702 |
iconIds.Append( KSkinPostfix ); |
|
703 |
} |
|
704 |
else if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_outbox_msg ) |
|
705 |
{ |
|
706 |
iconIds.Append( KSkinPrefix ); |
|
707 |
id.Num( EAknsMajorGeneric ); |
|
708 |
iconIds.Append( id ); |
|
709 |
iconIds.Append( KSpace ); |
|
710 |
id.Num( EAknsMinorGenericQgnIndiCmailOutboxMsg ); |
|
711 |
iconIds.Append( id ); |
|
712 |
iconIds.Append( KSkinPostfix ); |
|
713 |
} |
|
714 |
iconIds.Append( KMifPrefix ); |
|
715 |
iconIds.Append( mifParse.FullName() ); |
|
716 |
iconIds.Append( KSpace ); |
|
717 |
id.Num( aBitmapId ); |
|
718 |
iconIds.Append( id ); |
|
719 |
iconIds.Append( KSpace ); |
|
720 |
id.Num( aBitmapMaskId ); |
|
721 |
iconIds.Append( id ); |
|
722 |
iconIds.Append( _L(")") ); |
|
723 |
} |
|
724 |
||
725 |
// The actual image publishing part starts here |
|
726 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
727 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
728 |
||
729 |
TLiwGenericParam type( KType, TLiwVariant( KCpData ) ); |
|
730 |
inparam->AppendL( type ); |
|
731 |
||
732 |
CLiwDefaultMap* pdatamap = CLiwDefaultMap::NewLC(); |
|
733 |
CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC(); |
|
734 |
||
735 |
pdatamap->InsertL( KPublisherId, TLiwVariant( KPubId ) ); |
|
736 |
pdatamap->InsertL( KContentType, TLiwVariant( aContentType ) ); |
|
737 |
pdatamap->InsertL( KContentId, TLiwVariant( aContentId ) ); |
|
738 |
||
739 |
datamap->InsertL( aKey, TLiwVariant(iconIds) ); |
|
740 |
||
741 |
pdatamap->InsertL( KDataMap, TLiwVariant(datamap) ); |
|
742 |
TLiwGenericParam item( KItem, TLiwVariant( pdatamap ) ); |
|
743 |
inparam->AppendL( item ); |
|
744 |
||
745 |
// Publish icon ( or remove it from widget when no id provided ) |
|
746 |
if ( aBitmapId == KNullIcon ) |
|
747 |
{ |
|
748 |
iMsgInterface->ExecuteCmdL( KDelete, *inparam, *outparam ); |
|
749 |
} |
|
750 |
else |
|
751 |
{ |
|
752 |
iMsgInterface->ExecuteCmdL( KAdd, *inparam, *outparam ); |
|
753 |
} |
|
754 |
||
755 |
CleanupStack::PopAndDestroy( datamap ); |
|
756 |
CleanupStack::PopAndDestroy( pdatamap ); |
|
757 |
||
758 |
item.Reset(); |
|
759 |
type.Reset(); |
|
760 |
outparam->Reset(); |
|
761 |
inparam->Reset(); |
|
762 |
} |
|
763 |
||
764 |
// --------------------------------------------------------------------------- |
|
765 |
// CMailCpsIf::RemoveL |
|
766 |
// --------------------------------------------------------------------------- |
|
767 |
// |
|
768 |
void CMailCpsIf::RemoveL( TUint aId ) |
|
769 |
{ |
|
770 |
FUNC_LOG; |
|
771 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
772 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
773 |
if ( iMsgInterface ) |
|
774 |
{ |
|
775 |
TLiwGenericParam cptype( KType, TLiwVariant( KCpData )); |
|
776 |
inparam->AppendL( cptype ); |
|
777 |
CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC(); |
|
778 |
cpdatamap->InsertL( KId, TLiwVariant( aId )); |
|
779 |
||
780 |
TLiwGenericParam item( KFilter, TLiwVariant( cpdatamap )); |
|
781 |
inparam->AppendL( item ); |
|
782 |
||
783 |
iMsgInterface->ExecuteCmdL( KDelete , *inparam, *outparam); |
|
784 |
||
785 |
CleanupStack::PopAndDestroy( cpdatamap ); |
|
786 |
item.Reset(); |
|
787 |
cptype.Reset(); |
|
788 |
} |
|
789 |
outparam->Reset(); |
|
790 |
inparam->Reset(); |
|
791 |
} |
|
792 |
||
793 |
// --------------------------------------------------------------------------- |
|
794 |
// CMailCpsIf::PublisherRegisteryActionL |
|
795 |
// --------------------------------------------------------------------------- |
|
796 |
// |
|
797 |
void CMailCpsIf::PublisherRegisteryActionL() |
|
798 |
{ |
|
799 |
FUNC_LOG; |
|
800 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
801 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
802 |
||
803 |
TLiwGenericParam type( KType, TLiwVariant( KPubData )); |
|
804 |
inparam->AppendL( type ); |
|
805 |
||
806 |
CLiwDefaultMap* publishermap = CLiwDefaultMap::NewLC(); |
|
807 |
||
808 |
// Create the map for publisher registry |
|
809 |
publishermap->InsertL( KPublisherId, TLiwVariant( KPubId )); |
|
810 |
publishermap->InsertL( KContentId, TLiwVariant( KCPAll )); |
|
811 |
publishermap->InsertL( KContentType, TLiwVariant( KCPAll )); |
|
812 |
||
813 |
// Create the action map for publisher registry |
|
814 |
CLiwDefaultMap* mapAction = CLiwDefaultMap::NewLC(); |
|
815 |
mapAction->InsertL(KPluginStartup, TLiwVariant( KData )); |
|
816 |
mapAction->InsertL(KPluginShutdown, TLiwVariant( KData )); |
|
817 |
mapAction->InsertL(KSuspend, TLiwVariant( KData )); |
|
818 |
mapAction->InsertL(KResume, TLiwVariant( KData )); |
|
819 |
||
820 |
publishermap->InsertL( KActionMap, TLiwVariant(mapAction)); |
|
821 |
CleanupStack::PopAndDestroy(mapAction); |
|
822 |
||
823 |
TLiwGenericParam item( KItem, TLiwVariant( publishermap )); |
|
824 |
inparam->AppendL( item ); |
|
825 |
||
826 |
iMsgInterface->ExecuteCmdL( KAdd, *inparam, *outparam); |
|
827 |
||
828 |
CleanupStack::PopAndDestroy( publishermap ); |
|
829 |
||
830 |
item.Reset(); |
|
831 |
type.Reset(); |
|
832 |
||
833 |
outparam->Reset(); |
|
834 |
inparam->Reset(); |
|
835 |
} |
|
836 |
||
837 |
// --------------------------------------------------------------------------- |
|
838 |
// CMailCpsIf::RegisterForObserverL |
|
839 |
// --------------------------------------------------------------------------- |
|
840 |
// |
|
841 |
void CMailCpsIf::RegisterForObserverL() |
|
842 |
{ |
|
843 |
FUNC_LOG; |
|
844 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
845 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
846 |
||
847 |
CLiwDefaultMap* filter = CLiwDefaultMap::NewLC(); |
|
848 |
||
849 |
filter->InsertL( KPublisherId, TLiwVariant( KPubId ) ); |
|
850 |
filter->InsertL( KContentId, TLiwVariant( KCPAll ) ); |
|
851 |
filter->InsertL( KContentType, TLiwVariant( KCPAll ) ); |
|
852 |
filter->InsertL( KOperation, TLiwVariant( KExecute )); |
|
853 |
||
854 |
// Fill in input list for RequestNotification command |
|
855 |
inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant( KContentAndPublisher_Registry ))); |
|
856 |
inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant( filter ))); |
|
857 |
||
858 |
TInt errori(KErrNone); |
|
859 |
TRAP(errori, iMsgInterface->ExecuteCmdL( KRequestNotification, *inParamList, |
|
860 |
*outParamList, 0, this )); |
|
861 |
||
862 |
CleanupStack::PopAndDestroy( filter ); |
|
863 |
outParamList->Reset(); |
|
864 |
inParamList->Reset(); |
|
865 |
} |
|
866 |
||
867 |
// --------------------------------------------------------------------------- |
|
868 |
// CMailCpsIf::UnRegisterForObserverL |
|
869 |
// --------------------------------------------------------------------------- |
|
870 |
// |
|
871 |
void CMailCpsIf::UnRegisterForObserverL() |
|
872 |
{ |
|
873 |
FUNC_LOG; |
|
874 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
875 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
876 |
// Un Register for notification |
|
877 |
||
878 |
TInt err; |
|
879 |
err = KErrNone; |
|
880 |
||
881 |
// Un Register all the reuqest notification registered in this session |
|
882 |
TRAP( err, iMsgInterface->ExecuteCmdL( |
|
883 |
KRequestNotification, |
|
884 |
*inparam, |
|
885 |
*outparam, |
|
886 |
KLiwOptCancel, |
|
887 |
this ) ); |
|
888 |
||
889 |
outparam->Reset(); |
|
890 |
inparam->Reset(); |
|
891 |
} |
|
892 |
||
893 |
// --------------------------------------------------------------------------- |
|
894 |
// Notification handling |
|
895 |
// --------------------------------------------------------------------------- |
|
896 |
// |
|
897 |
TInt CMailCpsIf::HandleNotifyL( |
|
898 |
TInt /*aCmdId*/, |
|
899 |
TInt /*aEventId*/, |
|
900 |
CLiwGenericParamList& aEventParamList, |
|
901 |
const CLiwGenericParamList& /*aInParamList*/ ) |
|
902 |
{ |
|
903 |
FUNC_LOG; |
|
904 |
PublisherStatusL ( aEventParamList); |
|
905 |
return KErrNone; |
|
906 |
} |
|
907 |
||
908 |
// --------------------------------------------------------------------------- |
|
909 |
// Check if Publisher was activeated or deactivated |
|
910 |
// --------------------------------------------------------------------------- |
|
911 |
// |
|
912 |
TBool CMailCpsIf::PublisherStatusL(const CLiwGenericParamList& aEventParamList) |
|
913 |
{ |
|
914 |
FUNC_LOG; |
|
915 |
TBool result(EFalse); |
|
916 |
TInt pos(0); |
|
917 |
const TInt KSAPIContentNameMaxLength = 255; |
|
918 |
TBuf<300> text; |
|
919 |
aEventParamList.FindFirst(pos, KChangeInfo); |
|
920 |
if (pos != KErrNotFound) |
|
921 |
{ |
|
922 |
// Get list of maps |
|
923 |
TLiwVariant variant = (aEventParamList)[pos].Value(); |
|
924 |
variant.PushL(); |
|
925 |
const CLiwList* changeMapsList = variant.AsList(); |
|
926 |
||
927 |
TBuf<KSAPIContentNameMaxLength> contentid; |
|
928 |
TBuf<KSAPIContentNameMaxLength> operation; |
|
929 |
TBuf<KSAPIContentNameMaxLength> trigger; |
|
930 |
||
931 |
// Iter through list content |
|
932 |
||
933 |
TInt mapslistcount (changeMapsList->Count()); |
|
934 |
||
935 |
for (TInt i = 0; i < mapslistcount; ++i) |
|
936 |
{ |
|
937 |
if ( changeMapsList->AtL(i, variant) ) |
|
938 |
{ |
|
939 |
const CLiwMap* map = variant.AsMap(); |
|
940 |
||
941 |
// Check what triggered a notification |
|
942 |
if ( map->FindL(KOperation, variant) ) |
|
943 |
{ |
|
944 |
variant.Get(operation); |
|
945 |
variant.Reset(); |
|
946 |
if( map->FindL( KContentId, variant) ) |
|
947 |
{ |
|
948 |
variant.Get(contentid ); |
|
949 |
variant.Reset(); |
|
950 |
if( map->FindL( KActionTrigger, variant) ) |
|
951 |
{ |
|
952 |
variant.Get(trigger ); |
|
953 |
} |
|
954 |
if (trigger.Compare(KSuspend16) == 0) |
|
955 |
{ |
|
956 |
// Publishing to homescreen suspended. |
|
957 |
HBufC* cid = contentid.AllocLC(); |
|
958 |
TInt widgetInstance = GetWidgetInstanceId(cid->Des()); |
|
959 |
if(widgetInstance>=0) |
|
960 |
iAllowedToPublish[widgetInstance] = EFalse; |
|
961 |
CleanupStack::PopAndDestroy( cid ); |
|
962 |
} |
|
963 |
else if (trigger.Compare(KResume16) == 0) |
|
964 |
{ |
|
965 |
HBufC* cid = contentid.AllocLC(); |
|
966 |
if ( GetWidgetInstanceId(cid->Des()) < 0 ) |
|
967 |
{ |
|
968 |
TInstIdInfo instIdInfo; |
|
969 |
instIdInfo.iCid.Copy(cid->Des()); |
|
970 |
instIdInfo.iUpdateNeeded = ETrue; |
|
971 |
instIdInfo.iWizardPublished = EFalse; |
|
972 |
iInstIdList.AppendL(instIdInfo); |
|
973 |
} |
|
974 |
TInt widgetInstance = GetWidgetInstanceId(cid->Des()); |
|
975 |
if(widgetInstance>=0)// coverity fix, index can be negativ, allowed 0, since it is valid index |
|
976 |
{ |
|
977 |
iMailCpsHandler->UpdateMailboxesL(widgetInstance, cid->Des()); |
|
978 |
PublishSetupWizardL(widgetInstance); |
|
979 |
// Widget visible on the homescreen. Publishing allowed. |
|
980 |
iAllowedToPublish[widgetInstance] = ETrue; |
|
981 |
} |
|
982 |
CleanupStack::PopAndDestroy( cid ); |
|
983 |
} |
|
984 |
else if (trigger.Compare(KPluginStartup16) == 0) |
|
985 |
{ |
|
986 |
// Widget added to homescreen |
|
987 |
HBufC* cid = contentid.AllocLC(); |
|
988 |
if ( cid->Length() > 0 ) |
|
989 |
{ |
|
990 |
TInstIdInfo instIdInfo; |
|
991 |
instIdInfo.iCid.Copy(cid->Des()); |
|
992 |
instIdInfo.iUpdateNeeded = ETrue; |
|
993 |
instIdInfo.iWizardPublished = EFalse; |
|
994 |
iInstIdList.AppendL(instIdInfo); |
|
995 |
TFSMailMsgId mailBox( iMailCpsHandler->WaitingForNewWidget() ); |
|
996 |
if ( mailBox.Id() > 0 ) |
|
997 |
{ |
|
998 |
// Associate new mailbox to widget setting |
|
999 |
iMailCpsHandler->AssociateWidgetToSetting( |
|
1000 |
cid->Des(), |
|
1001 |
mailBox ); |
|
1002 |
iMailCpsHandler->CleanWaitingForNewWidget(); |
|
1003 |
} |
|
1004 |
else if ( iMailCpsHandler->TotalMailboxCountL() ) |
|
1005 |
{ |
|
1006 |
iMailCpsHandler->LaunchWidgetSettingsL(cid->Des()); |
|
1007 |
} |
|
1008 |
else |
|
1009 |
{ |
|
1010 |
iMailCpsHandler->LaunchEmailWizardL(cid->Des()); |
|
1011 |
} |
|
1012 |
} |
|
1013 |
CleanupStack::PopAndDestroy( cid ); |
|
1014 |
} |
|
1015 |
else if (trigger.Compare(KPluginShutdown16) == 0) |
|
1016 |
{ |
|
1017 |
// Widget removed from homescreen. |
|
1018 |
HBufC* cid = contentid.AllocLC(); |
|
1019 |
ResetPublishedDataL( cid->Des() ); |
|
1020 |
iMailCpsHandler->DissociateWidgetFromSettingL( cid->Des() ); |
|
1021 |
TInt widgetInstance = GetWidgetInstanceId( cid->Des() ); |
|
1022 |
if (widgetInstance != KErrNotFound ) |
|
1023 |
{ |
|
1024 |
iInstIdList.Remove(widgetInstance); |
|
1025 |
} |
|
1026 |
CleanupStack::PopAndDestroy( cid ); |
|
1027 |
} |
|
1028 |
else if (trigger.Compare(KTriggerEmailUi) == 0) |
|
1029 |
{ |
|
1030 |
HBufC* cid = contentid.AllocLC(); |
|
1031 |
iMailCpsHandler->LaunchEmailUIL(cid->Des()); |
|
1032 |
CleanupStack::PopAndDestroy( cid ); |
|
1033 |
} |
|
1034 |
else if ((trigger.Compare(KTriggerWizard) == 0) || |
|
1035 |
( trigger.Compare(KSettings16) == 0)) |
|
1036 |
{ |
|
1037 |
// If no accounts are created launch email wizard |
|
1038 |
// otherwice launch widget settings app |
|
1039 |
HBufC* cid = contentid.AllocLC(); |
|
1040 |
if ( iMailCpsHandler->TotalMailboxCountL() ) |
|
1041 |
{ |
|
1042 |
iMailCpsHandler->LaunchWidgetSettingsL(cid->Des()); |
|
1043 |
} |
|
1044 |
else |
|
1045 |
{ |
|
1046 |
iMailCpsHandler->LaunchEmailWizardL(cid->Des()); |
|
1047 |
} |
|
1048 |
CleanupStack::PopAndDestroy( cid ); |
|
1049 |
} |
|
1050 |
} |
|
1051 |
} |
|
1052 |
} |
|
1053 |
} |
|
1054 |
CleanupStack::PopAndDestroy(1); |
|
1055 |
} |
|
1056 |
return result; |
|
1057 |
} |
|
1058 |
||
1059 |
// --------------------------------------------------------------------------- |
|
1060 |
// CMailCpsIf::AllowedToPublish |
|
1061 |
// --------------------------------------------------------------------------- |
|
1062 |
// |
|
1063 |
TBool CMailCpsIf::AllowedToPublish( TInt aWidgetInstance ) |
|
1064 |
{ |
|
1065 |
FUNC_LOG; |
|
1066 |
if ( !iAllowedToPublish[aWidgetInstance] && !iIgnoreHsNotifications ) |
|
1067 |
{ |
|
1068 |
return EFalse; |
|
1069 |
} |
|
1070 |
else |
|
1071 |
{ |
|
1072 |
return ETrue; |
|
1073 |
} |
|
1074 |
} |
|
1075 |
||
1076 |
// --------------------------------------------------------------------------- |
|
1077 |
// CMailCpsIf::SetConfiguration |
|
1078 |
// --------------------------------------------------------------------------- |
|
1079 |
// |
|
1080 |
void CMailCpsIf::SetConfiguration( const TInt32 aConfigData ) |
|
1081 |
{ |
|
1082 |
FUNC_LOG; |
|
1083 |
iIgnoreHsNotifications = aConfigData & KCMailIgnoreHsEvents; |
|
1084 |
} |
|
1085 |
||
1086 |
// --------------------------------------------------------------------------- |
|
1087 |
// CMailCpsIf::GetWidgetInstanceCount |
|
1088 |
// --------------------------------------------------------------------------- |
|
1089 |
// |
|
1090 |
TInt CMailCpsIf::GetWidgetInstanceCount() |
|
1091 |
{ |
|
1092 |
FUNC_LOG; |
|
1093 |
return iInstIdList.Count(); |
|
1094 |
} |
|
1095 |
||
1096 |
||
1097 |
// --------------------------------------------------------------------------- |
|
1098 |
// CMailCpsIf::GetWidgetInstanceId |
|
1099 |
// --------------------------------------------------------------------------- |
|
1100 |
// |
|
1101 |
TInt CMailCpsIf::GetWidgetInstanceId( const TDesC& aContentId ) |
|
1102 |
{ |
|
1103 |
FUNC_LOG; |
|
1104 |
TInt instance(KErrNotFound); |
|
1105 |
for (TInt i = 0; i < iInstIdList.Count(); i++) |
|
1106 |
{ |
|
1107 |
TInt val = aContentId.Compare(iInstIdList[i].iCid); |
|
1108 |
if (!val) |
|
1109 |
{ |
|
1110 |
instance = i; |
|
1111 |
break; |
|
1112 |
} |
|
1113 |
} |
|
1114 |
return instance; |
|
1115 |
} |
|
1116 |
||
1117 |
// --------------------------------------------------------------------------- |
|
1118 |
// CMailCpsIf::ResetPublishedDataL |
|
1119 |
// --------------------------------------------------------------------------- |
|
1120 |
// |
|
1121 |
void CMailCpsIf::ResetPublishedDataL( const TDesC& aContentId ) |
|
1122 |
{ |
|
1123 |
FUNC_LOG; |
|
1124 |
// Clean up all published data |
|
1125 |
if( iMsgInterface == NULL) GetMessagingInterfaceL(); // Coverity fix, it does not like !iMsgInterface comparison |
|
1126 |
CLiwGenericParamList* inParam = &(iServiceHandler->InParamListL()); |
|
1127 |
CLiwGenericParamList* outParam = &(iServiceHandler->OutParamListL()); |
|
1128 |
||
1129 |
// Fill input param |
|
1130 |
TLiwGenericParam cptype( KType, TLiwVariant( KCpData )); |
|
1131 |
inParam->AppendL( cptype ); |
|
1132 |
||
1133 |
CLiwDefaultMap* cpData = CLiwDefaultMap::NewLC(); |
|
1134 |
cpData->InsertL( KPublisherId, TLiwVariant( KPubId ) ); |
|
1135 |
cpData->InsertL( KContentType, TLiwVariant( KCPAll ) ); |
|
1136 |
cpData->InsertL( KContentId, TLiwVariant( aContentId ) ); |
|
1137 |
TLiwGenericParam item( KData8, TLiwVariant( cpData ) ); |
|
1138 |
inParam->AppendL( item ); |
|
1139 |
||
1140 |
// Execute command |
|
1141 |
if ( iMsgInterface ) |
|
1142 |
{ |
|
1143 |
iMsgInterface->ExecuteCmdL( KDelete , *inParam, *outParam ); |
|
1144 |
} |
|
1145 |
||
1146 |
CleanupStack::PopAndDestroy( cpData ); |
|
1147 |
item.Reset(); |
|
1148 |
cptype.Reset(); |
|
1149 |
outParam->Reset(); |
|
1150 |
inParam->Reset(); |
|
1151 |
} |
|
1152 |
||
1153 |
// --------------------------------------------------------------------------- |
|
1154 |
// CMailCpsIf::AddWidgetToHomescreenL |
|
1155 |
// --------------------------------------------------------------------------- |
|
1156 |
// |
|
1157 |
void CMailCpsIf::AddWidgetToHomescreenL( const TFSMailMsgId aMailbox ) |
|
1158 |
{ |
|
1159 |
FUNC_LOG; |
|
1160 |
||
1161 |
for ( TInt i = 0; i < iInstIdList.Count(); i++ ) |
|
1162 |
{ |
|
1163 |
if ( !iMailCpsHandler->Associated(iInstIdList[i].iCid) ) |
|
1164 |
{ |
|
1165 |
// Empty e-mail widget found. Associate new account to it. |
|
1166 |
iMailCpsHandler->AssociateWidgetToSetting( |
|
1167 |
iInstIdList[i].iCid, |
|
1168 |
aMailbox ); |
|
1169 |
return; |
|
1170 |
} |
|
1171 |
} |
|
1172 |
||
1173 |
CHsContentInfoArray* widgets = CHsContentInfoArray::NewL(); |
|
1174 |
CleanupStack::PushL( widgets ); |
|
1175 |
iContentControlClient->WidgetListL( *widgets ); |
|
1176 |
CHsContentInfo* widgetContentInfo( NULL ); |
|
1177 |
||
1178 |
for ( TInt i = 0; i < widgets->Array().Count(); i++ ) |
|
1179 |
{ |
|
1180 |
widgetContentInfo = widgets->Array()[i]; |
|
1181 |
if (!widgetContentInfo->Uid().Compare(KConfId8)) |
|
1182 |
{ |
|
1183 |
// E-mail widget found |
|
1184 |
widgetContentInfo->SetCanBeRemoved( ETrue ); |
|
1185 |
if ( iContentControlClient->AddWidgetL( *widgetContentInfo ) == KErrNone ) |
|
1186 |
{ |
|
1187 |
// Widget added succesfully. Wait PluginStartup event from HS. |
|
1188 |
iMailCpsHandler->SetWaitingForNewWidget( aMailbox ); |
|
1189 |
} |
|
1190 |
else |
|
1191 |
{ |
|
1192 |
iMailCpsHandler->DisplayHSPageFullNoteL(); |
|
1193 |
} |
|
1194 |
break; |
|
1195 |
} |
|
1196 |
} |
|
1197 |
CleanupStack::PopAndDestroy(); |
|
1198 |
} |
|
1199 |
||
1200 |
||
1201 |
// --------------------------------------------------------------------------- |
|
1202 |
// CMailCpsIf::NotifyWidgetListChanged |
|
1203 |
// --------------------------------------------------------------------------- |
|
1204 |
// |
|
1205 |
void CMailCpsIf::NotifyWidgetListChanged() |
|
1206 |
{ |
|
1207 |
FUNC_LOG; |
|
1208 |
} |
|
1209 |
||
1210 |
// --------------------------------------------------------------------------- |
|
1211 |
// CMailCpsIf::NotifyViewListChanged |
|
1212 |
// --------------------------------------------------------------------------- |
|
1213 |
// |
|
1214 |
void CMailCpsIf::NotifyViewListChanged() |
|
1215 |
{ |
|
1216 |
FUNC_LOG; |
|
1217 |
} |
|
1218 |
||
1219 |
// --------------------------------------------------------------------------- |
|
1220 |
// CMailCpsIf::NotifyAppListChanged |
|
1221 |
// --------------------------------------------------------------------------- |
|
1222 |
// |
|
1223 |
void CMailCpsIf::NotifyAppListChanged() |
|
1224 |
{ |
|
1225 |
FUNC_LOG; |
|
1226 |
} |
|
1227 |
||
1228 |
// --------------------------------------------------------------------------- |
|
1229 |
// CMailCpsIf::SetUpdateNeeded |
|
1230 |
// --------------------------------------------------------------------------- |
|
1231 |
// |
|
1232 |
void CMailCpsIf::SetUpdateNeeded( const TInt aInstance, const TBool aValue ) |
|
1233 |
{ |
|
1234 |
FUNC_LOG; |
|
1235 |
if ( aInstance >= 0 && aInstance < GetWidgetInstanceCount() ) |
|
1236 |
{ |
|
1237 |
iInstIdList[aInstance].iUpdateNeeded = aValue; |
|
1238 |
} |
|
1239 |
} |
|
1240 |
||
1241 |
// --------------------------------------------------------------------------- |
|
1242 |
// CMailCpsIf::UpdateNeeded |
|
1243 |
// --------------------------------------------------------------------------- |
|
1244 |
// |
|
1245 |
TBool CMailCpsIf::UpdateNeeded( const TInt aInstance ) |
|
1246 |
{ |
|
1247 |
FUNC_LOG; |
|
1248 |
TBool rVal( EFalse ); |
|
1249 |
if ( aInstance >= 0 && aInstance < GetWidgetInstanceCount() ) |
|
1250 |
{ |
|
1251 |
rVal = iInstIdList[aInstance].iUpdateNeeded; |
|
1252 |
} |
|
1253 |
INFO_1("CMAIL CMailCpsIf::UpdateNeeded(): ret = %d",rVal); |
|
1254 |
return rVal; |
|
1255 |
} |
|
1256 |