|
1 /* |
|
2 * Copyright (c) 2008 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: Avkon testability hook class definitions. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <AknTasHook.h> |
|
21 #include <TasHookingInternalCRKeys.h> |
|
22 #include "AknBatteryStrength.h" |
|
23 #include "AknSignalStrength.h" |
|
24 #include <centralrepository.h> |
|
25 #include <AknTasPluginInterface.h> |
|
26 #include <TasDataModelInterface.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TUid KUidTasHook = { 0xE000DEC4 }; |
|
30 const TInt KTasHookingOff = 0; |
|
31 const TInt KTasHookingOn = 1; |
|
32 |
|
33 // MACROS |
|
34 |
|
35 /** |
|
36 * DEBUGPRINT |
|
37 * |
|
38 * Simple wrapper macro for the RDebug::Print utility. |
|
39 * |
|
40 * Usage: |
|
41 * |
|
42 * DEBUGPRINT( ( _L( "CAknTasHook::ConstructL: Error %d in doing stuff" ), error ) ) |
|
43 * |
|
44 */ |
|
45 #ifdef _DEBUG |
|
46 #define DEBUGPRINT( aFormatString ) { RDebug::Print aFormatString; } |
|
47 #else |
|
48 #define DEBUGPRINT( aFormatString ) {} |
|
49 #endif |
|
50 |
|
51 // FORWARD DECLARATIONS |
|
52 class CAknTasClassInfo; |
|
53 class CAknTasObjectInfo; |
|
54 |
|
55 // CLASS DEFINITIONS |
|
56 |
|
57 CAknTasClassInfo::CAknTasClassInfo() : |
|
58 iClassName( NULL ) |
|
59 { |
|
60 } |
|
61 |
|
62 CAknTasClassInfo::~CAknTasClassInfo() |
|
63 { |
|
64 delete iClassName; |
|
65 } |
|
66 |
|
67 void CAknTasClassInfo::ConstructL( TDesC& aClassName ) |
|
68 { |
|
69 // Allocate a copy of the given descriptor and take ownership of it |
|
70 iClassName = aClassName.AllocL(); |
|
71 } |
|
72 |
|
73 const TDesC& CAknTasClassInfo::GetClassName() const |
|
74 { |
|
75 return *iClassName; |
|
76 } |
|
77 |
|
78 TInt CAknTasClassInfo::MatchName( |
|
79 const CAknTasClassInfo& aInfo1, |
|
80 const CAknTasClassInfo& aInfo2 ) |
|
81 { |
|
82 if ( aInfo1.GetClassName() == aInfo2.GetClassName() ) |
|
83 { |
|
84 return 1; |
|
85 } |
|
86 return 0; |
|
87 } |
|
88 |
|
89 CAknTasObjectInfo::CAknTasObjectInfo() |
|
90 { |
|
91 } |
|
92 |
|
93 CAknTasObjectInfo::~CAknTasObjectInfo() |
|
94 { |
|
95 if ( iClassInfoArray ) |
|
96 { |
|
97 iClassInfoArray->ResetAndDestroy(); |
|
98 delete iClassInfoArray; |
|
99 } |
|
100 } |
|
101 |
|
102 void CAknTasObjectInfo::ConstructL( |
|
103 TAny* aObjPtr, |
|
104 TAknTasHookObjectType aObjType ) |
|
105 { |
|
106 iObjPtr = aObjPtr; // not owned |
|
107 if ( aObjPtr ) |
|
108 { |
|
109 iClassInfoArray = new ( ELeave ) RPointerArray<CAknTasClassInfo>; // owned |
|
110 iControlKey = TUint32( aObjPtr ); |
|
111 iObjType = aObjType; |
|
112 } |
|
113 else |
|
114 { |
|
115 iControlKey = 0; |
|
116 } |
|
117 } |
|
118 |
|
119 TInt CAknTasObjectInfo::MatchByControl( |
|
120 const CAknTasObjectInfo& aInfo1, |
|
121 const CAknTasObjectInfo& aInfo2 ) |
|
122 { |
|
123 if ( aInfo1.iControlKey == aInfo2.iControlKey ) |
|
124 { |
|
125 return 1; |
|
126 } |
|
127 return 0; |
|
128 } |
|
129 |
|
130 void CAknTasObjectInfo::AddL( CAknTasClassInfo* aObjPtr ) |
|
131 { |
|
132 iClassInfoArray->AppendL( aObjPtr ); |
|
133 } |
|
134 |
|
135 EXPORT_C TBool CAknTasObjectInfo::IsA( TPtrC aClassName ) |
|
136 { |
|
137 CAknTasClassInfo* classInfo = NULL; |
|
138 TRAPD( err, |
|
139 classInfo = new ( ELeave ) CAknTasClassInfo(); |
|
140 CleanupStack::PushL( classInfo ); |
|
141 classInfo->ConstructL( aClassName ); |
|
142 CleanupStack::Pop( classInfo ) ); |
|
143 if ( err ) |
|
144 { |
|
145 if ( classInfo ) |
|
146 { |
|
147 CleanupStack::PopAndDestroy( classInfo ); |
|
148 } |
|
149 return EFalse; |
|
150 } |
|
151 |
|
152 TIdentityRelation<CAknTasClassInfo> matcher( CAknTasClassInfo::MatchName ); |
|
153 TInt position = iClassInfoArray->Find( classInfo, matcher ); |
|
154 delete classInfo; |
|
155 if ( position != KErrNotFound ) |
|
156 { |
|
157 classInfo = ( *iClassInfoArray )[position]; |
|
158 return ETrue; |
|
159 } |
|
160 return EFalse; |
|
161 } |
|
162 |
|
163 // |
|
164 // Heap descriptor ownership passed to caller! |
|
165 // |
|
166 EXPORT_C HBufC* CAknTasObjectInfo::GetClassNames() |
|
167 { |
|
168 // Sum up the class name lengths and add room for the separators |
|
169 TInt bufLength( 0 ); |
|
170 for ( TInt i = 0; i < iClassInfoArray->Count(); i++ ) |
|
171 { |
|
172 bufLength += ( *iClassInfoArray )[i]->GetClassName().Length() + 1; |
|
173 } |
|
174 |
|
175 // Create a buffer of needed length and make it empty |
|
176 HBufC* buf = NULL; |
|
177 TRAPD( err, |
|
178 buf = HBufC::NewLC( bufLength ); |
|
179 CleanupStack::Pop( buf ) ); |
|
180 if ( err ) |
|
181 { |
|
182 return NULL; |
|
183 } |
|
184 TPtr modifiableBuf = buf->Des(); |
|
185 modifiableBuf.Zero(); |
|
186 |
|
187 if ( iClassInfoArray->Count() <= 0 ) |
|
188 { |
|
189 return buf; |
|
190 } |
|
191 |
|
192 // Append class names and separators |
|
193 for ( TInt i = 0; i < iClassInfoArray->Count(); i++ ) |
|
194 { |
|
195 modifiableBuf.Append( ( *iClassInfoArray )[i]->GetClassName() ); |
|
196 |
|
197 if ( i + 1 < iClassInfoArray->Count() ) |
|
198 { |
|
199 modifiableBuf.Append( _L( ":" ) ); |
|
200 } |
|
201 } |
|
202 |
|
203 return buf; |
|
204 } |
|
205 |
|
206 EXPORT_C TAny* CAknTasObjectInfo::GetControl() const |
|
207 { |
|
208 return iObjPtr; |
|
209 } |
|
210 |
|
211 EXPORT_C TAknTasHookObjectType CAknTasObjectInfo::Type() const |
|
212 { |
|
213 return iObjType; |
|
214 } |
|
215 |
|
216 CAknTasHook::CAknTasHook() : |
|
217 CCoeStatic( KUidTasHook ), |
|
218 iTasHookingEnabled( EFalse ), |
|
219 iTasHookStoringEnabled( EFalse ) |
|
220 { |
|
221 } |
|
222 |
|
223 CAknTasHook* CAknTasHook::InstanceL() |
|
224 { |
|
225 CAknTasHook* instance = |
|
226 static_cast<CAknTasHook*> ( CCoeEnv::Static( KUidTasHook ) ); |
|
227 if ( !instance ) |
|
228 { |
|
229 instance = new ( ELeave ) CAknTasHook(); |
|
230 CleanupStack::PushL( instance ); |
|
231 instance->ConstructL(); |
|
232 CleanupStack::Pop( instance ); |
|
233 } |
|
234 return instance; |
|
235 } |
|
236 |
|
237 CAknTasHook* CAknTasHook::Self() |
|
238 { |
|
239 CAknTasHook* instance = |
|
240 static_cast<CAknTasHook*> ( CCoeEnv::Static( KUidTasHook ) ); |
|
241 if ( !instance ) |
|
242 { |
|
243 return NULL; |
|
244 } |
|
245 return instance; |
|
246 } |
|
247 |
|
248 CAknTasHook::~CAknTasHook() |
|
249 { |
|
250 delete iTasPlugin; |
|
251 REComSession::FinalClose(); |
|
252 if ( iHookingNotifyHandler ) |
|
253 { |
|
254 iHookingNotifyHandler->StopListening(); |
|
255 delete iHookingNotifyHandler; |
|
256 } |
|
257 if ( iHookStoringNotifyHandler ) |
|
258 { |
|
259 iHookStoringNotifyHandler->StopListening(); |
|
260 delete iHookStoringNotifyHandler; |
|
261 } |
|
262 delete iTasHookingRepo; |
|
263 if ( iObjectInfoArray ) |
|
264 { |
|
265 iObjectInfoArray->ResetAndDestroy(); |
|
266 delete iObjectInfoArray; |
|
267 } |
|
268 } |
|
269 |
|
270 void CAknTasHook::ConstructL() |
|
271 { |
|
272 iObjectInfoArray = new ( ELeave ) RPointerArray<CAknTasObjectInfo>; // owned |
|
273 |
|
274 // Connect to TAS hooking CenRep repository |
|
275 TRAPD( error, iTasHookingRepo = CRepository::NewL( KCRUidTasHooking ) ); |
|
276 if ( error != KErrNone ) |
|
277 { |
|
278 DEBUGPRINT( ( _L( " CAknTasHook::ConstructL: Error %d in connecting to key 0x%x" ), error, KCRUidTasHooking.iUid ) ) |
|
279 User::Leave( error ); |
|
280 } |
|
281 |
|
282 // Process the initial values and start listening |
|
283 // for key changes in this repository |
|
284 TRAP( error, iHookingNotifyHandler = CreateNotifyHandlerL( *iTasHookingRepo, KTasHooking ) ); |
|
285 if ( error != KErrNone ) |
|
286 { |
|
287 DEBUGPRINT( ( _L( " CAknTasHook::ConstructL: Error %d in creating CenRep notify handler" ), error ) ) |
|
288 User::Leave( error ); |
|
289 } |
|
290 TRAP( error, iHookingNotifyHandler->StartListeningL() ); |
|
291 if ( error != KErrNone ) |
|
292 { |
|
293 DEBUGPRINT( ( _L( " CAknTasHook::ConstructL: Error %d in starting to listen" ), error ) ) |
|
294 User::Leave( error ); |
|
295 } |
|
296 TRAP( error, iHookStoringNotifyHandler = CreateNotifyHandlerL( *iTasHookingRepo, KTasHookStoring ) ); |
|
297 if ( error != KErrNone ) |
|
298 { |
|
299 DEBUGPRINT( ( _L( " CAknTasHook::ConstructL: Error %d in creating CenRep notify handler" ), error ) ) |
|
300 User::Leave( error ); |
|
301 } |
|
302 TRAP( error, iHookStoringNotifyHandler->StartListeningL() ); |
|
303 if ( error != KErrNone ) |
|
304 { |
|
305 DEBUGPRINT( ( _L( " CAknTasHook::ConstructL: Error %d in starting to listen" ), error ) ) |
|
306 User::Leave( error ); |
|
307 } |
|
308 } |
|
309 |
|
310 CCenRepNotifyHandler* CAknTasHook::CreateNotifyHandlerL( |
|
311 CRepository& aRepository, |
|
312 TUint32 aKey ) |
|
313 { |
|
314 // Process the initial value, the 1st notication is only received when the |
|
315 // value changes so we need to see if the hooking has already been activated |
|
316 TInt initialValue; |
|
317 TInt error = aRepository.Get( aKey, initialValue ); |
|
318 if ( error != KErrNone ) |
|
319 { |
|
320 DEBUGPRINT( ( _L( " CAknTasHook::CreateNotifyHandlerL: Error %d in getting key value" ), error ) ) |
|
321 User::Leave( error ); |
|
322 } |
|
323 else |
|
324 { |
|
325 HandleNotifyInt( aKey, initialValue ); |
|
326 } |
|
327 |
|
328 // Create a new notify handler for the given integer key |
|
329 return CCenRepNotifyHandler::NewL( *this, aRepository, CCenRepNotifyHandler::EIntKey, aKey ); |
|
330 } |
|
331 |
|
332 TBool CAknTasHook::Initialized() |
|
333 { |
|
334 if ( iObjectInfoArray ) |
|
335 { |
|
336 return ETrue; |
|
337 } |
|
338 return EFalse; |
|
339 } |
|
340 |
|
341 EXPORT_C void CAknTasHook::AddL( |
|
342 TAny* aObjPtr, |
|
343 TPtrC aStrPtr, |
|
344 TAknTasHookObjectType aObjType ) |
|
345 { |
|
346 if ( !aObjPtr ) |
|
347 { |
|
348 return; |
|
349 } |
|
350 |
|
351 CAknTasHook* mePtr = InstanceL(); |
|
352 if ( mePtr ) |
|
353 { |
|
354 mePtr->AddInfoL( aObjPtr, aStrPtr, aObjType ); |
|
355 } |
|
356 } |
|
357 |
|
358 void CAknTasHook::AddInfoL( |
|
359 TAny* aObjPtr, |
|
360 TPtrC aStrPtr, |
|
361 TAknTasHookObjectType aObjType ) |
|
362 { |
|
363 if ( iTasHookStoringEnabled ) |
|
364 { |
|
365 CAknTasObjectInfo* objInfo = new ( ELeave ) CAknTasObjectInfo(); |
|
366 CleanupStack::PushL( objInfo ); |
|
367 objInfo->ConstructL( aObjPtr, aObjType ); |
|
368 CleanupStack::Pop( objInfo ); |
|
369 CAknTasClassInfo* classInfo = new ( ELeave ) CAknTasClassInfo(); |
|
370 CleanupStack::PushL( classInfo ); |
|
371 classInfo->ConstructL( aStrPtr ); |
|
372 CleanupStack::Pop( classInfo ); |
|
373 |
|
374 if ( iObjectInfoArray->Count() <= 0 ) |
|
375 { |
|
376 objInfo->AddL( classInfo ); |
|
377 iObjectInfoArray->AppendL( objInfo ); |
|
378 return; |
|
379 } |
|
380 |
|
381 TIdentityRelation<CAknTasObjectInfo> matcher( CAknTasObjectInfo::MatchByControl ); |
|
382 TInt position = iObjectInfoArray->Find( objInfo, matcher ); |
|
383 if ( position != KErrNotFound ) |
|
384 { |
|
385 delete objInfo; |
|
386 objInfo = ( *iObjectInfoArray )[position]; |
|
387 } |
|
388 else |
|
389 { |
|
390 iObjectInfoArray->AppendL( objInfo ); |
|
391 } |
|
392 objInfo->AddL( classInfo ); |
|
393 } |
|
394 } |
|
395 |
|
396 EXPORT_C CAknTasObjectInfo* CAknTasHook::Get( TAny* aObjPtr ) |
|
397 { |
|
398 CAknTasHook* mePtr = Self(); |
|
399 if ( !mePtr->iTasHookingEnabled ) |
|
400 { |
|
401 return NULL; |
|
402 } |
|
403 |
|
404 if ( mePtr ) |
|
405 { |
|
406 return mePtr->GetInfo( aObjPtr ); |
|
407 } |
|
408 |
|
409 return NULL; |
|
410 } |
|
411 |
|
412 CAknTasObjectInfo* CAknTasHook::GetInfo( TAny* aObjPtr ) |
|
413 { |
|
414 CAknTasObjectInfo* objInfo = NULL; |
|
415 TRAPD( err, |
|
416 objInfo = new ( ELeave ) CAknTasObjectInfo(); |
|
417 CleanupStack::PushL( objInfo ); |
|
418 objInfo->ConstructL( aObjPtr ) ); |
|
419 CleanupStack::Pop( objInfo ); |
|
420 if ( err ) |
|
421 { |
|
422 if ( objInfo ) |
|
423 { |
|
424 CleanupStack::PopAndDestroy( objInfo ); |
|
425 } |
|
426 return NULL; |
|
427 } |
|
428 |
|
429 TIdentityRelation<CAknTasObjectInfo> matcher( CAknTasObjectInfo::MatchByControl ); |
|
430 TInt position = iObjectInfoArray->Find( objInfo, matcher ); |
|
431 delete objInfo; |
|
432 if ( position != KErrNotFound ) |
|
433 { |
|
434 return ( *iObjectInfoArray )[position]; |
|
435 } |
|
436 else |
|
437 { |
|
438 return NULL; |
|
439 } |
|
440 } |
|
441 |
|
442 TBool CAknTasHook::ExistsL( TAny* aObjPtr ) |
|
443 { |
|
444 CAknTasHook* mePtr = InstanceL(); |
|
445 return mePtr->InfoExistsL( aObjPtr ); |
|
446 } |
|
447 |
|
448 TBool CAknTasHook::InfoExistsL( TAny* aObjPtr ) |
|
449 { |
|
450 if ( iObjectInfoArray->Count() <= 0 ) |
|
451 { |
|
452 return EFalse; |
|
453 } |
|
454 |
|
455 CAknTasObjectInfo* objInfo = new ( ELeave ) CAknTasObjectInfo(); |
|
456 CleanupStack::PushL( objInfo ); |
|
457 objInfo->ConstructL( aObjPtr ); |
|
458 CleanupStack::Pop( objInfo ); |
|
459 |
|
460 TIdentityRelation<CAknTasObjectInfo> matcher( CAknTasObjectInfo::MatchByControl ); |
|
461 TInt position = iObjectInfoArray->Find( objInfo, matcher ); |
|
462 delete objInfo; |
|
463 if ( position != KErrNotFound ) |
|
464 { |
|
465 return ETrue; |
|
466 } |
|
467 else |
|
468 { |
|
469 return EFalse; |
|
470 } |
|
471 } |
|
472 |
|
473 EXPORT_C void CAknTasHook::Remove( TAny* aObjPtr ) |
|
474 { |
|
475 CAknTasHook* mePtr = Self(); |
|
476 if ( mePtr ) |
|
477 { |
|
478 TInt err( KErrNone ); |
|
479 TRAP( err, mePtr->RemoveInfoL( aObjPtr ) ); |
|
480 } |
|
481 } |
|
482 |
|
483 void CAknTasHook::RemoveInfoL( TAny* aObjPtr ) |
|
484 { |
|
485 if ( iTasHookStoringEnabled ) |
|
486 { |
|
487 if ( iObjectInfoArray->Count() <= 0 ) |
|
488 { |
|
489 return; |
|
490 } |
|
491 |
|
492 CAknTasObjectInfo* objInfo = new ( ELeave ) CAknTasObjectInfo(); |
|
493 CleanupStack::PushL( objInfo ); |
|
494 objInfo->ConstructL( aObjPtr ); |
|
495 CleanupStack::Pop( objInfo ); |
|
496 |
|
497 TIdentityRelation<CAknTasObjectInfo> matcher( CAknTasObjectInfo::MatchByControl ); |
|
498 TInt position = iObjectInfoArray->Find( objInfo, matcher ); |
|
499 delete objInfo; |
|
500 if ( position != KErrNotFound ) |
|
501 { |
|
502 objInfo = ( *iObjectInfoArray )[position]; |
|
503 iObjectInfoArray->Remove( position ); |
|
504 delete objInfo; |
|
505 } |
|
506 } |
|
507 } |
|
508 |
|
509 EXPORT_C RPointerArray<CAknTasObjectInfo>* CAknTasHook::GetAll() |
|
510 { |
|
511 if ( !iTasHookingEnabled ) |
|
512 { |
|
513 return NULL; |
|
514 } |
|
515 return iObjectInfoArray; |
|
516 } |
|
517 |
|
518 EXPORT_C void CAknTasHook::GetAknUiLC( MTasObject& aParentApplication ) |
|
519 { |
|
520 if ( !iTasHookingEnabled ) |
|
521 { |
|
522 return; |
|
523 } |
|
524 |
|
525 TInt numObjects = iObjectInfoArray->Count(); |
|
526 |
|
527 for ( TInt i = 0; i < numObjects; i++ ) |
|
528 { |
|
529 CAknTasObjectInfo* objInfo = ( *iObjectInfoArray )[i]; |
|
530 |
|
531 if ( objInfo->IsA( _L( "CAknBatteryStrength" ) ) ) |
|
532 { |
|
533 if ( !CheckSanityL( ( CCoeControl* ) objInfo->GetControl() ) ) |
|
534 { |
|
535 continue; |
|
536 } |
|
537 CAknBatteryStrength* battery = |
|
538 static_cast<CAknBatteryStrength*>( objInfo->GetControl() ); |
|
539 if ( battery ) |
|
540 { |
|
541 MTasObject& tasObj = aParentApplication.AddObjectL(); |
|
542 //tasObj.AddAttributeL( _L( "Id" ), objInfo->iControlKey ); |
|
543 tasObj.SetNameL( _L( "CAknBatteryStrength" ) ); |
|
544 tasObj.SetTypeL( _L( "indicator" ) ); |
|
545 tasObj.SetIdL( objInfo->iControlKey ); |
|
546 tasObj.AddAttributeL( _L( "Level" ), battery->BatteryLevel() ); |
|
547 tasObj.AddAttributeL( _L( "Recharging" ), battery->Recharging() ); |
|
548 AddCommonCoeInfoL( ( CCoeControl* ) objInfo->GetControl(), tasObj ); |
|
549 } |
|
550 } |
|
551 else if ( objInfo->IsA( _L( "CAknSignalStrength" ) ) ) |
|
552 { |
|
553 if ( !CheckSanityL( ( CCoeControl* )objInfo->GetControl() ) ) |
|
554 { |
|
555 continue; |
|
556 } |
|
557 CAknSignalStrength* signal = |
|
558 static_cast<CAknSignalStrength*>( objInfo->GetControl() ); |
|
559 if ( signal ) |
|
560 { |
|
561 MTasObject& tasObj = aParentApplication.AddObjectL(); |
|
562 //tasObj.AddAttributeL( _L( "Id" ), objInfo->iControlKey ); |
|
563 tasObj.SetNameL( _L( "CAknSignalStrength" ) ); |
|
564 tasObj.SetTypeL( _L( "indicator" ) ); |
|
565 tasObj.SetIdL( objInfo->iControlKey ); |
|
566 tasObj.AddAttributeL( _L( "Level" ), signal->SignalLevel() ); |
|
567 AddCommonCoeInfoL( ( CCoeControl* ) objInfo->GetControl(), tasObj ); |
|
568 } |
|
569 } |
|
570 } |
|
571 } |
|
572 |
|
573 void CAknTasHook::AddCommonCoeInfoL( CCoeControl* aObjPtr, MTasObject& aObjectInfo ) |
|
574 { |
|
575 //add positional details |
|
576 TRect absoluteRect( 0, 0, 0, 0 ); |
|
577 if ( aObjPtr->OwnsWindow() ) |
|
578 { |
|
579 RDrawableWindow* window = aObjPtr->DrawableWindow(); |
|
580 if ( window ) |
|
581 { |
|
582 TRect tempRect( window->AbsPosition(), window->Size() ); |
|
583 absoluteRect = tempRect; |
|
584 } |
|
585 } |
|
586 else |
|
587 { |
|
588 TRect tempRect( aObjPtr->PositionRelativeToScreen(), aObjPtr->Size() ); |
|
589 absoluteRect = tempRect; |
|
590 } |
|
591 |
|
592 aObjectInfo.AddAttributeL( _L( "X" ), absoluteRect.iTl.iX ); |
|
593 aObjectInfo.AddAttributeL( _L( "Y" ), absoluteRect.iTl.iY ); |
|
594 aObjectInfo.AddAttributeL( _L( "Width" ), absoluteRect.Width() ); |
|
595 aObjectInfo.AddAttributeL( _L( "Height" ), absoluteRect.Height() ); |
|
596 |
|
597 //some general details |
|
598 aObjectInfo.AddAttributeL( _L( "Visible" ), ( aObjPtr->IsVisible()? _L( "TRUE" ) : _L( "FALSE" ) ) ); |
|
599 aObjectInfo.AddAttributeL( _L( "Focused" ), ( aObjPtr->IsFocused()? _L( "TRUE" ): _L( "FALSE" ) ) ); |
|
600 aObjectInfo.AddAttributeL( _L( "Dimmed" ), ( aObjPtr->IsDimmed()? _L( "TRUE" ): _L( "FALSE" ) ) ); |
|
601 aObjectInfo.AddAttributeL( _L( "HasBorder" ), ( aObjPtr->HasBorder()? _L( "TRUE" ): _L( "FALSE" ) ) ); |
|
602 } |
|
603 |
|
604 void CAknTasHook::HandleNotifyInt( TUint32 aId, TInt aNewValue ) |
|
605 { |
|
606 if ( aId == KTasHooking ) |
|
607 { |
|
608 if ( aNewValue == KTasHookingOn && !iTasHookingEnabled ) |
|
609 { |
|
610 TRAPD( errorCreate, iTasPlugin = CAknTasPluginInterface::NewL() ); |
|
611 if ( errorCreate != KErrNone ) |
|
612 { |
|
613 iTasHookingEnabled = EFalse; |
|
614 return; |
|
615 } |
|
616 TRAPD( errorSet, iTasPlugin->SetHookInterfaceL( InstanceL() ) ); |
|
617 if ( errorSet != KErrNone ) |
|
618 { |
|
619 delete iTasPlugin; |
|
620 iTasPlugin = NULL; |
|
621 iTasHookingEnabled = EFalse; |
|
622 return; |
|
623 } |
|
624 iTasHookingEnabled = ETrue; |
|
625 } |
|
626 else if ( aNewValue == KTasHookingOff && iTasHookingEnabled ) |
|
627 { |
|
628 delete iTasPlugin; |
|
629 iTasPlugin = NULL; |
|
630 iTasHookingEnabled = EFalse; |
|
631 } |
|
632 else |
|
633 { |
|
634 // Invalid value |
|
635 } |
|
636 } |
|
637 else if ( aId == KTasHookStoring ) |
|
638 { |
|
639 if ( aNewValue == KTasHookingOn ) |
|
640 { |
|
641 iTasHookStoringEnabled = ETrue; |
|
642 } |
|
643 else if ( aNewValue == KTasHookingOff ) |
|
644 { |
|
645 iTasHookStoringEnabled = EFalse; |
|
646 } |
|
647 else |
|
648 { |
|
649 // Invalid value |
|
650 } |
|
651 } |
|
652 else |
|
653 { |
|
654 // Wrong key |
|
655 } |
|
656 } |
|
657 |
|
658 TBool CAknTasHook::CheckSanityL( CCoeControl* aControl ) |
|
659 { |
|
660 // check the sanity of the object |
|
661 if ( !aControl || |
|
662 !aControl->DrawableWindow() || |
|
663 !aControl->ControlEnv() || |
|
664 !aControl->IsVisible() ) |
|
665 { |
|
666 return EFalse; |
|
667 } |
|
668 |
|
669 if ( !iTasPlugin->IsControlVisible( *aControl ) ) |
|
670 { |
|
671 return EFalse; |
|
672 } |
|
673 |
|
674 return ETrue; |
|
675 } |
|
676 |
|
677 // End of File |