1 /* |
|
2 * Copyright (c) 2008 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: Asynchronous display of legal and disclaimer note. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System Includes |
|
20 #include <centralrepository.h> |
|
21 #include <StringLoader.h> |
|
22 #include <aknmessagequerydialog.h> |
|
23 #include <aknnotewrappers.h> |
|
24 #include <evtmgmtui.rsg> |
|
25 #include <coemain.h> |
|
26 #include <aknappui.h> |
|
27 |
|
28 // User Includes |
|
29 #include "evtmgmtuilegalnote.h" |
|
30 #include "evtdebug.h" |
|
31 #include "evtstoragedomaincrkeys.h" |
|
32 |
|
33 // Constants |
|
34 const TInt KDisclaimerValueOff = 0; |
|
35 |
|
36 // ================ Member funtions for CEvtDatabase class ================== |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CEvtMgmtUiLegalNote::CEvtMgmtUiLegalNote |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CEvtMgmtUiLegalNote::CEvtMgmtUiLegalNote( CAknAppUi& aAppUi ) |
|
43 :CActive( EPriorityStandard ), iAppUi(aAppUi) |
|
44 { |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CEvtMgmtUiLegalNote::~CEvtMgmtUiLegalNote |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CEvtMgmtUiLegalNote::~CEvtMgmtUiLegalNote() |
|
52 { |
|
53 Cancel(); |
|
54 delete iRepository; |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CEvtMgmtUiLegalNote::NewL |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CEvtMgmtUiLegalNote* CEvtMgmtUiLegalNote::NewL( CAknAppUi& aAppUi ) |
|
62 { |
|
63 CEvtMgmtUiLegalNote* self = NewLC( aAppUi ); |
|
64 CleanupStack::Pop( self ); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CEvtMgmtUiLegalNote::NewLC |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CEvtMgmtUiLegalNote* CEvtMgmtUiLegalNote::NewLC( CAknAppUi& aAppUi ) |
|
73 { |
|
74 CEvtMgmtUiLegalNote* self = new ( ELeave )CEvtMgmtUiLegalNote( aAppUi ); |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL( ); |
|
77 return self; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CEvtMgmtUiLegalNote::ConstructL |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CEvtMgmtUiLegalNote::ConstructL() |
|
85 { |
|
86 EVTUIDEBUG( "+ CEvtMgmtUiLegalNote::ConstructL()" ); |
|
87 CActiveScheduler::Add(this); |
|
88 |
|
89 EVTUIDEBUG( "Calling CRepository::NewL" ); |
|
90 // Create the Central repository object notifying the Disclaimer display |
|
91 TRAPD(err, iRepository = CRepository::NewL( TUid::Uid( KCRUidEvtStorageDb ) ) ); |
|
92 EVTUIDEBUG1( "Calling CRepository::NewL Cenrep Error Code- %d", err ); |
|
93 User::LeaveIfError( err ); |
|
94 |
|
95 EVTUIDEBUG( "- CEvtMgmtUiLegalNote::ConstructL()" ); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // void CEvtMgmtUiLegalNote::RunL() |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CEvtMgmtUiLegalNote::RunL() |
|
103 { |
|
104 EVTUIDEBUG( "+ CEvtMgmtUiLegalNote::RunL()" ); |
|
105 |
|
106 HBufC* queryHeader = StringLoader::LoadLC( R_LOCEV_NOTE_DISCLAIMER_HEADING, CCoeEnv::Static() ); |
|
107 HBufC* queryText = StringLoader::LoadLC( R_LOCEV_NOTE_DISCLAIMER_TEXT, CCoeEnv::Static() ); |
|
108 CAknMessageQueryDialog* dlg = new ( ELeave ) CAknMessageQueryDialog ( queryText, queryHeader ); |
|
109 TInt buttonId = dlg->ExecuteLD( R_EVTUI_DISCLAIMER_QUERY ); |
|
110 CleanupStack::Pop(2); |
|
111 if( EEikBidOk == buttonId ) |
|
112 { |
|
113 HBufC* msg = StringLoader::LoadLC( R_LOCEV_CONFIRMATION_NOTE_TEXT ); |
|
114 CAknQueryDialog* confirmationQuery = CAknQueryDialog::NewL(); |
|
115 if( EAknSoftkeyYes == confirmationQuery->ExecuteLD(R_EVTUI_CONFIRMATION_QUERY, *msg) ) |
|
116 { |
|
117 User::LeaveIfError( iRepository->Set( KEvtDisclaimerSetting, KDisclaimerValueOff ) ); |
|
118 } |
|
119 CleanupStack::PopAndDestroy(msg); |
|
120 } |
|
121 else // if( EEikBidCancel == buttonId ) |
|
122 { |
|
123 iAppUi.Exit(); |
|
124 } |
|
125 |
|
126 EVTUIDEBUG( "- CEvtMgmtUiLegalNote::RunL()" ); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // void CEvtMgmtUiLegalNote::DoCancel() |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 void CEvtMgmtUiLegalNote::DoCancel() |
|
134 { |
|
135 EVTUIDEBUG( "+ CEvtMgmtUiLegalNote::DoCancel()" ); |
|
136 // Nothing to do. |
|
137 EVTUIDEBUG( "- CEvtMgmtUiLegalNote::DoCancel()" ); |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // TInt CEvtMgmtUiLegalNote::RunError() |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 TInt CEvtMgmtUiLegalNote::RunError( TInt aError ) |
|
145 { |
|
146 return CActive::RunError( aError ); |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // void CEvtMgmtUiLegalNote::StartNotification() |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CEvtMgmtUiLegalNote::DisplayNoteL() |
|
154 { |
|
155 EVTUIDEBUG( "+ CEvtMgmtUiLegalNote::DisplayNoteL()" ); |
|
156 // Get the type of database change from Cenrep key |
|
157 TInt flag = 1; |
|
158 User::LeaveIfError( iRepository->Get( KEvtDisclaimerSetting, flag ) ); |
|
159 |
|
160 if( flag && !IsActive() ) |
|
161 { |
|
162 TRequestStatus* status = &iStatus; |
|
163 User::RequestComplete( status, KErrNone ); |
|
164 SetActive(); |
|
165 } |
|
166 EVTUIDEBUG( "- CEvtMgmtUiLegalNote::DisplayNoteL()" ); |
|
167 } |
|
168 |
|
169 // End of File |
|