|
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 * Logs "Sub application list" view container control class implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <StringLoader.h> |
|
22 #include <AknIconArray.h> |
|
23 #include <aknnavide.h> |
|
24 #include <akntabgrp.h> |
|
25 #include <AknsConstants.h> //for skinned icons |
|
26 #include <featmgr.h> |
|
27 |
|
28 #include <Logs.rsg> |
|
29 #include <logs.mbg> |
|
30 |
|
31 #include "CLogsSubAppListControlContainer.h" |
|
32 #include "CLogsBaseView.h" |
|
33 #include "CLogsEngine.h" |
|
34 #include "MLogsSharedData.h" |
|
35 #include "CLogsNaviDecoratorWrapper.h" |
|
36 |
|
37 #include "Logs.hrh" |
|
38 #include "LogsIcons.hrh" |
|
39 |
|
40 #include "LogsUID.h" |
|
41 #include <csxhelp/log.hlp.hrh> |
|
42 |
|
43 // EXTERNAL DATA STRUCTURES |
|
44 |
|
45 // EXTERNAL FUNCTION PROTOTYPES |
|
46 |
|
47 // CONSTANTS |
|
48 |
|
49 // MACROS |
|
50 |
|
51 // LOCAL CONSTANTS AND MACROS |
|
52 |
|
53 // MODULE DATA STRUCTURES |
|
54 |
|
55 // LOCAL FUNCTION PROTOTYPES |
|
56 |
|
57 // ==================== LOCAL FUNCTIONS ==================== |
|
58 |
|
59 // ================= MEMBER FUNCTIONS ======================= |
|
60 |
|
61 // ---------------------------------------------------------------------------- |
|
62 // CLogsSubAppListControlContainer::NewL |
|
63 // ---------------------------------------------------------------------------- |
|
64 // |
|
65 CLogsSubAppListControlContainer* CLogsSubAppListControlContainer::NewL |
|
66 ( CLogsBaseView* aAppView, const TRect& aRect) |
|
67 { |
|
68 CLogsSubAppListControlContainer* self = new( ELeave ) |
|
69 CLogsSubAppListControlContainer( aAppView ); |
|
70 self->SetMopParent( aAppView ); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL( aRect ); |
|
73 CleanupStack::Pop(); // self |
|
74 return self; |
|
75 } |
|
76 |
|
77 // ---------------------------------------------------------------------------- |
|
78 // CLogsSubAppListControlContainer::CLogsSubAppListControlContainer |
|
79 // ---------------------------------------------------------------------------- |
|
80 // |
|
81 CLogsSubAppListControlContainer::~CLogsSubAppListControlContainer() |
|
82 { |
|
83 delete iListBox; |
|
84 } |
|
85 |
|
86 // ---------------------------------------------------------------------------- |
|
87 // CLogsSubAppListControlContainer::CLogsSubAppListControlContainer |
|
88 // ---------------------------------------------------------------------------- |
|
89 // |
|
90 CLogsSubAppListControlContainer::CLogsSubAppListControlContainer |
|
91 ( CLogsBaseView* aAppView |
|
92 ) |
|
93 : CLogsBaseControlContainer( aAppView ), iAppView( aAppView ) |
|
94 { |
|
95 } |
|
96 |
|
97 // ---------------------------------------------------------------------------- |
|
98 // CLogsSubAppListControlContainer::ConstructL |
|
99 // ---------------------------------------------------------------------------- |
|
100 // |
|
101 void CLogsSubAppListControlContainer::ConstructL( const TRect& aRect ) |
|
102 { |
|
103 BaseConstructL(); |
|
104 |
|
105 if ( FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) ) |
|
106 { |
|
107 // use alt. title and do not create navi decorator for simple logs |
|
108 MakeTitleL( R_LOGS_TITLE_TEXT ); |
|
109 } |
|
110 else |
|
111 { |
|
112 MakeTitleL( R_STM_TITLE_TEXT ); |
|
113 |
|
114 CAknNavigationDecorator* decoratedTabGroup = NavigationTabGroupL( R_LOGS_SUB_APP_PANE_TAB_GROUP, |
|
115 CLogsNaviDecoratorWrapper::InstanceL() ); |
|
116 |
|
117 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( decoratedTabGroup-> |
|
118 DecoratedControl() ); |
|
119 tabGroup->SetActiveTabById( ESubAppRecentsTabId ); |
|
120 } |
|
121 |
|
122 SetRect( aRect ); |
|
123 CreateListBoxL(); |
|
124 } |
|
125 |
|
126 |
|
127 // ---------------------------------------------------------------------------- |
|
128 // CLogsSubAppListControlContainer::ComponentControl |
|
129 // ---------------------------------------------------------------------------- |
|
130 // |
|
131 CCoeControl* CLogsSubAppListControlContainer::ComponentControl |
|
132 ( TInt /*aIndex*/ ) const |
|
133 { |
|
134 return iListBox; |
|
135 } |
|
136 |
|
137 // ---------------------------------------------------------------------------- |
|
138 // CLogsSubAppListControlContainer::SizeChanged |
|
139 // ---------------------------------------------------------------------------- |
|
140 // |
|
141 void CLogsSubAppListControlContainer::SizeChanged() |
|
142 { |
|
143 if( iListBox ) |
|
144 { |
|
145 iListBox->SetRect( Rect() ); |
|
146 } |
|
147 } |
|
148 |
|
149 |
|
150 // ---------------------------------------------------------------------------- |
|
151 // CLogsSubAppListControlContainer::ListBox |
|
152 // ---------------------------------------------------------------------------- |
|
153 // |
|
154 CAknDoubleLargeStyleListBox* CLogsSubAppListControlContainer::ListBox() |
|
155 { |
|
156 return iListBox; |
|
157 } |
|
158 |
|
159 // ---------------------------------------------------------------------------- |
|
160 // CLogsSubAppListControlContainer::CreateListBoxL |
|
161 // ---------------------------------------------------------------------------- |
|
162 // |
|
163 void CLogsSubAppListControlContainer::CreateListBoxL() |
|
164 { |
|
165 if( iListBox ) |
|
166 { |
|
167 delete iListBox; |
|
168 iListBox = NULL; |
|
169 } |
|
170 |
|
171 iListBox = new( ELeave ) CAknDoubleLargeStyleListBox; |
|
172 iListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
173 |
|
174 CreateListBoxContentsL(); |
|
175 |
|
176 //These need to be here as this function is called from CLogsSubAppListView too. Otherwise |
|
177 //screen is not updated. |
|
178 MakeScrollArrowsL( iListBox ); |
|
179 SizeChanged(); |
|
180 DrawNow(); |
|
181 ActivateL(); |
|
182 } |
|
183 |
|
184 |
|
185 // ---------------------------------------------------------------------------- |
|
186 // CLogsSubAppListControlContainer::CreateListBoxContentsL |
|
187 // ---------------------------------------------------------------------------- |
|
188 // |
|
189 void CLogsSubAppListControlContainer::CreateListBoxContentsL() |
|
190 { |
|
191 if( !iListBox ) |
|
192 { |
|
193 return; |
|
194 } |
|
195 |
|
196 TInt newMissedCalls( 0 ); |
|
197 HBufC* textBuf = NULL; |
|
198 |
|
199 // Creation of the items, in which the temporary text will be inserted |
|
200 CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat( 1 ); |
|
201 CleanupStack::PushL( items ); |
|
202 |
|
203 // Fix for EILU-757CLC: |
|
204 // Only fetch the new missed calls amount if logging is turned on |
|
205 // (otherwise has the inital value of '0' and it wont be displayed) |
|
206 if (iAppView->Engine()->SharedDataL()->IsLoggingEnabled()) |
|
207 { |
|
208 newMissedCalls = iAppView->Engine()->SharedDataL()->NewMissedCalls(); |
|
209 } |
|
210 |
|
211 // Missed Calls second line has text "1 Missed call", if 1 missed call |
|
212 if( newMissedCalls == 1 ) |
|
213 { |
|
214 textBuf = StringLoader::LoadLC( R_STM_TEXT_ONE_NEW_CALL ); |
|
215 MakeListBoxLineL( items, KFirstIconAndTab, R_STM_APP_MISSED_RECENT, |
|
216 *textBuf ); |
|
217 CleanupStack::PopAndDestroy(); // textBuf |
|
218 } |
|
219 // Missed Calls second line has text "n Missed calls", if n missed calls |
|
220 else if( newMissedCalls > 1 ) |
|
221 { |
|
222 textBuf = StringLoader::LoadLC( R_STM_TEXT_N_NEW_CALLS, newMissedCalls ); |
|
223 MakeListBoxLineL( items, KFirstIconAndTab, R_STM_APP_MISSED_RECENT, |
|
224 *textBuf ); |
|
225 CleanupStack::PopAndDestroy(); // textBuf |
|
226 } |
|
227 // Missed Calls second line is empty, if no new missed calls |
|
228 else |
|
229 { |
|
230 MakeListBoxLineL( items, KFirstIconAndTab, R_STM_APP_MISSED_RECENT ); |
|
231 } |
|
232 |
|
233 // Received Calls line |
|
234 MakeListBoxLineL( items, KSecondIconAndTab, R_STM_APP_RECEIVED_RECENT ); |
|
235 |
|
236 // Dialled Calls line |
|
237 MakeListBoxLineL( items, KThirdIconAndTab, R_STM_APP_DIALLED_RECENT ); |
|
238 |
|
239 // Creation of the model, which handles the text items |
|
240 CTextListBoxModel* model = iListBox->Model(); |
|
241 model->SetItemTextArray( items ); |
|
242 model->SetOwnershipType( ELbmOwnsItemArray ); |
|
243 CleanupStack::Pop(); // items |
|
244 iListBox->HandleItemAdditionL(); |
|
245 |
|
246 AddControlContainerIconsL(); |
|
247 } |
|
248 |
|
249 // ---------------------------------------------------------------------------- |
|
250 // CLogsSubAppListControlContainer::GetHelpContext |
|
251 // ---------------------------------------------------------------------------- |
|
252 // |
|
253 void CLogsSubAppListControlContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
254 { |
|
255 aContext.iMajor = TUid::Uid( KLogsAppUID3 ); |
|
256 aContext.iContext = KSTM_HLP_MAIN; |
|
257 } |
|
258 |
|
259 // ---------------------------------------------------------------------------- |
|
260 // CLogsSubAppListControlContainer::AddControlContainerIconsL |
|
261 // ---------------------------------------------------------------------------- |
|
262 // |
|
263 void CLogsSubAppListControlContainer::AddControlContainerIconsL() |
|
264 { |
|
265 if( iListBox->ItemDrawer()->FormattedCellData()->IconArray() != NULL ) |
|
266 { |
|
267 CArrayPtr<CGulIcon>* iconArray = iListBox->ItemDrawer()->FormattedCellData()->IconArray(); |
|
268 delete iconArray; |
|
269 iconArray = NULL; |
|
270 iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( iconArray); |
|
271 } |
|
272 |
|
273 // Load and assign icons to the list box control; 3 is number of icons |
|
274 CAknIconArray* icons = new( ELeave ) CAknIconArray( KSubAppListCCNrOfItems ); |
|
275 |
|
276 iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons ); |
|
277 |
|
278 // First icon & mask ( Missed calls icon & mask ) |
|
279 AddIconL( icons |
|
280 , KLogsIconFile |
|
281 , KAknsIIDQgnPropLogMissedSub |
|
282 , qgn_prop_log_missed_sub |
|
283 , qgn_prop_log_missed_sub_mask |
|
284 ); |
|
285 |
|
286 // Second icon & mask ( Received calls icon & mask ) |
|
287 AddIconL( icons |
|
288 , KLogsIconFile |
|
289 , KAknsIIDQgnPropLogInSub |
|
290 , qgn_prop_log_in_sub |
|
291 , qgn_prop_log_in_sub_mask |
|
292 ); |
|
293 |
|
294 // Third icon & mask ( Dialled calls icon & mask ) |
|
295 AddIconL( icons |
|
296 , KLogsIconFile |
|
297 , KAknsIIDQgnPropLogOutSub |
|
298 , qgn_prop_log_out_sub |
|
299 , qgn_prop_log_out_sub_mask |
|
300 ); |
|
301 } |
|
302 |
|
303 // ---------------------------------------------------------------------------- |
|
304 // CLogsSubAppListControlContainer::FocusChanged |
|
305 // |
|
306 // This is needed to hand focus changes to list. Otherwise animations are not displayed. |
|
307 // ---------------------------------------------------------------------------- |
|
308 // |
|
309 void CLogsSubAppListControlContainer::FocusChanged(TDrawNow /* aDrawNow */ ) |
|
310 { |
|
311 if( iListBox) |
|
312 { |
|
313 iListBox->SetFocus( IsFocused() ); |
|
314 } |
|
315 } |
|
316 |
|
317 // End of File |