iaupdate/IAD/ui/src/iaupdateautomaticcheck.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
equal deleted inserted replaced
65:7333d7932ef7 66:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 
    19 
    20 
    20 
    21 //INCLUDES
    21 //INCLUDES
    22 
    22 
    23 #include "iaupdateautomaticcheck.h"
    23 #include "iaupdateautomaticcheck.h"
       
    24 #include "iaupdatedialogutil.h"
    24 #include "iaupdatefirsttimeinfo.h"
    25 #include "iaupdatefirsttimeinfo.h"
    25 #include "iaupdate.hrh"
    26 #include "iaupdate.hrh"
    26 #include "iaupdateprivatecrkeys.h"
    27 #include "iaupdateprivatecrkeys.h"
    27 #include "iaupdatedialogutil.h"
    28 #include "iaupdateapplication.h"
    28 
    29 
       
    30 #include <avkon.rsg>
       
    31 #include <avkon.hrh>
       
    32 #include <iaupdate.rsg>
    29 #include <centralrepository.h> 
    33 #include <centralrepository.h> 
    30 #include <hbaction.h>
       
    31 
    34 
    32 
    35 
    33 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    34 // CIAUpdateAutomaticCheck::NewL
    37 // CIAUpdateAutomaticCheck::NewL
    35 // Two-phased constructor.
    38 // Two-phased constructor.
    78 // Destructor
    81 // Destructor
    79 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
    80 //
    83 //
    81 CIAUpdateAutomaticCheck::~CIAUpdateAutomaticCheck()
    84 CIAUpdateAutomaticCheck::~CIAUpdateAutomaticCheck()
    82     {
    85     {
    83     if ( mDialogUtil )
       
    84         {
       
    85         delete mDialogUtil;
       
    86         }
       
    87     }
    86     }
    88 
    87 
    89 
    88 
    90 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    91 // CIAUpdateAutomaticCheck::AcceptAutomaticCheckL
    90 // CIAUpdateAutomaticCheck::AcceptAutomaticCheckL
    92 // 
    91 // 
    93 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
    94 //
    93 //
    95 void CIAUpdateAutomaticCheck::AcceptAutomaticCheckL()
    94 TBool CIAUpdateAutomaticCheck::AcceptAutomaticCheckL()
    96     {
    95     {
       
    96     TBool acceptChecks = ETrue;
    97 	CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC();
    97 	CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC();
    98 	if ( !firstTimeInfo->AutomaticUpdateChecksAskedL() )
    98 	if ( !firstTimeInfo->AutomaticUpdateChecksAskedL() )
    99 	    {
    99 	    {
   100 	    if ( AutoUpdateCheckEnabledL() )
   100 	    if ( AutoUpdateCheckEnabledL() )
   101 	        {
   101 	        {
   102 	        // if automatic update check configured as enabled, confirmation is not asked  
   102 	        // if automatic update check configured as enabled, confirmation is not asked  
   103 	        firstTimeInfo->SetAutomaticUpdatesAskedL();
   103 	        firstTimeInfo->SetAutomaticUpdatesAskedL();
   104 	        }
   104 	        }
   105 	    else
   105 	    else
   106 	        {
   106 	        {
   107 	        if ( !mDialogUtil )
   107 	        TInt ret = IAUpdateDialogUtil::ShowConfirmationQueryL( 
   108 	            {
   108 	                                          R_IAUPDATE_TURN_ON_AUTOUPD_CHECKS, 
   109 	        	mDialogUtil = new IAUpdateDialogUtil(NULL, this);
   109 	                                          R_AVKON_SOFTKEYS_YES_NO );    
       
   110 	        firstTimeInfo->SetAutomaticUpdatesAskedL();
       
   111 	        if ( ret == EAknSoftkeyYes )
       
   112                 {
       
   113 	            EnableAutoUpdateCheckL( ETrue );
   110 	            }
   114 	            }
   111 	        if ( mDialogUtil )
   115 	        }
   112 	            {
       
   113 	            mPrimaryAction = NULL;
       
   114 	            mPrimaryAction = new HbAction("Yes");
       
   115 	            HbAction *secondaryAction = NULL;
       
   116 	            secondaryAction = new HbAction("No");
       
   117 	            mDialogUtil->showQuestion(QString("Turn on setting for Automatic update checks?"), mPrimaryAction, secondaryAction);
       
   118 	            }
       
   119  	        }
       
   120 	    }
   116 	    }
   121 	CleanupStack::PopAndDestroy( firstTimeInfo ); 
   117 	CleanupStack::PopAndDestroy( firstTimeInfo ); 
       
   118     return acceptChecks;
   122     }
   119     }
   123 
   120 
   124 // ---------------------------------------------------------------------------
   121 // ---------------------------------------------------------------------------
   125 // CIAUpdateAutomaticCheck::AutoUpdateCheckEnabledL
   122 // CIAUpdateAutomaticCheck::AutoUpdateCheckEnabledL
   126 // 
   123 // 
   170     User::LeaveIfError( cenrep->CommitTransaction( ignore ) );
   167     User::LeaveIfError( cenrep->CommitTransaction( ignore ) );
   171     CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL()
   168     CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL()
   172     CleanupStack::PopAndDestroy( cenrep );
   169     CleanupStack::PopAndDestroy( cenrep );
   173     }
   170     }
   174 
   171 
   175 // ---------------------------------------------------------------------------
   172     
   176 // CIAUpdateAutomaticCheck::dialogFinished
       
   177 // 
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 void CIAUpdateAutomaticCheck::dialogFinished(HbAction *action)
       
   181     {
       
   182     if ( action == mPrimaryAction )
       
   183         {
       
   184         EnableAutoUpdateCheckL( ETrue ); 
       
   185         }
       
   186     CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC();
       
   187     firstTimeInfo->SetAutomaticUpdatesAskedL();
       
   188     CleanupStack::PopAndDestroy( firstTimeInfo );
       
   189     }
       
   190 // End of File  
   173 // End of File