63
|
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 |
// Refresh navi pane to empty here to cover navi pane of RecentListView.
|
|
109 |
MakeTitleL( R_LOGS_TITLE_TEXT );
|
|
110 |
NavigationTabGroupL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY,
|
|
111 |
CLogsNaviDecoratorWrapper::InstanceL() );
|
|
112 |
}
|
|
113 |
else
|
|
114 |
{
|
|
115 |
MakeTitleL( R_STM_TITLE_TEXT );
|
|
116 |
|
|
117 |
CAknNavigationDecorator* decoratedTabGroup = NavigationTabGroupL( R_LOGS_SUB_APP_PANE_TAB_GROUP,
|
|
118 |
CLogsNaviDecoratorWrapper::InstanceL() );
|
|
119 |
|
|
120 |
CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( decoratedTabGroup->
|
|
121 |
DecoratedControl() );
|
|
122 |
tabGroup->SetActiveTabById( ESubAppRecentsTabId );
|
|
123 |
}
|
|
124 |
|
|
125 |
SetRect( aRect );
|
|
126 |
CreateListBoxL();
|
|
127 |
}
|
|
128 |
|
|
129 |
|
|
130 |
// ----------------------------------------------------------------------------
|
|
131 |
// CLogsSubAppListControlContainer::ComponentControl
|
|
132 |
// ----------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
CCoeControl* CLogsSubAppListControlContainer::ComponentControl
|
|
135 |
( TInt /*aIndex*/ ) const
|
|
136 |
{
|
|
137 |
return iListBox;
|
|
138 |
}
|
|
139 |
|
|
140 |
// ----------------------------------------------------------------------------
|
|
141 |
// CLogsSubAppListControlContainer::SizeChanged
|
|
142 |
// ----------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
void CLogsSubAppListControlContainer::SizeChanged()
|
|
145 |
{
|
|
146 |
if( iListBox )
|
|
147 |
{
|
|
148 |
iListBox->SetRect( Rect() );
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
// ----------------------------------------------------------------------------
|
|
154 |
// CLogsSubAppListControlContainer::ListBox
|
|
155 |
// ----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
CAknDoubleLargeStyleListBox* CLogsSubAppListControlContainer::ListBox()
|
|
158 |
{
|
|
159 |
return iListBox;
|
|
160 |
}
|
|
161 |
|
|
162 |
// ----------------------------------------------------------------------------
|
|
163 |
// CLogsSubAppListControlContainer::CreateListBoxL
|
|
164 |
// ----------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
void CLogsSubAppListControlContainer::CreateListBoxL()
|
|
167 |
{
|
|
168 |
if( iListBox )
|
|
169 |
{
|
|
170 |
delete iListBox;
|
|
171 |
iListBox = NULL;
|
|
172 |
}
|
|
173 |
|
|
174 |
iListBox = new( ELeave ) CAknDoubleLargeStyleListBox;
|
|
175 |
iListBox->ConstructL( this, EAknListBoxSelectionList );
|
|
176 |
|
|
177 |
CreateListBoxContentsL();
|
|
178 |
|
|
179 |
//These need to be here as this function is called from CLogsSubAppListView too. Otherwise
|
|
180 |
//screen is not updated.
|
|
181 |
MakeScrollArrowsL( iListBox );
|
|
182 |
SizeChanged();
|
|
183 |
DrawNow();
|
|
184 |
ActivateL();
|
|
185 |
}
|
|
186 |
|
|
187 |
|
|
188 |
// ----------------------------------------------------------------------------
|
|
189 |
// CLogsSubAppListControlContainer::CreateListBoxContentsL
|
|
190 |
// ----------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
void CLogsSubAppListControlContainer::CreateListBoxContentsL()
|
|
193 |
{
|
|
194 |
if( !iListBox )
|
|
195 |
{
|
|
196 |
return;
|
|
197 |
}
|
|
198 |
|
|
199 |
TInt newMissedCalls( 0 );
|
|
200 |
HBufC* textBuf = NULL;
|
|
201 |
|
|
202 |
// Creation of the items, in which the temporary text will be inserted
|
|
203 |
CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat( 1 );
|
|
204 |
CleanupStack::PushL( items );
|
|
205 |
|
|
206 |
// Fix for EILU-757CLC:
|
|
207 |
// Only fetch the new missed calls amount if logging is turned on
|
|
208 |
// (otherwise has the inital value of '0' and it wont be displayed)
|
|
209 |
if (iAppView->Engine()->SharedDataL()->IsLoggingEnabled())
|
|
210 |
{
|
|
211 |
newMissedCalls = iAppView->Engine()->SharedDataL()->NewMissedCalls();
|
|
212 |
}
|
|
213 |
|
|
214 |
// Missed Calls second line has text "1 Missed call", if 1 missed call
|
|
215 |
if( newMissedCalls == 1 )
|
|
216 |
{
|
|
217 |
textBuf = StringLoader::LoadLC( R_STM_TEXT_ONE_NEW_CALL );
|
|
218 |
MakeListBoxLineL( items, KFirstIconAndTab, R_STM_APP_MISSED_RECENT,
|
|
219 |
*textBuf );
|
|
220 |
CleanupStack::PopAndDestroy(); // textBuf
|
|
221 |
}
|
|
222 |
// Missed Calls second line has text "n Missed calls", if n missed calls
|
|
223 |
else if( newMissedCalls > 1 )
|
|
224 |
{
|
|
225 |
textBuf = StringLoader::LoadLC( R_STM_TEXT_N_NEW_CALLS, newMissedCalls );
|
|
226 |
MakeListBoxLineL( items, KFirstIconAndTab, R_STM_APP_MISSED_RECENT,
|
|
227 |
*textBuf );
|
|
228 |
CleanupStack::PopAndDestroy(); // textBuf
|
|
229 |
}
|
|
230 |
// Missed Calls second line is empty, if no new missed calls
|
|
231 |
else
|
|
232 |
{
|
|
233 |
MakeListBoxLineL( items, KFirstIconAndTab, R_STM_APP_MISSED_RECENT );
|
|
234 |
}
|
|
235 |
|
|
236 |
// Received Calls line
|
|
237 |
MakeListBoxLineL( items, KSecondIconAndTab, R_STM_APP_RECEIVED_RECENT );
|
|
238 |
|
|
239 |
// Dialled Calls line
|
|
240 |
MakeListBoxLineL( items, KThirdIconAndTab, R_STM_APP_DIALLED_RECENT );
|
|
241 |
|
|
242 |
// Creation of the model, which handles the text items
|
|
243 |
CTextListBoxModel* model = iListBox->Model();
|
|
244 |
model->SetItemTextArray( items );
|
|
245 |
model->SetOwnershipType( ELbmOwnsItemArray );
|
|
246 |
CleanupStack::Pop(); // items
|
|
247 |
iListBox->HandleItemAdditionL();
|
|
248 |
|
|
249 |
AddControlContainerIconsL();
|
|
250 |
}
|
|
251 |
|
|
252 |
// ----------------------------------------------------------------------------
|
|
253 |
// CLogsSubAppListControlContainer::GetHelpContext
|
|
254 |
// ----------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
void CLogsSubAppListControlContainer::GetHelpContext( TCoeHelpContext& aContext ) const
|
|
257 |
{
|
|
258 |
aContext.iMajor = TUid::Uid( KLogsAppUID3 );
|
|
259 |
aContext.iContext = KSTM_HLP_MAIN;
|
|
260 |
}
|
|
261 |
|
|
262 |
// ----------------------------------------------------------------------------
|
|
263 |
// CLogsSubAppListControlContainer::AddControlContainerIconsL
|
|
264 |
// ----------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
void CLogsSubAppListControlContainer::AddControlContainerIconsL()
|
|
267 |
{
|
|
268 |
if( iListBox->ItemDrawer()->FormattedCellData()->IconArray() != NULL )
|
|
269 |
{
|
|
270 |
CArrayPtr<CGulIcon>* iconArray = iListBox->ItemDrawer()->FormattedCellData()->IconArray();
|
|
271 |
delete iconArray;
|
|
272 |
iconArray = NULL;
|
|
273 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( iconArray);
|
|
274 |
}
|
|
275 |
|
|
276 |
// Load and assign icons to the list box control; 3 is number of icons
|
|
277 |
CAknIconArray* icons = new( ELeave ) CAknIconArray( KSubAppListCCNrOfItems );
|
|
278 |
|
|
279 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons );
|
|
280 |
|
|
281 |
// First icon & mask ( Missed calls icon & mask )
|
|
282 |
AddIconL( icons
|
|
283 |
, KLogsIconFile
|
|
284 |
, KAknsIIDQgnPropLogMissedSub
|
|
285 |
, qgn_prop_log_missed_sub
|
|
286 |
, qgn_prop_log_missed_sub_mask
|
|
287 |
);
|
|
288 |
|
|
289 |
// Second icon & mask ( Received calls icon & mask )
|
|
290 |
AddIconL( icons
|
|
291 |
, KLogsIconFile
|
|
292 |
, KAknsIIDQgnPropLogInSub
|
|
293 |
, qgn_prop_log_in_sub
|
|
294 |
, qgn_prop_log_in_sub_mask
|
|
295 |
);
|
|
296 |
|
|
297 |
// Third icon & mask ( Dialled calls icon & mask )
|
|
298 |
AddIconL( icons
|
|
299 |
, KLogsIconFile
|
|
300 |
, KAknsIIDQgnPropLogOutSub
|
|
301 |
, qgn_prop_log_out_sub
|
|
302 |
, qgn_prop_log_out_sub_mask
|
|
303 |
);
|
|
304 |
}
|
|
305 |
|
|
306 |
// ----------------------------------------------------------------------------
|
|
307 |
// CLogsSubAppListControlContainer::FocusChanged
|
|
308 |
//
|
|
309 |
// This is needed to hand focus changes to list. Otherwise animations are not displayed.
|
|
310 |
// ----------------------------------------------------------------------------
|
|
311 |
//
|
|
312 |
void CLogsSubAppListControlContainer::FocusChanged(TDrawNow /* aDrawNow */ )
|
|
313 |
{
|
|
314 |
if( iListBox)
|
|
315 |
{
|
|
316 |
iListBox->SetFocus( IsFocused() );
|
|
317 |
}
|
|
318 |
}
|
|
319 |
|
|
320 |
// End of File
|