commsconfig/cscapplicationui/src/cscappui.cpp
branchRCL_3
changeset 10 7117cbf1600a
parent 6 fc8c25e5a2e8
child 11 bddb6d4447db
equal deleted inserted replaced
6:fc8c25e5a2e8 10:7117cbf1600a
    27 #include <AknsConstants.h>
    27 #include <AknsConstants.h>
    28 #include <cscsettingsui.h>
    28 #include <cscsettingsui.h>
    29 #include <xSPViewServices.h>
    29 #include <xSPViewServices.h>
    30 #include <AiwServiceHandler.h>
    30 #include <AiwServiceHandler.h>
    31 #include <mspnotifychangeobserver.h>
    31 #include <mspnotifychangeobserver.h>
       
    32 #include <gsfwviewuids.h>
       
    33 #include <apgwgnam.h>
       
    34 #include <csc.hlp.hrh>
    32 
    35 
    33 #include "cscappui.h"
    36 #include "cscappui.h"
    34 #include "csclogger.h"
    37 #include "csclogger.h"
    35 #include "cscdocument.h"
    38 #include "cscdocument.h"
    36 #include "cscconstants.h"
    39 #include "cscconstants.h"
    43 #include "cscengservicepluginhandler.h"
    46 #include "cscengservicepluginhandler.h"
    44 #include "cscengdestinationshandler.h"
    47 #include "cscengdestinationshandler.h"
    45 #include "cscenguiextensionpluginhandler.h"
    48 #include "cscenguiextensionpluginhandler.h"
    46 
    49 
    47 const TInt KMaxParamLength = 255;
    50 const TInt KMaxParamLength = 255;
       
    51 const TInt KGSChildAppWindowGroupNameLength = 100;
    48 
    52 
    49 // ======== MEMBER FUNCTIONS ========
    53 // ======== MEMBER FUNCTIONS ========
    50 
    54 
    51 
    55 
    52 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
   188     {
   192     {
   189     CSCDEBUG( "CCSCAppUi::HandleCommandL - begin" );
   193     CSCDEBUG( "CCSCAppUi::HandleCommandL - begin" );
   190     
   194     
   191     switch ( aCommand )
   195     switch ( aCommand )
   192         {
   196         {
       
   197         case EAknSoftkeyBack:
       
   198             {
       
   199             Exit();
       
   200             break;
       
   201             }
   193         case EEikCmdExit:
   202         case EEikCmdExit:
   194         case EAknSoftkeyExit:
   203         case EAknSoftkeyExit:
   195         case EAknSoftkeyBack:
       
   196         case EAknCmdExit:
   204         case EAknCmdExit:
       
   205             {
       
   206             ExitGSIfParentL();
   197             Exit();
   207             Exit();
   198             break;
   208             break;
       
   209             }
   199         default:
   210         default:
   200             break;
   211             break;
   201         }
   212         }
   202     
   213     
   203     CSCDEBUG( "CCSCAppUi::HandleCommandL - end" );
   214     CSCDEBUG( "CCSCAppUi::HandleCommandL - end" );
   455     
   466     
   456     CleanupStack::PopAndDestroy( destHandler );
   467     CleanupStack::PopAndDestroy( destHandler );
   457     
   468     
   458     CSCDEBUG( "CCSCAppUi::SnapCheckL - end" );  
   469     CSCDEBUG( "CCSCAppUi::SnapCheckL - end" );  
   459     }
   470     }
       
   471 
       
   472 // ---------------------------------------------------------------------------
       
   473 // Check if GS has to be closed
       
   474 // ---------------------------------------------------------------------------
       
   475 //
       
   476 TBool CCSCAppUi::ExitGSIfParentL()
       
   477     {
       
   478     TBool ret = EFalse;
       
   479     
       
   480     RWsSession ws  = CEikonEnv::Static()->WsSession();
       
   481     TApaTaskList taskList( ws );
       
   482     TApaTask gstask = taskList.FindApp( KUidGS  );
       
   483 
       
   484     if ( gstask.Exists() )
       
   485         {
       
   486         TInt gswgid = gstask.WgId();
       
   487         RArray<RWsSession::TWindowGroupChainInfo> wgrp;
       
   488         ws.WindowGroupList( &wgrp );
       
   489         TInt i = 0;
       
   490 
       
   491         // Loop window groups, find GS's child app
       
   492         for ( i=0; i < wgrp.Count() ; ++i )
       
   493             {
       
   494             TBuf< KGSChildAppWindowGroupNameLength > name;
       
   495             ws.GetWindowGroupNameFromIdentifier( wgrp[i].iId , name );
       
   496             RWsSession::TWindowGroupChainInfo wginfo = wgrp[i];
       
   497             if ( wginfo.iParentId == gswgid ) // Child of GS found
       
   498                 {
       
   499                 CApaWindowGroupName* windowName1 =
       
   500                     CApaWindowGroupName::NewLC( ws, wginfo.iId ); // CS:1
       
   501                 TUid embeddeeuid;
       
   502                 embeddeeuid = windowName1->AppUid();
       
   503 
       
   504                 // Check if CSC is the child of GS
       
   505                 if ( KUidCscHelp == embeddeeuid )
       
   506                     {
       
   507                     ret = ETrue;
       
   508                     gstask.EndTask();
       
   509                     }
       
   510                 CleanupStack::PopAndDestroy( windowName1 );  // CS:0
       
   511                 }
       
   512             }
       
   513         wgrp.Close();
       
   514         }
       
   515     
       
   516     return ret;
       
   517     }