diff -r 759dc5235cdb -r bf7eb7911fc5 ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp --- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Fri Jun 11 13:27:14 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Wed Jun 23 18:00:21 2010 +0300 @@ -25,11 +25,13 @@ #include "ipsplgmailstoreroperation.h" #include "ipsplgmessagepartstoreroperation.h" #include "BasePlugin.h" +// +#include "ipssosextendedsettingsmanager.h" +#include "ipssettingkeys.h" +// // -// S60 UID update #define FREESTYLE_EMAIL_UI_SID 0x200255BA -// S60 UID update const TInt KOpGranularity = 2; @@ -39,6 +41,29 @@ _LIT( KEmulatorIMEI, "123456789012345" ); #endif // __WINS__ +// +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +void CIpsPlgSosBasePlugin::ActiveFolderChanged( + const TFSMailMsgId& aActiveMailboxId, + const TFSMailMsgId& aActiveFolderId) + { + TRAP_IGNORE( HandleActiveFolderChangeL(aActiveMailboxId,aActiveFolderId) ); + } + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +CEmailExtension* CIpsPlgSosBasePlugin::ExtensionL( const TUid& aInterfaceUid ) + { + if(aInterfaceUid != KEmailMailboxStateExtensionUid) + { + User::Leave(KErrNotSupported); + } + + return iStateExtension; + } +// // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // iSettingsApi removed @@ -77,6 +102,7 @@ { iEventHandler->UnRegisterPropertyObserver( iSyncStateHandler ); } + delete iStateExtension; delete iEventHandler; delete iCachedEntry; delete iCachedEmailMessage; @@ -92,6 +118,7 @@ void CIpsPlgSosBasePlugin::BaseConstructL() { FUNC_LOG; + iStateExtension = CIpsStateExtension::NewL(*this); iEventHandler = CIpsPlgEventHandler::NewL( *this ); iSession = CMsvSession::OpenAsyncL( *iEventHandler ); iMsgMapper = CIpsPlgMsgMapper::NewL( *iSession, *this ); @@ -2456,4 +2483,50 @@ } return ret; } +// +// +// --------------------------------------------------------------------------- +// CIpsPlgImap4Plugin::HandleActiveFolderChangeL +// --------------------------------------------------------------------------- +// +void CIpsPlgSosBasePlugin::HandleActiveFolderChangeL( + const TFSMailMsgId& aActiveMailboxId, + const TFSMailMsgId& aActiveFolderId) + { + TMsvId service; + TMsvEntry folder; + iSession->GetEntry( aActiveFolderId.Id(), service, folder ); + + + //currently, no actions unless this is inbox + //also, if id is '0', it means inbox before first sync...it doesn't really exist yet + if( folder.iDetails.CompareF( KIpsPlgInbox ) == 0 || folder.Id() == 0 ) + { + //folder is inbox + if ( iSyncStateHandler->GetMailboxIpsState( aActiveMailboxId.Id() ) + == KIpsSosEmailSyncStarted ) + { + //we won't do anything if sync is already started + return; + } + + //check are we in polling mode + NmIpsSosExtendedSettingsManager* eMgr= + new NmIpsSosExtendedSettingsManager(aActiveMailboxId.Id()); + + QVariant value; + bool ok = eMgr->readSetting(IpsServices::ReceptionActiveProfile, value); + delete eMgr; + + if ( ok ) + { + TInt profile = value.toInt(); + if ( profile != IpsServices::EmailSyncProfileManualFetch ) + { + // let's sync + GoOnlineL(aActiveMailboxId); + } + } + } + } //