24 #include <centralrepository.h> |
24 #include <centralrepository.h> |
25 #include <emailobserverinterface.hrh> |
25 #include <emailobserverinterface.hrh> |
26 #include <emailobserverplugin.h> |
26 #include <emailobserverplugin.h> |
27 #include <memaildata.h> |
27 #include <memaildata.h> |
28 #include <memailmailboxdata.h> |
28 #include <memailmailboxdata.h> |
29 #include <e32property.h> |
|
30 #include <connect/sbdefs.h> |
|
31 #include <scs/cleanuputils.h> // CleanupResetAndDestroyPushL |
29 #include <scs/cleanuputils.h> // CleanupResetAndDestroyPushL |
32 |
30 |
33 #include "emailtrace.h" |
31 #include "emailtrace.h" |
34 #include "cfsmailclient.h" |
32 #include "cfsmailclient.h" |
35 #include "cfsmailbox.h" |
33 #include "cfsmailbox.h" |
408 } |
406 } |
409 |
407 |
410 // if contentId found from array, update the mailbox |
408 // if contentId found from array, update the mailbox |
411 if ( found ) |
409 if ( found ) |
412 { |
410 { |
413 INFO_1("found = TRUE iAccountsArray.Count() == %d", iAccountsArray.Count()); |
411 INFO_1("found = TRUE iAccountsArray.Count() == %d", iAccountsArray.Count()); |
414 // Update fields from left to right |
412 // Update fields from left to right |
415 UpdateMailBoxIconL( mailbox, aInstance, row ); |
413 UpdateMailBoxIconL( mailbox, aInstance, row ); |
416 UpdateMailboxNameL( mailbox, aInstance, row ); |
414 UpdateMailboxNameL( mailbox, aInstance, row ); |
417 UpdateIndicatorIconL( mailbox, aInstance, row ); |
415 UpdateIndicatorIconL( mailbox, aInstance, row ); |
418 row++; |
416 row++; |
787 |
785 |
788 if ( iSettings->GetNewMailStateL( mailBoxId, GetUnreadCountL(mailBoxId) ) ) |
786 if ( iSettings->GetNewMailStateL( mailBoxId, GetUnreadCountL(mailBoxId) ) ) |
789 { |
787 { |
790 iLiwIf->PublishIndicatorIconL( aWidgetInstance, |
788 iLiwIf->PublishIndicatorIconL( aWidgetInstance, |
791 aRowNumber, |
789 aRowNumber, |
792 EMbmCmailhandlerpluginQgn_stat_message_mail_uni ); |
790 EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg ); |
793 } |
791 } |
794 else if( !IsOutboxEmptyL(mailBoxId) ) |
792 else if( !IsOutboxEmptyL(mailBoxId) ) |
795 { |
793 { |
796 iLiwIf->PublishIndicatorIconL( aWidgetInstance, |
794 iLiwIf->PublishIndicatorIconL( aWidgetInstance, |
797 aRowNumber, |
795 aRowNumber, |
1105 |
1108 |
1106 // Find correct mailbox |
1109 // Find correct mailbox |
1107 CMailMailboxDetails* mailbox = FindMailboxDetails( aMailbox ); |
1110 CMailMailboxDetails* mailbox = FindMailboxDetails( aMailbox ); |
1108 if ( !mailbox ) |
1111 if ( !mailbox ) |
1109 { |
1112 { |
1110 //<Cmail> |
|
1111 CleanupStack::PopAndDestroy( entries ); |
1113 CleanupStack::PopAndDestroy( entries ); |
1112 //<Cmail> |
|
1113 return; |
1114 return; |
1114 } |
1115 } |
1115 |
1116 |
1116 const TInt iiMax( entries->Count() ); |
1117 const TInt iiMax( entries->Count() ); |
1117 const TInt jjMax( mailbox->iMessageDetailsArray.Count() ); |
1118 const TInt jjMax( mailbox->iMessageDetailsArray.Count() ); |
1152 if(mailbox) |
1153 if(mailbox) |
1153 { |
1154 { |
1154 TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) ); |
1155 TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) ); |
1155 delete mailbox; // transferred ownership |
1156 delete mailbox; // transferred ownership |
1156 // Check that folder is correct |
1157 // Check that folder is correct |
1157 CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, folderId ); |
1158 CFSMailFolder* folder(NULL); |
1158 if ( !folder ) |
1159 TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) ); |
1159 { |
1160 if ( !folder || err != KErrNone ) |
1160 return KErrNotFound; |
1161 { |
|
1162 return 0; |
1161 } |
1163 } |
1162 CleanupStack::PushL( folder ); |
1164 CleanupStack::PushL( folder ); |
1163 |
1165 |
1164 unread = folder->GetUnreadCount(); |
1166 unread = folder->GetUnreadCount(); |
1165 |
1167 |
1187 if(mailbox) |
1189 if(mailbox) |
1188 { |
1190 { |
1189 TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) ); |
1191 TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) ); |
1190 delete mailbox; // transferred ownership |
1192 delete mailbox; // transferred ownership |
1191 // Check that folder is correct |
1193 // Check that folder is correct |
1192 CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, folderId ); |
1194 CFSMailFolder* folder(NULL); |
1193 if ( !folder ) |
1195 TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) ); |
1194 { |
1196 if ( !folder || err != KErrNone ) |
1195 return KErrNotFound; |
1197 { |
|
1198 return 0; |
1196 } |
1199 } |
1197 CleanupStack::PushL( folder ); |
1200 CleanupStack::PushL( folder ); |
1198 |
1201 |
1199 unseen = folder->GetUnseenCount(); |
1202 unseen = folder->GetUnseenCount(); |
1200 |
1203 |
1223 if(mailbox) |
1226 if(mailbox) |
1224 { |
1227 { |
1225 TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSOutbox ) ); |
1228 TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSOutbox ) ); |
1226 delete mailbox; // ownership was transferred |
1229 delete mailbox; // ownership was transferred |
1227 // Check that folder is correct |
1230 // Check that folder is correct |
1228 CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, folderId ); |
1231 CFSMailFolder* folder(NULL); |
1229 if ( !folder ) |
1232 TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) ); |
1230 { |
1233 if ( !folder || err != KErrNone ) |
1231 return KErrNotFound; |
1234 { |
|
1235 return ret; |
1232 } |
1236 } |
1233 CleanupStack::PushL( folder ); |
1237 CleanupStack::PushL( folder ); |
1234 |
1238 |
1235 msgCount = folder->GetMessageCount(); |
1239 msgCount = folder->GetMessageCount(); |
1236 |
1240 |
1972 iQuery->ShowNoteL(EAknGlobalConfirmationNote, str->Des()); |
1976 iQuery->ShowNoteL(EAknGlobalConfirmationNote, str->Des()); |
1973 CleanupStack::PopAndDestroy( str ); |
1977 CleanupStack::PopAndDestroy( str ); |
1974 } |
1978 } |
1975 |
1979 |
1976 // ---------------------------------------------------------------------------- |
1980 // ---------------------------------------------------------------------------- |
1977 // CMailCpsHandler::BackupOrRestoreMode() |
|
1978 // Check if phone is in backup/restore mode |
|
1979 // ---------------------------------------------------------------------------- |
|
1980 // |
|
1981 TBool CMailCpsHandler::BackupOrRestoreMode() |
|
1982 { |
|
1983 FUNC_LOG; |
|
1984 |
|
1985 TBool backupOrRestore = EFalse; |
|
1986 |
|
1987 // Get the back-up restore key, return EFalse if we can't get the key |
|
1988 TInt keyVal = 0; |
|
1989 const TInt error = RProperty::Get( KUidSystemCategory, conn::KUidBackupRestoreKey, keyVal ); |
|
1990 if( error == KErrNone ) |
|
1991 { |
|
1992 const conn::TBURPartType partType = |
|
1993 static_cast< conn::TBURPartType >( keyVal & conn::KBURPartTypeMask ); |
|
1994 |
|
1995 if ( keyVal != 0 ) |
|
1996 { |
|
1997 switch( partType ) |
|
1998 { |
|
1999 case conn::EBURBackupFull: |
|
2000 case conn::EBURBackupPartial: |
|
2001 case conn::EBURRestoreFull: |
|
2002 case conn::EBURRestorePartial: |
|
2003 backupOrRestore = ETrue; |
|
2004 break; |
|
2005 case conn::EBURUnset: |
|
2006 case conn::EBURNormal: |
|
2007 default: |
|
2008 break; |
|
2009 } |
|
2010 } |
|
2011 } |
|
2012 return backupOrRestore; |
|
2013 } |
|
2014 |
|
2015 // ---------------------------------------------------------------------------- |
|
2016 // class CMailCpsUpdateHelper : public CTimer |
1981 // class CMailCpsUpdateHelper : public CTimer |
2017 // Used to limit the rate of updates to Homescreen widget |
1982 // Used to limit the rate of updates to Homescreen widget |
2018 // ---------------------------------------------------------------------------- |
1983 // ---------------------------------------------------------------------------- |
2019 // |
1984 // |
2020 |
1985 |