cryptoservices/filebasedcertificateandkeystores/test/keytool/keytool_usage.cpp
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mctkeystore.h>
       
    20 #include <f32file.h>
       
    21 #include <barsc.h>
       
    22 #include <barsread.h>
       
    23 #include <utf.h>
       
    24  
       
    25 #include "keytool_utils.h"
       
    26 #include "keytool_commands.h"
       
    27 #include "keytool_controller.h"
       
    28 
       
    29 #include <keytool.rsg> 
       
    30 
       
    31 /*static*/ CKeytoolUsage* CKeytoolUsage::NewLC(CKeyToolController* aController)
       
    32 	{
       
    33 	CKeytoolUsage* self = new (ELeave) CKeytoolUsage(aController);
       
    34 	CleanupStack::PushL(self);
       
    35 	self->ConstructL();
       
    36 	return self;
       
    37 	}
       
    38 	
       
    39 /*static*/ CKeytoolUsage* CKeytoolUsage::NewL(CKeyToolController* aController)
       
    40 	{
       
    41 	CKeytoolUsage* self = CKeytoolUsage::NewLC(aController);
       
    42 	CleanupStack::Pop(self);
       
    43 	return self;
       
    44 	}
       
    45 
       
    46 CKeytoolUsage::CKeytoolUsage(CKeyToolController* aController) : CKeyToolCommand(aController)
       
    47 	{
       
    48 	}
       
    49 
       
    50 void CKeytoolUsage::ConstructL()
       
    51 	{
       
    52 	}
       
    53 	
       
    54 CKeytoolUsage::~CKeytoolUsage()
       
    55 	{
       
    56 	}
       
    57 
       
    58 void CKeytoolUsage::RunL()
       
    59 	{
       
    60 	
       
    61 	}
       
    62 	
       
    63 void CKeytoolUsage::DoCancel()
       
    64 	{
       
    65 	
       
    66 	}
       
    67 	
       
    68 void CKeytoolUsage::DoCommandL(CUnifiedKeyStore& /*aKeyStore*/, CKeyToolParameters* aParam)
       
    69 	{
       
    70 	// Depending on parameters show the help!
       
    71 	if (!aParam->iDefault)
       
    72 		{
       
    73 		// Display general usage!
       
    74         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE);
       
    75         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE2);
       
    76         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE3);		        
       
    77         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE4);
       
    78         return;
       
    79 		}
       
    80 		
       
    81 	if (!aParam->iDefault->Compare(_L("import")) )
       
    82 		{
       
    83 		// Display detailed *import* help
       
    84         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_IMPORT);
       
    85         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_IMPORT2);
       
    86         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_IMPORT3);
       
    87         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_IMPORT4);
       
    88         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_KEYUSAGES);
       
    89         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_KEYACCESSES);	        
       
    90 		}
       
    91 	else
       
    92 	if (!aParam->iDefault->Compare(_L("list")) )
       
    93 		{
       
    94 		// Display detailed *import* help
       
    95         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_LIST);
       
    96         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_LIST2);
       
    97 		iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_LIST3);
       
    98         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_LIST4);                        
       
    99 		}
       
   100 	else
       
   101 	if (!aParam->iDefault->Compare(_L("liststores")) )
       
   102 		{
       
   103 		iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_LISTSTORES);                       
       
   104 		}
       
   105 	else
       
   106 	if (!aParam->iDefault->Compare(_L("page")) )
       
   107 		{
       
   108 		iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_PAGE);                       
       
   109 		iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_PAGE2);                       
       
   110 		}
       
   111 	else
       
   112 	if (!aParam->iDefault->Compare(_L("remove")) )
       
   113 		{
       
   114         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_REMOVE);
       
   115 		}
       
   116 	else		
       
   117 	if (!aParam->iDefault->Compare(_L("usage")) )
       
   118 		{
       
   119         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_KEYUSAGE);
       
   120         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_KEYUSAGES);
       
   121 		}
       
   122 	else
       
   123 	if (!aParam->iDefault->Compare(_L("removeuser")) )
       
   124 		{
       
   125         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_REMOVEUSER);
       
   126 		}
       
   127 	else
       
   128 	if (!aParam->iDefault->Compare(_L("setuser")) )
       
   129 		{
       
   130         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_SETUSER);
       
   131 		}
       
   132 	else
       
   133 	if (!aParam->iDefault->Compare(_L("setmanager")) )
       
   134 		{
       
   135         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_SETMANAGER);
       
   136         }
       
   137 	else
       
   138 	if (!aParam->iDefault->Compare(_L("setallusers")) )
       
   139 		{
       
   140         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_SETALLUSERS);
       
   141 		}
       
   142 	else
       
   143 	if (!aParam->iDefault->Compare(_L("noninteractive")) )
       
   144 		{
       
   145         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_NONINTERACTIVE);
       
   146         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_NONINTERACTIVE1);	        
       
   147 		}
       
   148 	else			
       
   149 	if (!aParam->iDefault->Compare(_L("access")) )
       
   150 		{
       
   151         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_KEYACCESS);
       
   152         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE_KEYACCESSES);	        
       
   153 		}
       
   154 	else
       
   155 		{
       
   156         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE);
       
   157         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE2);		
       
   158         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE3);		
       
   159         iController->DisplayLocalisedMsgL(R_KEYTOOL_USAGE4);
       
   160 		}						
       
   161 	}