messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 48 4f501b74aeb1
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
   147 
   147 
   148     //Load settings
   148     //Load settings
   149     mMmsClient->RestoreSettingsL();
   149     mMmsClient->RestoreSettingsL();
   150     mMmsSetting->CopyL( mMmsClient->MmsSettings() );
   150     mMmsSetting->CopyL( mMmsClient->MmsSettings() );
   151 
   151 
   152     //do your operation
   152     switch ( aRetrieval )
   153     TMmsReceivingMode receveMode = EMmsReceivingAutomatic;
   153                 {
   154 
   154                 case MsgSettingEngine::AutomInHomeNetwork:
   155     if (aRetrieval == MsgSettingEngine::Maual)
   155                     {
   156         receveMode = EMmsReceivingManual;
   156                     mMmsSetting->SetReceivingModeHome( EMmsReceivingAutomatic );
   157     else if (aRetrieval == MsgSettingEngine::Off)
   157                     mMmsSetting->SetReceivingModeForeign( EMmsReceivingManual );
   158         receveMode = EMmsReceivingPostpone;
   158                     break;
   159     else if (aRetrieval == MsgSettingEngine::No)
   159                     }
   160         receveMode = EMmsReceivingReject;
   160                 case MsgSettingEngine::AlwaysAutomatic:
   161 
   161                     { 
   162     if (aRetrieval == MsgSettingEngine::AlwaysAutomatic)
   162                     mMmsSetting->SetReceivingModeHome( EMmsReceivingAutomatic );
   163         {
   163                     mMmsSetting->SetReceivingModeForeign( EMmsReceivingAutomatic );
   164         mMmsSetting->SetReceivingModeForeign(receveMode);
   164                     break;
   165         }
   165                     }
   166     else
   166                 case  MsgSettingEngine::Manual:
   167         {
   167                     {
   168         mMmsSetting->SetReceivingModeForeign(EMmsReceivingManual);
   168                     mMmsSetting->SetReceivingModeHome( EMmsReceivingManual );
   169         }
   169                     mMmsSetting->SetReceivingModeForeign( EMmsReceivingManual );
   170 
   170                     break;
   171     mMmsSetting->SetReceivingModeHome(receveMode);
   171                     }
       
   172                 case MsgSettingEngine::Off:
       
   173                     {   
       
   174                     mMmsSetting->SetReceivingModeHome( EMmsReceivingPostpone );
       
   175                     mMmsSetting->SetReceivingModeForeign( EMmsReceivingPostpone );
       
   176                     break;
       
   177                     }
       
   178                 case MsgSettingEngine::No:
       
   179                    {   
       
   180                    mMmsSetting->SetReceivingModeHome( EMmsReceivingReject );
       
   181                    mMmsSetting->SetReceivingModeForeign( EMmsReceivingReject );
       
   182                    break;
       
   183                    }
       
   184                 default:
       
   185                     break;
       
   186                 }
       
   187     
   172     
   188     
   173     //save the settings
   189     //save the settings
   174     mMmsClient->SetSettingsL( *mMmsSetting );
   190     mMmsClient->SetSettingsL( *mMmsSetting );
   175     //TODO:User Input should be blocked when save is being done
   191     //TODO:User Input should be blocked when save is being done
   176     //This should be called as this takes care of automatic 
   192     //This should be called as this takes care of automatic 
   227     CMmsSettings* mMmsSetting = CMmsSettings::NewL();
   243     CMmsSettings* mMmsSetting = CMmsSettings::NewL();
   228     CleanupStack::PushL(mMmsSetting);
   244     CleanupStack::PushL(mMmsSetting);
   229 
   245 
   230     mMmsAccount->LoadSettingsL(*mMmsSetting);
   246     mMmsAccount->LoadSettingsL(*mMmsSetting);
   231 
   247 
   232     TMmsReceivingMode receveMode = mMmsSetting->ReceivingModeHome();
   248     TMmsReceivingMode receveModeHome = mMmsSetting->ReceivingModeHome();
       
   249     TMmsReceivingMode receveModeForeign = mMmsSetting->ReceivingModeForeign();
       
   250    
   233     
   251     
   234     if (receveMode == EMmsReceivingManual)
   252     // if default value is not acceptable, choose next by keeping costs low
   235         aRetrieval = MsgSettingEngine::Maual;
   253        if ( receveModeHome == EMmsReceivingAutomatic &&
   236     else if (receveMode == EMmsReceivingPostpone)
   254            receveModeForeign == EMmsReceivingAutomatic )
   237         aRetrieval = MsgSettingEngine::Off;
   255        {
   238     else if (receveMode == EMmsReceivingReject)
   256        aRetrieval = MsgSettingEngine::AlwaysAutomatic;
   239         aRetrieval = MsgSettingEngine::No;
   257        }
   240 
   258        else if ( receveModeHome == EMmsReceivingManual &&
   241     receveMode = mMmsSetting->ReceivingModeForeign();
   259            receveModeForeign == EMmsReceivingManual )
   242     if (receveMode == EMmsReceivingAutomatic)
   260        {
   243         {
   261        aRetrieval = MsgSettingEngine::Manual;   
   244         aRetrieval = MsgSettingEngine::AlwaysAutomatic;
   262        }
   245         }
   263        else if ( receveModeHome == EMmsReceivingReject &&
   246 
   264            receveModeForeign == EMmsReceivingReject )
       
   265        {
       
   266        aRetrieval = MsgSettingEngine::No; 
       
   267        }
       
   268        else if ( receveModeHome == EMmsReceivingPostpone &&
       
   269            receveModeForeign == EMmsReceivingPostpone )
       
   270        {
       
   271        aRetrieval = MsgSettingEngine::Off;   
       
   272        }
       
   273        // Should always be automatic@home & manaul@roam
       
   274        else
       
   275        {
       
   276        aRetrieval = MsgSettingEngine::AutomInHomeNetwork;   
       
   277        }
   247     aAnonymousStatus = mMmsSetting->AcceptAnonymousMessages();
   278     aAnonymousStatus = mMmsSetting->AcceptAnonymousMessages();
   248 
   279 
   249     aMmsAdvertsStatus = mMmsSetting->AcceptAdvertisementMessages();
   280     aMmsAdvertsStatus = mMmsSetting->AcceptAdvertisementMessages();
   250 
   281 
   251     CleanupStack::PopAndDestroy(2);
   282     CleanupStack::PopAndDestroy(2);