syncmlfw/syncmlnotifier/src/SyncMLFwUpdNotifier.cpp
branchRCL_3
changeset 26 19bba8228ff0
child 27 5cc2995847ea
equal deleted inserted replaced
25:b183ec05bd8c 26:19bba8228ff0
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  The firmware update result notifier.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <eikenv.h>          // Eikon environment
       
    22 #include <uikon/eiksrvui.h>
       
    23 #include <AknQueryDialog.h>
       
    24 #include <aknmessagequerydialog.h>
       
    25 #include <aknstaticnotedialog.h>
       
    26 #include <centralrepository.h>  
       
    27 #include <StringLoader.h>    // Localisation stringloader
       
    28 #include <SyncMLClient.h>
       
    29 #include <SyncMLClientDS.h>
       
    30 #include <SyncMLClientDM.h>
       
    31 #include <centralrepository.h>
       
    32 #include <DevManInternalCRKeys.h>   
       
    33 #include <SyncMLNotifierDomainCRKeys.h> 
       
    34 #include <SyncMLNotifier.rsg>           // Own resources
       
    35 #include <aknnotewrappers.h>
       
    36 #include <e32property.h>
       
    37 
       
    38 #include "SyncMLFwUpdNotifier.h"  // Class declaration
       
    39 #include "SyncMLNotifDebug.h"
       
    40 
       
    41 #include "SyncMLQueryDialog.h"
       
    42 #include "SyncMLMessageQueryDialog.h"
       
    43 #include "SyncMLNotifPrivateCRKeys.h"
       
    44 
       
    45 // ============================ MEMBER FUNCTIONS ===============================
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CSyncMLFwUpdNotifier::CSyncMLFwUpdNotifier
       
    49 // C++ default constructor can NOT contain any code, that
       
    50 // might leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CSyncMLFwUpdNotifier::CSyncMLFwUpdNotifier()
       
    54     {
       
    55     iRunLhang = EFalse;
       
    56     iDlg = NULL;
       
    57     iFotaEncryptReq = EFalse;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CSyncMLDSNotifier::NewL
       
    62 // Two-phased constructor.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 CSyncMLFwUpdNotifier* CSyncMLFwUpdNotifier::NewL()
       
    66     {
       
    67     CSyncMLFwUpdNotifier* self = new (ELeave) CSyncMLFwUpdNotifier();
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();
       
    70     CleanupStack::Pop();
       
    71     return self;
       
    72     }
       
    73 
       
    74     
       
    75 // -----------------------------------------------------------------------------
       
    76 // Destructor
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 CSyncMLFwUpdNotifier::~CSyncMLFwUpdNotifier()
       
    80     {
       
    81     Cancel();   // Free own resources
       
    82     }
       
    83 
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CSyncMLFwUpdNotifier::RegisterL
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 CSyncMLFwUpdNotifier::TNotifierInfo CSyncMLFwUpdNotifier::RegisterL()
       
    90     {
       
    91     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RegisterL()"));
       
    92     iInfo.iUid = KSyncMLFwUpdNotifierUid;
       
    93     iInfo.iChannel = KSmlFwUpdChannel;
       
    94     iInfo.iPriority = ENotifierPriorityHigh;
       
    95     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RegisterL() completed"));
       
    96     return iInfo;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CSyncMLFwUpdNotifier::GetParamsL
       
   101 // Initialize parameters and check if device is already
       
   102 // in registry. Jump to RunL as soon as possible.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CSyncMLFwUpdNotifier::GetParamsL( const TDesC8& aBuffer,
       
   106                                              TInt aReplySlot,
       
   107                                        const RMessagePtr2& aMessage )
       
   108     {
       
   109     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::GetParamsL()"));
       
   110 
       
   111     if( iReplySlot != NULL || iNeedToCompleteMessage )
       
   112         {
       
   113         User::Leave( KErrInUse );
       
   114         }
       
   115     iMessage = aMessage;
       
   116     iNeedToCompleteMessage = ETrue;
       
   117     iReplySlot = aReplySlot;
       
   118 
       
   119 	TSyncMLFwUpdNotifParams param;
       
   120  	TPckgC<TSyncMLFwUpdNotifParams> pckg( param );
       
   121  	pckg.Set( aBuffer );
       
   122 
       
   123     iNoteType = pckg().iNoteType;
       
   124     iNoteInfo = pckg().iIntParam;
       
   125     iFotaMemoryNeeded = pckg().iMemoryNeeded;
       
   126     iFotaEncryptReq = pckg().iEncryptReq;
       
   127 	
       
   128 	iUserPostponeCount = pckg().iFotaUserPostponeCount;
       
   129     iMaxPostponeCount = pckg().iFotaMaxPostponeCount;
       
   130     iIntervalType = pckg().iIntervalType;
       
   131     iInterval = pckg().iInterval;
       
   132     
       
   133     if(pckg().iSelectedReminder.Length() > 0)
       
   134         iSelectedReminder.Copy(pckg().iSelectedReminder);
       
   135 
       
   136     // Call SetActive() so RunL() will be called by the active scheduler
       
   137     //
       
   138     SetActive();
       
   139     iStatus = KRequestPending;
       
   140     TRequestStatus* stat = &iStatus;
       
   141     User::RequestComplete( stat, KErrNone );
       
   142 
       
   143     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::GetParamsL() completed"));
       
   144     }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CSyncMLFwUpdNotifier::RunL
       
   148 // Ask user response and return it to caller.
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 void CSyncMLFwUpdNotifier::RunL()
       
   152     {
       
   153     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RunL()"));
       
   154 
       
   155     TInt result( KErrNone );
       
   156     const TInt KNormal = 1;
       
   157 		const TInt KForce = 0;
       
   158 
       
   159     // Turn lights on and deactivate apps -key
       
   160     //
       
   161     TurnLightsOn();
       
   162     SuppressAppSwitching( ETrue );
       
   163 
       
   164     switch( iNoteType )
       
   165         {
       
   166         case ESyncMLFwUpdErrorNote:
       
   167             {
       
   168             result = ShowUpdateErrorNoteL();
       
   169             break;
       
   170             }
       
   171 
       
   172         case ESyncMLFwUpdResultNote:
       
   173             {
       
   174             if (iFotaEncryptReq)
       
   175                 {
       
   176                 result = ShowUpdateResultWithEncryptionNoteL();
       
   177                 }
       
   178             else
       
   179                 {
       
   180                 result = ShowUpdateResultNoteL();
       
   181                 }
       
   182             break;
       
   183             }
       
   184 		case ESyncMLFwUpdPostponeLimitQuery:
       
   185             {
       
   186             result = ShowPostLimitUpdateStartQueryL(KNormal);
       
   187        			break;
       
   188      				}
       
   189         
       
   190         case ESyncMLFwUpdForceQuery:
       
   191             {
       
   192             result = ShowPostLimitUpdateStartQueryL(KForce);
       
   193             break;
       
   194             }
       
   195             
       
   196         case ESyncMLFwUpdStartQuery:
       
   197             {
       
   198             result = ShowUpdateStartQueryL();
       
   199             break;
       
   200             }
       
   201         case ESyncMLFwUpdRebootNote:
       
   202             {
       
   203             CAknStaticNoteDialog* dlg = new ( ELeave ) CAknStaticNoteDialog;
       
   204             dlg->PrepareLC( R_SML_FOTA_RESTART_NOTE );
       
   205 
       
   206             HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_REBOOT_NOTE );
       
   207             dlg->SetTextL( *stringHolder );
       
   208             CleanupStack::PopAndDestroy( stringHolder );
       
   209 
       
   210             result = dlg->RunLD();
       
   211             if ( result == KErrNone )
       
   212                 {
       
   213                 result = EAknSoftkeyOk;
       
   214                 };
       
   215             
       
   216             break;
       
   217             }
       
   218      	case ESyncMLFwUpdNoReminder:
       
   219      		{
       
   220      		 result =  ShowNoReminderQueryL();
       
   221 			 break;
       
   222             }
       
   223         case ESyncMLFwUpdLargeNotEnoughMemory:
       
   224         	{
       
   225         	 result = ShowNotEnoughMemoryL( iFotaMemoryNeeded , EFalse );
       
   226 			 break;
       
   227         	}
       
   228         case ESyncMLFwUpdOmaDLNotEnoughMemory:
       
   229         	{
       
   230         	 result = ShowNotEnoughMemoryL( iFotaMemoryNeeded , ETrue );
       
   231 			 break;
       
   232         	}	
       
   233         case ESyncMLFwUpdOmaDLUserCancel:
       
   234         	{
       
   235         	 result = ShowDownloadUserCancelL();
       
   236         	 break;	
       
   237         	}
       
   238         case ESyncMLFwUpdOmaDLPostponed:
       
   239         	{
       
   240         	 result = ShowDownloadPostponedL();
       
   241         	 break;	
       
   242         	}
       
   243         case ESyncMLFwUpdOmaDLCancelled:
       
   244         	{
       
   245         	 result = ShowDownloadCancelledL();
       
   246         	 break;	
       
   247         	}
       
   248         case ESyncMLFwUpdOmaDLResume:
       
   249         	{
       
   250         	 result = ShowDownloadResumeL();
       
   251         	 break;	
       
   252         	}
       
   253         case ESyncMLFwUpdStartQueryEnc:
       
   254             {
       
   255             result = ShowUpdateStartQueryEncryptionL();
       
   256             break;
       
   257             }
       
   258 		case ESyncMLFwUpdPostponeNote:
       
   259             {
       
   260             result = ShowPostponeLimitNoteL();
       
   261             break; 
       
   262             }
       
   263         default: // Unhandled note type
       
   264             {
       
   265             FLOG(_L("[SMLNOTIF]\t CSyncMLDlgNotifier::RunL() Note type not handled"));
       
   266             User::Leave( KErrArgument );
       
   267             break;
       
   268             }
       
   269         }
       
   270 
       
   271     // Activate apps -key again
       
   272     //
       
   273     SuppressAppSwitching( EFalse );
       
   274 
       
   275 		if ( iNeedToCompleteMessage )
       
   276 			{
       
   277 			// Translate the user key presses to message completion response
       
   278 			FTRACE( FPrint( _L("[SmlNotif]\t User Key-Press for dialog = %d" ), result ) );
       
   279 			switch( result ) 
       
   280 				{
       
   281 					case ESyncMLDlgRespKeyOk://all LSK press will fall here.
       
   282 						iMessage.Complete( KErrNone );
       
   283 						break;
       
   284 					case ESyncMLDlgRespKeyCancel://all RSK press will fall here.
       
   285 						iMessage.Complete (KErrCancel);
       
   286 						break;
       
   287 					case ESyncMLDlgRespKeyOthers: //all call-termination key press fall here.
       
   288 						iMessage.Complete (KErrNotFound);
       
   289 						break;
       
   290 					default://rest of the cases and errors
       
   291 						iMessage.Complete (KErrNone);
       
   292 						break;
       
   293 				}		
       
   294 			}
       
   295 
       
   296 
       
   297     // Complete message and free resources
       
   298     //
       
   299     iNeedToCompleteMessage = EFalse;
       
   300     iReplySlot = NULL;
       
   301 
       
   302     iNoteType = ESyncMLFwUpdUnknown;
       
   303 
       
   304     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RunL() completed"));
       
   305     }
       
   306 
       
   307 // -----------------------------------------------------------------------------
       
   308 // CSyncMLFwUpdNotifier::Cancel
       
   309 // Release all own resources (member variables)
       
   310 // -----------------------------------------------------------------------------
       
   311 //
       
   312 void CSyncMLFwUpdNotifier::Cancel()
       
   313     {
       
   314     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()"));
       
   315     if(iRunLhang)
       
   316     	{
       
   317     	 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel() inside Runlhang"));
       
   318     	if(iDlg)
       
   319     		{
       
   320     		FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()before exit"));
       
   321     		TRAP_IGNORE(iDlg->ExitL());
       
   322     		if(iDlg)
       
   323     			{
       
   324         		FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()before delete"));
       
   325     			delete iDlg;
       
   326     			iDlg = NULL;
       
   327         		FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()after delete"));
       
   328     			}
       
   329     		}
       
   330     	}
       
   331     CSyncMLNotifierBase::Cancel();
       
   332 
       
   333     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel() completed"));
       
   334     }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL
       
   338 // -----------------------------------------------------------------------------
       
   339 //
       
   340 TInt CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL()
       
   341     {
       
   342     FTRACE( FPrint( _L(
       
   343         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL() error = %d" ),
       
   344         iNoteInfo ) );
       
   345 
       
   346     HBufC* stringHolder( NULL );
       
   347 
       
   348     switch ( iNoteInfo )
       
   349         {
       
   350         case KErrDiskFull:
       
   351             {
       
   352             stringHolder = StringLoader::LoadLC( R_FOTA_NOT_PERMITTED );
       
   353             break;
       
   354             }
       
   355         case KErrCommsLineFail:
       
   356             {
       
   357             stringHolder = StringLoader::LoadLC( R_FOTA_LOST_CONNECTION );
       
   358             break;
       
   359             }
       
   360         case KErrCouldNotConnect:
       
   361             {
       
   362             stringHolder = StringLoader::LoadLC( R_FOTA_SERVER_ERROR );
       
   363             break;
       
   364             }
       
   365         case KErrBadPower:
       
   366             {
       
   367             stringHolder = StringLoader::LoadLC( R_FOTA_BATTERY_LOW );
       
   368             break;
       
   369             }
       
   370         case KErrBadUsbPower:
       
   371              {
       
   372              	stringHolder = StringLoader::LoadLC( R_FOTA_USB_BATTERY_LOW ); 
       
   373              	break;
       
   374             }
       
   375         case KErrCommsLineFail2:
       
   376             {
       
   377             stringHolder = StringLoader::LoadLC( R_FOTA_CONNECTION_FAIL2 );
       
   378             break;
       
   379             }
       
   380         case KErrGeneralResume:
       
   381             {
       
   382             stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_GENERAL_RESUME );
       
   383             break;
       
   384             }
       
   385         case KErrGeneralNoResume:
       
   386             {
       
   387             stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_NO_RESUME );
       
   388             break;
       
   389             }
       
   390         case KErrBadPowerForEnc:
       
   391             {
       
   392             stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_ENC_BATTERY_LOW );
       
   393             break;
       
   394             }
       
   395         case KErrDeviceMemoryBusy:
       
   396             {
       
   397             stringHolder = StringLoader::LoadLC( R_FOTA_DEVICE_MEMORY_BUSY );
       
   398             break;
       
   399             }
       
   400         default:
       
   401             {
       
   402             return KErrArgument; // Will be converted to KErrNone when completing
       
   403                                  // message, since this is not actually an error.
       
   404             }
       
   405         }
       
   406 
       
   407     
       
   408     TBool keypress(EFalse);
       
   409 	CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   410     msgDlg->SetMessageTextL(*stringHolder);
       
   411     
       
   412     CleanupStack::PopAndDestroy( stringHolder );
       
   413     
       
   414     msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   415 
       
   416     stringHolder = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   417     msgDlg->SetHeaderTextL( stringHolder->Des() );
       
   418     CleanupStack::PopAndDestroy( stringHolder );
       
   419     stringHolder = NULL;
       
   420     
       
   421    	msgDlg->ButtonGroupContainer().SetCommandSetL( 
       
   422     	                                  R_AVKON_SOFTKEYS_OK_EMPTY__OK );
       
   423     
       
   424     TInt retval (ESyncMLDlgRespKeyNone);
       
   425     iRunLhang = ETrue;
       
   426     iDlg = msgDlg; 
       
   427 	retval = msgDlg->RunLD();
       
   428 	iRunLhang = EFalse;
       
   429     msgDlg = NULL;
       
   430 	iDlg = NULL;
       
   431 
       
   432 	//call-termination key press is handled here.
       
   433 	if (keypress)
       
   434     	retval = ESyncMLDlgRespKeyOthers;
       
   435     
       
   436     FTRACE( FPrint( _L(
       
   437         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL() completed: retval = %d" ),
       
   438         retval ) );
       
   439         
       
   440     return retval;
       
   441     }
       
   442 
       
   443 // -----------------------------------------------------------------------------
       
   444 // CSyncMLFwUpdNotifier::ShowUpdateResultNoteL
       
   445 // -----------------------------------------------------------------------------
       
   446 //
       
   447 TInt CSyncMLFwUpdNotifier::ShowUpdateResultNoteL()
       
   448     {
       
   449     FTRACE( FPrint( _L(
       
   450         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultNoteL() result = %d" ),
       
   451         iNoteInfo ) );
       
   452 
       
   453     HBufC* stringHolder( NULL );
       
   454 
       
   455     switch ( iNoteInfo )  // It is easier to add cases to switch structure
       
   456         {
       
   457         case KErrNone:
       
   458             {
       
   459             stringHolder = StringLoader::LoadLC( R_FOTA_NOTIF_COMPLETE );
       
   460             break;
       
   461             }
       
   462         default:
       
   463             {
       
   464             stringHolder = StringLoader::LoadLC( R_FOTA_MSG_QUERY_NOT_UPDATED );
       
   465             break;
       
   466             }
       
   467         }
       
   468         
       
   469     TBool keypress(EFalse);
       
   470 	CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   471     msgDlg->SetMessageTextL(*stringHolder);
       
   472 
       
   473     CleanupStack::PopAndDestroy( stringHolder );
       
   474     
       
   475     msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   476 
       
   477     stringHolder = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   478     msgDlg->SetHeaderTextL( stringHolder->Des() );
       
   479     CleanupStack::PopAndDestroy( stringHolder );
       
   480     stringHolder = NULL;
       
   481     
       
   482    	msgDlg->ButtonGroupContainer().SetCommandSetL( 
       
   483         									R_AVKON_SOFTKEYS_OK_EMPTY__OK );
       
   484     TInt retval(ESyncMLDlgRespKeyNone);
       
   485     iRunLhang = ETrue;
       
   486     iDlg = msgDlg; 
       
   487     retval = msgDlg->RunLD();
       
   488     iRunLhang = EFalse;
       
   489     msgDlg = NULL;
       
   490     iDlg = NULL;
       
   491 	//call-termination key press has to be suppressed here. so keypress has no significance here!    
       
   492 	/*if (keypress)
       
   493     	retval = EKeyOthers;*/
       
   494     	
       
   495     FTRACE( FPrint( _L(
       
   496         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultNoteL() completed: retval = %d" ),
       
   497         retval ) );
       
   498     
       
   499     return retval;
       
   500     }
       
   501 
       
   502 
       
   503 // -----------------------------------------------------------------------------
       
   504 // CSyncMLFwUpdNotifier::ShowPostLimitUpdateStartQueryL
       
   505 // -----------------------------------------------------------------------------
       
   506 //
       
   507 TInt CSyncMLFwUpdNotifier::ShowPostLimitUpdateStartQueryL(TInt aQueryType)
       
   508 {	    
       
   509 	    FTRACE( FPrint( _L(
       
   510 	        "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() profileId = %d" ),
       
   511 	        aQueryType ) );
       
   512         
       
   513       HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   514       TInt retval (ESyncMLDlgRespKeyNone);  
       
   515       
       
   516       TBool keypress(EFalse);
       
   517 //      CSyncMLQueryDialog* dlg = CSyncMLQueryDialog::NewL(keypress);
       
   518       
       
   519       CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   520       
       
   521       // Implementation of notes for postpone limit requirement.
       
   522         TBuf< KSyncMLMaxProfileNameLength > operatorName;
       
   523         RetrieveProfileNameL( operatorName );
       
   524         
       
   525         HBufC* stringHolder = NULL;
       
   526         retval = ESyncMLDlgRespKeyOk;       
       
   527         TBool bShowInstallQuery = ETrue;
       
   528         TInt fotaUpdateAppName (EFotaUpdateDM);
       
   529         TInt errAppName = RProperty::Get( KPSUidNSmlDMSyncApp, KNSmlCurrentFotaUpdateAppName, fotaUpdateAppName );
       
   530         TInt errShowInstall = RProperty::Get( KPSUidNSmlDMSyncApp, KDevManShowInstallNowQuery, bShowInstallQuery );
       
   531 
       
   532         FTRACE( FPrint(
       
   533                 _L("CSyncMLFwUpdNotifier::ShowUpdateStartQueryL found key Show install query = %d"),
       
   534                 bShowInstallQuery ) );
       
   535 
       
   536 
       
   537         if ( !errAppName && !errShowInstall && fotaUpdateAppName == EFotaUpdateNSC && !bShowInstallQuery )
       
   538             {
       
   539             FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() do not show install now query "));  
       
   540             bShowInstallQuery = EFalse;
       
   541             }
       
   542 
       
   543         if ( !bShowInstallQuery )
       
   544             {
       
   545             FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() should not query "));   
       
   546             }
       
   547         else
       
   548             {
       
   549             FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() will query for Install now? "));
       
   550             if(aQueryType)
       
   551                 {
       
   552                 stringHolder = StringLoader::LoadLC( R_POST_LIMIT_FOTA_QUERY_INSTALL_NOW, operatorName );
       
   553                 msgDlg->SetMessageTextL( *stringHolder );
       
   554                 //dlg->SetPromptL( *stringHolder );
       
   555                 }
       
   556             else
       
   557                 {
       
   558                 stringHolder = StringLoader::LoadLC( R_FOTA_QUERY_INSTALL_FORCE_NOW, operatorName );
       
   559                 msgDlg->SetMessageTextL( *stringHolder );
       
   560                 }
       
   561             CleanupStack::PopAndDestroy( stringHolder );
       
   562             stringHolder = NULL;
       
   563             retval = ESyncMLDlgRespKeyNone;
       
   564             if(aQueryType)
       
   565                 {
       
   566                 //retval = dlg->ExecuteLD( R_FOTA_INSTALL_CONFIRMATION_QUERY );
       
   567                 msgDlg->PrepareLC( R_FOTA_INSTALL_MESSAGE_QUERY );
       
   568                 msgDlg->SetHeaderTextL( headerText->Des() );
       
   569                 retval = msgDlg->RunLD();
       
   570                 }
       
   571             else
       
   572                 {
       
   573                 //retval = dlg->ExecuteLD( R_FOTA_FORCE_INSTALL_CONFIRMATION_QUERY );
       
   574                 msgDlg->PrepareLC( R_FOTA_FORCE_INSTALL_CONFIRMATION_QUERY );
       
   575                 msgDlg->SetHeaderTextL( headerText->Des() );
       
   576                 msgDlg->RunLD();
       
   577                 }
       
   578             //dlg = NULL;
       
   579             msgDlg = NULL;
       
   580             }   
       
   581         // set KDevManShowInstallNowQuery key back to value that it should show query
       
   582         TInt err = RProperty::Set(KPSUidNSmlDMSyncApp,KDevManShowInstallNowQuery,1 );
       
   583         FTRACE( FPrint(
       
   584                 _L("Install query is set back to be shown, err = %d"),
       
   585                 err ) );
       
   586         
       
   587 
       
   588         if ( !keypress && retval )
       
   589             {
       
   590             stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_2_WARNING );
       
   591 
       
   592             //keypress is EFalse here
       
   593             msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   594             msgDlg->SetMessageTextL( *stringHolder );
       
   595 
       
   596             CleanupStack::PopAndDestroy( stringHolder );
       
   597             stringHolder = NULL;
       
   598 
       
   599             msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   600             msgDlg->SetHeaderTextL( headerText->Des() );
       
   601 
       
   602             if(aQueryType)
       
   603                 {
       
   604                 msgDlg->ButtonGroupContainer().SetCommandSetL( 
       
   605                         R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT );
       
   606                 }
       
   607             else
       
   608                 {
       
   609                 msgDlg->ButtonGroupContainer().SetCommandSetL( 
       
   610                         R_SML_SOFTKEYS_FORCE_ACCEPT__ACCEPT );
       
   611                 }
       
   612 
       
   613             retval = ESyncMLDlgRespKeyNone;
       
   614             retval = msgDlg->RunLD();
       
   615             msgDlg = NULL;
       
   616             }
       
   617         
       
   618       CleanupStack::PopAndDestroy( headerText );
       
   619     
       
   620     FTRACE( FPrint( _L(
       
   621         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() completed: retval = %d, keypress = %d" ),
       
   622         retval,keypress ) );
       
   623 
       
   624 	//call-termination key press is handled here.
       
   625 	if (keypress)
       
   626     	retval = ESyncMLDlgRespKeyOthers;
       
   627 	
       
   628     return retval;
       
   629 }
       
   630 
       
   631 // -----------------------------------------------------------------------------
       
   632 // CSyncMLFwUpdNotifier::ShowUpdateStartQueryL
       
   633 // -----------------------------------------------------------------------------
       
   634 //
       
   635 TInt CSyncMLFwUpdNotifier::ShowUpdateStartQueryL()
       
   636     {
       
   637     FTRACE( FPrint( _L(
       
   638         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() profileId = %d" ),
       
   639         iNoteInfo ) );
       
   640 
       
   641     HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   642     TInt retval (ESyncMLDlgRespKeyNone);  
       
   643     TInt CustomNotes(KErrNone);
       
   644     CRepository* centrep = NULL;
       
   645     TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) );    
       
   646     if(!err && centrep)
       
   647     {
       
   648       TInt err= centrep->Get( KDevManUINotesCustomization, CustomNotes);	
       
   649       if (err)
       
   650        CustomNotes = 0;
       
   651     }
       
   652     else
       
   653     {
       
   654       CustomNotes = 0;	
       
   655     }
       
   656     TBool keypress(EFalse);
       
   657     CSyncMLQueryDialog* dlg = CSyncMLQueryDialog::NewL(keypress);
       
   658     TLanguage language = User::Language();
       
   659     if((CustomNotes) && IsLanguageSupportedL())
       
   660     {       //This note will be shown in chinese and english variant only and localisation is not done
       
   661      CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); 
       
   662      HBufC* stringHolder = StringLoader::LoadLC (R_QTN_FOTA_MSG_QUERY_UPDATE_CUSTOM_WARNING);     
       
   663      msgDlg->SetMessageTextL(*stringHolder);
       
   664      CleanupStack::PopAndDestroy( stringHolder );
       
   665      stringHolder = NULL;
       
   666      msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   667      msgDlg->SetHeaderTextL( headerText->Des() );
       
   668      msgDlg->ButtonGroupContainer().SetCommandSetL( R_FOTA_INSTALL_QUERY_SOFTKEYS_NOW_LATER__NOW );
       
   669      retval = ESyncMLDlgRespKeyNone;
       
   670      retval = msgDlg->RunLD();
       
   671      msgDlg = NULL;
       
   672      FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() after new changes in phone updates"));
       
   673     }
       
   674     else
       
   675     {
       
   676       TBuf< KSyncMLMaxProfileNameLength > profileName;
       
   677       RetrieveProfileNameL( profileName ); 
       
   678       
       
   679   HBufC* stringHolder = NULL;
       
   680 	retval = ESyncMLDlgRespKeyOk;    	
       
   681 	TBool bShowInstallQuery = ETrue;
       
   682 	TInt fotaUpdateAppName (EFotaUpdateDM);
       
   683 	TInt errAppName = RProperty::Get( KPSUidNSmlDMSyncApp, KNSmlCurrentFotaUpdateAppName, fotaUpdateAppName );
       
   684 	TInt errShowInstall = RProperty::Get( KPSUidNSmlDMSyncApp, KDevManShowInstallNowQuery, bShowInstallQuery );
       
   685 
       
   686 	FTRACE( FPrint(
       
   687 	    _L("CSyncMLFwUpdNotifier::ShowUpdateStartQueryL found key Show install query = %d"),
       
   688 	    bShowInstallQuery ) );
       
   689 
       
   690 
       
   691 	if ( !errAppName && !errShowInstall && fotaUpdateAppName == EFotaUpdateNSC && !bShowInstallQuery )
       
   692 	{
       
   693 			FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() do not show install now query "));	
       
   694 			bShowInstallQuery = EFalse;
       
   695 	}
       
   696 
       
   697 	if ( !bShowInstallQuery )
       
   698 	{
       
   699 		
       
   700 		FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() should not query "));	
       
   701 										
       
   702 	}
       
   703 	
       
   704 	else
       
   705 		
       
   706 	{
       
   707 		FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() will query for Install now? "));		
       
   708     stringHolder = StringLoader::LoadLC( R_FOTA_QUERY_INSTALL_NOW, profileName );
       
   709     dlg->SetPromptL( *stringHolder );
       
   710     CleanupStack::PopAndDestroy( stringHolder );
       
   711     stringHolder = NULL;
       
   712     retval = ESyncMLDlgRespKeyNone;
       
   713     
       
   714 
       
   715     retval = dlg->ExecuteLD( R_FOTA_INSTALL_CONFIRMATION_QUERY );
       
   716 	dlg = NULL;
       
   717 	}	
       
   718 	// set KDevManShowInstallNowQuery key back to value that it should show query
       
   719 	TInt err = RProperty::Set(KPSUidNSmlDMSyncApp,KDevManShowInstallNowQuery,1 );
       
   720 	FTRACE( FPrint(
       
   721 	    _L("Install query is set back to be shown, err = %d"),
       
   722 	    err ) );
       
   723 	
       
   724     if ( !keypress && retval )
       
   725         {
       
   726         stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_1_WARNING );
       
   727                 
       
   728         //keypress is EFalse here
       
   729         CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   730         
       
   731         msgDlg->SetMessageTextL(*stringHolder);
       
   732         CleanupStack::PopAndDestroy( stringHolder );
       
   733         stringHolder = NULL;
       
   734 
       
   735         msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   736         msgDlg->SetHeaderTextL( headerText->Des() );
       
   737         
       
   738        	msgDlg->ButtonGroupContainer().SetCommandSetL( R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT );
       
   739         
       
   740         retval = ESyncMLDlgRespKeyNone;;
       
   741         retval = msgDlg->RunLD();
       
   742         msgDlg = NULL;
       
   743 		
       
   744 		
       
   745 		if ( !keypress && retval )
       
   746 			{
       
   747 	        stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_2_WARNING );
       
   748 	        
       
   749 	        //keypress is EFalse here
       
   750 	        msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   751             msgDlg->SetMessageTextL( *stringHolder );
       
   752 
       
   753 	        CleanupStack::PopAndDestroy( stringHolder );
       
   754 	        stringHolder = NULL;
       
   755 
       
   756 	        msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   757 	        msgDlg->SetHeaderTextL( headerText->Des() );
       
   758 	        
       
   759         	msgDlg->ButtonGroupContainer().SetCommandSetL( 
       
   760 	        						R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT );
       
   761         
       
   762 	        retval = ESyncMLDlgRespKeyNone;
       
   763 	        retval = msgDlg->RunLD();
       
   764 	        msgDlg = NULL;
       
   765 			}
       
   766         }
       
   767         }
       
   768     
       
   769 
       
   770     CleanupStack::PopAndDestroy( headerText );
       
   771     
       
   772     FTRACE( FPrint( _L(
       
   773         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() completed: retval = %d, keypress = %d" ),
       
   774         retval,keypress ) );
       
   775 
       
   776 	//call-termination key press is handled here.
       
   777 	if (keypress)
       
   778     	retval = ESyncMLDlgRespKeyOthers;
       
   779 	
       
   780     return retval;
       
   781     }
       
   782 
       
   783 
       
   784 // -----------------------------------------------------------------------------
       
   785 // CSyncMLFwUpdNotifier::ShowUpdateStartQueryEncryptionL
       
   786 // -----------------------------------------------------------------------------
       
   787 //
       
   788 TInt CSyncMLFwUpdNotifier::ShowUpdateStartQueryEncryptionL()
       
   789     {
       
   790     FTRACE( FPrint( _L(
       
   791         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryEncryptionL() profileId = %d" ),
       
   792         iNoteInfo ) );
       
   793 
       
   794     HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   795     TInt retval (ESyncMLDlgRespKeyNone);  
       
   796     TBool keypress(EFalse);
       
   797 
       
   798     CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); 
       
   799     HBufC* stringHolder = StringLoader::LoadLC (R_FOTA_UPDATE_DEC_WARNING);     
       
   800     msgDlg->SetMessageTextL(*stringHolder);
       
   801     CleanupStack::PopAndDestroy( stringHolder );
       
   802    
       
   803     msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   804     msgDlg->SetHeaderTextL( headerText->Des() );
       
   805     msgDlg->ButtonGroupContainer().SetCommandSetL( R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT );
       
   806     retval = ESyncMLDlgRespKeyNone;
       
   807     retval = msgDlg->RunLD();
       
   808     msgDlg = NULL;
       
   809     
       
   810     CleanupStack::PopAndDestroy(headerText);
       
   811     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() after new changes in phone updates"));
       
   812     return retval;
       
   813     }
       
   814 
       
   815 // -----------------------------------------------------------------------------
       
   816 // CSyncMLFwUpdNotifier::ShowUpdateResultNoteL
       
   817 // -----------------------------------------------------------------------------
       
   818 //
       
   819 TInt CSyncMLFwUpdNotifier::ShowUpdateResultWithEncryptionNoteL()
       
   820     {
       
   821     FTRACE( FPrint( _L(
       
   822         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultWithEncryptionNoteL() result = %d" ),
       
   823         iNoteInfo ) );
       
   824 
       
   825     HBufC* firstStr( NULL );
       
   826 
       
   827     switch ( iNoteInfo )  // It is easier to add cases to switch structure
       
   828         {
       
   829         case KErrNone:
       
   830             {
       
   831             firstStr = StringLoader::LoadLC( R_FOTA_NOTIF_COMPLETE );
       
   832             break;
       
   833             }
       
   834         default:
       
   835             {
       
   836             firstStr = StringLoader::LoadLC( R_FOTA_MSG_QUERY_NOT_UPDATED );
       
   837             break;
       
   838             }
       
   839         }
       
   840     
       
   841     HBufC* secStr  = StringLoader::LoadLC(R_FOTA_UPDATE_ENC);
       
   842     
       
   843     HBufC* stringHolder = HBufC::NewLC(firstStr->Length() + secStr->Length());
       
   844     TPtr ptr (stringHolder->Des());
       
   845     ptr.Append(firstStr->Des());
       
   846     ptr.Append(secStr->Des());
       
   847     
       
   848     TBool keypress(EFalse);
       
   849     CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   850     msgDlg->SetMessageTextL(*stringHolder);
       
   851     CleanupStack::PopAndDestroy( stringHolder );
       
   852     CleanupStack::PopAndDestroy(secStr);
       
   853     CleanupStack::PopAndDestroy(firstStr);
       
   854 
       
   855     
       
   856     msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   857 
       
   858     stringHolder = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   859     msgDlg->SetHeaderTextL( stringHolder->Des() );
       
   860     CleanupStack::PopAndDestroy( stringHolder );
       
   861     stringHolder = NULL;
       
   862     
       
   863     msgDlg->ButtonGroupContainer().SetCommandSetL( R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT );
       
   864     TInt retval(ESyncMLDlgRespKeyNone);
       
   865     iRunLhang = ETrue;
       
   866     iDlg = msgDlg; 
       
   867     retval = msgDlg->RunLD();
       
   868     iRunLhang = EFalse;
       
   869     msgDlg = NULL;
       
   870     iDlg = NULL;
       
   871     //call-termination key press has to be suppressed here. so keypress has no significance here!    
       
   872     /*if (keypress)
       
   873         retval = EKeyOthers;*/
       
   874         
       
   875     FTRACE( FPrint( _L(
       
   876         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultWithEncryptionNoteL() completed: retval = %d" ),
       
   877         retval ) );
       
   878     
       
   879     return retval;
       
   880     }
       
   881 
       
   882 
       
   883 // -----------------------------------------------------------------------------
       
   884 // CSyncMLFwUpdNotifier::RetrieveProfileNameL
       
   885 // -----------------------------------------------------------------------------
       
   886 //
       
   887 void CSyncMLFwUpdNotifier::RetrieveProfileNameL( TDes& aServerName )
       
   888     {
       
   889     FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RetrieveProfileNameL()"));
       
   890 
       
   891     RSyncMLSession syncSession;
       
   892     RSyncMLDevManProfile syncProfile;
       
   893   
       
   894     syncSession.OpenL();
       
   895     CleanupClosePushL( syncSession );
       
   896     
       
   897     syncProfile.OpenL( syncSession, iNoteInfo, ESmlOpenRead );
       
   898     CleanupClosePushL( syncProfile );
       
   899     
       
   900     aServerName = syncProfile.DisplayName();
       
   901 
       
   902     CleanupStack::PopAndDestroy( &syncProfile );
       
   903     CleanupStack::PopAndDestroy( &syncSession );
       
   904 
       
   905     FTRACE( FPrint( _L(
       
   906         "[SmlNotif]\t CSyncMLFwUpdNotifier::RetrieveProfileNameL() completed: aServerName = %S" ),
       
   907         &aServerName ) );
       
   908     }
       
   909 
       
   910 // -----------------------------------------------------------------------------
       
   911 // CSyncMLFwUpdNotifier::ShowNoReminderQuery
       
   912 // -----------------------------------------------------------------------------
       
   913 //
       
   914 
       
   915 TInt CSyncMLFwUpdNotifier::ShowNoReminderQueryL()
       
   916 	{
       
   917 
       
   918     FLOG( _L(
       
   919         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNoReminderQueryL() begin "));
       
   920         
       
   921    	TInt configFlags( 0 );
       
   922     CRepository* cenrep = NULL;
       
   923     cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp );
       
   924     cenrep->Get( KNSmlDMFotaConfigurationKey, configFlags );
       
   925     delete cenrep;
       
   926     cenrep = NULL;
       
   927 	TInt retval (KErrNone);
       
   928 	
       
   929     // Show note if fota is not hidden
       
   930     if ( configFlags & KNSmlDMFotaEnableFotaViewFlag )
       
   931     	{
       
   932     	HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
   933     	HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_REMINDER );
       
   934         
       
   935     	TBool keypress(EFalse);        
       
   936         CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   937         msgDlg->SetMessageTextL(*stringHolder);
       
   938         CleanupStack::PopAndDestroy( stringHolder );
       
   939         stringHolder = NULL;
       
   940 
       
   941         msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   942         msgDlg->SetHeaderTextL( headerText->Des() );
       
   943             
       
   944         msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY__OK );
       
   945         retval = msgDlg->RunLD();
       
   946         msgDlg = NULL;
       
   947 
       
   948 		//call-termination key press is handled here.
       
   949 		if (keypress)
       
   950     		retval = ESyncMLDlgRespKeyOthers;
       
   951 		
       
   952         CleanupStack::PopAndDestroy( headerText );
       
   953     	}
       
   954         
       
   955      FLOG( _L(
       
   956         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNoReminderQueryL() Completed "));   
       
   957      
       
   958      return retval;
       
   959 	}
       
   960 
       
   961 // -----------------------------------------------------------------------------
       
   962 // CSyncMLFwUpdNotifier::ShowNotEnoughMemory
       
   963 // -----------------------------------------------------------------------------
       
   964 //
       
   965 TInt CSyncMLFwUpdNotifier::ShowNotEnoughMemoryL( TInt &aMemoryNeeded , TBool aOmaDL)
       
   966 {
       
   967   	FLOG( _L(
       
   968         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNotEnoughMemoryL() begin "));
       
   969         
       
   970   	HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );  
       
   971   	
       
   972   	HBufC* stringHolder;
       
   973   	
       
   974   	if( aOmaDL )	
       
   975   	stringHolder = StringLoader::LoadLC( R_FOTA_OMADL_NO_FLEXIBLE_MEMORY , aMemoryNeeded );
       
   976   	else
       
   977   	stringHolder = StringLoader::LoadLC( R_FOTA_LARGE_NO_FLEXIBLE_MEMORY , aMemoryNeeded );
       
   978     
       
   979     TBool keypress(EFalse);  	
       
   980     CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress);
       
   981 	msgDlg->SetMessageTextL(*stringHolder);
       
   982   	CleanupStack::PopAndDestroy( stringHolder );
       
   983   	stringHolder = NULL;
       
   984   
       
   985   	msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
   986   	msgDlg->SetHeaderTextL( headerText->Des() );
       
   987            
       
   988   	msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY__OK );
       
   989   	TInt retval (ESyncMLDlgRespKeyNone);
       
   990   	retval = msgDlg->RunLD();
       
   991   	msgDlg = NULL;
       
   992   	CleanupStack::PopAndDestroy( headerText );
       
   993   
       
   994   	FLOG( _L(
       
   995         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNotEnoughMemoryL() Completed "));    	
       
   996 	
       
   997 	//call-termination key press is handled here.
       
   998 	if (keypress)
       
   999     	retval = ESyncMLDlgRespKeyOthers;
       
  1000 	
       
  1001 	return retval;
       
  1002 }
       
  1003 // -----------------------------------------------------------------------------
       
  1004 // CSyncMLFwUpdNotifier::ShowDownloadUserCancelL
       
  1005 // Shows the notification when the user cancels the download.
       
  1006 // And inform the user the download is suspended.
       
  1007 // -----------------------------------------------------------------------------
       
  1008 //
       
  1009 TInt CSyncMLFwUpdNotifier::ShowDownloadUserCancelL()
       
  1010 {
       
  1011 
       
  1012     FLOG( _L(
       
  1013         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadUserCancelL() begin "));
       
  1014         
       
  1015   	TInt retval (KErrNone);
       
  1016 	
       
  1017     HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
  1018     HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_USER_CANCEL );
       
  1019         
       
  1020     TBool endKeyPress(EFalse);        
       
  1021     CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(endKeyPress);
       
  1022     msgDlg->SetMessageTextL(*stringHolder);
       
  1023     CleanupStack::PopAndDestroy( stringHolder );
       
  1024     stringHolder = NULL;
       
  1025 
       
  1026     msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
  1027     msgDlg->SetHeaderTextL( headerText->Des() );
       
  1028             
       
  1029     msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_YES_NO__YES );
       
  1030     iRunLhang = ETrue;
       
  1031     iDlg = msgDlg;
       
  1032     retval = msgDlg->RunLD();
       
  1033     iRunLhang = EFalse;
       
  1034     msgDlg = NULL;    
       
  1035     iDlg = NULL;
       
  1036 	//call-termination key press is handled here.
       
  1037 	if (endKeyPress)
       
  1038     	retval = ESyncMLDlgRespKeyOthers;
       
  1039 		
       
  1040     CleanupStack::PopAndDestroy( headerText );
       
  1041         
       
  1042      FLOG( _L(
       
  1043         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadUserCancelL() Completed "));   
       
  1044      
       
  1045      return retval;
       
  1046 }
       
  1047 // -----------------------------------------------------------------------------
       
  1048 // CSyncMLFwUpdNotifier::ShowDownloadPostponedL
       
  1049 // Shows the notification that the download is postponed.
       
  1050 // -----------------------------------------------------------------------------
       
  1051 //
       
  1052 TInt CSyncMLFwUpdNotifier::ShowDownloadPostponedL()
       
  1053 {
       
  1054 
       
  1055     FLOG( _L(
       
  1056         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadPostponedL() begin "));
       
  1057     
       
  1058     TInt retval (KErrNone);
       
  1059     
       
  1060     HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_POSTPONED );
       
  1061     CAknInformationNote* infoNote = new (ELeave) CAknInformationNote;
       
  1062 
       
  1063     infoNote->ExecuteLD( *stringHolder );
       
  1064     CleanupStack::PopAndDestroy( stringHolder );
       
  1065   	
       
  1066     FLOG( _L(
       
  1067         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadPostponedL() Completed "));   
       
  1068      
       
  1069     return retval;
       
  1070 }
       
  1071 // -----------------------------------------------------------------------------
       
  1072 // CSyncMLFwUpdNotifier::ShowDownloadCancelledL
       
  1073 // Shows the notification that the download is cancelled.
       
  1074 // -----------------------------------------------------------------------------
       
  1075 //
       
  1076 TInt CSyncMLFwUpdNotifier::ShowDownloadCancelledL()
       
  1077 {
       
  1078 
       
  1079     FLOG( _L(
       
  1080         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadCancelledL() begin "));
       
  1081         
       
  1082   	TInt retval (KErrNone);
       
  1083 	
       
  1084     HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_CANCELLED );
       
  1085     CAknInformationNote* infoNote = new (ELeave) CAknInformationNote;
       
  1086 
       
  1087     infoNote->ExecuteLD( *stringHolder );
       
  1088     CleanupStack::PopAndDestroy( stringHolder );
       
  1089         
       
  1090     FLOG( _L(
       
  1091         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadCancelledL() Completed "));   
       
  1092      
       
  1093     return retval;
       
  1094 }
       
  1095 
       
  1096 
       
  1097 // -----------------------------------------------------------------------------
       
  1098 // CSyncMLFwUpdNotifier::ShowPostponeLimitNoteL
       
  1099 // Shows the notification that the download is Postponed.
       
  1100 // -----------------------------------------------------------------------------
       
  1101 //
       
  1102 TInt CSyncMLFwUpdNotifier::ShowPostponeLimitNoteL()
       
  1103 {
       
  1104 
       
  1105     FLOG( _L(
       
  1106         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowPostponeLimitNoteL() begin "));
       
  1107 
       
  1108     TInt retval (KErrNone);
       
  1109     const TInt KTmpArraySize = 5;
       
  1110 		//const TInt KStrArraySize = 20;
       
  1111     
       
  1112     CDesCArrayFlat* aStrArr = new CDesCArrayFlat(KTmpArraySize); 
       
  1113     CleanupStack::PushL(aStrArr);
       
  1114     aStrArr->AppendL(iSelectedReminder);
       
  1115     CArrayFixFlat<TInt>* aIntparam = new(ELeave) CArrayFixFlat<TInt>(KTmpArraySize);
       
  1116     CleanupStack::PushL(aIntparam);
       
  1117     TInt leftPostpone =  iMaxPostponeCount - iUserPostponeCount;
       
  1118     if(iInterval > 1)
       
  1119         aIntparam->AppendL(iInterval);
       
  1120     aIntparam->AppendL(leftPostpone);
       
  1121     aIntparam->AppendL(iMaxPostponeCount);
       
  1122     
       
  1123     HBufC* stringHolder( NULL );
       
  1124     //stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE, *aStrArr, *aIntparam);
       
  1125     if(iIntervalType == EMonthly)
       
  1126     {
       
  1127     	if(iInterval > 1)
       
  1128     	    stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_MINUTES, *aIntparam);
       
  1129     	else
       
  1130     	    stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_ONE_MINUTE, *aIntparam);
       
  1131   	}
       
  1132   	else if(iIntervalType == EHourly)
       
  1133     {
       
  1134     	if(iInterval > 1)
       
  1135     	    stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_HOURS, *aIntparam);
       
  1136     	else
       
  1137     	    stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_ONE_HOUR, *aIntparam);
       
  1138     		
       
  1139     }
       
  1140     else if(iIntervalType == EDaily)
       
  1141     {
       
  1142     	if(iInterval > 1)
       
  1143     	    stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_DAYS, *aIntparam);
       
  1144     	else
       
  1145     	    stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_ONE_DAY, *aIntparam);
       
  1146     		
       
  1147   	}
       
  1148   	else
       
  1149   	{
       
  1150   		CleanupStack::PopAndDestroy( aIntparam );
       
  1151     	CleanupStack::PopAndDestroy( aStrArr );
       
  1152     	return retval;
       
  1153   	}
       
  1154   		
       
  1155     CAknInformationNote* infoNote = new (ELeave) CAknInformationNote;
       
  1156 
       
  1157     infoNote->ExecuteLD( *stringHolder );
       
  1158 
       
  1159     
       
  1160     CleanupStack::PopAndDestroy();
       
  1161     CleanupStack::PopAndDestroy( aIntparam );
       
  1162     CleanupStack::PopAndDestroy(aStrArr);
       
  1163         
       
  1164     FLOG( _L(
       
  1165         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowPostponeLimitNoteL() Completed "));   
       
  1166      
       
  1167     return retval;
       
  1168 }
       
  1169 
       
  1170 
       
  1171 
       
  1172 // -----------------------------------------------------------------------------
       
  1173 // CSyncMLFwUpdNotifier::ShowDownloadResumeL
       
  1174 // Shows the notification to the user for resuming the download.
       
  1175 // -----------------------------------------------------------------------------
       
  1176 //
       
  1177 TInt CSyncMLFwUpdNotifier::ShowDownloadResumeL()
       
  1178 {
       
  1179 
       
  1180     FLOG( _L(
       
  1181         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadResumeL() begin "));
       
  1182         
       
  1183   	TInt retval (KErrNone);
       
  1184 	
       
  1185     HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES );
       
  1186     HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_RESUME );
       
  1187         
       
  1188     TBool endKeyPress(EFalse);        
       
  1189     CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(endKeyPress);
       
  1190     msgDlg->SetMessageTextL(*stringHolder);
       
  1191     CleanupStack::PopAndDestroy( stringHolder );
       
  1192     stringHolder = NULL;
       
  1193 
       
  1194     msgDlg->PrepareLC( R_SML_MESSAGE_QUERY );  // Pushed dialog is popped inside RunLD
       
  1195     msgDlg->SetHeaderTextL( headerText->Des() );
       
  1196             
       
  1197     msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_YES_NO__YES );
       
  1198     iRunLhang = ETrue;
       
  1199     iDlg = msgDlg;
       
  1200     retval = msgDlg->RunLD();
       
  1201     iRunLhang = EFalse;
       
  1202     iDlg = NULL;
       
  1203     msgDlg = NULL;
       
  1204     
       
  1205 	//call-termination key press is handled here.
       
  1206 	if (endKeyPress)
       
  1207     	retval = ESyncMLDlgRespKeyOthers;
       
  1208 		
       
  1209     CleanupStack::PopAndDestroy( headerText );
       
  1210         
       
  1211      FLOG( _L(
       
  1212         "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadResumeL() Completed "));   
       
  1213      
       
  1214      return retval;
       
  1215 }
       
  1216 
       
  1217 // -----------------------------------------------------------------------------
       
  1218 // CSyncMLFwUpdNotifier::ShowDownloadResumeL
       
  1219 // Shows the notification to the user for resuming the download.
       
  1220 // -----------------------------------------------------------------------------
       
  1221 //
       
  1222 TBool CSyncMLFwUpdNotifier::IsLanguageSupportedL()
       
  1223 {
       
  1224 	TBool retVal(EFalse);
       
  1225 	TLanguage language = User::Language();
       
  1226 	if(language == ELangEnglish || language == ELangInternationalEnglish ||
       
  1227  		   language == ELangTaiwanChinese ||language == ELangHongKongChinese || language == ELangPrcChinese)
       
  1228  		   retVal = ETrue;
       
  1229  	return retVal;
       
  1230 }
       
  1231 
       
  1232 //  End of File