uifw/AvKon/src/akndiscreetpopup.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 55 aecbbf00d063
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    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 ========
    32 // CAknDiscreetPopup::~CAknDiscreetPopup
    33 // CAknDiscreetPopup::~CAknDiscreetPopup
    33 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    34 //
    35 //
    35 CAknDiscreetPopup::~CAknDiscreetPopup()
    36 CAknDiscreetPopup::~CAknDiscreetPopup()
    36     {
    37     {
       
    38     _AKNTRACE_FUNC_ENTER;
    37     if ( iUseCoeEnv )
    39     if ( iUseCoeEnv )
    38         {
    40         {
    39         AKNTASHOOK_REMOVE();
    41         AKNTASHOOK_REMOVE();
    40         }
    42         }
    41     CAknDiscreetPopupControl* popup( NULL );
    43     CAknDiscreetPopupControl* popup( NULL );
    45         delete popup;
    47         delete popup;
    46         popup = NULL;
    48         popup = NULL;
    47         }
    49         }
    48     iLocalPopups.Close();
    50     iLocalPopups.Close();
    49     delete iServerHandler;
    51     delete iServerHandler;
       
    52     _AKNTRACE_FUNC_EXIT;
    50     }
    53     }
    51 
    54 
    52 
    55 
    53 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    54 // CAknDiscreetPopup::ShowLocalPopupL
    57 // CAknDiscreetPopup::ShowLocalPopupL
    64     const TInt aMaskId,
    67     const TInt aMaskId,
    65     const TInt aFlags,
    68     const TInt aFlags,
    66     const TInt aCommand,
    69     const TInt aCommand,
    67     MEikCommandObserver* aCommandObserver )
    70     MEikCommandObserver* aCommandObserver )
    68     {
    71     {
       
    72     _AKNTRACE( "CAknDiscreetPopup::ShowLocalPopupL, Created by given parameters" );
    69     __ASSERT_ALWAYS( CCoeEnv::Static(), Panic( EAknPanicNotSupported ) );
    73     __ASSERT_ALWAYS( CCoeEnv::Static(), Panic( EAknPanicNotSupported ) );
    70     TInt popupId = 0;
    74     TInt popupId = 0;
    71     CAknDiscreetPopup* instance = InstanceL();
    75     CAknDiscreetPopup* instance = InstanceL();
    72     if( instance )
    76     if( instance )
    73         {
    77         {
    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() );
   197         {
   207         {
   198         delete instance;
   208         delete instance;
   199         instance = NULL;
   209         instance = NULL;
   200         Dll::SetTls( NULL );
   210         Dll::SetTls( NULL );
   201         }
   211         }
       
   212     _AKNTRACE_FUNC_EXIT;
   202     }
   213     }
   203 
   214 
   204 
   215 
   205 // ---------------------------------------------------------------------------
   216 // ---------------------------------------------------------------------------
   206 // CAknDiscreetPopup::CAknDiscreetPopup
   217 // CAknDiscreetPopup::CAknDiscreetPopup
   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     }