localisation/apparchitecture/tef/t_winchainChild_Application.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Source file for the implementation of the 
       
    15 // application class - CChainChildApplication
       
    16 // 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalComponent - Internal Symbian test code 
       
    24 */
       
    25 
       
    26 #include "t_winChainChild.h"
       
    27 
       
    28 
       
    29 /**   The function is called by the UI framework to ask for the
       
    30       application's UID. The returned value is defined by the
       
    31       constant KUidTChainChildApp and must match the second value
       
    32       defined in the project definition file.
       
    33 */ 
       
    34 TUid CChainChildApplication::AppDllUid() const
       
    35 	{
       
    36 	return KUidTChainChildApp;
       
    37 	}
       
    38 
       
    39 /**  This function is called by the UI framework at
       
    40      application start-up. It creates an instance of the
       
    41      document class.
       
    42 */
       
    43 CApaDocument* CChainChildApplication::CreateDocumentL()
       
    44 	{
       
    45 	return new (ELeave) CChainChildDocument(*this);
       
    46 	}
       
    47 	
       
    48 	LOCAL_C CApaApplication* NewApplication()
       
    49 	{
       
    50 	return new CChainChildApplication;
       
    51 	}
       
    52 
       
    53 TFileName CChainChildApplication::BitmapStoreName() const
       
    54 	{
       
    55 	return KNullDesC();
       
    56 	}
       
    57 
       
    58 TFileName CChainChildApplication::ResourceFileName() const
       
    59 	{
       
    60 	return KNullDesC();
       
    61 	}
       
    62 
       
    63 
       
    64 GLDEF_C TInt E32Main()
       
    65 	{
       
    66 	return EikStart::RunApplication( NewApplication );
       
    67 	}
       
    68 
       
    69 
       
    70 
       
    71 /**       The constructor of the document class just passes the
       
    72           supplied reference to the constructor initialisation list.
       
    73           The document has no real work to do in this application.
       
    74 */
       
    75 CChainChildDocument::CChainChildDocument(CEikApplication& aApp)
       
    76 		: CEikDocument(aApp)
       
    77 	{
       
    78 	}
       
    79 
       
    80 
       
    81 /**     This is called by the UI framework as soon as the 
       
    82         document has been created. It creates an instance
       
    83         of the ApplicationUI. The Application UI class is
       
    84         an instance of a CEikAppUi derived class.
       
    85 */
       
    86 CEikAppUi* CChainChildDocument::CreateAppUiL()
       
    87 	{
       
    88     return new(ELeave) CChainChildAppUi;
       
    89 	}
       
    90 
       
    91 #include <eikserverapp.h>
       
    92 /**  The second phase constructor of the application UI class.
       
    93      The application UI creates and owns the one and only view.
       
    94 */ 
       
    95 void CChainChildAppUi::ConstructL()
       
    96     {
       
    97     //CEikAppUi::ConstructL();	
       
    98     CEikAppUi::BaseConstructL(ENoAppResourceFile|ENoScreenFurniture);
       
    99 	}
       
   100 
       
   101 // Check if parent ID is the KExoticOrdinalPriority	
       
   102 TInt CMyAppService::TestL(TInt aParentWindowGroupID)
       
   103 	{
       
   104 	CCoeEnv* coeEnv = CCoeEnv::Static();
       
   105 		
       
   106 	
       
   107 	TInt wgCount=coeEnv->WsSession().NumWindowGroups(KExoticOrdinalPriority);
       
   108 		
       
   109 	RDebug::Print(_L("Child - TestL: wgCount = %d"), wgCount);
       
   110 	
       
   111     RArray<RWsSession::TWindowGroupChainInfo>* wgIds=new(ELeave) RArray<RWsSession::TWindowGroupChainInfo>(wgCount);
       
   112     CleanupStack::PushL(wgIds);
       
   113     User::LeaveIfError(coeEnv->WsSession().WindowGroupList(KExoticOrdinalPriority,wgIds));
       
   114         
       
   115     TBool testPassed=EFalse;
       
   116 
       
   117     // The root identifier of this window
       
   118     TInt rootIdentifier = coeEnv->RootWin().Identifier();
       
   119     
       
   120     RDebug::Print(_L("Child - TestL: rootIdentifier = %d"), rootIdentifier);
       
   121     
       
   122     RDebug::Print(_L("Child - TestL: Entering loop.."));
       
   123     // Go through all window group IDs looking for the current one
       
   124     for (TInt i=0;i<wgCount;i++)
       
   125         {
       
   126         RWsSession::TWindowGroupChainInfo wgId=(*wgIds)[i];
       
   127         
       
   128         RDebug::Print(_L("Child - TestL: wgId[%d].iId = %d"), i, wgId.iId);
       
   129         RDebug::Print(_L("Child - TestL: wgId[%d].iParentId = %d"), i, wgId.iParentId);
       
   130         
       
   131         // If this is the current window group ID
       
   132         if (wgId.iId == rootIdentifier)
       
   133         	{
       
   134         	RDebug::Print(_L("Child - TestL: Root Identifier = wgId.Id on %d"),i);
       
   135         	testPassed=(wgId.iParentId == aParentWindowGroupID);
       
   136         	RDebug::Print(_L("Child - TestL: TestPassed = %d"), testPassed);
       
   137         	break;
       
   138         	}
       
   139         }
       
   140         
       
   141 	CleanupStack::PopAndDestroy();  // wgids
       
   142 	
       
   143 	return testPassed;
       
   144 	}
       
   145 	
       
   146 //
       
   147 // CMyAppService
       
   148 //
       
   149 void CMyAppService::ServiceL(const RMessage2& aMessage)
       
   150 	{
       
   151 	RDebug::Print(_L("Child - ServiceL: message function = %d"),aMessage.Function());
       
   152 	
       
   153 	switch (aMessage.Function())
       
   154 	{
       
   155 	case KQueryChainChild1:
       
   156 		if (TestL(aMessage.Int0())) 
       
   157 			{
       
   158 			aMessage.Complete(KChainPass);
       
   159 			}
       
   160 		else
       
   161 			{
       
   162 			aMessage.Complete(KChainFail);	
       
   163 			}
       
   164 			User::Exit(-1);
       
   165 		break;
       
   166 	case KQueryChainChild2:
       
   167 		aMessage.Complete(KErrNone);
       
   168 		User::Exit(-1);
       
   169 		break;
       
   170 	default:
       
   171 		aMessage.Complete(KErrNotSupported);
       
   172 		User::Leave(KErrNotSupported);
       
   173 		break;
       
   174 		}
       
   175 	}
       
   176 	
       
   177 //
       
   178 // CMyEikAppServer
       
   179 //
       
   180 CApaAppServiceBase* CMyEikAppServer::CreateServiceL(TUid aServiceType) const
       
   181 	{
       
   182 	RDebug::Print(_L("Child - CreateServiceL: Creating Service Type %d"),aServiceType);
       
   183 	if (aServiceType==KUidTChainServerApp)
       
   184 		{
       
   185 		return new(ELeave) CMyAppService;
       
   186 		}
       
   187 	return CEikAppServer::CreateServiceL(aServiceType);
       
   188 	}	
       
   189 	
       
   190 	
       
   191 CChainChildAppUi::~CChainChildAppUi()
       
   192 	{
       
   193 
       
   194 	}
       
   195 
       
   196 void CChainChildAppUi::HandleCommandL(TInt /*aCommand*/)
       
   197 	{
       
   198 	
       
   199 	}
       
   200 
       
   201 void CChainChildAppUi::RunTestStepL(TInt /*aNextStep*/)
       
   202 	{
       
   203 	}
       
   204 	
       
   205 
       
   206 
       
   207