iaupdate/IAD/ui/src/iaupdateagreement.cpp
branchGCC_SURGE
changeset 56 afe7195bb6c3
parent 42 d17dc5398051
equal deleted inserted replaced
41:0410b3201a77 56:afe7195bb6c3
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 //INCLUDES
    20 //INCLUDES
    21 #include <hbaction.h>
    21 #include <hbaction.h>
    22 #include <hbdialog.h>
       
    23 #include <hbtextitem.h>
    22 #include <hbtextitem.h>
    24 #include <centralrepository.h>
    23 #include <centralrepository.h>
    25 
    24 
    26 #include "iaupdateagreement.h"
    25 #include "iaupdateagreement.h"
    27 #include "iaupdatefirsttimeinfo.h"
    26 #include "iaupdatefirsttimeinfo.h"
   100         TInt autoUpdateCheckValue( 0 );
    99         TInt autoUpdateCheckValue( 0 );
   101         CRepository* cenrep(  CRepository::NewLC( KCRUidIAUpdateSettings ) );
   100         CRepository* cenrep(  CRepository::NewLC( KCRUidIAUpdateSettings ) );
   102         User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, 
   101         User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, 
   103                                          autoUpdateCheckValue ) );
   102                                          autoUpdateCheckValue ) );
   104         CleanupStack::PopAndDestroy( cenrep );
   103         CleanupStack::PopAndDestroy( cenrep );
   105         autoUpdateCheckValue = EIAUpdateSettingValueDisable; //temp to test dialog
       
   106         if ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming ||
   104         if ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming ||
   107              autoUpdateCheckValue ==  EIAUpdateSettingValueEnable  ) 
   105              autoUpdateCheckValue ==  EIAUpdateSettingValueEnable  ) 
   108             {
   106             {
   109             accepted = ETrue;
   107             accepted = ETrue;
   110             firstTimeInfo->SetAgreementAcceptedL();
   108             firstTimeInfo->SetAgreementAcceptedL();
   111             }
   109             }
   112         else  
       
   113             {
       
   114      	    HbAction *primaryAction = new HbAction("Accept");
       
   115      	    HbAction *secondaryAction = new HbAction("Decline");
       
   116      	    if ( ShowDialogL( primaryAction, secondaryAction ) == primaryAction)
       
   117      	        {
       
   118      	        accepted = ETrue;
       
   119      	        firstTimeInfo->SetAgreementAcceptedL();
       
   120                 }
       
   121             }
       
   122         }
   110         }
   123     CleanupStack::PopAndDestroy( firstTimeInfo );
   111     CleanupStack::PopAndDestroy( firstTimeInfo );
   124     return accepted;
   112     return accepted;
   125     }
   113     }
   126 
   114 
   135     firstTimeInfo->SetAgreementAcceptedL();
   123     firstTimeInfo->SetAgreementAcceptedL();
   136     CleanupStack::PopAndDestroy( firstTimeInfo );
   124     CleanupStack::PopAndDestroy( firstTimeInfo );
   137     }
   125     }
   138 
   126 
   139 
   127 
   140 
       
   141 
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // CIAUpdateAgreement::ShowAgreementL
       
   145 // 
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 void CIAUpdateAgreement::ShowAgreementL()
       
   149     {
       
   150     HbAction *primaryAction = new HbAction("OK");
       
   151     ShowDialogL( primaryAction, NULL );	
       
   152     delete primaryAction;
       
   153     }
       
   154 
   128 
   155 // ---------------------------------------------------------------------------
   129 // ---------------------------------------------------------------------------
   156 // CIAUpdateAgreement::AgreementAcceptedL
   130 // CIAUpdateAgreement::AgreementAcceptedL
   157 // 
   131 // 
   158 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   163 	TBool ret = firstTimeInfo->AgreementAcceptedL();
   137 	TBool ret = firstTimeInfo->AgreementAcceptedL();
   164 	CleanupStack::PopAndDestroy( firstTimeInfo );
   138 	CleanupStack::PopAndDestroy( firstTimeInfo );
   165 	return ret;
   139 	return ret;
   166     }
   140     }
   167     
   141     
   168 // ---------------------------------------------------------------------------
   142 
   169 // CIAUpdateAgreement::ShowDialogL
       
   170 // 
       
   171 // ---------------------------------------------------------------------------
       
   172 //
       
   173 HbAction* CIAUpdateAgreement::ShowDialogL( HbAction *primaryAction, HbAction *secondaryAction )
       
   174     {
       
   175     HbDialog agreementDialog;
       
   176     HbTextItem *headingText = new HbTextItem(&agreementDialog);
       
   177     headingText->setFontSpec(HbFontSpec(HbFontSpec::Title));
       
   178     headingText->setText("Disclaimer");
       
   179     agreementDialog.setHeadingWidget(headingText);
       
   180     
       
   181    
       
   182     HbTextItem *text = new HbTextItem(&agreementDialog);
       
   183     text->setFontSpec(HbFontSpec(HbFontSpec::PrimarySmall));
       
   184     text->setText("This application allows you to download and use applications and services provided by Nokia or third parties. Service Terms and Privacy Policy will apply. Nokia will not assume any liability or responsibility for the availability or third party applications or services. Before using the third party application or service, read the applicable terms of use.\n\nUse of this application involves transmission of data. Contact your network service provider for information about data transmission charges.\n\n(c) 2007-2010 Nokia. All rights reserved.");
       
   185     agreementDialog.setContentWidget(text);
       
   186     
       
   187     agreementDialog.setPrimaryAction(primaryAction);
       
   188     
       
   189     if ( secondaryAction )
       
   190         {
       
   191         agreementDialog.setSecondaryAction(secondaryAction);
       
   192         }
       
   193     agreementDialog.setTimeout(HbPopup::NoTimeout);
       
   194     agreementDialog.show();
       
   195     //return agreementDialog.exec(); 
       
   196     return primaryAction;
       
   197     }        
       
   198     
   143     
   199     /*HBufC* text_1 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_1 );
   144     /*HBufC* text_1 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_1 );
   200     HBufC* text_2 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_2 );
   145     HBufC* text_2 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_2 );
   201     HBufC* text_3 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_3 );
   146     HBufC* text_3 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_3 );
   202     HBufC* text_4 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_4 );
   147     HBufC* text_4 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_4 );