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