localisation/apparchitecture/tef/tAppLaunchChecker.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 // Supporting ECOM plugin for use by  test programs that excercise
       
    15 // rule based launching of applications.
       
    16 // The classes CTAppLaunchChecker and CTAppLaunchChecker1 each implement an
       
    17 // ECOM RuleBased plugin interface.
       
    18 // 
       
    19 //
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @file 
       
    26  @internalComponent - Internal Symbian test code
       
    27 */
       
    28 
       
    29 #include <ImplementationProxy.h>
       
    30 #include "tAppLaunchChecker.h"
       
    31 #include <apacmdln.h>
       
    32 #include <W32STD.H>
       
    33 #include <apgtask.h>
       
    34 #include <coemain.h>
       
    35 #include <apaid.h>
       
    36 #include <apgcli.h>
       
    37 #include "..\tef\tRuleBasedApps\RuleBasedUID.H"
       
    38 
       
    39 
       
    40 // Define the interface UIDs
       
    41 const TImplementationProxy ImplementationTable[] = 
       
    42 	{
       
    43 	IMPLEMENTATION_PROXY_ENTRY(0x1020d467, CTAppLaunchChecker::NewL),
       
    44 	IMPLEMENTATION_PROXY_ENTRY(0x1020d468, CTAppLaunchChecker1::NewL)
       
    45 	};
       
    46 
       
    47 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    48 	{
       
    49 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
    50 	return ImplementationTable;
       
    51 	}
       
    52 
       
    53 CTAppLaunchChecker*	CTAppLaunchChecker::NewL()
       
    54 	{
       
    55 	CTAppLaunchChecker* theAppLaunchChecker = new (ELeave) CTAppLaunchChecker();
       
    56 	return theAppLaunchChecker;
       
    57 	}
       
    58 
       
    59 CTAppLaunchChecker::~CTAppLaunchChecker()
       
    60 	{
       
    61 	}
       
    62 
       
    63 /**
       
    64 The function CAppLaunchChecker::TAppLaunchCode  recieves the UID of the application to be launched.
       
    65 The function implements a rule for launching the application whose UID is supplied as the first parameter.
       
    66 The function returns  CAppLaunchChecker::EAppLaunchIndifferent if the rule is executed completly.
       
    67 */
       
    68 CAppLaunchChecker::TAppLaunchCode CTAppLaunchChecker::OkayToLaunchL(const TUid aAppToLaunch, TApaTaskList& aTaskList)
       
    69 	{ 
       
    70 	if(KUidApp4== aAppToLaunch)
       
    71 		{
       
    72 		TApaTask task = aTaskList.FindApp(KUidApp2);
       
    73 		if (task.Exists())
       
    74 			{
       
    75 			task.SendSystemEvent(EApaSystemEventShutdown);		
       
    76 			}	
       
    77 		}		
       
    78 	return CAppLaunchChecker::EAppLaunchIndifferent;
       
    79 	}
       
    80 
       
    81 //second plug-in implementation
       
    82 CTAppLaunchChecker1*	CTAppLaunchChecker1::NewL()
       
    83 	{
       
    84 	CTAppLaunchChecker1* theAppLaunchChecker = new (ELeave) CTAppLaunchChecker1();
       
    85 	return theAppLaunchChecker;
       
    86 	}
       
    87 
       
    88 CTAppLaunchChecker1::~CTAppLaunchChecker1()
       
    89 	{
       
    90 	}
       
    91 /**
       
    92 The function CAppLaunchChecker1::TAppLaunchCode  recieves the UID of the application to be launched.
       
    93 The function implements a rule for launching the application whose UID is supplied as the first parameter.
       
    94 The function returns  CAppLaunchChecker::EAppLaunchIndifferent if the rule is executed completly.
       
    95 */
       
    96 CAppLaunchChecker::TAppLaunchCode CTAppLaunchChecker1::OkayToLaunchL(const TUid aAppToLaunch, TApaTaskList& aTaskList)
       
    97 	{
       
    98 	                                                                                                                                                        
       
    99 	if(KUidApp3 == aAppToLaunch)
       
   100 		{
       
   101 		TApaTask task = aTaskList.FindApp(KUidApp1);
       
   102 		if (task.Exists())
       
   103 			{
       
   104 			task.SendSystemEvent(EApaSystemEventShutdown);
       
   105 			}	
       
   106 		}
       
   107 	else if (KUidApp1 == aAppToLaunch)
       
   108 		{
       
   109 		TApaTask task = aTaskList.FindApp(KUidApp3);
       
   110 		if (task.Exists())
       
   111 			{
       
   112 			return CAppLaunchChecker::EAppLaunchDecline;	
       
   113 			}
       
   114 		}
       
   115 		
       
   116 	return CAppLaunchChecker::EAppLaunchIndifferent;
       
   117 	}
       
   118 
       
   119 GLDEF_C TInt E32Dll()
       
   120 //
       
   121 // DLL entry point
       
   122 //
       
   123 	{
       
   124 	return KErrNone;
       
   125 	}