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);
|
|
210 |
|
|
211 |
PublishImageL(
|
|
212 |
iInstIdList[aInstance].iCid,
|
|
213 |
KContTypeSetupBrandIcon1,
|
|
214 |
KKeySetupBrandIcon1,
|
|
215 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
|
|
216 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask,
|
|
217 |
mailBoxId,
|
|
218 |
KSetupBrand1);
|
|
219 |
|
|
220 |
PublishImageL(
|
|
221 |
iInstIdList[aInstance].iCid,
|
|
222 |
KContTypeSetupBrandIcon2,
|
|
223 |
KKeySetupBrandIcon2,
|
|
224 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
|
|
225 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask,
|
|
226 |
mailBoxId,
|
|
227 |
KSetupBrand2);
|
|
228 |
|
|
229 |
PublishImageL(
|
|
230 |
iInstIdList[aInstance].iCid,
|
|
231 |
KContTypeSetupBrandIcon3,
|
|
232 |
KKeySetupBrandIcon3,
|
|
233 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
|
|
234 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask,
|
|
235 |
mailBoxId,
|
|
236 |
KSetupBrand3);
|
|
237 |
|
|
238 |
PublishImageL(
|
|
239 |
iInstIdList[aInstance].iCid,
|
|
240 |
KContTypeSetupBrandIcon4,
|
|
241 |
KKeySetupBrandIcon4,
|
|
242 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
|
|
243 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account_mask,
|
|
244 |
mailBoxId,
|
|
245 |
KSetupBrand4);
|
|
246 |
iInstIdList[aInstance].iWizardPublished = ETrue;
|
|
247 |
CleanupStack::PopAndDestroy(setupEmail);
|
|
248 |
}
|
|
249 |
}
|
|
250 |
|
|
251 |
// ---------------------------------------------------------------------------
|
|
252 |
// CMailCpsIf::PublishActiveMailboxNameL
|
|
253 |
// ---------------------------------------------------------------------------
|
|
254 |
//
|
|
255 |
void CMailCpsIf::PublishActiveMailboxNameL(
|
|
256 |
const TInt aInstance,
|
|
257 |
const TInt aRowNumber,
|
|
258 |
const TDesC& aMailboxName)
|
|
259 |
{
|
|
260 |
FUNC_LOG;
|
|
261 |
|
|
262 |
TBuf<KMaxDescLen> row;
|
|
263 |
row.Num(aRowNumber);
|
|
264 |
|
|
265 |
TBuf<KMaxDescLen> contentType;
|
|
266 |
contentType.Copy(KContTypeBodyText);
|
|
267 |
contentType.Append(row);
|
|
268 |
|
|
269 |
TBuf<KMaxDescLen> textKey;
|
|
270 |
textKey.Copy(KKeyBodyText);
|
|
271 |
textKey.Append(row);
|
|
272 |
|
|
273 |
iMailboxNameUid = PublishDescriptorL(
|
|
274 |
KPubId, contentType,
|
|
275 |
iInstIdList[aInstance].iCid,
|
|
276 |
aMailboxName,
|
|
277 |
textKey, KTriggerEmailUi8);
|
|
278 |
}
|
|
279 |
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
// CMailCpsIf::PublishActiveMailboxNameL
|
|
282 |
// ---------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
void CMailCpsIf::PublishMailboxNameL(
|
|
285 |
const TInt aInstance,
|
|
286 |
const TDesC& aMailboxName,
|
|
287 |
const TDesC8& aAction )
|
|
288 |
{
|
|
289 |
FUNC_LOG;
|
|
290 |
|
|
291 |
TBuf<KMaxDescLen> contentType;
|
|
292 |
contentType.Copy(KContTypeBodyText);
|
|
293 |
contentType.Append(_L("1"));
|
|
294 |
|
|
295 |
TBuf<KMaxDescLen> textKey;
|
|
296 |
textKey.Copy(KKeyBodyText);
|
|
297 |
textKey.Append(_L("1"));
|
|
298 |
|
|
299 |
TFSMailMsgId dummy;
|
|
300 |
|
|
301 |
PublishDescriptorL( KPubId, contentType, iInstIdList[aInstance].iCid,
|
|
302 |
aMailboxName, textKey, aAction);
|
|
303 |
}
|
|
304 |
|
|
305 |
// ---------------------------------------------------------------------------
|
|
306 |
// CMailCpsIf::PublishIndicatorIconL
|
|
307 |
// ---------------------------------------------------------------------------
|
|
308 |
//
|
|
309 |
void CMailCpsIf::PublishIndicatorIconL( const TInt aInstance,
|
|
310 |
const TInt aRowNumber,
|
|
311 |
const TInt aIcon )
|
|
312 |
{
|
|
313 |
FUNC_LOG;
|
|
314 |
TFSMailMsgId mailBoxId;
|
|
315 |
|
|
316 |
TBuf<KMaxDescLen> row;
|
|
317 |
row.Num(aRowNumber);
|
|
318 |
|
|
319 |
TBuf<KMaxDescLen> contentType;
|
|
320 |
contentType.Copy(KContTypeIndicatorIcon);
|
|
321 |
contentType.Append(row);
|
|
322 |
|
|
323 |
TBuf8<KMaxDescLen> row8;
|
|
324 |
row8.Num(aRowNumber);
|
|
325 |
|
|
326 |
TBuf8<KMaxDescLen> key;
|
|
327 |
key.Copy(KKeyIndicatorIcon);
|
|
328 |
key.Append(row8);
|
|
329 |
|
|
330 |
PublishImageL(
|
|
331 |
iInstIdList[aInstance].iCid,
|
|
332 |
contentType,
|
|
333 |
key,
|
|
334 |
aIcon,
|
|
335 |
aIcon + 1,
|
|
336 |
mailBoxId,
|
|
337 |
KNullDes);
|
|
338 |
}
|
|
339 |
|
|
340 |
// ---------------------------------------------------------------------------
|
|
341 |
// CMailCpsIf::PublishMailboxIconL
|
|
342 |
// ---------------------------------------------------------------------------
|
|
343 |
//
|
|
344 |
void CMailCpsIf::PublishMailboxIconL( const TInt aInstance,
|
|
345 |
const TInt aRowNumber,
|
|
346 |
const TInt aIcon,
|
|
347 |
TFSMailMsgId aMailBoxId )
|
|
348 |
{
|
|
349 |
FUNC_LOG;
|
|
350 |
|
|
351 |
TBuf<KMaxDescLen> row;
|
|
352 |
row.Num(aRowNumber);
|
|
353 |
|
|
354 |
TBuf<KMaxDescLen> contentType;
|
|
355 |
contentType.Copy(KContTypeMailboxIcons);
|
|
356 |
contentType.Append(row);
|
|
357 |
|
|
358 |
TBuf8<KMaxDescLen> row8;
|
|
359 |
row8.Num(aRowNumber);
|
|
360 |
|
|
361 |
TBuf8<KMaxDescLen> key;
|
|
362 |
key.Copy(KKeyMailboxIcons);
|
|
363 |
key.Append(row8);
|
|
364 |
|
|
365 |
PublishImageL(
|
|
366 |
iInstIdList[aInstance].iCid,
|
|
367 |
contentType,
|
|
368 |
key,
|
|
369 |
aIcon,
|
|
370 |
aIcon + 1,
|
|
371 |
aMailBoxId,
|
|
372 |
KNullDes);
|
|
373 |
}
|
|
374 |
|
|
375 |
// ---------------------------------------------------------------------------
|
|
376 |
// CMailCpsIf::PublishMailboxIconL
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
//
|
|
379 |
void CMailCpsIf::PublishMailboxIconL( const TInt aInstance, const TDesC& aIconPath )
|
|
380 |
{
|
|
381 |
FUNC_LOG;
|
|
382 |
|
|
383 |
TBuf<KMaxDescLen> contentType;
|
|
384 |
contentType.Copy(KContTypeMailboxIcons);
|
|
385 |
contentType.Append(_L("1"));
|
|
386 |
|
|
387 |
TBuf8<KMaxDescLen> key;
|
|
388 |
key.Copy(KKeyMailboxIcons);
|
|
389 |
key.Append(_L8("1"));
|
|
390 |
|
|
391 |
if ( GetWidgetInstanceCount() <= aInstance ) User::LeaveIfError( KErrNotFound );
|
|
392 |
|
|
393 |
PublishIconReferenceL(
|
|
394 |
iInstIdList[aInstance].iCid,
|
|
395 |
contentType,
|
|
396 |
key,
|
|
397 |
aIconPath );
|
|
398 |
}
|
|
399 |
|
|
400 |
// ---------------------------------------------------------------------------
|
|
401 |
// CMailCpsIf::PublishIconReferenceL
|
|
402 |
// ---------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
void CMailCpsIf::PublishIconReferenceL(
|
|
405 |
const TDesC& aContentId,
|
|
406 |
const TDesC& aContentType,
|
|
407 |
const TDesC8& aKey,
|
|
408 |
const TDesC& aIconPath )
|
|
409 |
{
|
|
410 |
FUNC_LOG;
|
|
411 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
412 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
413 |
|
|
414 |
TLiwGenericParam type( KType, TLiwVariant( KCpData ) );
|
|
415 |
inparam->AppendL( type );
|
|
416 |
|
|
417 |
CLiwDefaultMap* pdatamap = CLiwDefaultMap::NewLC();
|
|
418 |
CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
|
|
419 |
|
|
420 |
pdatamap->InsertL( KPublisherId, TLiwVariant( KPubId ) );
|
|
421 |
pdatamap->InsertL( KContentType, TLiwVariant( aContentType ) );
|
|
422 |
pdatamap->InsertL( KContentId, TLiwVariant( aContentId ) );
|
|
423 |
|
|
424 |
datamap->InsertL( aKey, TLiwVariant( aIconPath ) );
|
|
425 |
|
|
426 |
pdatamap->InsertL( KDataMap, TLiwVariant(datamap) );
|
|
427 |
TLiwGenericParam item( KItem, TLiwVariant( pdatamap ) );
|
|
428 |
inparam->AppendL( item );
|
|
429 |
|
|
430 |
iMsgInterface->ExecuteCmdL( KAdd, *inparam, *outparam );
|
|
431 |
|
|
432 |
CleanupStack::PopAndDestroy( datamap );
|
|
433 |
CleanupStack::PopAndDestroy( pdatamap );
|
|
434 |
|
|
435 |
item.Reset();
|
|
436 |
type.Reset();
|
|
437 |
outparam->Reset();
|
|
438 |
inparam->Reset();
|
|
439 |
}
|
|
440 |
|
|
441 |
// ---------------------------------------------------------------------------
|
|
442 |
// CMailCpsIf::PublishMailDetailL
|
|
443 |
// ---------------------------------------------------------------------------
|
|
444 |
//
|
|
445 |
void CMailCpsIf::PublishMailDetailL( const TInt aInstance,
|
|
446 |
const TInt aRowNumber,
|
|
447 |
const TDesC& aText,
|
|
448 |
TWidgetMailDetails aDetail)
|
|
449 |
{
|
|
450 |
FUNC_LOG;
|
|
451 |
|
|
452 |
TBuf<KMaxDescLen> row;
|
|
453 |
row.Num(aRowNumber);
|
|
454 |
|
|
455 |
TBuf<KMaxDescLen> contentType;
|
|
456 |
if (aDetail == ETime)
|
|
457 |
{
|
|
458 |
contentType.Copy(KContTypeTime);
|
|
459 |
}
|
|
460 |
else if (aDetail == ESubject)
|
|
461 |
{
|
|
462 |
contentType.Copy(KContTypeSubjectText);
|
|
463 |
}
|
|
464 |
else //aDetail == ESender
|
|
465 |
{
|
|
466 |
contentType.Copy(KContTypeBodyText);
|
|
467 |
}
|
|
468 |
contentType.Append(row);
|
|
469 |
|
|
470 |
TBuf<KMaxDescLen> textKey;
|
|
471 |
if (aDetail == ETime)
|
|
472 |
{
|
|
473 |
textKey.Copy(KKeyTime);
|
|
474 |
}
|
|
475 |
else if (aDetail == ESubject)
|
|
476 |
{
|
|
477 |
textKey.Copy(KKeySubjectText);
|
|
478 |
}
|
|
479 |
else
|
|
480 |
{
|
|
481 |
textKey.Copy(KKeyBodyText);
|
|
482 |
}
|
|
483 |
textKey.Append(row);
|
|
484 |
|
|
485 |
TFSMailMsgId mailBoxId;
|
|
486 |
TFSMailMsgId folderId;
|
|
487 |
|
|
488 |
iMailboxNameUid = PublishDescriptorL(
|
|
489 |
KPubId, contentType,
|
|
490 |
iInstIdList[aInstance].iCid,
|
|
491 |
aText,
|
|
492 |
textKey, KNullDes8);
|
|
493 |
}
|
|
494 |
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
// CMailCpsIf::ResetMessageL
|
|
497 |
// ---------------------------------------------------------------------------
|
|
498 |
//
|
|
499 |
void CMailCpsIf::ResetMessageL( TInt /*aRowNumber*/ )
|
|
500 |
{
|
|
501 |
FUNC_LOG;
|
|
502 |
RemoveL( iMsgUid );
|
|
503 |
iMsgUid = 0;
|
|
504 |
}
|
|
505 |
|
|
506 |
// ---------------------------------------------------------------------------
|
|
507 |
// CMailCpsIf::ExtractItemId
|
|
508 |
// ---------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
TUint CMailCpsIf::ExtractItemId(
|
|
511 |
const CLiwGenericParamList& aInParamList )
|
|
512 |
{
|
|
513 |
FUNC_LOG;
|
|
514 |
TUint result ( 0 );
|
|
515 |
TInt pos( 0 );
|
|
516 |
aInParamList.FindFirst( pos, KItemId );
|
|
517 |
if ( pos != KErrNotFound )
|
|
518 |
{
|
|
519 |
// item id present - extract and return
|
|
520 |
aInParamList[pos].Value().Get( result ); // indexing should be safe
|
|
521 |
}
|
|
522 |
return result;
|
|
523 |
}
|
|
524 |
|
|
525 |
// ---------------------------------------------------------------------------
|
|
526 |
// CMailCpsIf::PublishDescriptorL
|
|
527 |
// ---------------------------------------------------------------------------
|
|
528 |
//
|
|
529 |
TUint CMailCpsIf::PublishDescriptorL(
|
|
530 |
const TDesC& aPublisherId,
|
|
531 |
const TDesC& aContentType,
|
|
532 |
const TDesC& aContentId,
|
|
533 |
const TDesC& aTextToAdd,
|
|
534 |
const TDesC& aKey,
|
|
535 |
const TDesC8& aTrigger)
|
|
536 |
{
|
|
537 |
FUNC_LOG;
|
|
538 |
|
|
539 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
540 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
541 |
TUint id(0);
|
|
542 |
TBuf8<KMaxDescLen> key;
|
|
543 |
key.Copy(aKey);
|
|
544 |
if ( iMsgInterface )
|
|
545 |
{
|
|
546 |
TLiwGenericParam cptype( KType, TLiwVariant( KCpData ));
|
|
547 |
inparam->AppendL( cptype );
|
|
548 |
CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
|
|
549 |
CLiwDefaultMap* map = CLiwDefaultMap::NewLC();
|
|
550 |
map->InsertL( key, TLiwVariant( aTextToAdd ) );
|
|
551 |
cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId ));
|
|
552 |
cpdatamap->InsertL( KContentType, TLiwVariant( aContentType ));
|
|
553 |
cpdatamap->InsertL( KContentId, TLiwVariant( aContentId ));
|
|
554 |
cpdatamap->InsertL( KDataMap, TLiwVariant( map ) );
|
|
555 |
|
|
556 |
if( aTrigger.Length() > 0 )
|
|
557 |
{
|
|
558 |
CLiwDefaultMap* mapAction = CLiwDefaultMap::NewLC();
|
|
559 |
CLiwDefaultMap* mapInterface = CLiwDefaultMap::NewLC();
|
|
560 |
CLiwDefaultMap* mapPlugin = CLiwDefaultMap::NewLC();
|
|
561 |
mapInterface ->InsertL( KDataForActionHandler, TLiwVariant( mapPlugin ) );
|
|
562 |
mapAction->InsertL( aTrigger, TLiwVariant( mapInterface ) );
|
|
563 |
cpdatamap->InsertL( KActionMap, TLiwVariant(mapAction) );
|
|
564 |
}
|
|
565 |
|
|
566 |
TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ));
|
|
567 |
inparam->AppendL( item );
|
|
568 |
|
|
569 |
// Execute command
|
|
570 |
iMsgInterface->ExecuteCmdL( KAdd , *inparam, *outparam );
|
|
571 |
|
|
572 |
id = ExtractItemId(*outparam );
|
|
573 |
|
|
574 |
if( aTrigger.Length() > 0 )
|
|
575 |
{
|
|
576 |
CleanupStack::PopAndDestroy( 3 ); // action
|
|
577 |
}
|
|
578 |
|
|
579 |
CleanupStack::PopAndDestroy( map );
|
|
580 |
CleanupStack::PopAndDestroy( cpdatamap );
|
|
581 |
item.Reset();
|
|
582 |
cptype.Reset();
|
|
583 |
}
|
|
584 |
outparam->Reset();
|
|
585 |
inparam->Reset();
|
|
586 |
return id;
|
|
587 |
}
|
|
588 |
|
|
589 |
// ---------------------------------------------------------
|
|
590 |
// CMailCpsIf::PublishImageL
|
|
591 |
// ---------------------------------------------------------
|
|
592 |
//
|
|
593 |
void CMailCpsIf::PublishImageL(
|
|
594 |
const TDesC& aContentId,
|
|
595 |
const TDesC& aContentType,
|
|
596 |
const TDesC8& aKey,
|
|
597 |
TInt aBitmapId,
|
|
598 |
TInt aBitmapMaskId,
|
|
599 |
TFSMailMsgId aMailBoxId,
|
|
600 |
const TDesC& aBrandId )
|
|
601 |
{
|
|
602 |
FUNC_LOG;
|
|
603 |
|
|
604 |
TBuf<KMaxDescLen> iconIds(KNullDesC);
|
|
605 |
|
|
606 |
if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account )
|
|
607 |
{
|
|
608 |
// This is mailbox icon. Try finding branded mailbox icon.
|
|
609 |
TInt error(KErrNone);
|
|
610 |
TBuf<KMaxDescLen> brandedIconIds(KNullDesC);
|
|
611 |
|
|
612 |
MFSMailBrandManager& brandManager = iMailCpsHandler->MailClient().GetBrandManagerL();
|
|
613 |
TInt err2(KErrNone);
|
|
614 |
if (aBrandId.Length() > 0)
|
|
615 |
{
|
|
616 |
TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aBrandId, brandedIconIds ) );
|
|
617 |
err2 = err;
|
|
618 |
}
|
|
619 |
else
|
|
620 |
{
|
|
621 |
TRAPD( err, error = brandManager.GetGraphicIdsL( EFSMailboxIcon, aMailBoxId, brandedIconIds ) );
|
|
622 |
err2 = err;
|
|
623 |
}
|
|
624 |
|
|
625 |
if ( err2 == KErrNone && error == KErrNone )
|
|
626 |
{
|
|
627 |
iconIds.Copy(KMifPrefix);
|
|
628 |
iconIds.Append(brandedIconIds);
|
|
629 |
}
|
|
630 |
}
|
|
631 |
|
|
632 |
// Parse mif file full path by own dll drive letter
|
|
633 |
TFileName dllFileName;
|
|
634 |
Dll::FileName( dllFileName );
|
|
635 |
TParse mifParse;
|
|
636 |
User::LeaveIfError( mifParse.Set( KMifPath, &dllFileName, NULL ) );
|
|
637 |
|
|
638 |
if (!iconIds.Length())
|
|
639 |
{
|
|
640 |
TBuf<KMaxDescLen> id;
|
|
641 |
if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg )
|
|
642 |
{
|
|
643 |
iconIds.Append( KSkinPrefix );
|
|
644 |
id.Num( EAknsMajorGeneric );
|
|
645 |
iconIds.Append( id );
|
|
646 |
iconIds.Append( KSpace );
|
|
647 |
id.Num( EAknsMinorGenericQgnIndiCmailUnseenMsg );
|
|
648 |
iconIds.Append( id );
|
|
649 |
iconIds.Append( KSkinPostfix );
|
|
650 |
}
|
|
651 |
else if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_outbox_msg )
|
|
652 |
{
|
|
653 |
iconIds.Append( KSkinPrefix );
|
|
654 |
id.Num( EAknsMajorGeneric );
|
|
655 |
iconIds.Append( id );
|
|
656 |
iconIds.Append( KSpace );
|
|
657 |
id.Num( EAknsMinorGenericQgnIndiCmailOutboxMsg );
|
|
658 |
iconIds.Append( id );
|
|
659 |
iconIds.Append( KSkinPostfix );
|
|
660 |
}
|
|
661 |
iconIds.Append( KMifPrefix );
|
|
662 |
iconIds.Append( mifParse.FullName() );
|
|
663 |
iconIds.Append( KSpace );
|
|
664 |
id.Num( aBitmapId );
|
|
665 |
iconIds.Append( id );
|
|
666 |
iconIds.Append( KSpace );
|
|
667 |
id.Num( aBitmapMaskId );
|
|
668 |
iconIds.Append( id );
|
|
669 |
iconIds.Append( _L(")") );
|
|
670 |
}
|
|
671 |
|
|
672 |
// The actual image publishing part starts here
|
|
673 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
674 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
675 |
|
|
676 |
TLiwGenericParam type( KType, TLiwVariant( KCpData ) );
|
|
677 |
inparam->AppendL( type );
|
|
678 |
|
|
679 |
CLiwDefaultMap* pdatamap = CLiwDefaultMap::NewLC();
|
|
680 |
CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
|
|
681 |
|
|
682 |
pdatamap->InsertL( KPublisherId, TLiwVariant( KPubId ) );
|
|
683 |
pdatamap->InsertL( KContentType, TLiwVariant( aContentType ) );
|
|
684 |
pdatamap->InsertL( KContentId, TLiwVariant( aContentId ) );
|
|
685 |
|
|
686 |
datamap->InsertL( aKey, TLiwVariant(iconIds) );
|
|
687 |
|
|
688 |
pdatamap->InsertL( KDataMap, TLiwVariant(datamap) );
|
|
689 |
TLiwGenericParam item( KItem, TLiwVariant( pdatamap ) );
|
|
690 |
inparam->AppendL( item );
|
|
691 |
|
|
692 |
// Publish icon ( or remove it from widget when no id provided )
|
|
693 |
if ( aBitmapId == KNullIcon )
|
|
694 |
{
|
|
695 |
iMsgInterface->ExecuteCmdL( KDelete, *inparam, *outparam );
|
|
696 |
}
|
|
697 |
else
|
|
698 |
{
|
|
699 |
iMsgInterface->ExecuteCmdL( KAdd, *inparam, *outparam );
|
|
700 |
}
|
|
701 |
|
|
702 |
CleanupStack::PopAndDestroy( datamap );
|
|
703 |
CleanupStack::PopAndDestroy( pdatamap );
|
|
704 |
|
|
705 |
item.Reset();
|
|
706 |
type.Reset();
|
|
707 |
outparam->Reset();
|
|
708 |
inparam->Reset();
|
|
709 |
}
|
|
710 |
|
|
711 |
// ---------------------------------------------------------------------------
|
|
712 |
// CMailCpsIf::RemoveL
|
|
713 |
// ---------------------------------------------------------------------------
|
|
714 |
//
|
|
715 |
void CMailCpsIf::RemoveL( TUint aId )
|
|
716 |
{
|
|
717 |
FUNC_LOG;
|
|
718 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
719 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
720 |
if ( iMsgInterface )
|
|
721 |
{
|
|
722 |
TLiwGenericParam cptype( KType, TLiwVariant( KCpData ));
|
|
723 |
inparam->AppendL( cptype );
|
|
724 |
CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
|
|
725 |
cpdatamap->InsertL( KId, TLiwVariant( aId ));
|
|
726 |
|
|
727 |
TLiwGenericParam item( KFilter, TLiwVariant( cpdatamap ));
|
|
728 |
inparam->AppendL( item );
|
|
729 |
|
|
730 |
iMsgInterface->ExecuteCmdL( KDelete , *inparam, *outparam);
|
|
731 |
|
|
732 |
CleanupStack::PopAndDestroy( cpdatamap );
|
|
733 |
item.Reset();
|
|
734 |
cptype.Reset();
|
|
735 |
}
|
|
736 |
outparam->Reset();
|
|
737 |
inparam->Reset();
|
|
738 |
}
|
|
739 |
|
|
740 |
// ---------------------------------------------------------------------------
|
|
741 |
// CMailCpsIf::PublisherRegisteryActionL
|
|
742 |
// ---------------------------------------------------------------------------
|
|
743 |
//
|
|
744 |
void CMailCpsIf::PublisherRegisteryActionL()
|
|
745 |
{
|
|
746 |
FUNC_LOG;
|
|
747 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
748 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
749 |
|
|
750 |
TLiwGenericParam type( KType, TLiwVariant( KPubData ));
|
|
751 |
inparam->AppendL( type );
|
|
752 |
|
|
753 |
CLiwDefaultMap* publishermap = CLiwDefaultMap::NewLC();
|
|
754 |
|
|
755 |
// Create the map for publisher registry
|
|
756 |
publishermap->InsertL( KPublisherId, TLiwVariant( KPubId ));
|
|
757 |
publishermap->InsertL( KContentId, TLiwVariant( KCPAll ));
|
|
758 |
publishermap->InsertL( KContentType, TLiwVariant( KCPAll ));
|
|
759 |
|
|
760 |
// Create the action map for publisher registry
|
|
761 |
CLiwDefaultMap* mapAction = CLiwDefaultMap::NewLC();
|
|
762 |
mapAction->InsertL(KPluginStartup, TLiwVariant( KData ));
|
|
763 |
mapAction->InsertL(KPluginShutdown, TLiwVariant( KData ));
|
|
764 |
mapAction->InsertL(KSuspend, TLiwVariant( KData ));
|
|
765 |
mapAction->InsertL(KResume, TLiwVariant( KData ));
|
|
766 |
|
|
767 |
publishermap->InsertL( KActionMap, TLiwVariant(mapAction));
|
|
768 |
CleanupStack::PopAndDestroy(mapAction);
|
|
769 |
|
|
770 |
TLiwGenericParam item( KItem, TLiwVariant( publishermap ));
|
|
771 |
inparam->AppendL( item );
|
|
772 |
|
|
773 |
iMsgInterface->ExecuteCmdL( KAdd, *inparam, *outparam);
|
|
774 |
|
|
775 |
CleanupStack::PopAndDestroy( publishermap );
|
|
776 |
|
|
777 |
item.Reset();
|
|
778 |
type.Reset();
|
|
779 |
|
|
780 |
outparam->Reset();
|
|
781 |
inparam->Reset();
|
|
782 |
}
|
|
783 |
|
|
784 |
// ---------------------------------------------------------------------------
|
|
785 |
// CMailCpsIf::RegisterForObserverL
|
|
786 |
// ---------------------------------------------------------------------------
|
|
787 |
//
|
|
788 |
void CMailCpsIf::RegisterForObserverL()
|
|
789 |
{
|
|
790 |
FUNC_LOG;
|
|
791 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
792 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
793 |
|
|
794 |
CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
|
|
795 |
|
|
796 |
filter->InsertL( KPublisherId, TLiwVariant( KPubId ) );
|
|
797 |
filter->InsertL( KContentId, TLiwVariant( KCPAll ) );
|
|
798 |
filter->InsertL( KContentType, TLiwVariant( KCPAll ) );
|
|
799 |
filter->InsertL( KOperation, TLiwVariant( KExecute ));
|
|
800 |
|
|
801 |
// Fill in input list for RequestNotification command
|
|
802 |
inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant( KContentAndPublisher_Registry )));
|
|
803 |
inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant( filter )));
|
|
804 |
|
|
805 |
TInt errori(KErrNone);
|
|
806 |
TRAP(errori, iMsgInterface->ExecuteCmdL( KRequestNotification, *inParamList,
|
|
807 |
*outParamList, 0, this ));
|
|
808 |
|
|
809 |
CleanupStack::PopAndDestroy( filter );
|
|
810 |
outParamList->Reset();
|
|
811 |
inParamList->Reset();
|
|
812 |
}
|
|
813 |
|
|
814 |
// ---------------------------------------------------------------------------
|
|
815 |
// CMailCpsIf::UnRegisterForObserverL
|
|
816 |
// ---------------------------------------------------------------------------
|
|
817 |
//
|
|
818 |
void CMailCpsIf::UnRegisterForObserverL()
|
|
819 |
{
|
|
820 |
FUNC_LOG;
|
|
821 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
822 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
823 |
// Un Register for notification
|
|
824 |
|
|
825 |
TInt err;
|
|
826 |
err = KErrNone;
|
|
827 |
|
|
828 |
// Un Register all the reuqest notification registered in this session
|
|
829 |
TRAP( err, iMsgInterface->ExecuteCmdL(
|
|
830 |
KRequestNotification,
|
|
831 |
*inparam,
|
|
832 |
*outparam,
|
|
833 |
KLiwOptCancel,
|
|
834 |
this ) );
|
|
835 |
|
|
836 |
outparam->Reset();
|
|
837 |
inparam->Reset();
|
|
838 |
}
|
|
839 |
|
|
840 |
// ---------------------------------------------------------------------------
|
|
841 |
// Notification handling
|
|
842 |
// ---------------------------------------------------------------------------
|
|
843 |
//
|
|
844 |
TInt CMailCpsIf::HandleNotifyL(
|
|
845 |
TInt /*aCmdId*/,
|
|
846 |
TInt /*aEventId*/,
|
|
847 |
CLiwGenericParamList& aEventParamList,
|
|
848 |
const CLiwGenericParamList& /*aInParamList*/ )
|
|
849 |
{
|
|
850 |
FUNC_LOG;
|
|
851 |
PublisherStatusL ( aEventParamList);
|
|
852 |
return KErrNone;
|
|
853 |
}
|
|
854 |
|
|
855 |
// ---------------------------------------------------------------------------
|
|
856 |
// Check if Publisher was activeated or deactivated
|
|
857 |
// ---------------------------------------------------------------------------
|
|
858 |
//
|
|
859 |
TBool CMailCpsIf::PublisherStatusL(const CLiwGenericParamList& aEventParamList)
|
|
860 |
{
|
|
861 |
FUNC_LOG;
|
|
862 |
TBool result(EFalse);
|
|
863 |
TInt pos(0);
|
|
864 |
const TInt KSAPIContentNameMaxLength = 255;
|
|
865 |
TBuf<300> text;
|
|
866 |
aEventParamList.FindFirst(pos, KChangeInfo);
|
|
867 |
if (pos != KErrNotFound)
|
|
868 |
{
|
|
869 |
// Get list of maps
|
|
870 |
TLiwVariant variant = (aEventParamList)[pos].Value();
|
|
871 |
variant.PushL();
|
|
872 |
const CLiwList* changeMapsList = variant.AsList();
|
|
873 |
|
|
874 |
TBuf<KSAPIContentNameMaxLength> contentid;
|
|
875 |
TBuf<KSAPIContentNameMaxLength> operation;
|
|
876 |
TBuf<KSAPIContentNameMaxLength> trigger;
|
|
877 |
|
|
878 |
// Iter through list content
|
|
879 |
|
|
880 |
TInt mapslistcount (changeMapsList->Count());
|
|
881 |
|
|
882 |
for (TInt i = 0; i < mapslistcount; ++i)
|
|
883 |
{
|
|
884 |
if ( changeMapsList->AtL(i, variant) )
|
|
885 |
{
|
|
886 |
const CLiwMap* map = variant.AsMap();
|
|
887 |
|
|
888 |
// Check what triggered a notification
|
|
889 |
if ( map->FindL(KOperation, variant) )
|
|
890 |
{
|
|
891 |
variant.Get(operation);
|
|
892 |
variant.Reset();
|
|
893 |
if( map->FindL( KContentId, variant) )
|
|
894 |
{
|
|
895 |
variant.Get(contentid );
|
|
896 |
variant.Reset();
|
|
897 |
if( map->FindL( KActionTrigger, variant) )
|
|
898 |
{
|
|
899 |
variant.Get(trigger );
|
|
900 |
}
|
|
901 |
if (trigger.Compare(KSuspend16) == 0)
|
|
902 |
{
|
|
903 |
// Publishing to homescreen suspended.
|
|
904 |
HBufC* cid = contentid.AllocLC();
|
|
905 |
TInt widgetInstance = GetWidgetInstanceId(cid->Des());
|
|
906 |
if(widgetInstance>=0)
|
|
907 |
iAllowedToPublish[widgetInstance] = EFalse;
|
|
908 |
CleanupStack::PopAndDestroy( cid );
|
|
909 |
}
|
|
910 |
else if (trigger.Compare(KResume16) == 0)
|
|
911 |
{
|
|
912 |
HBufC* cid = contentid.AllocLC();
|
|
913 |
if ( GetWidgetInstanceId(cid->Des()) < 0 )
|
|
914 |
{
|
|
915 |
TInstIdInfo instIdInfo;
|
|
916 |
instIdInfo.iCid.Copy(cid->Des());
|
|
917 |
instIdInfo.iUpdateNeeded = ETrue;
|
|
918 |
instIdInfo.iWizardPublished = EFalse;
|
|
919 |
iInstIdList.AppendL(instIdInfo);
|
|
920 |
}
|
|
921 |
TInt widgetInstance = GetWidgetInstanceId(cid->Des());
|
|
922 |
if(widgetInstance>=0)// coverity fix, index can be negativ, allowed 0, since it is valid index
|
|
923 |
{
|
|
924 |
iMailCpsHandler->UpdateMailboxesL(widgetInstance, cid->Des());
|
|
925 |
PublishSetupWizardL(widgetInstance);
|
|
926 |
// Widget visible on the homescreen. Publishing allowed.
|
|
927 |
iAllowedToPublish[widgetInstance] = ETrue;
|
|
928 |
}
|
|
929 |
CleanupStack::PopAndDestroy( cid );
|
|
930 |
}
|
|
931 |
else if (trigger.Compare(KPluginStartup16) == 0)
|
|
932 |
{
|
|
933 |
// Widget added to homescreen
|
|
934 |
HBufC* cid = contentid.AllocLC();
|
|
935 |
if ( cid->Length() > 0 )
|
|
936 |
{
|
|
937 |
TInstIdInfo instIdInfo;
|
|
938 |
instIdInfo.iCid.Copy(cid->Des());
|
|
939 |
instIdInfo.iUpdateNeeded = ETrue;
|
|
940 |
instIdInfo.iWizardPublished = EFalse;
|
|
941 |
iInstIdList.AppendL(instIdInfo);
|
|
942 |
TFSMailMsgId mailBox( iMailCpsHandler->WaitingForNewWidget() );
|
|
943 |
if ( mailBox.Id() > 0 )
|
|
944 |
{
|
|
945 |
// Associate new mailbox to widget setting
|
|
946 |
iMailCpsHandler->AssociateWidgetToSetting(
|
|
947 |
cid->Des(),
|
|
948 |
mailBox );
|
|
949 |
iMailCpsHandler->CleanWaitingForNewWidget();
|
|
950 |
}
|
|
951 |
else if ( iMailCpsHandler->TotalMailboxCountL() )
|
|
952 |
{
|
|
953 |
iMailCpsHandler->LaunchWidgetSettingsL(cid->Des());
|
|
954 |
}
|
|
955 |
else
|
|
956 |
{
|
|
957 |
iMailCpsHandler->LaunchEmailWizardL(cid->Des());
|
|
958 |
}
|
|
959 |
}
|
|
960 |
CleanupStack::PopAndDestroy( cid );
|
|
961 |
}
|
|
962 |
else if (trigger.Compare(KPluginShutdown16) == 0)
|
|
963 |
{
|
|
964 |
// Widget removed from homescreen.
|
|
965 |
HBufC* cid = contentid.AllocLC();
|
|
966 |
ResetPublishedDataL( cid->Des() );
|
|
967 |
iMailCpsHandler->DissociateWidgetFromSettingL( cid->Des() );
|
|
968 |
TInt widgetInstance = GetWidgetInstanceId( cid->Des() );
|
|
969 |
if (widgetInstance != KErrNotFound )
|
|
970 |
{
|
|
971 |
iInstIdList.Remove(widgetInstance);
|
|
972 |
}
|
|
973 |
CleanupStack::PopAndDestroy( cid );
|
|
974 |
}
|
|
975 |
else if (trigger.Compare(KTriggerEmailUi) == 0)
|
|
976 |
{
|
|
977 |
HBufC* cid = contentid.AllocLC();
|
|
978 |
iMailCpsHandler->LaunchEmailUIL(cid->Des());
|
|
979 |
CleanupStack::PopAndDestroy( cid );
|
|
980 |
}
|
|
981 |
else if ((trigger.Compare(KTriggerWizard) == 0) ||
|
|
982 |
( trigger.Compare(KSettings16) == 0))
|
|
983 |
{
|
|
984 |
// If no accounts are created launch email wizard
|
|
985 |
// otherwice launch widget settings app
|
|
986 |
HBufC* cid = contentid.AllocLC();
|
|
987 |
if ( iMailCpsHandler->TotalMailboxCountL() )
|
|
988 |
{
|
|
989 |
iMailCpsHandler->LaunchWidgetSettingsL(cid->Des());
|
|
990 |
}
|
|
991 |
else
|
|
992 |
{
|
|
993 |
iMailCpsHandler->LaunchEmailWizardL(cid->Des());
|
|
994 |
}
|
|
995 |
CleanupStack::PopAndDestroy( cid );
|
|
996 |
}
|
|
997 |
}
|
|
998 |
}
|
|
999 |
}
|
|
1000 |
}
|
|
1001 |
CleanupStack::PopAndDestroy(1);
|
|
1002 |
}
|
|
1003 |
return result;
|
|
1004 |
}
|
|
1005 |
|
|
1006 |
// ---------------------------------------------------------------------------
|
|
1007 |
// CMailCpsIf::AllowedToPublish
|
|
1008 |
// ---------------------------------------------------------------------------
|
|
1009 |
//
|
|
1010 |
TBool CMailCpsIf::AllowedToPublish( TInt aWidgetInstance )
|
|
1011 |
{
|
|
1012 |
FUNC_LOG;
|
|
1013 |
if ( !iAllowedToPublish[aWidgetInstance] && !iIgnoreHsNotifications )
|
|
1014 |
{
|
|
1015 |
return EFalse;
|
|
1016 |
}
|
|
1017 |
else
|
|
1018 |
{
|
|
1019 |
return ETrue;
|
|
1020 |
}
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
// ---------------------------------------------------------------------------
|
|
1024 |
// CMailCpsIf::SetConfiguration
|
|
1025 |
// ---------------------------------------------------------------------------
|
|
1026 |
//
|
|
1027 |
void CMailCpsIf::SetConfiguration( const TInt32 aConfigData )
|
|
1028 |
{
|
|
1029 |
FUNC_LOG;
|
|
1030 |
iIgnoreHsNotifications = aConfigData & KCMailIgnoreHsEvents;
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
// ---------------------------------------------------------------------------
|
|
1034 |
// CMailCpsIf::GetWidgetInstanceCount
|
|
1035 |
// ---------------------------------------------------------------------------
|
|
1036 |
//
|
|
1037 |
TInt CMailCpsIf::GetWidgetInstanceCount()
|
|
1038 |
{
|
|
1039 |
FUNC_LOG;
|
|
1040 |
return iInstIdList.Count();
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
|
|
1044 |
// ---------------------------------------------------------------------------
|
|
1045 |
// CMailCpsIf::GetWidgetInstanceId
|
|
1046 |
// ---------------------------------------------------------------------------
|
|
1047 |
//
|
|
1048 |
TInt CMailCpsIf::GetWidgetInstanceId( const TDesC& aContentId )
|
|
1049 |
{
|
|
1050 |
FUNC_LOG;
|
|
1051 |
TInt instance(KErrNotFound);
|
|
1052 |
for (TInt i = 0; i < iInstIdList.Count(); i++)
|
|
1053 |
{
|
|
1054 |
TInt val = aContentId.Compare(iInstIdList[i].iCid);
|
|
1055 |
if (!val)
|
|
1056 |
{
|
|
1057 |
instance = i;
|
|
1058 |
break;
|
|
1059 |
}
|
|
1060 |
}
|
|
1061 |
return instance;
|
|
1062 |
}
|
|
1063 |
|
|
1064 |
// ---------------------------------------------------------------------------
|
|
1065 |
// CMailCpsIf::ResetPublishedDataL
|
|
1066 |
// ---------------------------------------------------------------------------
|
|
1067 |
//
|
|
1068 |
void CMailCpsIf::ResetPublishedDataL( const TDesC& aContentId )
|
|
1069 |
{
|
|
1070 |
FUNC_LOG;
|
|
1071 |
// Clean up all published data
|
|
1072 |
if( iMsgInterface == NULL) GetMessagingInterfaceL(); // Coverity fix, it does not like !iMsgInterface comparison
|
|
1073 |
CLiwGenericParamList* inParam = &(iServiceHandler->InParamListL());
|
|
1074 |
CLiwGenericParamList* outParam = &(iServiceHandler->OutParamListL());
|
|
1075 |
|
|
1076 |
// Fill input param
|
|
1077 |
TLiwGenericParam cptype( KType, TLiwVariant( KCpData ));
|
|
1078 |
inParam->AppendL( cptype );
|
|
1079 |
|
|
1080 |
CLiwDefaultMap* cpData = CLiwDefaultMap::NewLC();
|
|
1081 |
cpData->InsertL( KPublisherId, TLiwVariant( KPubId ) );
|
|
1082 |
cpData->InsertL( KContentType, TLiwVariant( KCPAll ) );
|
|
1083 |
cpData->InsertL( KContentId, TLiwVariant( aContentId ) );
|
|
1084 |
TLiwGenericParam item( KData8, TLiwVariant( cpData ) );
|
|
1085 |
inParam->AppendL( item );
|
|
1086 |
|
|
1087 |
// Execute command
|
|
1088 |
if ( iMsgInterface )
|
|
1089 |
{
|
|
1090 |
iMsgInterface->ExecuteCmdL( KDelete , *inParam, *outParam );
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
CleanupStack::PopAndDestroy( cpData );
|
|
1094 |
item.Reset();
|
|
1095 |
cptype.Reset();
|
|
1096 |
outParam->Reset();
|
|
1097 |
inParam->Reset();
|
|
1098 |
}
|
|
1099 |
|
|
1100 |
// ---------------------------------------------------------------------------
|
|
1101 |
// CMailCpsIf::AddWidgetToHomescreenL
|
|
1102 |
// ---------------------------------------------------------------------------
|
|
1103 |
//
|
|
1104 |
void CMailCpsIf::AddWidgetToHomescreenL( const TFSMailMsgId aMailbox )
|
|
1105 |
{
|
|
1106 |
FUNC_LOG;
|
|
1107 |
|
|
1108 |
for ( TInt i = 0; i < iInstIdList.Count(); i++ )
|
|
1109 |
{
|
|
1110 |
if ( !iMailCpsHandler->Associated(iInstIdList[i].iCid) )
|
|
1111 |
{
|
|
1112 |
// Empty e-mail widget found. Associate new account to it.
|
|
1113 |
iMailCpsHandler->AssociateWidgetToSetting(
|
|
1114 |
iInstIdList[i].iCid,
|
|
1115 |
aMailbox );
|
|
1116 |
return;
|
|
1117 |
}
|
|
1118 |
}
|
|
1119 |
|
|
1120 |
CHsContentInfoArray* widgets = CHsContentInfoArray::NewL();
|
|
1121 |
CleanupStack::PushL( widgets );
|
|
1122 |
iContentControlClient->WidgetListL( *widgets );
|
|
1123 |
CHsContentInfo* widgetContentInfo( NULL );
|
|
1124 |
|
|
1125 |
for ( TInt i = 0; i < widgets->Array().Count(); i++ )
|
|
1126 |
{
|
|
1127 |
widgetContentInfo = widgets->Array()[i];
|
|
1128 |
if (!widgetContentInfo->Uid().Compare(KConfId8))
|
|
1129 |
{
|
|
1130 |
// E-mail widget found
|
|
1131 |
widgetContentInfo->SetCanBeRemoved( ETrue );
|
|
1132 |
if ( iContentControlClient->AddWidgetL( *widgetContentInfo ) == KErrNone )
|
|
1133 |
{
|
|
1134 |
// Widget added succesfully. Wait PluginStartup event from HS.
|
|
1135 |
iMailCpsHandler->SetWaitingForNewWidget( aMailbox );
|
|
1136 |
}
|
|
1137 |
else
|
|
1138 |
{
|
|
1139 |
iMailCpsHandler->DisplayHSPageFullNoteL();
|
|
1140 |
}
|
|
1141 |
break;
|
|
1142 |
}
|
|
1143 |
}
|
|
1144 |
CleanupStack::PopAndDestroy();
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
|
|
1148 |
// ---------------------------------------------------------------------------
|
|
1149 |
// CMailCpsIf::NotifyWidgetListChanged
|
|
1150 |
// ---------------------------------------------------------------------------
|
|
1151 |
//
|
|
1152 |
void CMailCpsIf::NotifyWidgetListChanged()
|
|
1153 |
{
|
|
1154 |
FUNC_LOG;
|
|
1155 |
}
|
|
1156 |
|
|
1157 |
// ---------------------------------------------------------------------------
|
|
1158 |
// CMailCpsIf::NotifyViewListChanged
|
|
1159 |
// ---------------------------------------------------------------------------
|
|
1160 |
//
|
|
1161 |
void CMailCpsIf::NotifyViewListChanged()
|
|
1162 |
{
|
|
1163 |
FUNC_LOG;
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// ---------------------------------------------------------------------------
|
|
1167 |
// CMailCpsIf::NotifyAppListChanged
|
|
1168 |
// ---------------------------------------------------------------------------
|
|
1169 |
//
|
|
1170 |
void CMailCpsIf::NotifyAppListChanged()
|
|
1171 |
{
|
|
1172 |
FUNC_LOG;
|
|
1173 |
}
|
|
1174 |
|
|
1175 |
// ---------------------------------------------------------------------------
|
|
1176 |
// CMailCpsIf::SetUpdateNeeded
|
|
1177 |
// ---------------------------------------------------------------------------
|
|
1178 |
//
|
|
1179 |
void CMailCpsIf::SetUpdateNeeded( const TInt aInstance, const TBool aValue )
|
|
1180 |
{
|
|
1181 |
FUNC_LOG;
|
|
1182 |
if ( aInstance >= 0 && aInstance < GetWidgetInstanceCount() )
|
|
1183 |
{
|
|
1184 |
iInstIdList[aInstance].iUpdateNeeded = aValue;
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
// ---------------------------------------------------------------------------
|
|
1189 |
// CMailCpsIf::UpdateNeeded
|
|
1190 |
// ---------------------------------------------------------------------------
|
|
1191 |
//
|
|
1192 |
TBool CMailCpsIf::UpdateNeeded( const TInt aInstance )
|
|
1193 |
{
|
|
1194 |
FUNC_LOG;
|
|
1195 |
TBool rVal( EFalse );
|
|
1196 |
if ( aInstance >= 0 && aInstance < GetWidgetInstanceCount() )
|
|
1197 |
{
|
|
1198 |
rVal = iInstIdList[aInstance].iUpdateNeeded;
|
|
1199 |
}
|
|
1200 |
INFO_1("CMAIL CMailCpsIf::UpdateNeeded(): ret = %d",rVal);
|
|
1201 |
return rVal;
|
|
1202 |
}
|
|
1203 |
|