1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 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" |
|
25 #include "iaupdatefirsttimeinfo.h" |
24 #include "iaupdatefirsttimeinfo.h" |
26 #include "iaupdate.hrh" |
25 #include "iaupdate.hrh" |
27 #include "iaupdateprivatecrkeys.h" |
26 #include "iaupdateprivatecrkeys.h" |
28 #include "iaupdateapplication.h" |
27 #include "iaupdatedialogutil.h" |
29 |
28 |
30 #include <avkon.rsg> |
|
31 #include <avkon.hrh> |
|
32 #include <iaupdate.rsg> |
|
33 #include <centralrepository.h> |
29 #include <centralrepository.h> |
|
30 #include <hbaction.h> |
34 |
31 |
35 |
32 |
36 // --------------------------------------------------------------------------- |
33 // --------------------------------------------------------------------------- |
37 // CIAUpdateAutomaticCheck::NewL |
34 // CIAUpdateAutomaticCheck::NewL |
38 // Two-phased constructor. |
35 // Two-phased constructor. |
81 // Destructor |
78 // Destructor |
82 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
83 // |
80 // |
84 CIAUpdateAutomaticCheck::~CIAUpdateAutomaticCheck() |
81 CIAUpdateAutomaticCheck::~CIAUpdateAutomaticCheck() |
85 { |
82 { |
|
83 if ( mDialogUtil ) |
|
84 { |
|
85 delete mDialogUtil; |
|
86 } |
86 } |
87 } |
87 |
88 |
88 |
89 |
89 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
90 // CIAUpdateAutomaticCheck::AcceptAutomaticCheckL |
91 // CIAUpdateAutomaticCheck::AcceptAutomaticCheckL |
91 // |
92 // |
92 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
93 // |
94 // |
94 TBool CIAUpdateAutomaticCheck::AcceptAutomaticCheckL() |
95 void CIAUpdateAutomaticCheck::AcceptAutomaticCheckL() |
95 { |
96 { |
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 TInt ret = IAUpdateDialogUtil::ShowConfirmationQueryL( |
107 if ( !mDialogUtil ) |
108 R_IAUPDATE_TURN_ON_AUTOUPD_CHECKS, |
108 { |
109 R_AVKON_SOFTKEYS_YES_NO ); |
109 mDialogUtil = new IAUpdateDialogUtil(NULL, this); |
110 firstTimeInfo->SetAutomaticUpdatesAskedL(); |
|
111 if ( ret == EAknSoftkeyYes ) |
|
112 { |
|
113 EnableAutoUpdateCheckL( ETrue ); |
|
114 } |
110 } |
115 } |
111 if ( mDialogUtil ) |
|
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 } |
116 } |
120 } |
117 CleanupStack::PopAndDestroy( firstTimeInfo ); |
121 CleanupStack::PopAndDestroy( firstTimeInfo ); |
118 return acceptChecks; |
|
119 } |
122 } |
120 |
123 |
121 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
122 // CIAUpdateAutomaticCheck::AutoUpdateCheckEnabledL |
125 // CIAUpdateAutomaticCheck::AutoUpdateCheckEnabledL |
123 // |
126 // |
167 User::LeaveIfError( cenrep->CommitTransaction( ignore ) ); |
170 User::LeaveIfError( cenrep->CommitTransaction( ignore ) ); |
168 CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL() |
171 CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL() |
169 CleanupStack::PopAndDestroy( cenrep ); |
172 CleanupStack::PopAndDestroy( cenrep ); |
170 } |
173 } |
171 |
174 |
172 |
175 // --------------------------------------------------------------------------- |
|
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 } |
173 // End of File |
190 // End of File |