|
1 /* |
|
2 * Copyright (c) 2008-2009 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: This module contains the implementation of CIAUpdateAgreement class |
|
15 * member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 //INCLUDES |
|
21 |
|
22 #include "iaupdateagreement.h" |
|
23 #include "iaupdatefirsttimeinfo.h" |
|
24 #include "iaupdatedialogutil.h" |
|
25 #include "iaupdate.hrh" |
|
26 #include "iaupdateprivatecrkeys.h" |
|
27 |
|
28 #include <avkon.rsg> |
|
29 #include <iaupdate.rsg> |
|
30 #include <aknmessagequerydialog.h> // CAknMessageQueryDialog |
|
31 #include <StringLoader.h> |
|
32 #include <AknUtils.h> |
|
33 |
|
34 // ================= MEMBER FUNCTIONS ======================= |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CIAUpdateAgreement::NewL |
|
38 // Two-phased constructor. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CIAUpdateAgreement* CIAUpdateAgreement::NewL() |
|
42 { |
|
43 CIAUpdateAgreement* self = CIAUpdateAgreement::NewLC(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CIAUpdateAgreement::NewLC |
|
50 // Two-phased constructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CIAUpdateAgreement* CIAUpdateAgreement::NewLC() |
|
54 { |
|
55 CIAUpdateAgreement* self = new( ELeave ) CIAUpdateAgreement(); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CIAUpdateAgreement::ConstructL |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void CIAUpdateAgreement::ConstructL() |
|
68 { |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CIAUpdateAgreement::CIAUpdateAgreement |
|
73 // constructor |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CIAUpdateAgreement::CIAUpdateAgreement() |
|
77 { |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CIAUpdateAgreement::~CIAUpdateAgreement |
|
82 // Destructor |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 CIAUpdateAgreement::~CIAUpdateAgreement() |
|
86 { |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CIAUpdateAgreement::AcceptAgreementL |
|
91 // |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 TBool CIAUpdateAgreement::AcceptAgreementL() |
|
95 { |
|
96 CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC(); |
|
97 TBool accepted = firstTimeInfo->AgreementAcceptedL(); |
|
98 if ( !accepted ) |
|
99 { |
|
100 // if configured so that automatic updates are allowed, |
|
101 // then also disclaimer is set as accepted without showing it all |
|
102 TInt autoUpdateCheckValue( 0 ); |
|
103 CRepository* cenrep( CRepository::NewLC( KCRUidIAUpdateSettings ) ); |
|
104 User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, |
|
105 autoUpdateCheckValue ) ); |
|
106 CleanupStack::PopAndDestroy( cenrep ); |
|
107 if ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming || |
|
108 autoUpdateCheckValue == EIAUpdateSettingValueEnable ) |
|
109 { |
|
110 accepted = ETrue; |
|
111 firstTimeInfo->SetAgreementAcceptedL(); |
|
112 } |
|
113 else if ( ShowDialogL( R_IAUPDATE_SOFTKEYS_ACCEPT_DECLINE__ACCEPT ) == EAknSoftkeyYes ) |
|
114 { |
|
115 accepted = ETrue; |
|
116 firstTimeInfo->SetAgreementAcceptedL(); |
|
117 } |
|
118 } |
|
119 CleanupStack::PopAndDestroy( firstTimeInfo ); |
|
120 return accepted; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // CIAUpdateAgreement::ShowAgreementL |
|
125 // |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CIAUpdateAgreement::ShowAgreementL() |
|
129 { |
|
130 ShowDialogL( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CIAUpdateAgreement::AgreementAcceptedL |
|
135 // |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 TBool CIAUpdateAgreement::AgreementAcceptedL() |
|
139 { |
|
140 CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC(); |
|
141 TBool ret = firstTimeInfo->AgreementAcceptedL(); |
|
142 CleanupStack::PopAndDestroy( firstTimeInfo ); |
|
143 return ret; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CIAUpdateAgreement::ShowDialogL |
|
148 // |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 TInt CIAUpdateAgreement::ShowDialogL( TInt aCbaResourceId ) |
|
152 { |
|
153 HBufC* text_1 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_1 ); |
|
154 HBufC* text_2 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_2 ); |
|
155 HBufC* text_3 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_3 ); |
|
156 HBufC* text_4 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_4 ); |
|
157 HBufC* text_5 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_5 ); |
|
158 HBufC* text_6 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_6 ); |
|
159 HBufC* text_7 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_7 ); |
|
160 HBufC* text_8 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_8 ); |
|
161 HBufC* text_9 = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TEXT_9 ); |
|
162 CArrayFix<TInt>* numberArray = |
|
163 new ( ELeave ) CArrayFixFlat<TInt>( 2 ); |
|
164 CleanupStack::PushL( numberArray ); |
|
165 numberArray->AppendL( 2007 ); |
|
166 numberArray->AppendL( 2009 ); |
|
167 HBufC* text_copyright = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_COPYRIGHT, *numberArray ); |
|
168 TPtr ptr = text_copyright->Des(); |
|
169 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); |
|
170 |
|
171 HBufC* text = HBufC::NewLC( text_1->Length() + |
|
172 text_2->Length() + |
|
173 text_3->Length() + |
|
174 text_4->Length() + |
|
175 text_5->Length() + |
|
176 text_6->Length() + |
|
177 text_7->Length() + |
|
178 text_8->Length() + |
|
179 text_9->Length() + |
|
180 text_copyright->Length() ); |
|
181 |
|
182 text->Des() += *text_1; |
|
183 text->Des() += *text_2; |
|
184 text->Des() += *text_3; |
|
185 text->Des() += *text_4; |
|
186 text->Des() += *text_5; |
|
187 text->Des() += *text_6; |
|
188 text->Des() += *text_7; |
|
189 text->Des() += *text_8; |
|
190 text->Des() += *text_9; |
|
191 text->Des() += *text_copyright; |
|
192 |
|
193 CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *text ); |
|
194 CleanupStack::PopAndDestroy( text ); |
|
195 CleanupStack::PopAndDestroy( text_copyright ); |
|
196 CleanupStack::PopAndDestroy( numberArray ); |
|
197 CleanupStack::PopAndDestroy( text_9 ); |
|
198 CleanupStack::PopAndDestroy( text_8 ); |
|
199 CleanupStack::PopAndDestroy( text_7 ); |
|
200 CleanupStack::PopAndDestroy( text_6 ); |
|
201 CleanupStack::PopAndDestroy( text_5 ); |
|
202 CleanupStack::PopAndDestroy( text_4 ); |
|
203 CleanupStack::PopAndDestroy( text_3 ); |
|
204 CleanupStack::PopAndDestroy( text_2 ); |
|
205 CleanupStack::PopAndDestroy( text_1 ); |
|
206 dlg->PrepareLC( R_IAUPDATE_MESSAGE_QUERY ); |
|
207 |
|
208 CAknPopupHeadingPane* headingPane = dlg->Heading(); |
|
209 HBufC* title = StringLoader::LoadLC( R_IAUPDATE_AGREEMENT_DIALOG_TITLE ); |
|
210 headingPane->SetTextL( *title ); |
|
211 CleanupStack::PopAndDestroy( title ); |
|
212 |
|
213 dlg->ButtonGroupContainer().SetCommandSetL( aCbaResourceId ); |
|
214 |
|
215 TInt ret = dlg->RunLD(); |
|
216 |
|
217 return ret; |
|
218 } |
|
219 |
|
220 // End of File |