messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp
changeset 73 ecf6a73a9186
parent 48 4f501b74aeb1
equal deleted inserted replaced
68:e8a69c93c830 73:ecf6a73a9186
    32 #include "mmssettingprivate.h"
    32 #include "mmssettingprivate.h"
    33 
    33 
    34 /**
    34 /**
    35  * Message Server session event handler 
    35  * Message Server session event handler 
    36  */
    36  */
    37 class CEventHandler : public MMsvSessionObserver
    37 class CEventHandler : public CBase, public MMsvSessionObserver
    38 {
    38 {
    39 public:
    39 public:
    40     void HandleSessionEvent(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
    40     void HandleSessionEvent(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
    41                             TAny* aArg3);
    41                             TAny* aArg3);
    42     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
    42     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
    93 void MmsSettingsPrivate::createRepositoryL()
    93 void MmsSettingsPrivate::createRepositoryL()
    94 {
    94 {
    95     CEventHandler* pObserver = new (ELeave) CEventHandler();
    95     CEventHandler* pObserver = new (ELeave) CEventHandler();
    96     CleanupStack::PushL(pObserver);
    96     CleanupStack::PushL(pObserver);
    97 
    97 
    98     CMsvSession* iMsvSession = CMsvSession::OpenSyncL(*pObserver);
    98     CMsvSession* msvSession = CMsvSession::OpenSyncL(*pObserver);
    99     CleanupStack::PushL(iMsvSession);
    99     CleanupStack::PushL( msvSession);
   100 
   100 
   101     CMmsSettings* mmsSetting = CMmsSettings::NewL();
   101     CMmsSettings* mmsSetting = CMmsSettings::NewL();
   102     CleanupStack::PushL(mmsSetting);
   102     CleanupStack::PushL(mmsSetting);
   103 
   103 
   104     mmsSetting->LoadSettingsL();
   104     mmsSetting->LoadSettingsL();
   105 
   105 
   106     TMsvId entryToBeKilled = KMsvNullIndexEntryId;
   106     TMsvId entryToBeKilled = KMsvNullIndexEntryId;
   107     // Get access to root index
   107     // Get access to root index
   108     CMsvEntry* cEntry = iMsvSession->GetEntryL(KMsvRootIndexEntryId);
   108     CMsvEntry* cEntry = msvSession->GetEntryL(KMsvRootIndexEntryId);
   109     CleanupStack::PushL(cEntry);
   109     CleanupStack::PushL(cEntry);
   110 
   110 
   111     entryToBeKilled = mmsSetting->Service();
   111     entryToBeKilled = mmsSetting->Service();
   112     cEntry->SetSortTypeL(TMsvSelectionOrdering(KMsvNoGrouping,
   112     cEntry->SetSortTypeL(TMsvSelectionOrdering(KMsvNoGrouping,
   113                                                EMsvSortByNone,
   113                                                EMsvSortByNone,
   114                                                ETrue));
   114                                                ETrue));
   115     if (entryToBeKilled == KMsvNullIndexEntryId)
   115     if (entryToBeKilled == KMsvNullIndexEntryId)
   116     {
   116     {
   117         mmsSetting->CreateNewServiceL(*iMsvSession);
   117         mmsSetting->CreateNewServiceL(*msvSession);
   118     }
   118     }
   119 
   119 
   120     CleanupStack::PopAndDestroy(); // cEntry          
   120     CleanupStack::PopAndDestroy(); // cEntry          
   121 
   121 
   122     mmsSetting->SetReceivingModeHome(EMmsReceivingAutomatic);
   122     mmsSetting->SetReceivingModeHome(EMmsReceivingAutomatic);