sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/defineemergencycallps.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #include <eikstart.h> 
       
    23 #include <eikapp.h>
       
    24 #include <e32property.h>
       
    25 #include "defineemergencycallps.h"
       
    26 #include "ssmuiproviderdll.h"
       
    27 
       
    28 /**
       
    29 Standard DLL entry point function.
       
    30 Creates and returns an instance of the CApaApplication-derived class.
       
    31 @return an instance of the CApaApplication-derived class
       
    32 */
       
    33 TInt E32Main()
       
    34 	{
       
    35 	return EikStart::RunApplication( CTestApplication::NewApplication );
       
    36 	}
       
    37 
       
    38 CTestApplication::CTestApplication()
       
    39 	{
       
    40 	}
       
    41 
       
    42 CTestApplication::~CTestApplication()
       
    43 	{
       
    44 	}
       
    45 		
       
    46 /**
       
    47 @return The application's UID 
       
    48 */
       
    49 TUid CTestApplication::AppDllUid() const
       
    50 	{
       
    51 	const TUid dll = {0x2001032C};
       
    52 	return dll;
       
    53 	}
       
    54 
       
    55 /**
       
    56 @return CTestApplication or NULL if KErrNoMemory
       
    57 */
       
    58 CApaApplication* CTestApplication::NewApplication()
       
    59 	{
       
    60 	// As the framework has at this point not started up enough, and therefore the TRAP-harness and 
       
    61 	// exception handlers aren’t available yet, this factory function is a non-leaving function and 
       
    62 	// can't use the new(Eleave) operator.
       
    63 	return new CTestApplication();
       
    64 	}
       
    65 	
       
    66 /**
       
    67 Called by the UI framework at application start-up to create an instance of the document class.
       
    68 @leave	KErrNoMemory
       
    69 @return A CTestDocument
       
    70 */
       
    71 CApaDocument* CTestApplication::CreateDocumentL()
       
    72 	{
       
    73 	return CTestDocument::NewL(*this);
       
    74 	}
       
    75 
       
    76 CTestDocument::CTestDocument(CEikApplication& aApp) : CEikDocument(aApp)
       
    77 	{
       
    78 	}
       
    79 
       
    80 CTestDocument::~CTestDocument()
       
    81 	{
       
    82 	}
       
    83 
       
    84 /**
       
    85 Factory function for this class
       
    86 @return a new CEndTaskTestDocument instance.
       
    87 */
       
    88 CTestDocument* CTestDocument::NewL(CEikApplication& aApp)
       
    89 	{
       
    90 	return new(ELeave) CTestDocument(aApp);
       
    91 	}
       
    92 
       
    93 
       
    94 /**
       
    95 Called by the UI framework to construct the application UI class. 
       
    96 Note that the app UI's ConstructL() is called by the UI framework.
       
    97 */
       
    98 CEikAppUi* CTestDocument::CreateAppUiL()
       
    99 	{
       
   100 	return new(ELeave) CTestAppUi();
       
   101 	}
       
   102 
       
   103 CTestAppUi::CTestAppUi()
       
   104 	{
       
   105 	}
       
   106 
       
   107 CTestAppUi::~CTestAppUi()
       
   108 	{
       
   109 	}
       
   110 
       
   111 void CTestAppUi::ConstructL()
       
   112 	{
       
   113 	//This appplication is used to define the property for emergency call. Uid3 of the application should be 
       
   114 	//same as the emergency call property uid. This is to allow the application to define the property as
       
   115 	//emergency call property uid falls under system range.
       
   116 
       
   117 	//Define the property for emergency call
       
   118 	_LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
       
   119 	TInt result = RProperty::Define(CSsmUiSpecific::EmergencyCallPropertyCategory(), CSsmUiSpecific::EmergencyCallPropertyKey(), RProperty::EInt,
       
   120 									KAllowAllPolicy, KAllowAllPolicy);
       
   121 	
       
   122 	_LIT(KPRINT,"Return code for RProperty::Define for emergency call property key - %d -");
       
   123 	RDebug::Print(KPRINT, result);
       
   124 	User::LeaveIfError(result);
       
   125 
       
   126 	// Complete the UI framework's construction of the App UI.
       
   127 	BaseConstructL(CEikAppUi::ENoAppResourceFile);
       
   128 	}