|
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: Implementation of class CCCHUiNoteHandler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <avkon.rsg> |
|
20 #include <AknGlobalNote.h> |
|
21 #include <AknQueryDialog.h> |
|
22 #include <AknGlobalMsgQuery.h> |
|
23 #include <cenrepnotifyhandler.h> |
|
24 |
|
25 #include "cchuilogger.h" |
|
26 #include "cchuinotehandler.h" |
|
27 #include "cchuiglobalqueryhandler.h" |
|
28 #include "mcchuinoteresultobserver.h" |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 CCCHUiNoteHandler::CCCHUiNoteHandler( |
|
33 MCchUiNoteResultObserver& aObserver ) : |
|
34 CActive ( EPriorityHigh ), |
|
35 iObserver( aObserver ), |
|
36 iCurrentNote( MCchUiObserver::ECchUiDialogTypeNotSet ) |
|
37 { |
|
38 } |
|
39 |
|
40 void CCCHUiNoteHandler::ConstructL() |
|
41 { |
|
42 CCHUIDEBUG( "CCCHUiNoteHandler::ConstructL - IN" ); |
|
43 |
|
44 CActiveScheduler::Add( this ); |
|
45 iGlobalQueryHandler = CCchUiGlobalQueryHandler::NewL(); |
|
46 |
|
47 CCHUIDEBUG( "CCCHUiNoteHandler::ConstructL - OUT" ); |
|
48 } |
|
49 |
|
50 CCCHUiNoteHandler* CCCHUiNoteHandler::NewL( |
|
51 MCchUiNoteResultObserver& aObserver ) |
|
52 { |
|
53 CCCHUiNoteHandler* self = |
|
54 new( ELeave ) CCCHUiNoteHandler( aObserver ); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CCCHUiNoteHandler::~CCCHUiNoteHandler() |
|
62 { |
|
63 CCHUIDEBUG( "CCCHUiNoteHandler::~CCCHUiNoteHandler - IN" ); |
|
64 |
|
65 Cancel(); |
|
66 delete iGlobalQueryHandler; |
|
67 iGlobalQueryHandler = NULL; |
|
68 |
|
69 CCHUIDEBUG( "CCCHUiNoteHandler::~CCCHUiNoteHandler - OUT" ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // Launch note. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CCCHUiNoteHandler::LaunchNoteL( |
|
77 MCchUiObserver::TCchUiDialogType aNote, |
|
78 TUint aServiceId, |
|
79 TUint aIapId, |
|
80 RBuf& aUserName ) |
|
81 { |
|
82 CCHUIDEBUG( "CCCHUiNoteHandler::LaunchNoteL - IN"); |
|
83 CCHUIDEBUG2( "LaunchNoteL - aNote: %d", aNote ); |
|
84 CCHUIDEBUG2( "LaunchNoteL - aServiceId: %d", aServiceId ); |
|
85 CCHUIDEBUG2( "LaunchNoteL - aIapId: %d", aIapId ); |
|
86 CCHUIDEBUG2( "LaunchNoteL - aUserName: %S", &aUserName ); |
|
87 CCHUIDEBUG2( "LaunchNoteL - IsActive: %d", IsActive() ); |
|
88 |
|
89 // If already showing note => leave with KErrAlreadyExists to signal |
|
90 // client as API definition dictates. |
|
91 __ASSERT_ALWAYS( !IsActive(), User::Leave( KErrAlreadyExists )); |
|
92 switch ( aNote ) |
|
93 { |
|
94 case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed: |
|
95 case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed: |
|
96 case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable: |
|
97 case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined: |
|
98 case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection: |
|
99 case MCchUiObserver::ECchUiDialogTypeChangeConnection: |
|
100 case MCchUiObserver::ECchUiDialogTypeDefectiveSettings: |
|
101 case MCchUiObserver::ECchUiDialogTypeErrorInConnection: |
|
102 { |
|
103 iCurrentNote = aNote; |
|
104 iGlobalQueryHandler->ShowMsgQueryL( |
|
105 aNote, iStatus, aServiceId, aIapId, aUserName ); |
|
106 SetActive(); |
|
107 } |
|
108 break; |
|
109 |
|
110 default: |
|
111 { |
|
112 CCHUIDEBUG( "LaunchNoteL - default switch case" ); |
|
113 User::Leave( KErrNotSupported ); |
|
114 } |
|
115 break; |
|
116 } |
|
117 CCHUIDEBUG( "CCCHUiNoteHandler::LaunchNoteL - OUT" ); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // Active dialog check. By dialog we mean dialog which needs user action. |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 TBool CCCHUiNoteHandler::ActiveDialogExists() |
|
125 { |
|
126 CCHUIDEBUG( "CCCHUiNoteHandler::ActiveDialogExists" ); |
|
127 |
|
128 switch ( iCurrentNote ) |
|
129 { |
|
130 case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed: |
|
131 case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable: |
|
132 case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined: |
|
133 case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection: |
|
134 case MCchUiObserver::ECchUiDialogTypeChangeConnection: |
|
135 { |
|
136 return ETrue; |
|
137 } |
|
138 case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed: |
|
139 case MCchUiObserver::ECchUiDialogTypeDefectiveSettings: |
|
140 case MCchUiObserver::ECchUiDialogTypeErrorInConnection: |
|
141 default: |
|
142 { |
|
143 return EFalse; |
|
144 } |
|
145 } |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CancelOldNotes. |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 void CCCHUiNoteHandler::CancelOldNotes() |
|
153 { |
|
154 CCHUIDEBUG( "CCCHUiNoteHandler::CancelOldNotes - IN" ); |
|
155 |
|
156 if ( iGlobalQueryHandler && IsActive() ) |
|
157 { |
|
158 iGlobalQueryHandler->CancelMsgQuery(); |
|
159 Cancel(); |
|
160 } |
|
161 |
|
162 CCHUIDEBUG( "CCCHUiNoteHandler::CancelOldNotes - OUT" ); |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // Returns current note. |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 MCchUiObserver::TCchUiDialogType CCCHUiNoteHandler::CurrentNote() |
|
170 { |
|
171 return iCurrentNote; |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // From class CActive |
|
176 // RunL. |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void CCCHUiNoteHandler::RunL() |
|
180 { |
|
181 CCHUIDEBUG2( "CCCHUiNoteHandler::RunL, status: %d", iStatus.Int() ); |
|
182 |
|
183 TInt status = iStatus.Int(); |
|
184 if ( iGlobalQueryHandler ) |
|
185 { |
|
186 iCurrentNote = MCchUiObserver::ECchUiDialogTypeNotSet; |
|
187 |
|
188 TRAP_IGNORE( iObserver.DialogCompletedL( status, |
|
189 iGlobalQueryHandler->ResultParams() ) ); |
|
190 } |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // From class CActive |
|
195 // DoCancel. |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 void CCCHUiNoteHandler::DoCancel() |
|
199 { |
|
200 CCHUIDEBUG( "CCCHUiNoteHandler::DoCancel - IN" ); |
|
201 |
|
202 if ( iGlobalQueryHandler ) |
|
203 { |
|
204 CCHUIDEBUG( "DoCancel - cancel message query"); |
|
205 iGlobalQueryHandler->CancelMsgQuery(); |
|
206 } |
|
207 |
|
208 CCHUIDEBUG( "CCCHUiNoteHandler::DoCancel - OUT" ); |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // From class CActive. |
|
213 // RunError. |
|
214 // --------------------------------------------------------------------------- |
|
215 // |
|
216 TInt CCCHUiNoteHandler::RunError( TInt /*aError*/ ) |
|
217 { |
|
218 return KErrNone; |
|
219 } |
|
220 |