|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * GPRS counters view |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <aknnotedialog.h> |
|
22 |
|
23 #include <Logs.rsg> |
|
24 |
|
25 #include "CGprsCtView.h" |
|
26 #include "CGprsCtControlContainer.h" |
|
27 #include "CLogsAppUi.h" |
|
28 #include "CLogsEngine.h" |
|
29 #include "CLogsAocObjFactory.h" |
|
30 #include "MLogsSystemAgent.h" |
|
31 #include "MLogsSharedData.h" |
|
32 #include "MLogsAocUtil.h" |
|
33 |
|
34 // CONSTANTS |
|
35 |
|
36 // ================= MEMBER FUNCTIONS ======================= |
|
37 |
|
38 // ---------------------------------------------------------------------------- |
|
39 // CGprsCtView::NewL |
|
40 // ---------------------------------------------------------------------------- |
|
41 // |
|
42 CGprsCtView* CGprsCtView::NewL() |
|
43 { |
|
44 CGprsCtView* self = new( ELeave ) CGprsCtView; |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(); |
|
47 CleanupStack::Pop(); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // ---------------------------------------------------------------------------- |
|
52 // CGprsCtView::~CGprsCtView |
|
53 // ---------------------------------------------------------------------------- |
|
54 // |
|
55 CGprsCtView::~CGprsCtView() |
|
56 { |
|
57 if( iContainer ) |
|
58 { |
|
59 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
60 delete iContainer; |
|
61 } |
|
62 |
|
63 delete iAocUtil; |
|
64 } |
|
65 |
|
66 // ---------------------------------------------------------------------------- |
|
67 // CGprsCtView::ConstructL |
|
68 // ---------------------------------------------------------------------------- |
|
69 // |
|
70 void CGprsCtView::ConstructL() |
|
71 { |
|
72 BaseConstructL( R_LOGS_GPRS_COUNTER_VIEW ); |
|
73 iAocUtil = CLogsAocObjFactory::AocUtilL(); |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------------------------------- |
|
77 // CGprsCtView::ProcessPointerEventL |
|
78 // |
|
79 // Handler for pointer events, when the current focused item is tapped |
|
80 // ---------------------------------------------------------------------------- |
|
81 // |
|
82 void CGprsCtView::ProcessPointerEventL( TInt /* aIndex */) |
|
83 { |
|
84 // Open the context sensitive menu |
|
85 ProcessCommandL( EAknSoftkeyContextOptions ); |
|
86 } |
|
87 |
|
88 // ---------------------------------------------------------------------------- |
|
89 // CGprsCtView::HandleCommandL |
|
90 // ---------------------------------------------------------------------------- |
|
91 // |
|
92 void CGprsCtView::HandleCommandL( TInt aCommandId ) |
|
93 { |
|
94 switch ( aCommandId ) |
|
95 { |
|
96 case ELogsCmdMenuClearGprs: |
|
97 if( Engine()->SystemAgentL()->GprsConnectionActive() ) |
|
98 { |
|
99 CAknNoteDialog* noteDlg = new( ELeave ) CAknNoteDialog( |
|
100 CAknNoteDialog::ENoTone, |
|
101 CAknNoteDialog::ELongTimeout); |
|
102 noteDlg->ExecuteLD( R_COUNTER_CLEARING_PROHIB_NOTE ); |
|
103 } |
|
104 else |
|
105 { |
|
106 if( iAocUtil->AskSecCodeL() == KErrNone ) |
|
107 { |
|
108 Engine()->SharedDataL()->ClearGprsCounters(); |
|
109 if( iContainer ) |
|
110 { |
|
111 iContainer->UpdateL(); |
|
112 } |
|
113 } |
|
114 } |
|
115 break; |
|
116 |
|
117 case ELogsCmdHandleMSK: |
|
118 OkOptionCtMenuL(); |
|
119 break; |
|
120 |
|
121 default: |
|
122 CLogsBaseView::HandleCommandL( aCommandId ); |
|
123 } |
|
124 } |
|
125 |
|
126 |
|
127 // ---------------------------------------------------------------------------- |
|
128 // CGprsCtView::Id |
|
129 // ---------------------------------------------------------------------------- |
|
130 // |
|
131 TUid CGprsCtView::Id() const |
|
132 { |
|
133 return TUid::Uid( EGprsCounterViewId ); |
|
134 } |
|
135 |
|
136 |
|
137 // ---------------------------------------------------------------------------- |
|
138 // CGprsCtView::HandleClientRectChange |
|
139 // ---------------------------------------------------------------------------- |
|
140 // |
|
141 void CGprsCtView::HandleClientRectChange() |
|
142 { |
|
143 if (iContainer) |
|
144 { |
|
145 iContainer->SetRect( ClientRect() ); |
|
146 } |
|
147 } |
|
148 |
|
149 |
|
150 // ---------------------------------------------------------------------------- |
|
151 // CGprsCtView::DoActivateL |
|
152 // ---------------------------------------------------------------------------- |
|
153 // |
|
154 void CGprsCtView::DoActivateL( |
|
155 const TVwsViewId& aPrevViewId, |
|
156 TUid /*aCustomMessageId*/, |
|
157 const TDesC8& /*aCustomMessage*/ ) |
|
158 { |
|
159 if( ! iContainer ) |
|
160 { |
|
161 iContainer = CGprsCtControlContainer::NewL( this, ClientRect() ); |
|
162 AppUi()->AddToViewStackL( *this, iContainer ); |
|
163 } |
|
164 |
|
165 Engine()->SharedDataL()->SetObserver( this ); |
|
166 iContainer->ListBox()->SetListBoxObserver( this ); |
|
167 LogsAppUi()->SetPreviousViewId( aPrevViewId.iViewUid ); |
|
168 LogsAppUi()->SetCurrentViewId( Id() ); |
|
169 |
|
170 // Just to make sure the inputblocker is not on |
|
171 RemoveInputBlocker(); |
|
172 } |
|
173 |
|
174 |
|
175 // ---------------------------------------------------------------------------- |
|
176 // CGprsCtView::StateChangedL |
|
177 // ---------------------------------------------------------------------------- |
|
178 // |
|
179 void CGprsCtView::StateChangedL( MLogsStateHolder* /*aHolder*/ ) |
|
180 { |
|
181 if( iContainer ) |
|
182 { |
|
183 iContainer->UpdateL(); |
|
184 } |
|
185 } |
|
186 |
|
187 // ---------------------------------------------------------------------------- |
|
188 // CGprsCtView::DoDeactivate |
|
189 // ---------------------------------------------------------------------------- |
|
190 // |
|
191 void CGprsCtView::DoDeactivate() |
|
192 { |
|
193 if( iContainer ) |
|
194 { |
|
195 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
196 delete iContainer; |
|
197 iContainer = NULL; |
|
198 } |
|
199 } |
|
200 |
|
201 // ---------------------------------------------------------------------------- |
|
202 // CGprsCtView::OkOptionCtMenuL |
|
203 // ---------------------------------------------------------------------------- |
|
204 // |
|
205 void CGprsCtView::OkOptionCtMenuL() |
|
206 { |
|
207 LaunchPopupMenuL( R_LOGS_GPRS_COUNTER_OK_MENUBAR ); |
|
208 } |
|
209 |
|
210 |
|
211 |
|
212 // End of File |