uifw/AknGlobalUI/AknCapServer/src/akncapserverdiscreetpopuphandler.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 18 0aa5fbdfbc30
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    21 #include <avkondomainpskeys.h>
    21 #include <avkondomainpskeys.h>
    22 
    22 
    23 #include "akncapserverdiscreetpopuphandler.h"
    23 #include "akncapserverdiscreetpopuphandler.h"
    24 #include "akndiscreetpopupcontrol.h"
    24 #include "akndiscreetpopupcontrol.h"
    25 #include "akndiscreetpopupdata.h"
    25 #include "akndiscreetpopupdata.h"
       
    26 #include "akntrace.h"
    26 
    27 
    27 const TUid KAknCapServerDiscreetPopupHandler = { 0x2001FDF8 };
    28 const TUid KAknCapServerDiscreetPopupHandler = { 0x2001FDF8 };
    28 
    29 
    29 // ======== MEMBER FUNCTIONS ========
    30 // ======== MEMBER FUNCTIONS ========
    30 
    31 
    32 // CAknCapServerDiscreetPopupHandler::~CAknCapServerDiscreetPopupHandler
    33 // CAknCapServerDiscreetPopupHandler::~CAknCapServerDiscreetPopupHandler
    33 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    34 //
    35 //
    35 CAknCapServerDiscreetPopupHandler::~CAknCapServerDiscreetPopupHandler()
    36 CAknCapServerDiscreetPopupHandler::~CAknCapServerDiscreetPopupHandler()
    36     {
    37     {
       
    38     _AKNTRACE_FUNC_ENTER;
    37     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
    39     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
    38         {
    40         {
    39         if ( iPopupDataArray[ i ].iPopupControl )
    41         if ( iPopupDataArray[ i ].iPopupControl )
    40             {
    42             {
    41             delete iPopupDataArray[ i ].iPopupControl;
    43             delete iPopupDataArray[ i ].iPopupControl;
    42             iPopupDataArray[ i ].iPopupControl = NULL;
    44             iPopupDataArray[ i ].iPopupControl = NULL;
    43             }
    45             }
    44         }
    46         }
    45     iPopupDataArray.Close();    
    47     iPopupDataArray.Close();    
       
    48     _AKNTRACE_FUNC_EXIT;
    46     }
    49     }
    47 
    50 
    48 
    51 
    49 // ---------------------------------------------------------------------------
    52 // ---------------------------------------------------------------------------
    50 // CAknCapServerDiscreetPopupHandler::HandleDiscreetPopupMessageL
    53 // CAknCapServerDiscreetPopupHandler::HandleDiscreetPopupMessageL
    51 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    52 //
    55 //
    53 void CAknCapServerDiscreetPopupHandler::HandleDiscreetPopupMessageL( 
    56 void CAknCapServerDiscreetPopupHandler::HandleDiscreetPopupMessageL( 
    54         const RMessage2& aMessage )
    57         const RMessage2& aMessage )
    55     {
    58     {
       
    59     _AKNTRACE_FUNC_ENTER;
    56     CAknCapServerDiscreetPopupHandler* instance 
    60     CAknCapServerDiscreetPopupHandler* instance 
    57         = CAknCapServerDiscreetPopupHandler::InstanceL();
    61         = CAknCapServerDiscreetPopupHandler::InstanceL();
    58     if ( instance )
    62     if ( instance )
    59         {
    63         {
    60         instance->DoHandleDiscreetPopupMessageL( aMessage );
    64         instance->DoHandleDiscreetPopupMessageL( aMessage );
    61         }
    65         }
       
    66     _AKNTRACE_FUNC_EXIT;
    62     }
    67     }
    63 
    68 
    64 
    69 
    65 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    66 // CAknCapServerDiscreetPopupHandler::CreateDiscreetPopupHandlerL
    71 // CAknCapServerDiscreetPopupHandler::CreateDiscreetPopupHandlerL
    67 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    68 //
    73 //
    69 void CAknCapServerDiscreetPopupHandler::CreateDiscreetPopupHandlerL()
    74 void CAknCapServerDiscreetPopupHandler::CreateDiscreetPopupHandlerL()
    70     {
    75     {
       
    76     _AKNTRACE_FUNC_ENTER;
    71     CAknCapServerDiscreetPopupHandler* instance 
    77     CAknCapServerDiscreetPopupHandler* instance 
    72         = CAknCapServerDiscreetPopupHandler::InstanceL();
    78         = CAknCapServerDiscreetPopupHandler::InstanceL();
       
    79     _AKNTRACE_FUNC_EXIT;
    73     }
    80     }
    74 
    81 
    75 
    82 
    76 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    77 // CAknCapServerDiscreetPopupHandler::CAknCapServerDiscreetPopupHandler
    84 // CAknCapServerDiscreetPopupHandler::CAknCapServerDiscreetPopupHandler
   119 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   120 //
   127 //
   121 void CAknCapServerDiscreetPopupHandler::DoHandleDiscreetPopupMessageL(
   128 void CAknCapServerDiscreetPopupHandler::DoHandleDiscreetPopupMessageL(
   122     const RMessage2& aMessage )
   129     const RMessage2& aMessage )
   123     {
   130     {
       
   131     _AKNTRACE_FUNC_ENTER;
   124     TAknDiscreetPopupData dataType;
   132     TAknDiscreetPopupData dataType;
   125     TPckg<TAknDiscreetPopupData> pkgType( dataType );
   133     TPckg<TAknDiscreetPopupData> pkgType( dataType );
   126     aMessage.ReadL( 0, pkgType );
   134     aMessage.ReadL( 0, pkgType );
   127     switch ( dataType.Type() )
   135     switch ( dataType.Type() )
   128         {
   136         {
   149         default:
   157         default:
   150             {
   158             {
   151             break;
   159             break;
   152             }
   160             }
   153         }
   161         }
       
   162     _AKNTRACE_FUNC_EXIT;
   154     }
   163     }
   155 
   164 
   156 
   165 
   157 // ---------------------------------------------------------------------------
   166 // ---------------------------------------------------------------------------
   158 // CAknCapServerDiscreetPopupHandler::LaunchFromResourceL
   167 // CAknCapServerDiscreetPopupHandler::LaunchFromResourceL
   159 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   160 //
   169 //
   161 void CAknCapServerDiscreetPopupHandler::LaunchFromResourceL(  
   170 void CAknCapServerDiscreetPopupHandler::LaunchFromResourceL(  
   162         const RMessage2& aMessage )
   171         const RMessage2& aMessage )
   163     {
   172     {
       
   173     _AKNTRACE_FUNC_ENTER;
   164     TAknDiscreetPopupResourceData data;
   174     TAknDiscreetPopupResourceData data;
   165     TPckg<TAknDiscreetPopupResourceData> pkg( data );
   175     TPckg<TAknDiscreetPopupResourceData> pkg( data );
   166     aMessage.ReadL( 0, pkg );
   176     aMessage.ReadL( 0, pkg );
   167 
   177 
   168     MEikCommandObserver* observer( NULL );
   178     MEikCommandObserver* observer( NULL );
   186         popup,
   196         popup,
   187         data.AppUid(),
   197         data.AppUid(),
   188         data.ViewUid(),
   198         data.ViewUid(),
   189         aMessage );
   199         aMessage );
   190     CleanupStack::Pop( popup );
   200     CleanupStack::Pop( popup );
       
   201     _AKNTRACE_FUNC_EXIT;
   191     }
   202     }
   192 
   203 
   193 
   204 
   194 // ---------------------------------------------------------------------------
   205 // ---------------------------------------------------------------------------
   195 // CAknCapServerDiscreetPopupHandler::LaunchWithParamsL
   206 // CAknCapServerDiscreetPopupHandler::LaunchWithParamsL
   196 // ---------------------------------------------------------------------------
   207 // ---------------------------------------------------------------------------
   197 //
   208 //
   198 void CAknCapServerDiscreetPopupHandler::LaunchWithParamsL(  
   209 void CAknCapServerDiscreetPopupHandler::LaunchWithParamsL(  
   199         const RMessage2& aMessage )
   210         const RMessage2& aMessage )
   200     {
   211     {
       
   212     _AKNTRACE_FUNC_ENTER;
   201     TAknDiscreetPopupParamData data;
   213     TAknDiscreetPopupParamData data;
   202     TPckg<TAknDiscreetPopupParamData> pkg( data );
   214     TPckg<TAknDiscreetPopupParamData> pkg( data );
   203     aMessage.ReadL( 0, pkg );
   215     aMessage.ReadL( 0, pkg );
   204 
   216 
   205     MEikCommandObserver* observer( NULL );
   217     MEikCommandObserver* observer( NULL );
   229         popup,
   241         popup,
   230         data.AppUid(),
   242         data.AppUid(),
   231         data.ViewUid(),
   243         data.ViewUid(),
   232         aMessage );
   244         aMessage );
   233     CleanupStack::Pop( popup );
   245     CleanupStack::Pop( popup );
       
   246     _AKNTRACE_FUNC_EXIT;
   234     }
   247     }
   235 
   248 
   236 
   249 
   237 // ---------------------------------------------------------------------------
   250 // ---------------------------------------------------------------------------
   238 // CAknCapServerDiscreetPopupHandler::HandleRequestCancellationL
   251 // CAknCapServerDiscreetPopupHandler::HandleRequestCancellationL
   239 // ---------------------------------------------------------------------------
   252 // ---------------------------------------------------------------------------
   240 //
   253 //
   241 void CAknCapServerDiscreetPopupHandler::HandleRequestCancellationL(  
   254 void CAknCapServerDiscreetPopupHandler::HandleRequestCancellationL(  
   242         const RMessage2& aMessage )
   255         const RMessage2& aMessage )
   243     {
   256     {
       
   257     _AKNTRACE_FUNC_ENTER;
   244     TAknDiscreetPopupCancelRequestData data;
   258     TAknDiscreetPopupCancelRequestData data;
   245     TPckg<TAknDiscreetPopupCancelRequestData> pkg( data );
   259     TPckg<TAknDiscreetPopupCancelRequestData> pkg( data );
   246     aMessage.ReadL( 0, pkg );
   260     aMessage.ReadL( 0, pkg );
   247     
   261     
   248     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   262     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   261                 break;
   275                 break;
   262                 }
   276                 }
   263             }
   277             }
   264         }
   278         }
   265     aMessage.Complete( KErrNone );
   279     aMessage.Complete( KErrNone );
       
   280     _AKNTRACE_FUNC_EXIT;
   266     }
   281     }
   267 
   282 
   268 // ---------------------------------------------------------------------------
   283 // ---------------------------------------------------------------------------
   269 // CAknCapServerDiscreetPopupHandler::HandleQueryInUseRect
   284 // CAknCapServerDiscreetPopupHandler::HandleQueryInUseRect
   270 // ---------------------------------------------------------------------------
   285 // ---------------------------------------------------------------------------
   271 //
   286 //
   272 void CAknCapServerDiscreetPopupHandler::HandleQueryInUseRect( 
   287 void CAknCapServerDiscreetPopupHandler::HandleQueryInUseRect( 
   273         const RMessage2& aMessage )
   288         const RMessage2& aMessage )
   274     {
   289     {
       
   290     _AKNTRACE_FUNC_ENTER;
   275     TRect rect(TRect::EUninitialized);
   291     TRect rect(TRect::EUninitialized);
   276     if( iPopupDataArray.Count() != 0 ) 
   292     if( iPopupDataArray.Count() != 0 ) 
   277         {
   293         {
   278         rect = iPopupDataArray[0].iPopupControl->Rect();
   294         rect = iPopupDataArray[0].iPopupControl->Rect();
   279         }
   295         }
   280     
   296     
   281     TAknDiscreetPopupRectData data(rect);
   297     TAknDiscreetPopupRectData data(rect);
   282     TPckg<TAknDiscreetPopupRectData> pkg( data );
   298     TPckg<TAknDiscreetPopupRectData> pkg( data );
   283     aMessage.WriteL( 0, pkg );
   299     aMessage.WriteL( 0, pkg );
   284     aMessage.Complete( KErrNone );
   300     aMessage.Complete( KErrNone );
       
   301     _AKNTRACE_FUNC_EXIT;
   285     }
   302     }
   286 
   303 
   287 // ---------------------------------------------------------------------------
   304 // ---------------------------------------------------------------------------
   288 // CAknCapServerDiscreetPopupHandler::ShowPopupL
   305 // CAknCapServerDiscreetPopupHandler::ShowPopupL
   289 // ---------------------------------------------------------------------------
   306 // ---------------------------------------------------------------------------
   293         CAknDiscreetPopupControl* aPopup,
   310         CAknDiscreetPopupControl* aPopup,
   294         const TUid& aAppUid,
   311         const TUid& aAppUid,
   295         const TUid& aViewUid,
   312         const TUid& aViewUid,
   296         const RMessage2& aMessage )
   313         const RMessage2& aMessage )
   297     {
   314     {
       
   315     _AKNTRACE_FUNC_ENTER;
   298     aPopup->SetObserver( this );
   316     aPopup->SetObserver( this );
   299 
   317 
   300     // Inform other popups that new popup is launched
   318     // Inform other popups that new popup is launched
   301     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   319     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   302         {
   320         {
   314     popupData.iAppUid = aAppUid;
   332     popupData.iAppUid = aAppUid;
   315     popupData.iViewUid = aViewUid;
   333     popupData.iViewUid = aViewUid;
   316     popupData.iMessage = aMessage;
   334     popupData.iMessage = aMessage;
   317     iPopupDataArray.AppendL( popupData );
   335     iPopupDataArray.AppendL( popupData );
   318     NotifyRunningGlobalDiscreetPopupChanged();
   336     NotifyRunningGlobalDiscreetPopupChanged();
       
   337     _AKNTRACE_FUNC_EXIT;
   319     }
   338     }
   320 
   339 
   321 
   340 
   322 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   323 // CAknCapServerDiscreetPopupHandler::NextAvailableCommandId
   342 // CAknCapServerDiscreetPopupHandler::NextAvailableCommandId
   348 // CAknCapServerDiscreetPopupHandler::NotifyRunningGlobalDiscreetPopupChanged
   367 // CAknCapServerDiscreetPopupHandler::NotifyRunningGlobalDiscreetPopupChanged
   349 // ---------------------------------------------------------------------------
   368 // ---------------------------------------------------------------------------
   350 //
   369 //
   351 void CAknCapServerDiscreetPopupHandler::NotifyRunningGlobalDiscreetPopupChanged()
   370 void CAknCapServerDiscreetPopupHandler::NotifyRunningGlobalDiscreetPopupChanged()
   352     {
   371     {
       
   372     _AKNTRACE_FUNC_ENTER;
   353     _LIT_SECURITY_POLICY_S0( writePolicy, RProcess().SecureId() );
   373     _LIT_SECURITY_POLICY_S0( writePolicy, RProcess().SecureId() );
   354 	_LIT_SECURITY_POLICY_PASS( readPolicy );
   374 	_LIT_SECURITY_POLICY_PASS( readPolicy );
   355     
   375     
   356     TInt err = RProperty::Define( KPSUidAvkonDomain, 
   376     TInt err = RProperty::Define( KPSUidAvkonDomain, 
   357                                   KAknGlobalDiscreetPopupNumChanged, 
   377                                   KAknGlobalDiscreetPopupNumChanged, 
   361 
   381 
   362     if( err == KErrAlreadyExists || err == KErrNone )
   382     if( err == KErrAlreadyExists || err == KErrNone )
   363         {
   383         {
   364         RProperty::Set( KPSUidAvkonDomain, KAknGlobalDiscreetPopupNumChanged, 0 );
   384         RProperty::Set( KPSUidAvkonDomain, KAknGlobalDiscreetPopupNumChanged, 0 );
   365         }            
   385         }            
       
   386     _AKNTRACE_FUNC_EXIT;
   366     }
   387     }
   367 
   388 
   368 // ---------------------------------------------------------------------------
   389 // ---------------------------------------------------------------------------
   369 // CAknCapServerDiscreetPopupHandler::ProcessCommandL
   390 // CAknCapServerDiscreetPopupHandler::ProcessCommandL
   370 // ---------------------------------------------------------------------------
   391 // ---------------------------------------------------------------------------
   371 //
   392 //
   372 void CAknCapServerDiscreetPopupHandler::ProcessCommandL( TInt aCommandId )
   393 void CAknCapServerDiscreetPopupHandler::ProcessCommandL( TInt aCommandId )
   373     {
   394     {
       
   395     _AKNTRACE_FUNC_ENTER;
   374     TAknCapServerDiscreetPopupData* popupData( NULL );
   396     TAknCapServerDiscreetPopupData* popupData( NULL );
   375     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   397     for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   376         {
   398         {
   377         if ( iPopupDataArray[ i ].iCommandId == aCommandId )
   399         if ( iPopupDataArray[ i ].iCommandId == aCommandId )
   378             {
   400             {
   403         }
   425         }
   404     if ( popupData && !popupData->iMessage.IsNull() )
   426     if ( popupData && !popupData->iMessage.IsNull() )
   405         {
   427         {
   406         popupData->iMessage.Complete( KErrCompletion );
   428         popupData->iMessage.Complete( KErrCompletion );
   407         }
   429         }
       
   430     _AKNTRACE_FUNC_EXIT;
   408     }
   431     }
   409 
   432 
   410 
   433 
   411 // ---------------------------------------------------------------------------
   434 // ---------------------------------------------------------------------------
   412 // CAknCapServerDiscreetPopupHandler::HandleControlEventL
   435 // CAknCapServerDiscreetPopupHandler::HandleControlEventL
   413 // ---------------------------------------------------------------------------
   436 // ---------------------------------------------------------------------------
   414 //
   437 //
   415 void CAknCapServerDiscreetPopupHandler::HandleControlEventL( 
   438 void CAknCapServerDiscreetPopupHandler::HandleControlEventL( 
   416     CCoeControl* aControl, TCoeEvent aEventType )
   439     CCoeControl* aControl, TCoeEvent aEventType )
   417     {
   440     {
       
   441     _AKNTRACE( "CAknCapServerDiscreetPopupHandler::HandleControlEventL, aEventType : %d", aEventType );
   418     // Popup has been closed or cancelled - remove from array
   442     // Popup has been closed or cancelled - remove from array
   419     if ( aEventType == EEventRequestExit || aEventType == EEventRequestCancel )
   443     if ( aEventType == EEventRequestExit || aEventType == EEventRequestCancel )
   420         {
   444         {
   421         for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   445         for ( TInt i = 0; i < iPopupDataArray.Count(); i++ )
   422             {
   446             {