iaupdate/IAD/ui/src/iaupdateagreement.cpp
changeset 29 26b6f0522fd8
parent 0 ba25891c3a9e
child 33 8110bf1194d1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 //INCLUDES
    20 //INCLUDES
       
    21 #include <hbaction.h>
       
    22 #include <hbmessagebox.h>
       
    23 #include <hbtextitem.h>
       
    24 #include <centralrepository.h>
    21 
    25 
    22 #include "iaupdateagreement.h"
    26 #include "iaupdateagreement.h"
    23 #include "iaupdatefirsttimeinfo.h"
    27 #include "iaupdatefirsttimeinfo.h"
    24 #include "iaupdatedialogutil.h"
       
    25 #include "iaupdate.hrh"
    28 #include "iaupdate.hrh"
    26 #include "iaupdateprivatecrkeys.h"
    29 #include "iaupdateprivatecrkeys.h"
    27 
    30 
    28 #include <avkon.rsg>
       
    29 #include <iaupdate.rsg>
       
    30 #include <aknmessagequerydialog.h>      // CAknMessageQueryDialog
       
    31 #include <StringLoader.h>
       
    32 #include <AknUtils.h>
       
    33 
    31 
    34 // ================= MEMBER FUNCTIONS =======================
    32 // ================= MEMBER FUNCTIONS =======================
    35 
    33 
    36 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    37 // CIAUpdateAgreement::NewL
    35 // CIAUpdateAgreement::NewL
   102         TInt autoUpdateCheckValue( 0 );
   100         TInt autoUpdateCheckValue( 0 );
   103         CRepository* cenrep(  CRepository::NewLC( KCRUidIAUpdateSettings ) );
   101         CRepository* cenrep(  CRepository::NewLC( KCRUidIAUpdateSettings ) );
   104         User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, 
   102         User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, 
   105                                          autoUpdateCheckValue ) );
   103                                          autoUpdateCheckValue ) );
   106         CleanupStack::PopAndDestroy( cenrep );
   104         CleanupStack::PopAndDestroy( cenrep );
       
   105         autoUpdateCheckValue = EIAUpdateSettingValueDisable; //temp to test dialog
   107         if ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming ||
   106         if ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming ||
   108              autoUpdateCheckValue ==  EIAUpdateSettingValueEnable  ) 
   107              autoUpdateCheckValue ==  EIAUpdateSettingValueEnable  ) 
   109             {
   108             {
   110             accepted = ETrue;
   109             accepted = ETrue;
   111             firstTimeInfo->SetAgreementAcceptedL();
   110             firstTimeInfo->SetAgreementAcceptedL();
   112             }
   111             }
   113         else if ( ShowDialogL( R_IAUPDATE_SOFTKEYS_ACCEPT_DECLINE__ACCEPT ) == EAknSoftkeyYes )
   112         else  
   114             {
   113             {
   115      	    accepted = ETrue;
   114      	    HbAction *primaryAction = new HbAction("Accept");
   116      	    firstTimeInfo->SetAgreementAcceptedL();
   115      	    HbAction *secondaryAction = new HbAction("Decline");
       
   116      	    if ( ShowDialogL( primaryAction, secondaryAction ) == primaryAction)
       
   117      	        {
       
   118      	        accepted = ETrue;
       
   119      	        firstTimeInfo->SetAgreementAcceptedL();
       
   120                 }
   117             }
   121             }
   118         }
   122         }
   119     CleanupStack::PopAndDestroy( firstTimeInfo );
   123     CleanupStack::PopAndDestroy( firstTimeInfo );
   120     return accepted;
   124     return accepted;
   121     }
   125     }
   125 // 
   129 // 
   126 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   127 //
   131 //
   128 void CIAUpdateAgreement::ShowAgreementL()
   132 void CIAUpdateAgreement::ShowAgreementL()
   129     {
   133     {
   130     ShowDialogL( R_AVKON_SOFTKEYS_OK_EMPTY );	
   134     HbAction *primaryAction = new HbAction("OK");
       
   135     ShowDialogL( primaryAction, NULL );	
       
   136     delete primaryAction;
   131     }
   137     }
   132 
   138 
   133 // ---------------------------------------------------------------------------
   139 // ---------------------------------------------------------------------------
   134 // CIAUpdateAgreement::AgreementAcceptedL
   140 // CIAUpdateAgreement::AgreementAcceptedL
   135 // 
   141 // 
   146 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
   147 // CIAUpdateAgreement::ShowDialogL
   153 // CIAUpdateAgreement::ShowDialogL
   148 // 
   154 // 
   149 // ---------------------------------------------------------------------------
   155 // ---------------------------------------------------------------------------
   150 //
   156 //
   151 TInt CIAUpdateAgreement::ShowDialogL( TInt aCbaResourceId )
   157 HbAction* CIAUpdateAgreement::ShowDialogL( HbAction *primaryAction, HbAction *secondaryAction )
   152     {
   158     {
   153     HBufC* text_1 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_1 );
   159     HbDialog agreementDialog;
       
   160     HbTextItem *headingText = new HbTextItem(&agreementDialog);
       
   161     headingText->setFontSpec(HbFontSpec(HbFontSpec::Title));
       
   162     headingText->setText("Disclaimer");
       
   163     agreementDialog.setHeadingWidget(headingText);
       
   164     
       
   165    
       
   166     HbTextItem *text = new HbTextItem(&agreementDialog);
       
   167     text->setFontSpec(HbFontSpec(HbFontSpec::PrimarySmall));
       
   168     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.");
       
   169     agreementDialog.setContentWidget(text);
       
   170     
       
   171     agreementDialog.setPrimaryAction(primaryAction);
       
   172     
       
   173     if ( secondaryAction )
       
   174         {
       
   175         agreementDialog.setSecondaryAction(secondaryAction);
       
   176         }
       
   177     agreementDialog.setTimeout(HbPopup::NoTimeout);
       
   178     
       
   179     return agreementDialog.exec(); 
       
   180     }        
       
   181     
       
   182     /*HBufC* text_1 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_1 );
   154     HBufC* text_2 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_2 );
   183     HBufC* text_2 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_2 );
   155     HBufC* text_3 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_3 );
   184     HBufC* text_3 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_3 );
   156     HBufC* text_4 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_4 );
   185     HBufC* text_4 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_4 );
   157     HBufC* text_5 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_5 );
   186     HBufC* text_5 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_5 );
   158     HBufC* text_6 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_6 );
   187     HBufC* text_6 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_6 );
   162     CArrayFix<TInt>* numberArray = 
   191     CArrayFix<TInt>* numberArray = 
   163                          new ( ELeave ) CArrayFixFlat<TInt>( 2 );
   192                          new ( ELeave ) CArrayFixFlat<TInt>( 2 );
   164     CleanupStack::PushL( numberArray );
   193     CleanupStack::PushL( numberArray );
   165     numberArray->AppendL( 2007 ); 
   194     numberArray->AppendL( 2007 ); 
   166     numberArray->AppendL( 2009 );
   195     numberArray->AppendL( 2009 );
   167     HBufC* text_copyright = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_COPYRIGHT, *numberArray );
   196     //HBufC* text_copyright = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_COPYRIGHT, *numberArray );
   168     TPtr ptr = text_copyright->Des();
   197     TPtr ptr = text_copyright->Des();
   169     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
   198     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
   170     
   199     
   171     HBufC* text = HBufC::NewLC( text_1->Length() +
   200     HBufC* text = HBufC::NewLC( text_1->Length() +
   172                                 text_2->Length() + 
   201                                 text_2->Length() + 
   212 	    
   241 	    
   213     dlg->ButtonGroupContainer().SetCommandSetL( aCbaResourceId );
   242     dlg->ButtonGroupContainer().SetCommandSetL( aCbaResourceId );
   214 
   243 
   215 	TInt ret = dlg->RunLD();
   244 	TInt ret = dlg->RunLD();
   216 	
   245 	
   217     return ret;
   246     return ret;*/
   218     }
   247     //return KErrNone;
       
   248 
   219     
   249     
   220 // End of File  
   250 // End of File