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: Class to handle content publishing for widget
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <cmailhandlerplugin.mbg>
|
|
19 |
#include <ecom/ecom.h>
|
|
20 |
#include <StringLoader.h>
|
|
21 |
#include <emailwidget.rsg>
|
|
22 |
#include <AknUtils.h>
|
|
23 |
#include <apgcli.h>
|
|
24 |
#include <centralrepository.h>
|
|
25 |
#include <emailobserverinterface.hrh>
|
|
26 |
#include <emailobserverplugin.h>
|
|
27 |
#include <memaildata.h>
|
|
28 |
#include <memailmailboxdata.h>
|
|
29 |
#include <scs/cleanuputils.h> // CleanupResetAndDestroyPushL
|
|
30 |
|
|
31 |
#include "emailtrace.h"
|
|
32 |
#include "cfsmailclient.h"
|
|
33 |
#include "cfsmailbox.h"
|
|
34 |
#include "cfsmailfolder.h"
|
|
35 |
#include "cmailcpshandler.h"
|
|
36 |
#include "cmailcpssettings.h"
|
|
37 |
#include "cmailcpsif.h"
|
|
38 |
#include "cmailmessagedetails.h"
|
|
39 |
#include "cmailmailboxdetails.h"
|
|
40 |
#include "cmailexternalaccount.h"
|
|
41 |
#include "cmailcpsifconsts.h"
|
|
42 |
#include "FreestyleEmailUiConstants.h"
|
|
43 |
#include "cmailpluginproxy.h"
|
|
44 |
#include "cmailhandlerpluginpanic.h"
|
|
45 |
|
|
46 |
#include "fsemailserverpskeys.h"
|
|
47 |
|
|
48 |
using namespace EmailInterface;
|
|
49 |
|
|
50 |
// ---------------------------------------------------------
|
|
51 |
// CMailCpsHandler::CMailCpsHandler
|
|
52 |
// ---------------------------------------------------------
|
|
53 |
//
|
|
54 |
CMailCpsHandler::CMailCpsHandler( MFSNotificationHandlerMgr& aOwner ):
|
|
55 |
CFSNotificationHandlerBase( aOwner ),
|
|
56 |
iWaitingForNewMailbox( NULL ),
|
|
57 |
iWaitingForNewWidget(),
|
|
58 |
iUpdateHelper( NULL )
|
|
59 |
{
|
|
60 |
FUNC_LOG;
|
|
61 |
iWaitingForNewWidget.SetPluginId( KNullUid );
|
|
62 |
iWaitingForNewWidget.SetId( 0 );
|
|
63 |
}
|
|
64 |
|
|
65 |
// ---------------------------------------------------------
|
|
66 |
// CMailCpsHandler::NewL
|
|
67 |
// ---------------------------------------------------------
|
|
68 |
//
|
|
69 |
CMailCpsHandler* CMailCpsHandler::NewL( MFSNotificationHandlerMgr& aOwner )
|
|
70 |
{
|
|
71 |
FUNC_LOG;
|
|
72 |
CMailCpsHandler* self = new(ELeave) CMailCpsHandler( aOwner );
|
|
73 |
CleanupStack::PushL(self);
|
|
74 |
self->ConstructL();
|
|
75 |
CleanupStack::Pop( self );
|
|
76 |
return self;
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------
|
|
80 |
// CMailCpsHandler::ConstructL
|
|
81 |
// ---------------------------------------------------------
|
|
82 |
//
|
|
83 |
void CMailCpsHandler::ConstructL()
|
|
84 |
{
|
|
85 |
FUNC_LOG;
|
|
86 |
|
|
87 |
CFSNotificationHandlerBase::ConstructL();
|
|
88 |
|
|
89 |
iEnv = CEikonEnv::Static( );
|
|
90 |
|
|
91 |
SetObserving( ETrue );
|
|
92 |
|
|
93 |
// Instantiate helper classes
|
|
94 |
// Leaves if ContentPublishing service not found
|
|
95 |
iLiwIf = CMailCpsIf::NewL(this);
|
|
96 |
// Leaves if CenRep file not found
|
|
97 |
iSettings = CMailCpsSettings::NewL( MailClient() );
|
|
98 |
|
|
99 |
InitializeL();
|
|
100 |
InitializeExternalAccountsL();
|
|
101 |
|
|
102 |
iSettings->StartObservingL( this );
|
|
103 |
|
|
104 |
TInt err = RProperty::Define( KPSUidEmailServerCategory,
|
|
105 |
KIntMailboxCount,
|
|
106 |
RProperty::EInt );
|
|
107 |
if ( err != KErrAlreadyExists && err != KErrNone )
|
|
108 |
{
|
|
109 |
User::LeaveIfError( err );
|
|
110 |
}
|
|
111 |
|
|
112 |
// set mailbox initial count
|
|
113 |
TInt intCount = TotalIntMailboxCount();
|
|
114 |
User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
|
|
115 |
}
|
|
116 |
|
|
117 |
// ---------------------------------------------------------
|
|
118 |
// CMailCpsHandler::~CMailCpsHandler
|
|
119 |
// ---------------------------------------------------------
|
|
120 |
//
|
|
121 |
CMailCpsHandler::~CMailCpsHandler()
|
|
122 |
{
|
|
123 |
FUNC_LOG;
|
|
124 |
delete iUpdateHelper;
|
|
125 |
delete iLiwIf;
|
|
126 |
delete iSettings;
|
|
127 |
iAccountsArray.ResetAndDestroy();
|
|
128 |
iExternalPlugins.ResetAndDestroy();
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------
|
|
132 |
// CMailCpsHandler::Reset
|
|
133 |
// ---------------------------------------------------------
|
|
134 |
//
|
|
135 |
void CMailCpsHandler::Reset()
|
|
136 |
{
|
|
137 |
FUNC_LOG;
|
|
138 |
iAccountsArray.ResetAndDestroy();
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------
|
|
142 |
// CMailCpsHandler::InitializeL
|
|
143 |
// ---------------------------------------------------------
|
|
144 |
//
|
|
145 |
void CMailCpsHandler::InitializeL()
|
|
146 |
{
|
|
147 |
FUNC_LOG;
|
|
148 |
// Get current configuration from settings interface,
|
|
149 |
// and pass it on to actual publisher interface
|
|
150 |
|
|
151 |
iLiwIf->SetConfiguration( iSettings->Configuration() );
|
|
152 |
TInt iiMax( iSettings->Mailboxes().Count() );
|
|
153 |
INFO_1("iSettings->Mailboxes().Count() = %d", iiMax );
|
|
154 |
for ( TInt ii = 0; ii < iiMax; ii++ )
|
|
155 |
{
|
|
156 |
CFSMailBox* mailbox( NULL );
|
|
157 |
mailbox = MailClient().GetMailBoxByUidL( iSettings->Mailboxes()[ii] );
|
|
158 |
|
|
159 |
TInt mailboxId(0);
|
|
160 |
if (mailbox)
|
|
161 |
{
|
|
162 |
CleanupStack::PushL( mailbox );
|
|
163 |
mailboxId = mailbox->GetId().Id();
|
|
164 |
if ( mailboxId )
|
|
165 |
{
|
|
166 |
CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox );
|
|
167 |
CleanupStack::PushL( mailboxDetails );
|
|
168 |
|
|
169 |
TBuf<KMaxDescLen> cid;
|
|
170 |
TInt next(1);
|
|
171 |
|
|
172 |
// Check if same mailbox is already in iAccountsArray once or more
|
|
173 |
for ( TInt i = 0; i < iAccountsArray.Count(); i++ )
|
|
174 |
{
|
|
175 |
TInt id = (TInt)iAccountsArray[i]->iMailboxId.Id();
|
|
176 |
if (id == mailboxId)
|
|
177 |
{
|
|
178 |
next++;
|
|
179 |
}
|
|
180 |
}
|
|
181 |
iSettings->GetContentId(mailboxId, next, cid);
|
|
182 |
mailboxDetails->SetWidgetInstance(cid);
|
|
183 |
iAccountsArray.AppendL( mailboxDetails );
|
|
184 |
CleanupStack::Pop( mailboxDetails );
|
|
185 |
}
|
|
186 |
CleanupStack::PopAndDestroy( mailbox );
|
|
187 |
}
|
|
188 |
}
|
|
189 |
INFO_1("iAccountsArray.Count() = %d", iAccountsArray.Count() );
|
|
190 |
}
|
|
191 |
|
|
192 |
// ---------------------------------------------------------
|
|
193 |
// CMailCpsHandler::InitializeExternalAccountsL
|
|
194 |
// ---------------------------------------------------------
|
|
195 |
//
|
|
196 |
void CMailCpsHandler::InitializeExternalAccountsL()
|
|
197 |
{
|
|
198 |
FUNC_LOG;
|
|
199 |
// Read external account data from settings
|
|
200 |
RPointerArray<CMailExternalAccount> extAccounts;
|
|
201 |
CleanupResetAndDestroyPushL( extAccounts ); // owning - GetExtMailboxesL transfers ownership
|
|
202 |
iSettings->GetExtMailboxesL( extAccounts );
|
|
203 |
|
|
204 |
// Delete removed plugins
|
|
205 |
RemoveUnusedPluginsL( extAccounts );
|
|
206 |
|
|
207 |
// Instantiate new plugins
|
|
208 |
AddNewPluginsL( extAccounts );
|
|
209 |
|
|
210 |
// Set accounts under correct pluginProxies
|
|
211 |
SelectAndUpdateExtAccountsL( extAccounts );
|
|
212 |
|
|
213 |
__ASSERT_DEBUG( extAccounts.Count() == 0, Panic( ECmailHandlerPluginPanicNoFailedState ) );
|
|
214 |
CleanupStack::PopAndDestroy( &extAccounts );
|
|
215 |
}
|
|
216 |
|
|
217 |
// ---------------------------------------------------------
|
|
218 |
// CMailCpsHandler::RemoveUnusedPluginsL
|
|
219 |
// ---------------------------------------------------------
|
|
220 |
//
|
|
221 |
void CMailCpsHandler::RemoveUnusedPluginsL( RPointerArray<CMailExternalAccount>& aAccounts )
|
|
222 |
{
|
|
223 |
FUNC_LOG;
|
|
224 |
for ( TInt i = 0; i < iExternalPlugins.Count(); i++ )
|
|
225 |
{
|
|
226 |
if ( !IsPluginInArray( iExternalPlugins[i]->PluginId(), aAccounts ) )
|
|
227 |
{
|
|
228 |
// all plugin's accounts have been removed from widget settings, unloading resources
|
|
229 |
CMailPluginProxy* proxy = iExternalPlugins[i];
|
|
230 |
iExternalPlugins.Remove(i--); // also change the loop index
|
|
231 |
delete proxy;
|
|
232 |
}
|
|
233 |
}
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------
|
|
237 |
// CMailCpsHandler::AddNewPluginsL
|
|
238 |
// ---------------------------------------------------------
|
|
239 |
//
|
|
240 |
void CMailCpsHandler::AddNewPluginsL( RPointerArray<CMailExternalAccount>& aAccounts )
|
|
241 |
{
|
|
242 |
FUNC_LOG;
|
|
243 |
for ( TInt i = 0; i < aAccounts.Count(); i++ )
|
|
244 |
{
|
|
245 |
if ( !IsPluginInArray( aAccounts[i]->PluginId(), iExternalPlugins ) )
|
|
246 |
{
|
|
247 |
// new plugin instantiation
|
|
248 |
INFO_1("Instantiating plugin 0x%x", aAccounts[i]->PluginId() );
|
|
249 |
CMailPluginProxy* proxy = CMailPluginProxy::NewL( aAccounts[i]->PluginId(), *iLiwIf );
|
|
250 |
CleanupStack::PushL( proxy );
|
|
251 |
iExternalPlugins.AppendL( proxy );
|
|
252 |
CleanupStack::Pop( proxy );
|
|
253 |
}
|
|
254 |
}
|
|
255 |
}
|
|
256 |
|
|
257 |
// ---------------------------------------------------------
|
|
258 |
// CMailCpsHandler::UpdateExtAccountsL
|
|
259 |
// ---------------------------------------------------------
|
|
260 |
//
|
|
261 |
void CMailCpsHandler::SelectAndUpdateExtAccountsL( RPointerArray<CMailExternalAccount>& aAccounts )
|
|
262 |
{
|
|
263 |
FUNC_LOG;
|
|
264 |
for ( TInt i = 0; i < iExternalPlugins.Count(); i++ )
|
|
265 |
{
|
|
266 |
iExternalPlugins[i]->SelectAndUpdateAccountsL( aAccounts );
|
|
267 |
}
|
|
268 |
}
|
|
269 |
|
|
270 |
// ---------------------------------------------------------
|
|
271 |
// CMailCpsHandler::IsPluginInArray
|
|
272 |
// ---------------------------------------------------------
|
|
273 |
//
|
|
274 |
TBool CMailCpsHandler::IsPluginInArray( const TInt aPluginId, RPointerArray<CMailExternalAccount>& aAccounts )
|
|
275 |
{
|
|
276 |
FUNC_LOG;
|
|
277 |
TBool found( EFalse );
|
|
278 |
for ( TInt i = 0; i < aAccounts.Count(); i++ )
|
|
279 |
{
|
|
280 |
if ( aAccounts[i]->PluginId() == aPluginId )
|
|
281 |
{
|
|
282 |
found = ETrue;
|
|
283 |
}
|
|
284 |
}
|
|
285 |
return found;
|
|
286 |
}
|
|
287 |
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
// CMailCpsHandler::IsPluginInArray
|
|
290 |
// ---------------------------------------------------------
|
|
291 |
//
|
|
292 |
TBool CMailCpsHandler::IsPluginInArray( const TInt aPluginId, RPointerArray<CMailPluginProxy>& aPlugins )
|
|
293 |
{
|
|
294 |
FUNC_LOG;
|
|
295 |
TBool found( EFalse );
|
|
296 |
for ( TInt i = 0; i < aPlugins.Count(); i++ )
|
|
297 |
{
|
|
298 |
if ( aPlugins[i]->PluginId() == aPluginId )
|
|
299 |
{
|
|
300 |
found = ETrue;
|
|
301 |
}
|
|
302 |
}
|
|
303 |
return found;
|
|
304 |
}
|
|
305 |
|
|
306 |
// ---------------------------------------------------------
|
|
307 |
// CMailCpsHandler::CreateMailboxDetailsL
|
|
308 |
// ---------------------------------------------------------
|
|
309 |
//
|
|
310 |
CMailMailboxDetails* CMailCpsHandler::CreateMailboxDetailsL( CFSMailBox& aMailbox )
|
|
311 |
{
|
|
312 |
FUNC_LOG;
|
|
313 |
// Create instance to return
|
|
314 |
CMailMailboxDetails* details =
|
|
315 |
CMailMailboxDetails::NewL( aMailbox.GetId(), aMailbox.GetName() );
|
|
316 |
return details;
|
|
317 |
}
|
|
318 |
|
|
319 |
// ---------------------------------------------------------
|
|
320 |
// CMailCpsHandler::SettingsChangedCallback
|
|
321 |
// ---------------------------------------------------------
|
|
322 |
//
|
|
323 |
void CMailCpsHandler::SettingsChangedCallback()
|
|
324 |
{
|
|
325 |
FUNC_LOG;
|
|
326 |
Reset();
|
|
327 |
// Trying to keep callback interface non-leaving
|
|
328 |
TRAP_IGNORE( InitializeL() );
|
|
329 |
TRAP_IGNORE( InitializeExternalAccountsL() );
|
|
330 |
// Update widget contents after settings change
|
|
331 |
TInt count = iLiwIf->GetWidgetInstanceCount();
|
|
332 |
for (TInt i = 0; i < count; i++ )
|
|
333 |
{
|
|
334 |
iLiwIf->SetUpdateNeeded( i, ETrue );
|
|
335 |
}
|
|
336 |
TRAP_IGNORE( UpdateFullL() );
|
|
337 |
CleanWaitingForNewMailbox();
|
|
338 |
}
|
|
339 |
|
|
340 |
// ---------------------------------------------------------
|
|
341 |
// CMailCpsHandler::SetUpdateNeeded
|
|
342 |
// ---------------------------------------------------------
|
|
343 |
//
|
|
344 |
void CMailCpsHandler::SetUpdateNeeded( const TFSMailMsgId aMailbox )
|
|
345 |
{
|
|
346 |
FUNC_LOG;
|
|
347 |
TInt count = iSettings->WidgetCountByMailbox( aMailbox.Id() );
|
|
348 |
for (TInt i = 0; i < count; i++ )
|
|
349 |
{
|
|
350 |
TBuf<KMaxDescLen> cid;
|
|
351 |
iSettings->GetContentId( aMailbox.Id(), i + 1, cid );
|
|
352 |
TInt widgetInstance = iLiwIf->GetWidgetInstanceId( cid );
|
|
353 |
if ( widgetInstance != KErrNotFound )
|
|
354 |
{
|
|
355 |
iLiwIf->SetUpdateNeeded( widgetInstance, ETrue );
|
|
356 |
}
|
|
357 |
}
|
|
358 |
}
|
|
359 |
|
|
360 |
// ---------------------------------------------------------
|
|
361 |
// CMailCpsHandler::UpdateFullL
|
|
362 |
// ---------------------------------------------------------
|
|
363 |
//
|
|
364 |
void CMailCpsHandler::UpdateFullL()
|
|
365 |
{
|
|
366 |
FUNC_LOG;
|
|
367 |
if ( !iUpdateHelper )
|
|
368 |
{
|
|
369 |
iUpdateHelper = CMailCpsUpdateHelper::NewL( this );
|
|
370 |
}
|
|
371 |
iUpdateHelper->UpdateL();
|
|
372 |
}
|
|
373 |
|
|
374 |
// ---------------------------------------------------------
|
|
375 |
// CMailCpsHandler::DoUpdateFullL
|
|
376 |
// ---------------------------------------------------------
|
|
377 |
//
|
|
378 |
void CMailCpsHandler::DoUpdateFullL()
|
|
379 |
{
|
|
380 |
FUNC_LOG;
|
|
381 |
for (TInt instance = 0; instance < iLiwIf->GetWidgetInstanceCount(); instance++)
|
|
382 |
{
|
|
383 |
if ( iLiwIf->AllowedToPublish(instance) )
|
|
384 |
{
|
|
385 |
UpdateMailboxesL(instance, iLiwIf->iInstIdList[instance].iCid);
|
|
386 |
}
|
|
387 |
}
|
|
388 |
}
|
|
389 |
|
|
390 |
// ---------------------------------------------------------
|
|
391 |
// CMailCpsHandler::UpdateMailboxesL
|
|
392 |
// ---------------------------------------------------------
|
|
393 |
//
|
|
394 |
void CMailCpsHandler::UpdateMailboxesL(TInt aInstance, const TDesC& aContentId)
|
|
395 |
{
|
|
396 |
FUNC_LOG;
|
|
397 |
// Look up 3rd party plugin that handles this account
|
|
398 |
CMailPluginProxy* plugin = GetExtPluginL( aContentId );
|
|
399 |
if ( plugin ) // handle external 3rd party accounts
|
|
400 |
{
|
|
401 |
// Publish its data
|
|
402 |
plugin->UpdateAccountL( aContentId );
|
|
403 |
}
|
|
404 |
else // handle internal accounts
|
|
405 |
{
|
|
406 |
if ( iLiwIf->UpdateNeeded( aInstance ) )
|
|
407 |
{
|
|
408 |
TInt row(1); // start from first row
|
|
409 |
TInt mailbox(0);
|
|
410 |
TBool found( EFalse );
|
|
411 |
// try to find mailbox with matching contentId
|
|
412 |
for ( mailbox = 0; mailbox < iAccountsArray.Count(); mailbox++ )
|
|
413 |
{
|
|
414 |
if ( !aContentId.Compare( *iAccountsArray[mailbox]->iWidgetInstance ) )
|
|
415 |
{
|
|
416 |
INFO_1("iAccountsArray[mailbox] mailbox = %d", mailbox);
|
|
417 |
found = ETrue;
|
|
418 |
break;
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
// if contentId found from array, update the mailbox
|
|
423 |
if ( found )
|
|
424 |
{
|
|
425 |
INFO_1("found = TRUE iAccountsArray.Count() == %d", iAccountsArray.Count());
|
|
426 |
// Update fields from left to right
|
|
427 |
UpdateMailBoxIconL( mailbox, aInstance, row );
|
|
428 |
UpdateMailboxNameL( mailbox, aInstance, row );
|
|
429 |
UpdateIndicatorIconL( mailbox, aInstance, row );
|
|
430 |
row++;
|
|
431 |
UpdateMessagesL( mailbox, aInstance, 1, row);
|
|
432 |
row++;
|
|
433 |
UpdateMessagesL( mailbox, aInstance, 2, row);
|
|
434 |
}
|
|
435 |
else
|
|
436 |
{
|
|
437 |
INFO_1("found = FALSE iAccountsArray.Count() == %d", iAccountsArray.Count());
|
|
438 |
// Clean mailbox name
|
|
439 |
iLiwIf->PublishActiveMailboxNameL( aInstance, 1, KNullDesC );
|
|
440 |
// Clean mailbox icon
|
|
441 |
TFSMailMsgId mailBoxId; // id not essential here
|
|
442 |
iLiwIf->PublishMailboxIconL( aInstance, 1, KNullIcon, mailBoxId);
|
|
443 |
// Clean indicator icon
|
|
444 |
iLiwIf->PublishIndicatorIconL( aInstance, 1, KNullIcon);
|
|
445 |
// Clean message rows
|
|
446 |
UpdateEmptyMessagesL( aInstance, 2 );
|
|
447 |
UpdateEmptyMessagesL( aInstance, 3 );
|
|
448 |
}
|
|
449 |
iLiwIf->SetUpdateNeeded( aInstance, EFalse );
|
|
450 |
}
|
|
451 |
}
|
|
452 |
}
|
|
453 |
|
|
454 |
// ---------------------------------------------------------
|
|
455 |
// CMailCpsHandler::UpdateMailboxNameL
|
|
456 |
// ---------------------------------------------------------
|
|
457 |
//
|
|
458 |
void CMailCpsHandler::UpdateMailboxNameL( const TInt aMailBoxNumber,
|
|
459 |
const TInt aWidgetInstance,
|
|
460 |
const TInt aRowNumber )
|
|
461 |
{
|
|
462 |
FUNC_LOG;
|
|
463 |
TFSMailMsgId mailBoxId;
|
|
464 |
TFSMailMsgId folderId;
|
|
465 |
TBool mailBoxFound(EFalse);
|
|
466 |
if ( aMailBoxNumber < iAccountsArray.Count() )
|
|
467 |
{
|
|
468 |
mailBoxId = iAccountsArray[aMailBoxNumber]->iMailboxId;
|
|
469 |
CFSMailBox* mailbox( NULL );
|
|
470 |
mailbox = MailClient().GetMailBoxByUidL( mailBoxId );
|
|
471 |
|
|
472 |
if(mailbox)
|
|
473 |
{
|
|
474 |
mailBoxFound = ETrue;
|
|
475 |
TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) );
|
|
476 |
delete mailbox;
|
|
477 |
|
|
478 |
TBuf<KMaxDescLen> accountName;
|
|
479 |
accountName.Append(*iAccountsArray[aMailBoxNumber]->iMailboxName);
|
|
480 |
|
|
481 |
TInt unreadCount(GetUnreadCountL(iAccountsArray[aMailBoxNumber]->iMailboxId));
|
|
482 |
if ( unreadCount > 0 )
|
|
483 |
{
|
|
484 |
// Use localisation format when displaying also unread messages
|
|
485 |
|
|
486 |
// Arrays must be used when loc string contains indexed parameters
|
|
487 |
CDesCArrayFlat* strings = new( ELeave) CDesCArrayFlat( 1 );
|
|
488 |
CleanupStack::PushL( strings );
|
|
489 |
strings->AppendL( accountName ); // replace "%0U" with mailbox name
|
|
490 |
|
|
491 |
CArrayFix<TInt>* ints = new(ELeave) CArrayFixFlat<TInt>( 1 );
|
|
492 |
CleanupStack::PushL( ints );
|
|
493 |
ints->AppendL( unreadCount ); // replace "%1N" with number of unread messages
|
|
494 |
|
|
495 |
HBufC* mailboxAndCount = StringLoader::LoadLC( R_EMAILWIDGET_TEXT_MAILBOX_AND_MAILCOUNT,
|
|
496 |
*strings,
|
|
497 |
*ints );
|
|
498 |
|
|
499 |
iLiwIf->PublishActiveMailboxNameL(
|
|
500 |
aWidgetInstance,
|
|
501 |
aRowNumber, *mailboxAndCount);
|
|
502 |
|
|
503 |
CleanupStack::PopAndDestroy(mailboxAndCount);
|
|
504 |
CleanupStack::PopAndDestroy(ints);
|
|
505 |
CleanupStack::PopAndDestroy(strings);
|
|
506 |
}
|
|
507 |
else
|
|
508 |
{
|
|
509 |
// show only mailbox name
|
|
510 |
|
|
511 |
iLiwIf->PublishActiveMailboxNameL(
|
|
512 |
aWidgetInstance,
|
|
513 |
aRowNumber, accountName);
|
|
514 |
}
|
|
515 |
}
|
|
516 |
}
|
|
517 |
else if(!mailBoxFound)
|
|
518 |
{
|
|
519 |
// Publishing empty descriptor for rows that should not contain
|
|
520 |
// anything on widget UI.
|
|
521 |
iLiwIf->PublishActiveMailboxNameL( aWidgetInstance,
|
|
522 |
aRowNumber,
|
|
523 |
KNullDesC);
|
|
524 |
}
|
|
525 |
}
|
|
526 |
|
|
527 |
|
|
528 |
// ---------------------------------------------------------
|
|
529 |
// CMailCpsHandler::UpdateMessagesL
|
|
530 |
// ---------------------------------------------------------
|
|
531 |
//
|
|
532 |
void CMailCpsHandler::UpdateMessagesL( const TInt aMailBoxNumber,
|
|
533 |
const TInt aWidgetInstance,
|
|
534 |
const TInt aMessageNumber,
|
|
535 |
const TInt aRow )
|
|
536 |
{
|
|
537 |
FUNC_LOG;
|
|
538 |
|
|
539 |
if ( aMailBoxNumber < iAccountsArray.Count() )
|
|
540 |
{
|
|
541 |
TFSMailMsgId mailBoxId;
|
|
542 |
mailBoxId = iAccountsArray[aMailBoxNumber]->iMailboxId;
|
|
543 |
|
|
544 |
CFSMailBox* mailbox( NULL );
|
|
545 |
mailbox = MailClient().GetMailBoxByUidL( mailBoxId ); // transferred ownership
|
|
546 |
if(mailbox)
|
|
547 |
{
|
|
548 |
TFSMailMsgId parentFolder( mailbox->GetStandardFolderId( EFSInbox ) );
|
|
549 |
delete mailbox;
|
|
550 |
// Check that folder is correct
|
|
551 |
CFSMailFolder* folder = MailClient().GetFolderByUidL( mailBoxId, parentFolder );
|
|
552 |
if ( !folder )
|
|
553 |
{
|
|
554 |
UpdateEmptyMessagesL( aWidgetInstance, aRow );
|
|
555 |
return;
|
|
556 |
}
|
|
557 |
CleanupStack::PushL( folder );
|
|
558 |
|
|
559 |
TInt msgCount = folder->GetMessageCount();
|
|
560 |
|
|
561 |
if(msgCount<1 || (msgCount == 1 && aRow == 3))
|
|
562 |
{
|
|
563 |
UpdateEmptyMessagesL( aWidgetInstance, aRow );
|
|
564 |
CleanupStack::PopAndDestroy( folder );
|
|
565 |
return;
|
|
566 |
}
|
|
567 |
|
|
568 |
folder->SetFolderType(EFSInbox);
|
|
569 |
|
|
570 |
// Update folder if provided, otherwise use current folder
|
|
571 |
RPointerArray<CFSMailMessage> folderMessages(1);
|
|
572 |
CleanupResetAndDestroyPushL( folderMessages ); // owning array, from emailapiutils.h
|
|
573 |
|
|
574 |
TFSMailDetails details( EFSMsgDataEnvelope );
|
|
575 |
RArray<TFSMailSortCriteria> sorting;
|
|
576 |
CleanupClosePushL( sorting );
|
|
577 |
|
|
578 |
TFSMailSortCriteria sortCriteria;
|
|
579 |
sortCriteria.iField = EFSMailSortByDate;
|
|
580 |
sortCriteria.iOrder = EFSMailDescending;
|
|
581 |
sorting.Append( sortCriteria );
|
|
582 |
// List all or maximum number of messages
|
|
583 |
MFSMailIterator* iterator = folder->ListMessagesL( details, sorting );
|
|
584 |
CleanupDeletePushL( iterator ); // standard CleanupStack::PushL does not work with non-C-class pointer
|
|
585 |
|
|
586 |
TFSMailMsgId dummy;
|
|
587 |
iterator->NextL( dummy, aMessageNumber, folderMessages);
|
|
588 |
TInt count (folderMessages.Count());
|
|
589 |
if(!count || (count == 1 && aRow == 3))
|
|
590 |
{
|
|
591 |
UpdateEmptyMessagesL( aWidgetInstance, aRow );
|
|
592 |
|
|
593 |
CleanupStack::PopAndDestroy( iterator );
|
|
594 |
CleanupStack::PopAndDestroy( &sorting );
|
|
595 |
CleanupStack::PopAndDestroy( &folderMessages );
|
|
596 |
CleanupStack::PopAndDestroy( folder );
|
|
597 |
return;
|
|
598 |
}
|
|
599 |
TFSMailMsgId msgId = folderMessages[aMessageNumber - 1]->GetMessageId();
|
|
600 |
|
|
601 |
CFSMailMessage* msg( NULL );
|
|
602 |
msg = MailClient().GetMessageByUidL( mailBoxId, parentFolder, msgId, EFSMsgDataEnvelope );
|
|
603 |
CleanupDeletePushL( msg );
|
|
604 |
|
|
605 |
// Get sender information
|
|
606 |
TBuf<KMaxDescLen> sender( NULL );
|
|
607 |
TBuf<KMaxDescLen> subject( NULL );
|
|
608 |
subject.Append(msg->GetSubject());
|
|
609 |
CFSMailAddress* fromAddress = msg->GetSender();
|
|
610 |
if ( fromAddress )
|
|
611 |
{
|
|
612 |
if ( IsValidDisplayName(fromAddress->GetDisplayName()) )
|
|
613 |
{
|
|
614 |
sender.Append(fromAddress->GetDisplayName());
|
|
615 |
}
|
|
616 |
else
|
|
617 |
{
|
|
618 |
sender.Append(fromAddress->GetEmailAddress());
|
|
619 |
}
|
|
620 |
}
|
|
621 |
|
|
622 |
// Get message time and format it correctly
|
|
623 |
TTime msgTime = msg->GetDate();
|
|
624 |
HBufC* timeString( NULL );
|
|
625 |
timeString = GetMessageTimeStringL( msgTime );
|
|
626 |
CleanupDeletePushL( timeString );
|
|
627 |
|
|
628 |
// Publish message details
|
|
629 |
PublishMessageL( aWidgetInstance,
|
|
630 |
*msg,
|
|
631 |
sender,
|
|
632 |
subject,
|
|
633 |
*timeString,
|
|
634 |
aRow );
|
|
635 |
|
|
636 |
CleanupStack::PopAndDestroy( timeString );
|
|
637 |
CleanupStack::PopAndDestroy( msg );
|
|
638 |
CleanupStack::PopAndDestroy( iterator );
|
|
639 |
CleanupStack::PopAndDestroy( &sorting );
|
|
640 |
CleanupStack::PopAndDestroy( &folderMessages );
|
|
641 |
CleanupStack::PopAndDestroy( folder );
|
|
642 |
}
|
|
643 |
}
|
|
644 |
}
|
|
645 |
|
|
646 |
|
|
647 |
// ---------------------------------------------------------
|
|
648 |
// CMailCpsHandler::GetMessageTimeStringL
|
|
649 |
// ---------------------------------------------------------
|
|
650 |
//
|
|
651 |
HBufC* CMailCpsHandler::GetMessageTimeStringL( TTime aMessageTime )
|
|
652 |
{
|
|
653 |
FUNC_LOG;
|
|
654 |
|
|
655 |
// Get current local time
|
|
656 |
TTime currentTime;
|
|
657 |
currentTime.HomeTime();
|
|
658 |
|
|
659 |
// Get universal time offset and add it to message time
|
|
660 |
TLocale locale;
|
|
661 |
TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
|
|
662 |
aMessageTime += universalTimeOffset;
|
|
663 |
|
|
664 |
// If daylight saving is on, add one hour offset to message time
|
|
665 |
if ( locale.QueryHomeHasDaylightSavingOn() )
|
|
666 |
{
|
|
667 |
TTimeIntervalHours daylightSaving( 1 );
|
|
668 |
aMessageTime += daylightSaving;
|
|
669 |
}
|
|
670 |
|
|
671 |
// Get datetime objects and compare dates
|
|
672 |
TDateTime currentDate = currentTime.DateTime();
|
|
673 |
TDateTime messageDate = aMessageTime.DateTime();
|
|
674 |
HBufC* formatString( NULL );
|
|
675 |
|
|
676 |
if ( currentDate.Year() == messageDate.Year()
|
|
677 |
&& currentDate.Month() == messageDate.Month()
|
|
678 |
&& currentDate.Day() == messageDate.Day())
|
|
679 |
{
|
|
680 |
// Message arrived today
|
|
681 |
formatString = StringLoader::LoadLC( R_QTN_TIME_USUAL_WITH_ZERO );
|
|
682 |
}
|
|
683 |
else
|
|
684 |
{
|
|
685 |
// Message arrived earlier than today
|
|
686 |
formatString = StringLoader::LoadLC( R_QTN_DATE_WITHOUT_YEAR_WITH_ZERO );
|
|
687 |
}
|
|
688 |
|
|
689 |
// Format time string using chosen time or date formatString
|
|
690 |
TBuf<KMaxShortDateFormatSpec*2> timeString;
|
|
691 |
TRAP_IGNORE( aMessageTime.FormatL( timeString, formatString->Des() ) );
|
|
692 |
CleanupStack::PopAndDestroy( formatString );
|
|
693 |
// If format fails, result is empty
|
|
694 |
|
|
695 |
HBufC* result = timeString.Alloc();
|
|
696 |
TPtr ptr = result->Des();
|
|
697 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
|
|
698 |
return result;
|
|
699 |
}
|
|
700 |
|
|
701 |
|
|
702 |
// ---------------------------------------------------------
|
|
703 |
// CMailCpsHandler::PublishMessageL
|
|
704 |
//
|
|
705 |
// ---------------------------------------------------------
|
|
706 |
//
|
|
707 |
void CMailCpsHandler::PublishMessageL( TInt aWidgetInstance, CFSMailMessage& aMessage,
|
|
708 |
const TDesC& aSenderName, const TDesC& aSubject,
|
|
709 |
const TDesC& aTime, TInt aRow )
|
|
710 |
{
|
|
711 |
FUNC_LOG;
|
|
712 |
|
|
713 |
TFSMailMsgId msgId( aMessage.GetMessageId() );
|
|
714 |
|
|
715 |
iLiwIf->PublishMailboxIconL( aWidgetInstance, aRow, GetMailIcon( &aMessage ), msgId );
|
|
716 |
iLiwIf->PublishMailDetailL( aWidgetInstance, aRow, aSenderName, ESender );
|
|
717 |
iLiwIf->PublishMailDetailL( aWidgetInstance, aRow, aSubject, ESubject );
|
|
718 |
iLiwIf->PublishMailDetailL( aWidgetInstance, aRow, aTime, ETime );
|
|
719 |
}
|
|
720 |
|
|
721 |
// ---------------------------------------------------------
|
|
722 |
// CMailCpsHandler::UpdateEmptyMessagesL
|
|
723 |
//
|
|
724 |
// ---------------------------------------------------------
|
|
725 |
//
|
|
726 |
void CMailCpsHandler::UpdateEmptyMessagesL( const TInt aWidgetInstance,
|
|
727 |
const TInt aRow )
|
|
728 |
{
|
|
729 |
FUNC_LOG;
|
|
730 |
|
|
731 |
TFSMailMsgId mailBoxId; // id not essential here
|
|
732 |
|
|
733 |
iLiwIf->PublishMailDetailL(
|
|
734 |
aWidgetInstance,
|
|
735 |
aRow,
|
|
736 |
KNullDes,
|
|
737 |
ESender);
|
|
738 |
|
|
739 |
iLiwIf->PublishMailDetailL(
|
|
740 |
aWidgetInstance,
|
|
741 |
aRow,
|
|
742 |
KNullDes,
|
|
743 |
ESubject);
|
|
744 |
|
|
745 |
iLiwIf->PublishMailboxIconL(
|
|
746 |
aWidgetInstance,
|
|
747 |
aRow,
|
|
748 |
KNullIcon,
|
|
749 |
mailBoxId);
|
|
750 |
|
|
751 |
iLiwIf->PublishMailDetailL(
|
|
752 |
aWidgetInstance,
|
|
753 |
aRow,
|
|
754 |
KNullDes,
|
|
755 |
ETime);
|
|
756 |
}
|
|
757 |
|
|
758 |
// ---------------------------------------------------------
|
|
759 |
// CMailCpsHandler::UpdateMailBoxIconL
|
|
760 |
// ---------------------------------------------------------
|
|
761 |
//
|
|
762 |
void CMailCpsHandler::UpdateMailBoxIconL( const TInt aMailBoxNumber,
|
|
763 |
const TInt aWidgetInstance,
|
|
764 |
const TInt aRowNumber )
|
|
765 |
{
|
|
766 |
FUNC_LOG;
|
|
767 |
|
|
768 |
TFSMailMsgId mailBoxId; // id required only for getting branded mailbox icon
|
|
769 |
|
|
770 |
if ( aMailBoxNumber < iAccountsArray.Count() )
|
|
771 |
{
|
|
772 |
mailBoxId = iAccountsArray[aMailBoxNumber]->iMailboxId;
|
|
773 |
iLiwIf->PublishMailboxIconL( aWidgetInstance,
|
|
774 |
aRowNumber,
|
|
775 |
EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
|
|
776 |
mailBoxId);
|
|
777 |
}
|
|
778 |
else
|
|
779 |
{
|
|
780 |
iLiwIf->PublishMailboxIconL( aWidgetInstance, aRowNumber, KNullIcon, mailBoxId);
|
|
781 |
}
|
|
782 |
}
|
|
783 |
|
|
784 |
// ---------------------------------------------------------
|
|
785 |
// CMailCpsHandler::UpdateIndicatorIconL
|
|
786 |
// ---------------------------------------------------------
|
|
787 |
//
|
|
788 |
void CMailCpsHandler::UpdateIndicatorIconL( const TInt aMailBoxNumber,
|
|
789 |
const TInt aWidgetInstance,
|
|
790 |
const TInt aRowNumber )
|
|
791 |
|
|
792 |
{
|
|
793 |
FUNC_LOG;
|
|
794 |
|
|
795 |
if ( aMailBoxNumber < iAccountsArray.Count() )
|
|
796 |
{
|
|
797 |
TFSMailMsgId mailBoxId;
|
|
798 |
mailBoxId = iAccountsArray[aMailBoxNumber]->iMailboxId;
|
|
799 |
|
|
800 |
if ( iSettings->GetNewMailStateL( mailBoxId, GetUnreadCountL(mailBoxId) ) )
|
|
801 |
{
|
|
802 |
iLiwIf->PublishIndicatorIconL( aWidgetInstance,
|
|
803 |
aRowNumber,
|
|
804 |
EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg );
|
|
805 |
}
|
|
806 |
else if( !IsOutboxEmptyL(mailBoxId) )
|
|
807 |
{
|
|
808 |
iLiwIf->PublishIndicatorIconL( aWidgetInstance,
|
|
809 |
aRowNumber,
|
|
810 |
EMbmCmailhandlerpluginQgn_indi_cmail_outbox_msg);
|
|
811 |
}
|
|
812 |
else
|
|
813 |
{
|
|
814 |
iLiwIf->PublishIndicatorIconL( aWidgetInstance,
|
|
815 |
aRowNumber,
|
|
816 |
KNullIcon);
|
|
817 |
}
|
|
818 |
}
|
|
819 |
else
|
|
820 |
{
|
|
821 |
iLiwIf->PublishIndicatorIconL( aWidgetInstance,
|
|
822 |
aRowNumber,
|
|
823 |
KNullIcon);
|
|
824 |
}
|
|
825 |
}
|
|
826 |
|
|
827 |
// ---------------------------------------------------------
|
|
828 |
// CMailCpsHandler::CapabilitiesToContinueL
|
|
829 |
// ---------------------------------------------------------
|
|
830 |
//
|
|
831 |
TBool CMailCpsHandler::CapabilitiesToContinueL(
|
|
832 |
TFSMailEvent /*aEvent*/,
|
|
833 |
TFSMailMsgId /*aMailbox*/,
|
|
834 |
TAny* /*aParam1*/,
|
|
835 |
TAny* /*aParam2*/,
|
|
836 |
TAny* /*aParam3*/ ) const
|
|
837 |
{
|
|
838 |
FUNC_LOG;
|
|
839 |
// Inherited from baseclass, not used
|
|
840 |
return ETrue;
|
|
841 |
}
|
|
842 |
|
|
843 |
// ---------------------------------------------------------
|
|
844 |
// CMailCpsHandler::FindMailboxDetails
|
|
845 |
// ---------------------------------------------------------
|
|
846 |
//
|
|
847 |
CMailMailboxDetails* CMailCpsHandler::FindMailboxDetails( TFSMailMsgId aMailbox )
|
|
848 |
{
|
|
849 |
FUNC_LOG;
|
|
850 |
const TInt iiMax( iAccountsArray.Count() );
|
|
851 |
for ( TInt ii = 0; ii < iiMax; ii++ )
|
|
852 |
{
|
|
853 |
if ( iAccountsArray[ii]->iMailboxId == aMailbox )
|
|
854 |
{
|
|
855 |
return iAccountsArray[ii];
|
|
856 |
}
|
|
857 |
}
|
|
858 |
// mailbox id not found from local cache, returning NULL
|
|
859 |
return NULL;
|
|
860 |
}
|
|
861 |
|
|
862 |
// ---------------------------------------------------------
|
|
863 |
// CMailCpsHandler::HandleEventL
|
|
864 |
// ---------------------------------------------------------
|
|
865 |
//
|
|
866 |
void CMailCpsHandler::HandleEventL(
|
|
867 |
TFSMailEvent aEvent,
|
|
868 |
TFSMailMsgId aMailbox,
|
|
869 |
TAny* /*aParam1*/,
|
|
870 |
TAny* /*aParam2*/,
|
|
871 |
TAny* /*aParam3*/ )
|
|
872 |
{
|
|
873 |
FUNC_LOG;
|
|
874 |
|
|
875 |
// If backup or restore is ongoing ignore all events
|
|
876 |
if ( iSettings->BackupOrRestoreMode() )
|
|
877 |
{
|
|
878 |
return;
|
|
879 |
}
|
|
880 |
switch ( aEvent )
|
|
881 |
{
|
|
882 |
case TFSEventNewMailbox:
|
|
883 |
{
|
|
884 |
HandleNewMailboxEventL( aMailbox );
|
|
885 |
break;
|
|
886 |
}
|
|
887 |
case TFSEventMailboxRenamed:
|
|
888 |
{
|
|
889 |
HandleMailboxRenamedEventL( aMailbox );
|
|
890 |
SetUpdateNeeded( aMailbox );
|
|
891 |
UpdateFullL();
|
|
892 |
break;
|
|
893 |
}
|
|
894 |
case TFSEventMailboxDeleted:
|
|
895 |
{
|
|
896 |
HandleMailboxDeletedEventL( aMailbox );
|
|
897 |
SetUpdateNeeded( aMailbox );
|
|
898 |
UpdateFullL();
|
|
899 |
break;
|
|
900 |
}
|
|
901 |
case TFSEventNewMail:
|
|
902 |
{
|
|
903 |
iSettings->ToggleWidgetNewMailIconL( ETrue, aMailbox );
|
|
904 |
SetUpdateNeeded( aMailbox );
|
|
905 |
UpdateFullL();
|
|
906 |
break;
|
|
907 |
}
|
|
908 |
case TFSEventMailDeleted:
|
|
909 |
{
|
|
910 |
SetUpdateNeeded( aMailbox );
|
|
911 |
UpdateFullL();
|
|
912 |
break;
|
|
913 |
}
|
|
914 |
case TFSEventMailChanged:
|
|
915 |
{
|
|
916 |
SetUpdateNeeded( aMailbox );
|
|
917 |
UpdateFullL();
|
|
918 |
break;
|
|
919 |
}
|
|
920 |
case TFSEventMailMoved:
|
|
921 |
{
|
|
922 |
SetUpdateNeeded( aMailbox );
|
|
923 |
UpdateFullL();
|
|
924 |
break;
|
|
925 |
}
|
|
926 |
default:
|
|
927 |
{
|
|
928 |
break;
|
|
929 |
}
|
|
930 |
}
|
|
931 |
}
|
|
932 |
|
|
933 |
// ---------------------------------------------------------
|
|
934 |
// CMailCpsHandler::HandleNewMailboxEventL
|
|
935 |
// ---------------------------------------------------------
|
|
936 |
//
|
|
937 |
void CMailCpsHandler::HandleNewMailboxEventL( const TFSMailMsgId aMailbox )
|
|
938 |
{
|
|
939 |
FUNC_LOG;
|
|
940 |
if (iWaitingForNewMailbox)
|
|
941 |
{
|
|
942 |
iSettings->AssociateWidgetToSetting( iWaitingForNewMailbox->Des(), aMailbox );
|
|
943 |
}
|
|
944 |
else
|
|
945 |
{
|
|
946 |
iLiwIf->AddWidgetToHomescreenL( aMailbox );
|
|
947 |
}
|
|
948 |
|
|
949 |
// update total mailbox count.
|
|
950 |
TInt intCount = TotalIntMailboxCount();
|
|
951 |
User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
|
|
952 |
}
|
|
953 |
|
|
954 |
// ---------------------------------------------------------
|
|
955 |
// CMailCpsHandler::HandleMailboxRenamedEventL
|
|
956 |
// ---------------------------------------------------------
|
|
957 |
//
|
|
958 |
void CMailCpsHandler::HandleMailboxRenamedEventL( const TFSMailMsgId aMailbox )
|
|
959 |
{
|
|
960 |
for ( TInt ii = iAccountsArray.Count() - 1; ii >= 0; --ii )
|
|
961 |
{
|
|
962 |
if ( iAccountsArray[ii]->iMailboxId.Id() == aMailbox.Id() )
|
|
963 |
{
|
|
964 |
CFSMailBox* mailbox = NULL;
|
|
965 |
mailbox = MailClient().GetMailBoxByUidL( aMailbox );
|
|
966 |
if ( mailbox )
|
|
967 |
{
|
|
968 |
iAccountsArray[ii]->SetMailboxName( mailbox->GetName() );
|
|
969 |
}
|
|
970 |
delete mailbox;
|
|
971 |
break;
|
|
972 |
}
|
|
973 |
}
|
|
974 |
}
|
|
975 |
|
|
976 |
// ---------------------------------------------------------
|
|
977 |
// CMailCpsHandler::HandleMailboxDeletedEventL
|
|
978 |
// ---------------------------------------------------------
|
|
979 |
//
|
|
980 |
void CMailCpsHandler::HandleMailboxDeletedEventL( const TFSMailMsgId aMailbox )
|
|
981 |
{
|
|
982 |
FUNC_LOG;
|
|
983 |
|
|
984 |
// Look from local cache
|
|
985 |
const TInt iiMax( iAccountsArray.Count() );
|
|
986 |
for ( TInt ii = 0; ii < iiMax; ii++ )
|
|
987 |
{
|
|
988 |
if( iAccountsArray[ii]->iMailboxId.Id() == aMailbox.Id() )
|
|
989 |
{
|
|
990 |
CMailMailboxDetails* tmp = iAccountsArray[ii];
|
|
991 |
iAccountsArray.Remove( ii );
|
|
992 |
delete tmp;
|
|
993 |
tmp = NULL;
|
|
994 |
|
|
995 |
// Remove from cenrep
|
|
996 |
iSettings->RemoveMailboxL( aMailbox );
|
|
997 |
iSettings->ToggleWidgetNewMailIconL( EFalse, aMailbox );
|
|
998 |
break;
|
|
999 |
}
|
|
1000 |
}
|
|
1001 |
// update total mailbox count.
|
|
1002 |
TInt intCount = TotalIntMailboxCount();
|
|
1003 |
User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
|
|
1004 |
}
|
|
1005 |
|
|
1006 |
|
|
1007 |
// ---------------------------------------------------------
|
|
1008 |
// CMailCpsHandler::GetUnreadCountL
|
|
1009 |
// ---------------------------------------------------------
|
|
1010 |
//
|
|
1011 |
TInt CMailCpsHandler::GetUnreadCountL(TFSMailMsgId aMailbox)
|
|
1012 |
{
|
|
1013 |
FUNC_LOG;
|
|
1014 |
CFSMailBox* mailbox( NULL );
|
|
1015 |
TInt unread (0);
|
|
1016 |
mailbox = MailClient().GetMailBoxByUidL( aMailbox );
|
|
1017 |
if(mailbox)
|
|
1018 |
{
|
|
1019 |
TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) );
|
|
1020 |
delete mailbox; // transferred ownership
|
|
1021 |
// Check that folder is correct
|
|
1022 |
CFSMailFolder* folder(NULL);
|
|
1023 |
TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) );
|
|
1024 |
if ( !folder || err != KErrNone )
|
|
1025 |
{
|
|
1026 |
return 0;
|
|
1027 |
}
|
|
1028 |
CleanupStack::PushL( folder );
|
|
1029 |
|
|
1030 |
unread = folder->GetUnreadCount();
|
|
1031 |
|
|
1032 |
CleanupStack::PopAndDestroy( folder );
|
|
1033 |
|
|
1034 |
if (unread > KMaxUnreadCount)
|
|
1035 |
{
|
|
1036 |
unread = KMaxUnreadCount;
|
|
1037 |
}
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
return unread;
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
// ---------------------------------------------------------
|
|
1044 |
// CMailCpsHandler::GetUnseenCountL
|
|
1045 |
// ---------------------------------------------------------
|
|
1046 |
//
|
|
1047 |
TInt CMailCpsHandler::GetUnseenCountL(TFSMailMsgId aMailbox)
|
|
1048 |
{
|
|
1049 |
FUNC_LOG;
|
|
1050 |
CFSMailBox* mailbox( NULL );
|
|
1051 |
TInt unseen (0);
|
|
1052 |
mailbox = MailClient().GetMailBoxByUidL( aMailbox );
|
|
1053 |
if(mailbox)
|
|
1054 |
{
|
|
1055 |
TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) );
|
|
1056 |
delete mailbox; // transferred ownership
|
|
1057 |
// Check that folder is correct
|
|
1058 |
CFSMailFolder* folder(NULL);
|
|
1059 |
TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) );
|
|
1060 |
if ( !folder || err != KErrNone )
|
|
1061 |
{
|
|
1062 |
return 0;
|
|
1063 |
}
|
|
1064 |
CleanupStack::PushL( folder );
|
|
1065 |
|
|
1066 |
unseen = folder->GetUnseenCount();
|
|
1067 |
|
|
1068 |
CleanupStack::PopAndDestroy( folder );
|
|
1069 |
|
|
1070 |
if (unseen > KMaxUnreadCount)
|
|
1071 |
{
|
|
1072 |
unseen = KMaxUnreadCount;
|
|
1073 |
}
|
|
1074 |
}
|
|
1075 |
|
|
1076 |
return unseen;
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
// ---------------------------------------------------------
|
|
1080 |
// CMailCpsHandler::IsOutboxEmptyL
|
|
1081 |
// ---------------------------------------------------------
|
|
1082 |
//
|
|
1083 |
TBool CMailCpsHandler::IsOutboxEmptyL(TFSMailMsgId aMailbox)
|
|
1084 |
{
|
|
1085 |
FUNC_LOG;
|
|
1086 |
CFSMailBox* mailbox( NULL );
|
|
1087 |
TBool ret(ETrue);
|
|
1088 |
TInt msgCount(0);
|
|
1089 |
mailbox = MailClient().GetMailBoxByUidL( aMailbox );
|
|
1090 |
if(mailbox)
|
|
1091 |
{
|
|
1092 |
TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSOutbox ) );
|
|
1093 |
delete mailbox; // ownership was transferred
|
|
1094 |
// Check that folder is correct
|
|
1095 |
CFSMailFolder* folder(NULL);
|
|
1096 |
TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) );
|
|
1097 |
if ( !folder || err != KErrNone )
|
|
1098 |
{
|
|
1099 |
return ret;
|
|
1100 |
}
|
|
1101 |
CleanupStack::PushL( folder );
|
|
1102 |
|
|
1103 |
msgCount = folder->GetMessageCount();
|
|
1104 |
|
|
1105 |
if ( msgCount<1 )
|
|
1106 |
{
|
|
1107 |
CleanupStack::PopAndDestroy( folder );
|
|
1108 |
return ret;
|
|
1109 |
}
|
|
1110 |
|
|
1111 |
TFSMailDetails details( EFSMsgDataEnvelope );
|
|
1112 |
RArray<TFSMailSortCriteria> sorting;
|
|
1113 |
CleanupClosePushL( sorting );
|
|
1114 |
TFSMailSortCriteria sortCriteria;
|
|
1115 |
sortCriteria.iField = EFSMailDontCare;
|
|
1116 |
sortCriteria.iOrder = EFSMailDescending;
|
|
1117 |
sorting.Append( sortCriteria );
|
|
1118 |
// List all or maximum number of messages
|
|
1119 |
MFSMailIterator* iterator = folder->ListMessagesL( details, sorting );
|
|
1120 |
CleanupStack::PopAndDestroy( &sorting );
|
|
1121 |
CleanupDeletePushL( iterator );
|
|
1122 |
|
|
1123 |
RPointerArray<CFSMailMessage> messages;
|
|
1124 |
CleanupResetAndDestroyPushL( messages ); // owning array
|
|
1125 |
iterator->NextL( TFSMailMsgId(), msgCount, messages );
|
|
1126 |
|
|
1127 |
TInt arrayCount(messages.Count());
|
|
1128 |
for (TInt i = 0; i < arrayCount; i++)
|
|
1129 |
{
|
|
1130 |
TFSMailMsgId msgId = messages[i]->GetMessageId();
|
|
1131 |
CFSMailMessage* msg( NULL );
|
|
1132 |
msg = MailClient().GetMessageByUidL( aMailbox, folderId, msgId, EFSMsgDataEnvelope );
|
|
1133 |
if (msg)
|
|
1134 |
{
|
|
1135 |
CleanupDeletePushL( msg );
|
|
1136 |
TFSMailMsgId mailboxId = msg->GetMailBoxId();
|
|
1137 |
CleanupStack::PopAndDestroy( msg );
|
|
1138 |
|
|
1139 |
if (mailboxId == aMailbox)
|
|
1140 |
{
|
|
1141 |
ret = EFalse;
|
|
1142 |
break;
|
|
1143 |
}
|
|
1144 |
}
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
CleanupStack::PopAndDestroy( &messages );
|
|
1148 |
CleanupStack::PopAndDestroy( iterator );
|
|
1149 |
CleanupStack::PopAndDestroy( folder );
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
return ret;
|
|
1153 |
}
|
|
1154 |
|
|
1155 |
// ---------------------------------------------------------
|
|
1156 |
// CMailCpsHandler::TurnNotificationOn
|
|
1157 |
// ---------------------------------------------------------
|
|
1158 |
//
|
|
1159 |
void CMailCpsHandler::TurnNotificationOn()
|
|
1160 |
{
|
|
1161 |
FUNC_LOG;
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
// ---------------------------------------------------------
|
|
1165 |
// CMailCpsHandler::TurnNotificationOff
|
|
1166 |
// ---------------------------------------------------------
|
|
1167 |
//
|
|
1168 |
void CMailCpsHandler::TurnNotificationOff()
|
|
1169 |
{
|
|
1170 |
FUNC_LOG;
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
// ---------------------------------------------------------------------------
|
|
1174 |
// CMailCpsHandler::GetMailIcon
|
|
1175 |
// ---------------------------------------------------------------------------
|
|
1176 |
//
|
|
1177 |
TInt CMailCpsHandler::GetMailIcon( CFSMailMessage* aMsg )
|
|
1178 |
{
|
|
1179 |
FUNC_LOG;
|
|
1180 |
TInt ret(EMbmCmailhandlerpluginQgn_indi_cmail_unread);
|
|
1181 |
if (aMsg->IsFlagSet( EFSMsgFlag_Read ))
|
|
1182 |
{
|
|
1183 |
ret = GetReadMsgIcon(aMsg);
|
|
1184 |
}
|
|
1185 |
else
|
|
1186 |
{
|
|
1187 |
ret = GetUnreadMsgIcon(aMsg);
|
|
1188 |
}
|
|
1189 |
|
|
1190 |
return ret;
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
// -----------------------------------------------------------------------------
|
|
1194 |
// CMailCpsHandler::GetUnreadMsgIcon
|
|
1195 |
// -----------------------------------------------------------------------------
|
|
1196 |
TInt CMailCpsHandler::GetUnreadMsgIcon( CFSMailMessage* aMsg )
|
|
1197 |
{
|
|
1198 |
FUNC_LOG;
|
|
1199 |
TInt icon(EMbmCmailhandlerpluginQgn_indi_cmail_unread);
|
|
1200 |
|
|
1201 |
// Unread calendar invitation
|
|
1202 |
if ( aMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ))
|
|
1203 |
{
|
|
1204 |
icon = GetUnreadCalMsgIcon( aMsg );
|
|
1205 |
}
|
|
1206 |
else // Normal message icons
|
|
1207 |
{
|
|
1208 |
// Check whether msg has attachment or not
|
|
1209 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments )) // Has attachments
|
|
1210 |
{
|
|
1211 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Important )) // High priority, has attachments
|
|
1212 |
{
|
|
1213 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1214 |
{
|
|
1215 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_replied_attach_high_prio;
|
|
1216 |
}
|
|
1217 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1218 |
{
|
|
1219 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_forwarded_attach_high_prio;
|
|
1220 |
}
|
|
1221 |
else
|
|
1222 |
{
|
|
1223 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_attach_high_prio;
|
|
1224 |
}
|
|
1225 |
}
|
|
1226 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, has attachments
|
|
1227 |
{
|
|
1228 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1229 |
{
|
|
1230 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_replied_attach_low_prio;
|
|
1231 |
}
|
|
1232 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1233 |
{
|
|
1234 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_forwarded_attach_low_prio;
|
|
1235 |
}
|
|
1236 |
else
|
|
1237 |
{
|
|
1238 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_attach_low_prio;
|
|
1239 |
}
|
|
1240 |
}
|
|
1241 |
else // Normal priority, has attachments
|
|
1242 |
{
|
|
1243 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1244 |
{
|
|
1245 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_replied_attach;
|
|
1246 |
}
|
|
1247 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1248 |
{
|
|
1249 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_forwarded_attach;
|
|
1250 |
}
|
|
1251 |
else
|
|
1252 |
{
|
|
1253 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_attach;
|
|
1254 |
}
|
|
1255 |
}
|
|
1256 |
}
|
|
1257 |
|
|
1258 |
else // No attachments
|
|
1259 |
{
|
|
1260 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Important )) // High priority, no attachments
|
|
1261 |
{
|
|
1262 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1263 |
{
|
|
1264 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_replied_high_prio;
|
|
1265 |
}
|
|
1266 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1267 |
{
|
|
1268 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_forwarded_high_prio;
|
|
1269 |
}
|
|
1270 |
else
|
|
1271 |
{
|
|
1272 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_high_prio;
|
|
1273 |
}
|
|
1274 |
}
|
|
1275 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, no attachments
|
|
1276 |
{
|
|
1277 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1278 |
{
|
|
1279 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_replied_low_prio;
|
|
1280 |
}
|
|
1281 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1282 |
{
|
|
1283 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_forwarded_low_prio;
|
|
1284 |
}
|
|
1285 |
else
|
|
1286 |
{
|
|
1287 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_low_prio;
|
|
1288 |
}
|
|
1289 |
}
|
|
1290 |
else // Normal priority, no attachments
|
|
1291 |
{
|
|
1292 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1293 |
{
|
|
1294 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_replied;
|
|
1295 |
}
|
|
1296 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1297 |
{
|
|
1298 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_unread_forwarded;
|
|
1299 |
}
|
|
1300 |
}
|
|
1301 |
}
|
|
1302 |
}
|
|
1303 |
return icon;
|
|
1304 |
}
|
|
1305 |
|
|
1306 |
// -----------------------------------------------------------------------------
|
|
1307 |
// CMailCpsHandler::GetReadMsgIcon
|
|
1308 |
// -----------------------------------------------------------------------------
|
|
1309 |
TInt CMailCpsHandler::GetReadMsgIcon( CFSMailMessage* aMsg )
|
|
1310 |
{
|
|
1311 |
FUNC_LOG;
|
|
1312 |
TInt icon(EMbmCmailhandlerpluginQgn_indi_cmail_read);
|
|
1313 |
|
|
1314 |
if ( aMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ))
|
|
1315 |
{
|
|
1316 |
icon = GetReadCalMsgIcon( aMsg );
|
|
1317 |
}
|
|
1318 |
else // Normal message icons
|
|
1319 |
{
|
|
1320 |
// Check whether msg has attachment or not
|
|
1321 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments )) // Has attachments
|
|
1322 |
{
|
|
1323 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Important )) // High priority, has attachments
|
|
1324 |
{
|
|
1325 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1326 |
{
|
|
1327 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_replied_attach_high_prio;
|
|
1328 |
}
|
|
1329 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1330 |
{
|
|
1331 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_forwarded_attach_high_prio;
|
|
1332 |
}
|
|
1333 |
else
|
|
1334 |
{
|
|
1335 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_attach_high_prio;
|
|
1336 |
}
|
|
1337 |
}
|
|
1338 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, has attachments
|
|
1339 |
{
|
|
1340 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1341 |
{
|
|
1342 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_replied_attach_low_prio;
|
|
1343 |
}
|
|
1344 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1345 |
{
|
|
1346 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_forwarded_attach_low_prio;
|
|
1347 |
}
|
|
1348 |
else
|
|
1349 |
{
|
|
1350 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_attach_low_prio;
|
|
1351 |
}
|
|
1352 |
}
|
|
1353 |
else // Normal priority, has attachments
|
|
1354 |
{
|
|
1355 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1356 |
{
|
|
1357 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_replied_attach;
|
|
1358 |
}
|
|
1359 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1360 |
{
|
|
1361 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_forwarded_attach;
|
|
1362 |
}
|
|
1363 |
else
|
|
1364 |
{
|
|
1365 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_attach;
|
|
1366 |
}
|
|
1367 |
}
|
|
1368 |
}
|
|
1369 |
else // No attachments
|
|
1370 |
{
|
|
1371 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Important )) // High priority, no attachments
|
|
1372 |
{
|
|
1373 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1374 |
{
|
|
1375 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_replied_high_prio;
|
|
1376 |
}
|
|
1377 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1378 |
{
|
|
1379 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_forwarded_high_prio;
|
|
1380 |
}
|
|
1381 |
else
|
|
1382 |
{
|
|
1383 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_high_prio;
|
|
1384 |
}
|
|
1385 |
}
|
|
1386 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, no attachments
|
|
1387 |
{
|
|
1388 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1389 |
{
|
|
1390 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_replied_low_prio;
|
|
1391 |
}
|
|
1392 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1393 |
{
|
|
1394 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_forwarded_low_prio;
|
|
1395 |
}
|
|
1396 |
else
|
|
1397 |
{
|
|
1398 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_low_prio;
|
|
1399 |
}
|
|
1400 |
}
|
|
1401 |
else // Normal priority, no attachments
|
|
1402 |
{
|
|
1403 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
1404 |
{
|
|
1405 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_replied;
|
|
1406 |
}
|
|
1407 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
1408 |
{
|
|
1409 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_read_forwarded;
|
|
1410 |
}
|
|
1411 |
}
|
|
1412 |
}
|
|
1413 |
}
|
|
1414 |
return icon;
|
|
1415 |
}
|
|
1416 |
|
|
1417 |
// -----------------------------------------------------------------------------
|
|
1418 |
// CMailCpsHandler::GetUnreadCalMsgIcon
|
|
1419 |
// -----------------------------------------------------------------------------
|
|
1420 |
TInt CMailCpsHandler::GetUnreadCalMsgIcon( CFSMailMessage* aMsg )
|
|
1421 |
{
|
|
1422 |
FUNC_LOG;
|
|
1423 |
TInt icon(0);
|
|
1424 |
|
|
1425 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Important ) )
|
|
1426 |
{
|
|
1427 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
1428 |
{
|
|
1429 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_unread_attachments_high_prio ;
|
|
1430 |
}
|
|
1431 |
else
|
|
1432 |
{
|
|
1433 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_unread_high_prio;
|
|
1434 |
}
|
|
1435 |
}
|
|
1436 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Low ) )
|
|
1437 |
{
|
|
1438 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
1439 |
{
|
|
1440 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_unread_attachments_low_prio;
|
|
1441 |
}
|
|
1442 |
else
|
|
1443 |
{
|
|
1444 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_unread_low_prio;
|
|
1445 |
}
|
|
1446 |
}
|
|
1447 |
else
|
|
1448 |
{
|
|
1449 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
1450 |
{
|
|
1451 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_unread_attachments;
|
|
1452 |
}
|
|
1453 |
else
|
|
1454 |
{
|
|
1455 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_unread;
|
|
1456 |
}
|
|
1457 |
}
|
|
1458 |
|
|
1459 |
return icon;
|
|
1460 |
}
|
|
1461 |
|
|
1462 |
// -----------------------------------------------------------------------------
|
|
1463 |
// CMailCpsHandler::GetReadCalMsgIcon
|
|
1464 |
// -----------------------------------------------------------------------------
|
|
1465 |
TInt CMailCpsHandler::GetReadCalMsgIcon( CFSMailMessage* aMsg )
|
|
1466 |
{
|
|
1467 |
FUNC_LOG;
|
|
1468 |
TInt icon(0);
|
|
1469 |
|
|
1470 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Important ) )
|
|
1471 |
{
|
|
1472 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
1473 |
{
|
|
1474 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_read_attachments_high_prio ;
|
|
1475 |
}
|
|
1476 |
else
|
|
1477 |
{
|
|
1478 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_read_high_prio;
|
|
1479 |
}
|
|
1480 |
}
|
|
1481 |
else if ( aMsg->IsFlagSet( EFSMsgFlag_Low ) )
|
|
1482 |
{
|
|
1483 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
1484 |
{
|
|
1485 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_read_attachments_low_prio;
|
|
1486 |
}
|
|
1487 |
else
|
|
1488 |
{
|
|
1489 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_read_low_prio;
|
|
1490 |
}
|
|
1491 |
}
|
|
1492 |
else
|
|
1493 |
{
|
|
1494 |
if ( aMsg->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
1495 |
{
|
|
1496 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_read_attachments;
|
|
1497 |
}
|
|
1498 |
else
|
|
1499 |
{
|
|
1500 |
icon = EMbmCmailhandlerpluginQgn_indi_cmail_calendar_event_read;
|
|
1501 |
}
|
|
1502 |
}
|
|
1503 |
|
|
1504 |
return icon;
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
// -----------------------------------------------------------------------------
|
|
1508 |
// CMailCpsHandler::IsValidDisplayName
|
|
1509 |
// -----------------------------------------------------------------------------
|
|
1510 |
TBool CMailCpsHandler::IsValidDisplayName(const TDesC& aDisplayName)
|
|
1511 |
{
|
|
1512 |
FUNC_LOG;
|
|
1513 |
TInt length(aDisplayName.Length());
|
|
1514 |
|
|
1515 |
if (length == 0)
|
|
1516 |
{
|
|
1517 |
return EFalse;
|
|
1518 |
}
|
|
1519 |
|
|
1520 |
// If displayname is in <xxx(at)yyyyy.zzz> format use e-mail address instead of display name.
|
|
1521 |
if ((aDisplayName.Find(KLessThan) == 0) &&
|
|
1522 |
(aDisplayName.Right(1).Find(KGreaterThan) == 0) &&
|
|
1523 |
(aDisplayName.Find(KAt)) &&
|
|
1524 |
(aDisplayName.Find(KDot)))
|
|
1525 |
{
|
|
1526 |
return EFalse;
|
|
1527 |
}
|
|
1528 |
|
|
1529 |
return ETrue;
|
|
1530 |
}
|
|
1531 |
|
|
1532 |
// -----------------------------------------------------------------------------
|
|
1533 |
// CMailCpsHandler::LaunchWidgetSettingsL()
|
|
1534 |
// -----------------------------------------------------------------------------
|
|
1535 |
//
|
|
1536 |
void CMailCpsHandler::LaunchWidgetSettingsL( const TDesC& aContentId )
|
|
1537 |
{
|
|
1538 |
FUNC_LOG;
|
|
1539 |
|
|
1540 |
RApaLsSession appArcSession;
|
|
1541 |
CleanupClosePushL( appArcSession );
|
|
1542 |
User::LeaveIfError( appArcSession.Connect( ) );
|
|
1543 |
TApaAppInfo appInfo;
|
|
1544 |
appArcSession.GetAppInfo( appInfo, KUidEMWSettings );
|
|
1545 |
|
|
1546 |
TPtrC fullFileName;
|
|
1547 |
TPtrC arguments;
|
|
1548 |
|
|
1549 |
fullFileName.Set( appInfo.iFullName );
|
|
1550 |
arguments.Set( aContentId );
|
|
1551 |
|
|
1552 |
TParse fileName;
|
|
1553 |
User::LeaveIfError(fileName.Set(fullFileName, NULL, NULL));
|
|
1554 |
|
|
1555 |
RProcess process;
|
|
1556 |
process.Create(fileName.FullName(), arguments );
|
|
1557 |
CApaCommandLine* commandLine = CApaCommandLine::NewLC();
|
|
1558 |
commandLine->SetDocumentNameL(KNullDesC);
|
|
1559 |
commandLine->SetExecutableNameL(fullFileName);
|
|
1560 |
commandLine->SetCommandL( EApaCommandRun );
|
|
1561 |
commandLine->SetProcessEnvironmentL(process);
|
|
1562 |
CleanupStack::PopAndDestroy(commandLine);
|
|
1563 |
|
|
1564 |
process.Resume();
|
|
1565 |
process.Close();
|
|
1566 |
|
|
1567 |
CleanupStack::PopAndDestroy(&appArcSession);
|
|
1568 |
SetWaitingForNewMailbox( aContentId );
|
|
1569 |
}
|
|
1570 |
|
|
1571 |
// -----------------------------------------------------------------------------
|
|
1572 |
// CMailCpsHandler::LaunchEmailUIL()
|
|
1573 |
// -----------------------------------------------------------------------------
|
|
1574 |
//
|
|
1575 |
void CMailCpsHandler::LaunchEmailUIL( const TDesC& aContentId )
|
|
1576 |
{
|
|
1577 |
FUNC_LOG;
|
|
1578 |
|
|
1579 |
TInt nativeMailboxId( iSettings->GetMailboxUidByContentId( aContentId ) );
|
|
1580 |
// Is the contentId related to internal mailbox or external?
|
|
1581 |
if( nativeMailboxId )
|
|
1582 |
{
|
|
1583 |
TUid mailBoxUid;
|
|
1584 |
mailBoxUid.iUid = nativeMailboxId;
|
|
1585 |
|
|
1586 |
TFSMailMsgId mailBoxId;
|
|
1587 |
mailBoxId.SetId(mailBoxUid.iUid);
|
|
1588 |
TUid pluginUid;
|
|
1589 |
pluginUid.iUid = iSettings->GetPluginUidByContentId(aContentId);
|
|
1590 |
mailBoxId.SetPluginId(pluginUid);
|
|
1591 |
CFSMailBox* mailBox = MailClient().GetMailBoxByUidL( mailBoxId );
|
|
1592 |
CleanupStack::PushL( mailBox );
|
|
1593 |
if ( mailBox )
|
|
1594 |
{
|
|
1595 |
TFSMailMsgId inboxFolderId = mailBox->GetStandardFolderId( EFSInbox );
|
|
1596 |
|
|
1597 |
TMailListActivationData tmp;
|
|
1598 |
tmp.iFolderId = inboxFolderId;
|
|
1599 |
tmp.iMailBoxId = mailBoxId;
|
|
1600 |
const TPckgBuf<TMailListActivationData> pkgOut( tmp );
|
|
1601 |
iEnv->EikAppUi()->ActivateViewL(
|
|
1602 |
TVwsViewId(KUidEmailUi, KMailListId),
|
|
1603 |
KStartListWithFolderIdFromHomeScreen, pkgOut);
|
|
1604 |
}
|
|
1605 |
CleanupStack::PopAndDestroy( mailBox );
|
|
1606 |
}
|
|
1607 |
else
|
|
1608 |
{
|
|
1609 |
LaunchExtAppL( aContentId );
|
|
1610 |
}
|
|
1611 |
}
|
|
1612 |
|
|
1613 |
// -----------------------------------------------------------------------------
|
|
1614 |
// CMailCpsHandler::LaunchEmailWizardL()
|
|
1615 |
// -----------------------------------------------------------------------------
|
|
1616 |
//
|
|
1617 |
void CMailCpsHandler::LaunchEmailWizardL( const TDesC& aContentId )
|
|
1618 |
{
|
|
1619 |
FUNC_LOG;
|
|
1620 |
TUid viewUid(KNullUid);
|
|
1621 |
iEnv->EikAppUi()->ActivateViewL( TVwsViewId(KUidWizardApp, KUidEmailWizardView),
|
|
1622 |
viewUid,
|
|
1623 |
KNullDesC8);
|
|
1624 |
SetWaitingForNewMailbox( aContentId );
|
|
1625 |
}
|
|
1626 |
|
|
1627 |
// -----------------------------------------------------------------------------
|
|
1628 |
// CMailCpsHandler::LaunchExtAppL()
|
|
1629 |
// -----------------------------------------------------------------------------
|
|
1630 |
//
|
|
1631 |
void CMailCpsHandler::LaunchExtAppL( const TDesC& aContentId )
|
|
1632 |
{
|
|
1633 |
FUNC_LOG;
|
|
1634 |
CMailPluginProxy* plugin = GetExtPluginL( aContentId );
|
|
1635 |
if ( plugin )
|
|
1636 |
{
|
|
1637 |
plugin->LaunchExtAppL( aContentId );
|
|
1638 |
}
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
// -----------------------------------------------------------------------------
|
|
1642 |
// CMailCpsHandler::GetExtPluginL
|
|
1643 |
// -----------------------------------------------------------------------------
|
|
1644 |
//
|
|
1645 |
CMailPluginProxy* CMailCpsHandler::GetExtPluginL( const TDesC& aContentId )
|
|
1646 |
{
|
|
1647 |
FUNC_LOG;
|
|
1648 |
CMailPluginProxy* plugin( NULL );
|
|
1649 |
for( TInt i = 0; i < iExternalPlugins.Count(); i++ )
|
|
1650 |
{
|
|
1651 |
if ( iExternalPlugins[i]->HasAccount( aContentId ) )
|
|
1652 |
{
|
|
1653 |
plugin = iExternalPlugins[i];
|
|
1654 |
}
|
|
1655 |
}
|
|
1656 |
return plugin;
|
|
1657 |
}
|
|
1658 |
|
|
1659 |
// ---------------------------------------------------------------------------
|
|
1660 |
// CMailCpsHandler::DissociateWidget
|
|
1661 |
// ---------------------------------------------------------------------------
|
|
1662 |
//
|
|
1663 |
void CMailCpsHandler::DissociateWidgetFromSettingL( const TDesC& aContentId )
|
|
1664 |
{
|
|
1665 |
FUNC_LOG;
|
|
1666 |
iSettings->DissociateWidgetFromSettingL( aContentId );
|
|
1667 |
}
|
|
1668 |
|
|
1669 |
// ---------------------------------------------------------------------------
|
|
1670 |
// CMailCpsHandler::TotalMailboxCount
|
|
1671 |
// ---------------------------------------------------------------------------
|
|
1672 |
//
|
|
1673 |
TInt CMailCpsHandler::TotalMailboxCountL()
|
|
1674 |
{
|
|
1675 |
FUNC_LOG;
|
|
1676 |
return TotalIntMailboxCount() + TotalExtMailboxCountL();
|
|
1677 |
}
|
|
1678 |
|
|
1679 |
// ---------------------------------------------------------------------------
|
|
1680 |
// CMailCpsHandler::GetMailboxCount
|
|
1681 |
// ---------------------------------------------------------------------------
|
|
1682 |
//
|
|
1683 |
TInt CMailCpsHandler::TotalIntMailboxCount()
|
|
1684 |
{
|
|
1685 |
FUNC_LOG;
|
|
1686 |
return iSettings->TotalIntMailboxCount();
|
|
1687 |
}
|
|
1688 |
|
|
1689 |
// ---------------------------------------------------------
|
|
1690 |
// CMailCpsHandler::TotalExtMailboxCount
|
|
1691 |
// ---------------------------------------------------------
|
|
1692 |
//
|
|
1693 |
TInt CMailCpsHandler::TotalExtMailboxCountL()
|
|
1694 |
{
|
|
1695 |
FUNC_LOG;
|
|
1696 |
TInt totalMailboxCount( 0 );
|
|
1697 |
TUid interfaceUid = TUid::Uid( KEmailObserverInterfaceUid );
|
|
1698 |
RImplInfoPtrArray plugins;
|
|
1699 |
CleanupResetAndDestroyPushL(plugins); // CleanupClosePushL does not call ptr destructors
|
|
1700 |
REComSession::ListImplementationsL( interfaceUid, plugins);
|
|
1701 |
|
|
1702 |
for ( TInt i = 0; i < plugins.Count(); i++ )
|
|
1703 |
{
|
|
1704 |
TUid implUid = plugins[i]->ImplementationUid();
|
|
1705 |
INFO_1("Instantiating plugin %d", implUid.iUid);
|
|
1706 |
EmailInterface::CEmailObserverPlugin* plugin =
|
|
1707 |
EmailInterface::CEmailObserverPlugin::NewL( implUid, this );
|
|
1708 |
MEmailData& data( plugin->EmailDataL() );
|
|
1709 |
totalMailboxCount += data.MailboxesL().Count();
|
|
1710 |
}
|
|
1711 |
|
|
1712 |
CleanupStack::PopAndDestroy( &plugins ); // plugins
|
|
1713 |
return totalMailboxCount;
|
|
1714 |
}
|
|
1715 |
|
|
1716 |
// ---------------------------------------------------------------------------
|
|
1717 |
// CMailCpsHandler::EmailObserverEvent
|
|
1718 |
// ---------------------------------------------------------------------------
|
|
1719 |
void CMailCpsHandler::EmailObserverEvent( EmailInterface::MEmailData& /*aData*/ )
|
|
1720 |
{
|
|
1721 |
FUNC_LOG;
|
|
1722 |
// Nothing to do
|
|
1723 |
}
|
|
1724 |
|
|
1725 |
// -----------------------------------------------------------------------------
|
|
1726 |
// CMailCpsHandler::SetWaitingForNewMailbox()
|
|
1727 |
// -----------------------------------------------------------------------------
|
|
1728 |
//
|
|
1729 |
void CMailCpsHandler::SetWaitingForNewMailbox( const TDesC& aContentId )
|
|
1730 |
{
|
|
1731 |
FUNC_LOG;
|
|
1732 |
HBufC* newCid = aContentId.Alloc();
|
|
1733 |
if ( newCid )
|
|
1734 |
{
|
|
1735 |
delete iWaitingForNewMailbox;
|
|
1736 |
iWaitingForNewMailbox = newCid;
|
|
1737 |
}
|
|
1738 |
}
|
|
1739 |
|
|
1740 |
// -----------------------------------------------------------------------------
|
|
1741 |
// CMailCpsHandler::CleanWaitingForNewMailbox()
|
|
1742 |
// -----------------------------------------------------------------------------
|
|
1743 |
//
|
|
1744 |
void CMailCpsHandler::CleanWaitingForNewMailbox()
|
|
1745 |
{
|
|
1746 |
FUNC_LOG;
|
|
1747 |
if (iWaitingForNewMailbox)
|
|
1748 |
{
|
|
1749 |
delete iWaitingForNewMailbox;
|
|
1750 |
iWaitingForNewMailbox = NULL;
|
|
1751 |
}
|
|
1752 |
}
|
|
1753 |
|
|
1754 |
// -----------------------------------------------------------------------------
|
|
1755 |
// CMailCpsHandler::SetWaitingForNewWidget()
|
|
1756 |
// -----------------------------------------------------------------------------
|
|
1757 |
//
|
|
1758 |
void CMailCpsHandler::SetWaitingForNewWidget( const TFSMailMsgId aMailbox )
|
|
1759 |
{
|
|
1760 |
FUNC_LOG;
|
|
1761 |
iWaitingForNewWidget.SetPluginId( aMailbox.PluginId() );
|
|
1762 |
iWaitingForNewWidget.SetId( aMailbox.Id() );
|
|
1763 |
}
|
|
1764 |
|
|
1765 |
// -----------------------------------------------------------------------------
|
|
1766 |
// CMailCpsHandler::CleanWaitingForNewWidget()
|
|
1767 |
// -----------------------------------------------------------------------------
|
|
1768 |
//
|
|
1769 |
void CMailCpsHandler::CleanWaitingForNewWidget()
|
|
1770 |
{
|
|
1771 |
FUNC_LOG;
|
|
1772 |
iWaitingForNewWidget.SetPluginId( KNullUid );
|
|
1773 |
iWaitingForNewWidget.SetId( 0 );
|
|
1774 |
}
|
|
1775 |
|
|
1776 |
// -----------------------------------------------------------------------------
|
|
1777 |
// CMailCpsHandler::WaitingForNewWidget()
|
|
1778 |
// -----------------------------------------------------------------------------
|
|
1779 |
//
|
|
1780 |
TFSMailMsgId CMailCpsHandler::WaitingForNewWidget()
|
|
1781 |
{
|
|
1782 |
FUNC_LOG;
|
|
1783 |
return iWaitingForNewWidget;
|
|
1784 |
}
|
|
1785 |
|
|
1786 |
// ---------------------------------------------------------------------------
|
|
1787 |
// CMailCpsSettings::AssociateWidgetToSetting
|
|
1788 |
// ---------------------------------------------------------------------------
|
|
1789 |
//
|
|
1790 |
void CMailCpsHandler::AssociateWidgetToSetting( const TDesC& aContentId,
|
|
1791 |
const TFSMailMsgId aMailbox )
|
|
1792 |
{
|
|
1793 |
FUNC_LOG;
|
|
1794 |
iSettings->AssociateWidgetToSetting( aContentId, aMailbox );
|
|
1795 |
}
|
|
1796 |
|
|
1797 |
|
|
1798 |
// ---------------------------------------------------------------------------
|
|
1799 |
// CMailCpsHandler::Associated
|
|
1800 |
// ---------------------------------------------------------------------------
|
|
1801 |
//
|
|
1802 |
TBool CMailCpsHandler::Associated( const TDesC& aContentId )
|
|
1803 |
{
|
|
1804 |
FUNC_LOG;
|
|
1805 |
return iSettings->Associated( aContentId );
|
|
1806 |
}
|
|
1807 |
|
|
1808 |
// ---------------------------------------------------------------------------
|
|
1809 |
// CMailCpsSettings::DisplayHSPageFullNoteL
|
|
1810 |
// ---------------------------------------------------------------------------
|
|
1811 |
//
|
|
1812 |
void CMailCpsHandler::DisplayHSPageFullNoteL()
|
|
1813 |
{
|
|
1814 |
FUNC_LOG;
|
|
1815 |
if (!iQuery)
|
|
1816 |
{
|
|
1817 |
iQuery = CAknGlobalNote::NewL();
|
|
1818 |
iQuery->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
|
|
1819 |
}
|
|
1820 |
HBufC* str( NULL );
|
|
1821 |
str = StringLoader::LoadLC( R_EMAILWIDGET_TEXT_HS_PAGE_FULL );
|
|
1822 |
iQuery->ShowNoteL(EAknGlobalConfirmationNote, str->Des());
|
|
1823 |
CleanupStack::PopAndDestroy( str );
|
|
1824 |
}
|
|
1825 |
|
|
1826 |
// ----------------------------------------------------------------------------
|
|
1827 |
// class CMailCpsUpdateHelper : public CTimer
|
|
1828 |
// Used to limit the rate of updates to Homescreen widget
|
|
1829 |
// ----------------------------------------------------------------------------
|
|
1830 |
//
|
|
1831 |
|
|
1832 |
CMailCpsUpdateHelper::CMailCpsUpdateHelper(
|
|
1833 |
CMailCpsHandler *aHandler )
|
|
1834 |
: CTimer( EPriorityStandard ) // Could be EPriorityLow
|
|
1835 |
, iCpsHandler( aHandler )
|
|
1836 |
, iPending( EFalse )
|
|
1837 |
{
|
|
1838 |
FUNC_LOG;
|
|
1839 |
}
|
|
1840 |
|
|
1841 |
CMailCpsUpdateHelper* CMailCpsUpdateHelper::NewLC( CMailCpsHandler* aHandler )
|
|
1842 |
{
|
|
1843 |
FUNC_LOG;
|
|
1844 |
CMailCpsUpdateHelper* self = new ( ELeave ) CMailCpsUpdateHelper( aHandler );
|
|
1845 |
CleanupStack::PushL( self );
|
|
1846 |
self->ConstructL();
|
|
1847 |
return self;
|
|
1848 |
}
|
|
1849 |
|
|
1850 |
CMailCpsUpdateHelper* CMailCpsUpdateHelper::NewL( CMailCpsHandler *aHandler )
|
|
1851 |
{
|
|
1852 |
FUNC_LOG;
|
|
1853 |
CMailCpsUpdateHelper* self = CMailCpsUpdateHelper::NewLC( aHandler );
|
|
1854 |
CleanupStack::Pop( self );
|
|
1855 |
return self;
|
|
1856 |
}
|
|
1857 |
|
|
1858 |
void CMailCpsUpdateHelper::ConstructL()
|
|
1859 |
{
|
|
1860 |
FUNC_LOG;
|
|
1861 |
CTimer::ConstructL();
|
|
1862 |
CActiveScheduler::Add( this );
|
|
1863 |
}
|
|
1864 |
|
|
1865 |
CMailCpsUpdateHelper::~CMailCpsUpdateHelper()
|
|
1866 |
{
|
|
1867 |
FUNC_LOG;
|
|
1868 |
iCpsHandler = NULL; // Not owned
|
|
1869 |
Cancel(); // Stop any pending request
|
|
1870 |
Deque(); // Remove from CActiveScheduler
|
|
1871 |
}
|
|
1872 |
|
|
1873 |
// Notification that Homescreen widget(s) should be updated
|
|
1874 |
void CMailCpsUpdateHelper::UpdateL()
|
|
1875 |
{
|
|
1876 |
FUNC_LOG;
|
|
1877 |
if ( IsActive() )
|
|
1878 |
{
|
|
1879 |
// Timer is running, so just flag that an update should be sent when
|
|
1880 |
// the timer expires.
|
|
1881 |
iPending = ETrue;
|
|
1882 |
}
|
|
1883 |
else
|
|
1884 |
{
|
|
1885 |
// Timer is not running, so perform an update and set the timer
|
|
1886 |
// running.
|
|
1887 |
DoUpdateL();
|
|
1888 |
}
|
|
1889 |
}
|
|
1890 |
|
|
1891 |
// Actually perform an update of the Homescreen widget. Also sets the timer
|
|
1892 |
// running and clears the pending flag.
|
|
1893 |
void CMailCpsUpdateHelper::DoUpdateL()
|
|
1894 |
{
|
|
1895 |
FUNC_LOG;
|
|
1896 |
// Set the timer running.
|
|
1897 |
After( KMailCpsHandlerUpdateDelay );
|
|
1898 |
// Clear the pending flag.
|
|
1899 |
iPending = EFalse;
|
|
1900 |
// Do the update.
|
|
1901 |
iCpsHandler->DoUpdateFullL();
|
|
1902 |
}
|
|
1903 |
|
|
1904 |
void CMailCpsUpdateHelper::RunL()
|
|
1905 |
{
|
|
1906 |
FUNC_LOG;
|
|
1907 |
if ( iPending )
|
|
1908 |
{
|
|
1909 |
// There was an update request since the last update, so do another
|
|
1910 |
// update (and set the timer running again, etc.).
|
|
1911 |
DoUpdateL();
|
|
1912 |
}
|
|
1913 |
}
|
|
1914 |
|
|
1915 |
TInt CMailCpsUpdateHelper::RunError( TInt aError )
|
|
1916 |
{
|
|
1917 |
FUNC_LOG;
|
|
1918 |
if ( KErrNone != aError )
|
|
1919 |
{
|
|
1920 |
Cancel(); // Stop any pending request
|
|
1921 |
}
|
|
1922 |
return KErrNone; // Don't panic the thread
|
|
1923 |
}
|
|
1924 |
|