62
|
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: Implementation of CPhoneTextTitlePane class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <aknappui.h>
|
|
21 |
#include <eikspane.h>
|
|
22 |
#include <akntitle.h>
|
|
23 |
#include <aknnavi.h>
|
|
24 |
#include <aknnavide.h>
|
|
25 |
#include <aknnavilabel.h>
|
|
26 |
#include <coemain.h>
|
|
27 |
#include <avkon.rsg>
|
|
28 |
#include <avkon.hrh>
|
|
29 |
#include <AknIndicatorContainer.h>
|
|
30 |
#include <barsread.h>
|
|
31 |
#include <phoneui.rsg>
|
|
32 |
#include <featmgr.h>
|
|
33 |
#include <AknIconUtils.h>
|
|
34 |
#include <AknUtils.h>
|
|
35 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
36 |
|
|
37 |
#include "phoneui.pan"
|
|
38 |
#include "cphonestatuspane.h"
|
|
39 |
#include "mphonestatuspaneobserver.h"
|
|
40 |
#include "cphonerecoverysystem.h"
|
|
41 |
|
|
42 |
#include "tphonecommandparam.h"
|
|
43 |
#include "tphonecmdparaminteger.h"
|
|
44 |
#include "tphonecmdparamboolean.h"
|
|
45 |
#include "tphonecmdparambitmap.h"
|
|
46 |
#include "phonelogger.h"
|
|
47 |
|
|
48 |
#include <StringLoader.h>
|
|
49 |
|
|
50 |
// CONSTANTS
|
|
51 |
|
|
52 |
// MODULE DATA STRUCTURES
|
|
53 |
|
|
54 |
/**
|
|
55 |
* It is title pane containing text.
|
|
56 |
*/
|
|
57 |
class CPhoneTextTitlePane :
|
|
58 |
public CBase,
|
|
59 |
private MPhoneStatusPaneObserver
|
|
60 |
{
|
|
61 |
public: // Constructors and destructor
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Two-phased constructor.
|
|
65 |
*/
|
|
66 |
static CPhoneTextTitlePane* NewLC(
|
|
67 |
CPhoneStatusPane& aStatusPaneManager,
|
|
68 |
TInt aTextResourceId );
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Destructor.
|
|
72 |
*/
|
|
73 |
~CPhoneTextTitlePane();
|
|
74 |
|
|
75 |
public: // Functions from base classes
|
|
76 |
|
|
77 |
/**
|
|
78 |
* From MPhoneStatusPaneObserver, handles activation of title pane.
|
|
79 |
*/
|
|
80 |
void HandleTitlePaneActiveL( TBool aActive );
|
|
81 |
|
|
82 |
private:
|
|
83 |
|
|
84 |
/**
|
|
85 |
* C++ constructor.
|
|
86 |
*/
|
|
87 |
CPhoneTextTitlePane(
|
|
88 |
CPhoneStatusPane& aStatusPaneManager,
|
|
89 |
TInt aTextResourceId );
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Symbian OS constructor.
|
|
93 |
*/
|
|
94 |
void ConstructL();
|
|
95 |
|
|
96 |
private: // Data
|
|
97 |
|
|
98 |
// Status pane manager.
|
|
99 |
CPhoneStatusPane& iStatusPaneManager;
|
|
100 |
|
|
101 |
// Text resource id.
|
|
102 |
const TInt iTextResourceId;
|
|
103 |
|
|
104 |
};
|
|
105 |
|
|
106 |
// ================= MEMBER FUNCTIONS =======================
|
|
107 |
|
|
108 |
// ---------------------------------------------------------
|
|
109 |
// CPhoneStatusPane::Instance
|
|
110 |
// Initializes the singleton object
|
|
111 |
// (other items were commented in a header).
|
|
112 |
// ---------------------------------------------------------
|
|
113 |
//
|
|
114 |
CPhoneStatusPane* CPhoneStatusPane::Instance()
|
|
115 |
{
|
|
116 |
CPhoneStatusPane* instance = static_cast<CPhoneStatusPane*>
|
|
117 |
( CCoeEnv::Static ( KUidPhoneStatusPaneHandlerSingleton ) );
|
|
118 |
|
|
119 |
if( !instance )
|
|
120 |
{
|
|
121 |
TRAPD( err, instance = CPhoneStatusPane::NewL() );
|
|
122 |
if ( err )
|
|
123 |
{
|
|
124 |
Panic( EPhoneUtilsCouldNotCreateSingleton );
|
|
125 |
}
|
|
126 |
}
|
|
127 |
return instance;
|
|
128 |
}
|
|
129 |
|
|
130 |
// ---------------------------------------------------------
|
|
131 |
// CPhoneStatusPane::CPhoneStatusPane
|
|
132 |
// ---------------------------------------------------------
|
|
133 |
//
|
|
134 |
// C++ default constructor can NOT contain any code, that
|
|
135 |
// might leave.
|
|
136 |
//
|
|
137 |
CPhoneStatusPane::CPhoneStatusPane( ) :
|
|
138 |
CCoeStatic( KUidPhoneStatusPaneHandlerSingleton, EThread ),
|
|
139 |
iTitlePaneList( NULL ),
|
|
140 |
iStatusPane( NULL ),
|
|
141 |
iTitlePane( NULL ),
|
|
142 |
iTitlePanePicture( NULL ),
|
|
143 |
iTitlePanePictureMask( NULL ),
|
|
144 |
iNaviPane( NULL ),
|
|
145 |
iNaviDecorator( NULL )
|
|
146 |
{
|
|
147 |
}
|
|
148 |
|
|
149 |
// Symbian OS default constructor can leave.
|
|
150 |
void CPhoneStatusPane::ConstructL()
|
|
151 |
{
|
|
152 |
iTitlePaneList = new ( ELeave ) CArrayFixFlat< THandlerTag >
|
|
153 |
( KPhoneTitlePaneListGranularity );
|
|
154 |
|
|
155 |
// Get pointer for title pane
|
|
156 |
iStatusPane = static_cast<CAknAppUi*>( CEikonEnv::Static()->
|
|
157 |
EikAppUi() )->StatusPane();
|
|
158 |
iTitlePane = static_cast<CAknTitlePane*>( iStatusPane->ControlL(
|
|
159 |
TUid::Uid( EEikStatusPaneUidTitle ) ) );
|
|
160 |
iTitlePane->SetNumberOfVisibleTextRows( 1 );
|
|
161 |
|
|
162 |
// Initialize display of title pane information
|
|
163 |
iTitlePaneTextIsDisplayed = ETrue;
|
|
164 |
|
|
165 |
// Get pointer for navigation pane
|
|
166 |
iNaviPane = static_cast<CAknNavigationControlContainer*>
|
|
167 |
( iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) );
|
|
168 |
|
|
169 |
if ( !FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) )
|
|
170 |
{
|
|
171 |
// Construct navi pane decorator
|
|
172 |
iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC() );
|
|
173 |
iNaviPane->PushL( *iNaviDecorator );
|
|
174 |
}
|
|
175 |
|
|
176 |
// Get recovery Id from recovery system
|
|
177 |
iUpdateTitlePaneRecoveryId = CPhoneRecoverySystem::Instance()->AddL(
|
|
178 |
TCallBack( UpdateTitlePaneCallBackL, this ),
|
|
179 |
CTeleRecoverySystem::EPhonePriorityStandard,
|
|
180 |
CTeleRecoverySystem::EPhoneStateIdle );
|
|
181 |
}
|
|
182 |
|
|
183 |
// Constructor
|
|
184 |
CPhoneStatusPane* CPhoneStatusPane::NewL()
|
|
185 |
{
|
|
186 |
CPhoneStatusPane* self = new (ELeave) CPhoneStatusPane();
|
|
187 |
|
|
188 |
CleanupStack::PushL( self );
|
|
189 |
self->ConstructL();
|
|
190 |
CleanupStack::Pop( self );
|
|
191 |
|
|
192 |
return self;
|
|
193 |
}
|
|
194 |
|
|
195 |
// Destructor
|
|
196 |
CPhoneStatusPane::~CPhoneStatusPane()
|
|
197 |
{
|
|
198 |
if ( iTitlePaneList )
|
|
199 |
{
|
|
200 |
iTitlePaneList->Reset();
|
|
201 |
}
|
|
202 |
delete iTitlePaneList;
|
|
203 |
|
|
204 |
iStatusPane = NULL;
|
|
205 |
iTitlePane = NULL;
|
|
206 |
|
|
207 |
if( iTitlePanePicture )
|
|
208 |
{
|
|
209 |
delete iTitlePanePicture;
|
|
210 |
iTitlePanePicture = NULL;
|
|
211 |
}
|
|
212 |
if( iTitlePanePictureMask )
|
|
213 |
{
|
|
214 |
delete iTitlePanePictureMask;
|
|
215 |
iTitlePanePictureMask = NULL;
|
|
216 |
}
|
|
217 |
|
|
218 |
iNaviPane = NULL;
|
|
219 |
|
|
220 |
if ( iNaviDecorator )
|
|
221 |
{
|
|
222 |
delete iNaviDecorator;
|
|
223 |
iNaviDecorator = NULL;
|
|
224 |
}
|
|
225 |
|
|
226 |
CPhoneRecoverySystem::Remove( iUpdateTitlePaneRecoveryId );
|
|
227 |
}
|
|
228 |
|
|
229 |
// ---------------------------------------------------------
|
|
230 |
// CPhoneStatusPane::UpdateTitlePane
|
|
231 |
// ---------------------------------------------------------
|
|
232 |
//
|
|
233 |
void CPhoneStatusPane::UpdateTitlePane()
|
|
234 |
{
|
|
235 |
CPhoneRecoverySystem::Instance()->RecoverNow(
|
|
236 |
iUpdateTitlePaneRecoveryId,
|
|
237 |
CTeleRecoverySystem::EPhonePriorityStandard );
|
|
238 |
}
|
|
239 |
|
|
240 |
// ---------------------------------------------------------
|
|
241 |
// CPhoneStatusPane::UpdateTitlePaneCallBackL
|
|
242 |
// ---------------------------------------------------------
|
|
243 |
//
|
|
244 |
TInt CPhoneStatusPane::UpdateTitlePaneCallBackL( TAny* aAny )
|
|
245 |
{
|
|
246 |
reinterpret_cast<CPhoneStatusPane*>( aAny )->DoUpdateTitlePaneL();
|
|
247 |
return KErrNone;
|
|
248 |
}
|
|
249 |
|
|
250 |
// ---------------------------------------------------------
|
|
251 |
// CPhoneStatusPane::DoUpdateTitlePaneL
|
|
252 |
// ---------------------------------------------------------
|
|
253 |
//
|
|
254 |
void CPhoneStatusPane::DoUpdateTitlePaneL()
|
|
255 |
{
|
|
256 |
if ( iTitlePaneTextIsDisplayed )
|
|
257 |
{
|
|
258 |
iTitlePane->SetTextL( iTitleText );
|
|
259 |
}
|
|
260 |
else
|
|
261 |
{
|
|
262 |
// Title pane takes ownership of the picture
|
|
263 |
RenderBitmapOnTitlePaneL();
|
|
264 |
}
|
|
265 |
}
|
|
266 |
|
|
267 |
|
|
268 |
// ---------------------------------------------------------
|
|
269 |
// CPhoneStatusPane::RenderBitmapOnTitlePaneL
|
|
270 |
// ---------------------------------------------------------
|
|
271 |
//
|
|
272 |
void CPhoneStatusPane::RenderBitmapOnTitlePaneL()
|
|
273 |
{
|
|
274 |
if( !iTitlePanePicture )
|
|
275 |
{
|
|
276 |
return;
|
|
277 |
}
|
|
278 |
|
|
279 |
TSize size;
|
|
280 |
|
|
281 |
TRect titlePaneRect;
|
|
282 |
AknLayoutUtils::LayoutMetricsRect(
|
|
283 |
AknLayoutUtils::ETitlePane, titlePaneRect );
|
|
284 |
|
|
285 |
TAknLayoutRect oplogoLayout;
|
|
286 |
|
|
287 |
// stacon
|
|
288 |
oplogoLayout.LayoutRect( titlePaneRect,
|
|
289 |
AknLayoutScalable_Avkon::title_pane_stacon_g2(0).LayoutLine() );
|
|
290 |
|
|
291 |
size = oplogoLayout.Rect().Size();
|
|
292 |
|
|
293 |
// CAknIcon takes ownership of bitmaps.
|
|
294 |
CFbsBitmap* dupMain = new ( ELeave ) CFbsBitmap;
|
|
295 |
CleanupStack::PushL( dupMain );
|
|
296 |
User::LeaveIfError(
|
|
297 |
dupMain->Duplicate( iTitlePanePicture->Handle() ) );
|
|
298 |
|
|
299 |
CFbsBitmap* dupMask = NULL;
|
|
300 |
if ( iTitlePanePictureMask )
|
|
301 |
{
|
|
302 |
dupMask = new ( ELeave ) CFbsBitmap;
|
|
303 |
CleanupStack::PushL( dupMask );
|
|
304 |
User::LeaveIfError(
|
|
305 |
dupMask->Duplicate( iTitlePanePictureMask->Handle() ) );
|
|
306 |
}
|
|
307 |
|
|
308 |
//bitmapIcon is not pushed to cleanupstack, ownership
|
|
309 |
//is transferred later
|
|
310 |
CAknIcon* bitmapIcon = CAknIcon::NewL();
|
|
311 |
bitmapIcon->SetMask( dupMask ); // ownership transferred
|
|
312 |
if ( iTitlePanePictureMask )
|
|
313 |
{
|
|
314 |
CleanupStack::Pop( dupMask );
|
|
315 |
}
|
|
316 |
|
|
317 |
bitmapIcon->SetBitmap( dupMain ); // ownership transferred
|
|
318 |
CleanupStack::Pop( dupMain );
|
|
319 |
|
|
320 |
//ownership of bitmapIcon is transferred
|
|
321 |
CAknIcon* scalableIcon = AknIconUtils::CreateIconL( bitmapIcon );
|
|
322 |
CleanupStack::PushL( scalableIcon );
|
|
323 |
|
|
324 |
AknIconUtils::SetSize( scalableIcon->Bitmap(), size,
|
|
325 |
EAspectRatioPreservedAndUnusedSpaceRemoved );
|
|
326 |
AknIconUtils::SetSize( scalableIcon->Mask(), size,
|
|
327 |
EAspectRatioPreservedAndUnusedSpaceRemoved );
|
|
328 |
|
|
329 |
// Title pane takes ownership of icons.
|
|
330 |
CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap;
|
|
331 |
CleanupStack::PushL( bitmap );
|
|
332 |
User::LeaveIfError( bitmap->Duplicate( scalableIcon->Bitmap()->Handle() ) );
|
|
333 |
|
|
334 |
// Check if icon has mask
|
|
335 |
CFbsBitmap* bitmapMask = NULL;
|
|
336 |
if ( scalableIcon->Mask() )
|
|
337 |
{
|
|
338 |
bitmapMask = new ( ELeave ) CFbsBitmap;
|
|
339 |
CleanupStack::PushL( bitmapMask );
|
|
340 |
User::LeaveIfError(
|
|
341 |
bitmapMask->Duplicate( scalableIcon->Mask()->Handle() ) );
|
|
342 |
}
|
|
343 |
|
|
344 |
// Set the icon in title pane...
|
|
345 |
iTitlePane->SetPicture( bitmap, bitmapMask );
|
|
346 |
|
|
347 |
if ( bitmapMask )
|
|
348 |
{
|
|
349 |
CleanupStack::Pop( bitmapMask );
|
|
350 |
}
|
|
351 |
CleanupStack::Pop( bitmap );
|
|
352 |
CleanupStack::PopAndDestroy( scalableIcon );
|
|
353 |
}
|
|
354 |
|
|
355 |
// ---------------------------------------------------------
|
|
356 |
// CPhoneStatusPane::SetTitlePaneContentL
|
|
357 |
// ---------------------------------------------------------
|
|
358 |
//
|
|
359 |
void CPhoneStatusPane::SetTitlePaneContentL( const TDesC& aContent )
|
|
360 |
{
|
|
361 |
iTitleText = aContent;
|
|
362 |
iTitlePane->SetTextL( iTitleText );
|
|
363 |
iTitlePaneTextIsDisplayed = ETrue;
|
|
364 |
}
|
|
365 |
|
|
366 |
// ---------------------------------------------------------
|
|
367 |
// CPhoneStatusPane::SetTitlePanePicture
|
|
368 |
// ---------------------------------------------------------
|
|
369 |
//
|
|
370 |
void CPhoneStatusPane::SetTitlePanePictureL(
|
|
371 |
TPhoneCommandParam* aCommandParam )
|
|
372 |
{
|
|
373 |
if ( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBitmap )
|
|
374 |
{
|
|
375 |
TPhoneCmdParamBitmap* bitmapParam = static_cast<TPhoneCmdParamBitmap*>(
|
|
376 |
aCommandParam );
|
|
377 |
|
|
378 |
delete iTitlePanePicture;
|
|
379 |
iTitlePanePicture = NULL;
|
|
380 |
iTitlePanePicture = bitmapParam->Bitmap();
|
|
381 |
|
|
382 |
delete iTitlePanePictureMask;
|
|
383 |
iTitlePanePictureMask = NULL;
|
|
384 |
iTitlePanePictureMask = bitmapParam->MaskBitmap();
|
|
385 |
|
|
386 |
RenderBitmapOnTitlePaneL();
|
|
387 |
iTitlePaneTextIsDisplayed = EFalse;
|
|
388 |
}
|
|
389 |
}
|
|
390 |
|
|
391 |
// ---------------------------------------------------------
|
|
392 |
// CPhoneStatusPane::IsVisible
|
|
393 |
// ---------------------------------------------------------
|
|
394 |
//
|
|
395 |
TBool CPhoneStatusPane::IsVisible() const
|
|
396 |
{
|
|
397 |
return iStatusPane->IsVisible();
|
|
398 |
}
|
|
399 |
|
|
400 |
// ---------------------------------------------------------
|
|
401 |
// CPhoneStatusPane::TitlePane
|
|
402 |
// ---------------------------------------------------------
|
|
403 |
//
|
|
404 |
CAknTitlePane& CPhoneStatusPane::TitlePane() const
|
|
405 |
{
|
|
406 |
return *iTitlePane;
|
|
407 |
}
|
|
408 |
|
|
409 |
// ---------------------------------------------------------
|
|
410 |
// CPhoneStatusPane::StatusPane
|
|
411 |
// ---------------------------------------------------------
|
|
412 |
//
|
|
413 |
CEikStatusPane& CPhoneStatusPane::StatusPane() const
|
|
414 |
{
|
|
415 |
return *iStatusPane;
|
|
416 |
}
|
|
417 |
|
|
418 |
// ---------------------------------------------------------
|
|
419 |
// CPhoneStatusPane::NaviPane
|
|
420 |
// ---------------------------------------------------------
|
|
421 |
//
|
|
422 |
CAknNavigationControlContainer& CPhoneStatusPane::NaviPane() const
|
|
423 |
{
|
|
424 |
return *iNaviPane;
|
|
425 |
}
|
|
426 |
|
|
427 |
// ---------------------------------------------------------
|
|
428 |
// CPhoneStatusPane::NaviDecorator
|
|
429 |
// ---------------------------------------------------------
|
|
430 |
//
|
|
431 |
CAknNavigationDecorator& CPhoneStatusPane::NaviDecorator() const
|
|
432 |
{
|
|
433 |
return *iNaviDecorator;
|
|
434 |
}
|
|
435 |
|
|
436 |
// ---------------------------------------------------------
|
|
437 |
// CPhoneStatusPane::AddTitlePaneHandlerL
|
|
438 |
// ---------------------------------------------------------
|
|
439 |
//
|
|
440 |
void CPhoneStatusPane::AddTitlePaneHandlerL(
|
|
441 |
MPhoneStatusPaneObserver& aObserver )
|
|
442 |
{
|
|
443 |
THandlerTag titleTag;
|
|
444 |
titleTag.iObserver = &aObserver;
|
|
445 |
titleTag.iLayer = -1; //-1 means it's not reserved
|
|
446 |
iTitlePaneList->AppendL( titleTag );
|
|
447 |
}
|
|
448 |
|
|
449 |
// ---------------------------------------------------------
|
|
450 |
// CPhoneStatusPane::ReserveTitlePane
|
|
451 |
// ---------------------------------------------------------
|
|
452 |
//
|
|
453 |
void CPhoneStatusPane::ReserveTitlePane(
|
|
454 |
MPhoneStatusPaneObserver& aObserver )
|
|
455 |
{
|
|
456 |
//notify the inactive of the topmost handler
|
|
457 |
THandlerTag* topmostHandler = FindTopmostTitlePaneHandler();
|
|
458 |
if ( topmostHandler &&
|
|
459 |
topmostHandler->iObserver != &aObserver )
|
|
460 |
{
|
|
461 |
NotifyHandlerOnActivation( *topmostHandler, EFalse );
|
|
462 |
}
|
|
463 |
|
|
464 |
THandlerTag* titleTag = FindTitlePaneHandler( aObserver );
|
|
465 |
if ( titleTag )
|
|
466 |
{
|
|
467 |
if ( topmostHandler )
|
|
468 |
{
|
|
469 |
titleTag->iLayer = topmostHandler->iLayer+1;
|
|
470 |
}
|
|
471 |
else
|
|
472 |
{
|
|
473 |
titleTag->iLayer = 0; // 0 is the lowest one
|
|
474 |
}
|
|
475 |
}
|
|
476 |
}
|
|
477 |
|
|
478 |
// ---------------------------------------------------------
|
|
479 |
// CPhoneStatusPane::ReleaseTitlePane
|
|
480 |
// ---------------------------------------------------------
|
|
481 |
//
|
|
482 |
void CPhoneStatusPane::ReleaseTitlePane(
|
|
483 |
MPhoneStatusPaneObserver& aObserver )
|
|
484 |
{
|
|
485 |
THandlerTag* titleTag = FindTitlePaneHandler( aObserver );
|
|
486 |
if ( titleTag )
|
|
487 |
{
|
|
488 |
titleTag->iLayer = -1; //put it to the unreserved status
|
|
489 |
THandlerTag* topmostHandler = FindTopmostTitlePaneHandler();
|
|
490 |
if ( topmostHandler )
|
|
491 |
{
|
|
492 |
NotifyHandlerOnActivation( *topmostHandler, ETrue );
|
|
493 |
}
|
|
494 |
}
|
|
495 |
}
|
|
496 |
|
|
497 |
// ---------------------------------------------------------
|
|
498 |
// CPhoneStatusPane::RemoveTitlePaneHandler
|
|
499 |
// ---------------------------------------------------------
|
|
500 |
//
|
|
501 |
void CPhoneStatusPane::RemoveTitlePaneHandler(
|
|
502 |
MPhoneStatusPaneObserver& aObserver )
|
|
503 |
{
|
|
504 |
TInt count = iTitlePaneList->Count();
|
|
505 |
for ( TInt i = 0; i<count; i++ )
|
|
506 |
{
|
|
507 |
THandlerTag& handler = iTitlePaneList->At( i );
|
|
508 |
if ( &aObserver == handler.iObserver )
|
|
509 |
{
|
|
510 |
iTitlePaneList->Delete( i );
|
|
511 |
break;
|
|
512 |
}
|
|
513 |
}
|
|
514 |
THandlerTag* topmostHandler = FindTopmostTitlePaneHandler();
|
|
515 |
if ( topmostHandler )
|
|
516 |
{
|
|
517 |
NotifyHandlerOnActivation( *topmostHandler, ETrue );
|
|
518 |
}
|
|
519 |
return;
|
|
520 |
}
|
|
521 |
|
|
522 |
|
|
523 |
// ---------------------------------------------------------
|
|
524 |
// CPhoneStatusPane::IsTitlePaneVisible
|
|
525 |
// ---------------------------------------------------------
|
|
526 |
//
|
|
527 |
TBool CPhoneStatusPane::IsTitlePaneVisible(
|
|
528 |
MPhoneStatusPaneObserver& aObserver ) const
|
|
529 |
{
|
|
530 |
THandlerTag* titleTag = FindTitlePaneHandler( aObserver );
|
|
531 |
if ( titleTag )
|
|
532 |
{
|
|
533 |
return ( titleTag->iLayer != -1 ) &&
|
|
534 |
( titleTag->iLayer == LargestLayerInTitlePaneList() );
|
|
535 |
}
|
|
536 |
return EFalse;
|
|
537 |
}
|
|
538 |
|
|
539 |
// ---------------------------------------------------------
|
|
540 |
// CPhoneStatusPane::CreateTextTitlePaneLC
|
|
541 |
// ---------------------------------------------------------
|
|
542 |
//
|
|
543 |
CBase* CPhoneStatusPane::CreateTextTitlePaneLC(
|
|
544 |
TInt aTextResourceId )
|
|
545 |
{
|
|
546 |
return CPhoneTextTitlePane::NewLC( *this, aTextResourceId );
|
|
547 |
}
|
|
548 |
|
|
549 |
// -----------------------------------------------------------------------------
|
|
550 |
// CPhoneStatusPane::GetShape
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
//
|
|
553 |
void CPhoneStatusPane::GetShape( TRegion& aRegion )
|
|
554 |
{
|
|
555 |
TRAPD( err, iStatusPane->GetShapeL( aRegion, ETrue, ETrue ) );
|
|
556 |
if ( err != KErrNone )
|
|
557 |
{
|
|
558 |
aRegion.Clear();
|
|
559 |
}
|
|
560 |
}
|
|
561 |
|
|
562 |
// ---------------------------------------------------------
|
|
563 |
// CPhoneStatusPane::LargestLayerInTitlePaneList
|
|
564 |
// ---------------------------------------------------------
|
|
565 |
//
|
|
566 |
TInt CPhoneStatusPane::LargestLayerInTitlePaneList() const
|
|
567 |
{
|
|
568 |
THandlerTag* topmostHandler = FindTopmostTitlePaneHandler();
|
|
569 |
if ( topmostHandler )
|
|
570 |
{
|
|
571 |
return topmostHandler->iLayer;
|
|
572 |
}
|
|
573 |
return -1; //-1 means no item in the list yet
|
|
574 |
}
|
|
575 |
|
|
576 |
// ---------------------------------------------------------
|
|
577 |
// CPhoneStatusPane::FindTopmostTitlePaneHandler
|
|
578 |
// ---------------------------------------------------------
|
|
579 |
//
|
|
580 |
THandlerTag* CPhoneStatusPane::FindTopmostTitlePaneHandler() const
|
|
581 |
{
|
|
582 |
TInt largest = -1;
|
|
583 |
THandlerTag* handler = NULL;
|
|
584 |
TInt count = iTitlePaneList->Count();
|
|
585 |
for ( TInt i = 0; i<count; i++ )
|
|
586 |
{
|
|
587 |
THandlerTag& currentHandler = iTitlePaneList->At( i );
|
|
588 |
if ( largest < currentHandler.iLayer )
|
|
589 |
{
|
|
590 |
largest = currentHandler.iLayer;
|
|
591 |
handler = ¤tHandler;
|
|
592 |
}
|
|
593 |
}
|
|
594 |
return handler;
|
|
595 |
}
|
|
596 |
|
|
597 |
// ---------------------------------------------------------
|
|
598 |
// CPhoneStatusPane::FindTitlePaneHandler
|
|
599 |
// ---------------------------------------------------------
|
|
600 |
//
|
|
601 |
THandlerTag* CPhoneStatusPane::FindTitlePaneHandler(
|
|
602 |
MPhoneStatusPaneObserver& aObserver ) const
|
|
603 |
{
|
|
604 |
TInt count = iTitlePaneList->Count();
|
|
605 |
for ( TInt i = 0; i<count; i++ )
|
|
606 |
{
|
|
607 |
THandlerTag* handler = &iTitlePaneList->At( i );
|
|
608 |
if ( &aObserver == handler->iObserver )
|
|
609 |
{
|
|
610 |
return handler;
|
|
611 |
}
|
|
612 |
}
|
|
613 |
return NULL;
|
|
614 |
}
|
|
615 |
|
|
616 |
// ---------------------------------------------------------
|
|
617 |
// CPhoneStatusPane::NotifyHandlerOnActivation
|
|
618 |
// ---------------------------------------------------------
|
|
619 |
//
|
|
620 |
void CPhoneStatusPane::NotifyHandlerOnActivation(
|
|
621 |
THandlerTag& aHandlerTag,
|
|
622 |
TBool aActive )
|
|
623 |
{
|
|
624 |
TRAP_IGNORE( aHandlerTag.iObserver->HandleTitlePaneActiveL( aActive ) );
|
|
625 |
}
|
|
626 |
|
|
627 |
// ---------------------------------------------------------
|
|
628 |
// CPhoneStatusPane::CreateEmptyIndicatorContainerL
|
|
629 |
// ---------------------------------------------------------
|
|
630 |
//
|
|
631 |
CAknIndicatorContainer* CPhoneStatusPane::CreateEmptyIndicatorContainerL()
|
|
632 |
{
|
|
633 |
CCoeControl* container = StatusPane().
|
|
634 |
ContainerControlL( TUid::Uid( EEikStatusPaneUidIndic ) );
|
|
635 |
|
|
636 |
CAknIndicatorContainer* indicatorContainer =
|
|
637 |
new (ELeave) CAknIndicatorContainer(
|
|
638 |
CAknIndicatorContainer::ENaviPaneEditorIndicators );
|
|
639 |
|
|
640 |
CleanupStack::PushL( indicatorContainer );
|
|
641 |
|
|
642 |
indicatorContainer->SetContainerWindowL( *container );
|
|
643 |
|
|
644 |
TResourceReader reader;
|
|
645 |
CCoeEnv::Static()->CreateResourceReaderLC( reader,
|
|
646 |
R_PHONEUI_EMPTY_INDICATORS );
|
|
647 |
indicatorContainer->ConstructFromResourceL( reader );
|
|
648 |
|
|
649 |
CleanupStack::PopAndDestroy(); // resource reader
|
|
650 |
|
|
651 |
TRect controlRect = StatusPane().PaneRectL( TUid::Uid( EEikStatusPaneUidIndic ) );
|
|
652 |
indicatorContainer->SetRect( TRect( controlRect.Size() ) );
|
|
653 |
indicatorContainer->ActivateL();
|
|
654 |
|
|
655 |
CleanupStack::Pop( indicatorContainer ); // indicatorContainer
|
|
656 |
|
|
657 |
return indicatorContainer;
|
|
658 |
}
|
|
659 |
|
|
660 |
//
|
|
661 |
// IMPLEMENTATION OF CPHONETEXTTITLEPANE
|
|
662 |
//
|
|
663 |
// ---------------------------------------------------------
|
|
664 |
// CPhoneTextTitlePane::NewLC
|
|
665 |
// ---------------------------------------------------------
|
|
666 |
//
|
|
667 |
CPhoneTextTitlePane* CPhoneTextTitlePane::NewLC(
|
|
668 |
CPhoneStatusPane& aStatusPaneManager,
|
|
669 |
TInt aTextResourceId )
|
|
670 |
{
|
|
671 |
CPhoneTextTitlePane* self =
|
|
672 |
new (ELeave) CPhoneTextTitlePane(
|
|
673 |
aStatusPaneManager,
|
|
674 |
aTextResourceId );
|
|
675 |
|
|
676 |
CleanupStack::PushL( self );
|
|
677 |
self->ConstructL();
|
|
678 |
|
|
679 |
return self;
|
|
680 |
}
|
|
681 |
|
|
682 |
// Destructor
|
|
683 |
CPhoneTextTitlePane::~CPhoneTextTitlePane()
|
|
684 |
{
|
|
685 |
iStatusPaneManager.ReleaseTitlePane( *this );
|
|
686 |
iStatusPaneManager.RemoveTitlePaneHandler( *this );
|
|
687 |
}
|
|
688 |
|
|
689 |
// ---------------------------------------------------------
|
|
690 |
// CPhoneTextTitlePane::HandleTitlePaneActiveL
|
|
691 |
// ---------------------------------------------------------
|
|
692 |
//
|
|
693 |
void CPhoneTextTitlePane::HandleTitlePaneActiveL(
|
|
694 |
TBool /*aActive*/ )
|
|
695 |
{
|
|
696 |
if ( iStatusPaneManager.IsTitlePaneVisible( *this ) )
|
|
697 |
{
|
|
698 |
HBufC* text = StringLoader::LoadL( iTextResourceId );
|
|
699 |
iStatusPaneManager.TitlePane().SetText( text );
|
|
700 |
}
|
|
701 |
}
|
|
702 |
|
|
703 |
// -----------------------------------------------------------------------------
|
|
704 |
// CPhoneTextTitlePane::CPhoneTextTitlePane
|
|
705 |
// C++ default constructor can NOT contain any code, that
|
|
706 |
// might leave.
|
|
707 |
// -----------------------------------------------------------------------------
|
|
708 |
//
|
|
709 |
CPhoneTextTitlePane::CPhoneTextTitlePane(
|
|
710 |
CPhoneStatusPane& aStatusPaneManager,
|
|
711 |
TInt aTextResourceId ) :
|
|
712 |
iStatusPaneManager( aStatusPaneManager ),
|
|
713 |
iTextResourceId( aTextResourceId )
|
|
714 |
{
|
|
715 |
}
|
|
716 |
|
|
717 |
// -----------------------------------------------------------------------------
|
|
718 |
// CPhoneTextTitlePane::ConstructL
|
|
719 |
// Symbian 2nd phase constructor can leave.
|
|
720 |
// -----------------------------------------------------------------------------
|
|
721 |
//
|
|
722 |
void CPhoneTextTitlePane::ConstructL()
|
|
723 |
{
|
|
724 |
iStatusPaneManager.AddTitlePaneHandlerL( *this );
|
|
725 |
iStatusPaneManager.ReserveTitlePane( *this );
|
|
726 |
|
|
727 |
HandleTitlePaneActiveL( ETrue );
|
|
728 |
}
|
|
729 |
|
|
730 |
// End of File
|