20 #include <AknTasHook.h> |
20 #include <AknTasHook.h> |
21 #include <eiksrvs.h> |
21 #include <eiksrvs.h> |
22 |
22 |
23 #include "akndiscreetpopupcontrol.h" |
23 #include "akndiscreetpopupcontrol.h" |
24 #include "akndiscreetpopupserverhandler.h" |
24 #include "akndiscreetpopupserverhandler.h" |
|
25 #include "akntrace.h" |
25 |
26 |
26 const TUid KDiscreetPopupSingleton = { 537001156 }; |
27 const TUid KDiscreetPopupSingleton = { 537001156 }; |
27 const TInt KInitialPopupId( 1 ); |
28 const TInt KInitialPopupId( 1 ); |
28 |
29 |
29 // ======== MEMBER FUNCTIONS ======== |
30 // ======== MEMBER FUNCTIONS ======== |
93 EXPORT_C TInt CAknDiscreetPopup::ShowLocalPopupL( |
97 EXPORT_C TInt CAknDiscreetPopup::ShowLocalPopupL( |
94 const TInt aResourceId, |
98 const TInt aResourceId, |
95 const TInt aCommand, |
99 const TInt aCommand, |
96 MEikCommandObserver* aCommandObserver ) |
100 MEikCommandObserver* aCommandObserver ) |
97 { |
101 { |
|
102 _AKNTRACE( "CAknDiscreetPopup::ShowLocalPopupL, Created by given resource" ); |
98 __ASSERT_ALWAYS( CCoeEnv::Static(), Panic( EAknPanicNotSupported ) ); |
103 __ASSERT_ALWAYS( CCoeEnv::Static(), Panic( EAknPanicNotSupported ) ); |
99 TInt popupId = 0; |
104 TInt popupId = 0; |
100 CAknDiscreetPopup* instance = InstanceL(); |
105 CAknDiscreetPopup* instance = InstanceL(); |
101 if( instance ) |
106 if( instance ) |
102 { |
107 { |
121 const TInt aCommandId, |
126 const TInt aCommandId, |
122 MEikCommandObserver* aCommandObserver, |
127 MEikCommandObserver* aCommandObserver, |
123 const TUid& aAppUid, |
128 const TUid& aAppUid, |
124 const TUid& aViewUid ) |
129 const TUid& aViewUid ) |
125 { |
130 { |
|
131 _AKNTRACE( "CAknDiscreetPopup::ShowGlobalPopupL, Created by given parameters" ); |
126 TInt popupId = 0; |
132 TInt popupId = 0; |
127 CAknDiscreetPopup* instance = InstanceL(); |
133 CAknDiscreetPopup* instance = InstanceL(); |
128 if ( instance ) |
134 if ( instance ) |
129 { |
135 { |
130 popupId = instance->DoShowGlobalL(aTitle, aText, aSkinId, aBitmapFile, |
136 popupId = instance->DoShowGlobalL(aTitle, aText, aSkinId, aBitmapFile, |
145 const TInt aCommandId, |
151 const TInt aCommandId, |
146 MEikCommandObserver* aCommandObserver, |
152 MEikCommandObserver* aCommandObserver, |
147 const TUid& aAppUid, |
153 const TUid& aAppUid, |
148 const TUid& aViewUid ) |
154 const TUid& aViewUid ) |
149 { |
155 { |
|
156 _AKNTRACE( "CAknDiscreetPopup::ShowGlobalPopupL, Created by given resource" ); |
150 TInt popupId = 0; |
157 TInt popupId = 0; |
151 CAknDiscreetPopup* instance = InstanceL(); |
158 CAknDiscreetPopup* instance = InstanceL(); |
152 if( instance ) |
159 if( instance ) |
153 { |
160 { |
154 popupId = instance->DoShowGlobalL( aResourceId, |
161 popupId = instance->DoShowGlobalL( aResourceId, |
166 // CAknDiscreetPopup::InitL |
173 // CAknDiscreetPopup::InitL |
167 // --------------------------------------------------------------------------- |
174 // --------------------------------------------------------------------------- |
168 // |
175 // |
169 EXPORT_C void CAknDiscreetPopup::InitL() |
176 EXPORT_C void CAknDiscreetPopup::InitL() |
170 { |
177 { |
|
178 _AKNTRACE_FUNC_ENTER; |
171 __ASSERT_ALWAYS( !CCoeEnv::Static(), Panic( EAknPanicNotSupported ) ); |
179 __ASSERT_ALWAYS( !CCoeEnv::Static(), Panic( EAknPanicNotSupported ) ); |
172 |
180 |
173 // Create popup instance and store it to TLS |
181 // Create popup instance and store it to TLS |
174 if ( !Dll::Tls() ) |
182 if ( !Dll::Tls() ) |
175 { |
183 { |
177 CleanupStack::PushL( instance ); |
185 CleanupStack::PushL( instance ); |
178 instance->ConstructL(); |
186 instance->ConstructL(); |
179 User::LeaveIfError( Dll::SetTls( instance ) ); |
187 User::LeaveIfError( Dll::SetTls( instance ) ); |
180 CleanupStack::Pop( instance ); |
188 CleanupStack::Pop( instance ); |
181 } |
189 } |
|
190 _AKNTRACE_FUNC_EXIT; |
182 } |
191 } |
183 |
192 |
184 |
193 |
185 // --------------------------------------------------------------------------- |
194 // --------------------------------------------------------------------------- |
186 // CAknDiscreetPopup::Release |
195 // CAknDiscreetPopup::Release |
187 // --------------------------------------------------------------------------- |
196 // --------------------------------------------------------------------------- |
188 // |
197 // |
189 EXPORT_C void CAknDiscreetPopup::Release() |
198 EXPORT_C void CAknDiscreetPopup::Release() |
190 { |
199 { |
|
200 _AKNTRACE_FUNC_ENTER; |
191 __ASSERT_ALWAYS( !CCoeEnv::Static(), Panic( EAknPanicNotSupported ) ); |
201 __ASSERT_ALWAYS( !CCoeEnv::Static(), Panic( EAknPanicNotSupported ) ); |
192 |
202 |
193 // Delete popup instance from TLS |
203 // Delete popup instance from TLS |
194 CAknDiscreetPopup* instance = |
204 CAknDiscreetPopup* instance = |
195 static_cast<CAknDiscreetPopup*>( Dll::Tls() ); |
205 static_cast<CAknDiscreetPopup*>( Dll::Tls() ); |
390 // CAknDiscreetPopup::ShowPopupL |
401 // CAknDiscreetPopup::ShowPopupL |
391 // --------------------------------------------------------------------------- |
402 // --------------------------------------------------------------------------- |
392 // |
403 // |
393 void CAknDiscreetPopup::ShowPopupL( CAknDiscreetPopupControl* aControl ) |
404 void CAknDiscreetPopup::ShowPopupL( CAknDiscreetPopupControl* aControl ) |
394 { |
405 { |
|
406 _AKNTRACE_FUNC_ENTER; |
395 if ( !aControl ) |
407 if ( !aControl ) |
396 { |
408 { |
|
409 _AKNTRACE( "CAknDiscreetPopup::ShowPopupL, return (aControl is NULL)" ); |
397 return; |
410 return; |
398 } |
411 } |
399 |
412 |
400 // Inform other popups that new popup is launched |
413 // Inform other popups that new popup is launched |
401 for ( TInt i = 0; i < iLocalPopups.Count(); i++ ) |
414 for ( TInt i = 0; i < iLocalPopups.Count(); i++ ) |
406 // Show popup and add it to popup list |
419 // Show popup and add it to popup list |
407 aControl->SetObserver( this ); |
420 aControl->SetObserver( this ); |
408 aControl->HandleDiscreetPopupActionL( |
421 aControl->HandleDiscreetPopupActionL( |
409 CAknDiscreetPopupControl::EAknDiscreetPopupShow ); |
422 CAknDiscreetPopupControl::EAknDiscreetPopupShow ); |
410 iLocalPopups.AppendL( aControl ); |
423 iLocalPopups.AppendL( aControl ); |
|
424 _AKNTRACE_FUNC_EXIT; |
411 } |
425 } |
412 |
426 |
413 |
427 |
414 // --------------------------------------------------------------------------- |
428 // --------------------------------------------------------------------------- |
415 // CAknDiscreetPopup::DeletePopup |
429 // CAknDiscreetPopup::DeletePopup |
416 // --------------------------------------------------------------------------- |
430 // --------------------------------------------------------------------------- |
417 // |
431 // |
418 void CAknDiscreetPopup::DeletePopup( CAknDiscreetPopupControl* aControl ) |
432 void CAknDiscreetPopup::DeletePopup( CAknDiscreetPopupControl* aControl ) |
419 { |
433 { |
|
434 _AKNTRACE_FUNC_ENTER; |
420 if ( !aControl ) |
435 if ( !aControl ) |
421 { |
436 { |
|
437 _AKNTRACE( "CAknDiscreetPopup::DeletePopup, return (aControl is NULL)" ); |
422 return; |
438 return; |
423 } |
439 } |
424 |
440 |
425 TInt index = iLocalPopups.Find( aControl ); |
441 TInt index = iLocalPopups.Find( aControl ); |
426 iLocalPopups.Remove( index ); |
442 iLocalPopups.Remove( index ); |
427 delete aControl; |
443 delete aControl; |
428 aControl = NULL; |
444 aControl = NULL; |
|
445 _AKNTRACE_FUNC_EXIT; |
429 } |
446 } |
430 |
447 |
431 |
448 |
432 // --------------------------------------------------------------------------- |
449 // --------------------------------------------------------------------------- |
433 // CAknDiscreetPopup::NextPopupId |
450 // CAknDiscreetPopup::NextPopupId |
470 // --------------------------------------------------------------------------- |
487 // --------------------------------------------------------------------------- |
471 // |
488 // |
472 void CAknDiscreetPopup::HandleControlEventL( |
489 void CAknDiscreetPopup::HandleControlEventL( |
473 CCoeControl* aControl, TCoeEvent aEventType ) |
490 CCoeControl* aControl, TCoeEvent aEventType ) |
474 { |
491 { |
|
492 _AKNTRACE( "CAknDiscreetPopup::HandleControlEventL, aEventType : %d", aEventType ); |
475 if ( aEventType == EEventRequestExit || aEventType == EEventRequestCancel ) |
493 if ( aEventType == EEventRequestExit || aEventType == EEventRequestCancel ) |
476 { |
494 { |
477 DeletePopup( static_cast<CAknDiscreetPopupControl*>( aControl ) ); |
495 DeletePopup( static_cast<CAknDiscreetPopupControl*>( aControl ) ); |
478 } |
496 } |
479 } |
497 } |