<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -->
<!-- All rights reserved. -->
<!-- This component and the accompanying materials are made available -->
<!-- under the terms of the License "Eclipse Public License v1.0" -->
<!-- which accompanies this distribution, and is available -->
<!-- at the URL "http://www.eclipse.org/legal/epl-v10.html". -->

<componentDefinition xmlns="http://www.nokia.com/sdt/emf/component" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.graphics.tTestAlign"  defaultValue="ELeft">
		<enumElement value="ELeft"/>
		<enumElement value="ECenter"/>
		<enumElement value="ERight"/>
	</enumPropertyDeclaration>
	
	<component friendlyName="%friendlyName"
		qualifiedName="com.nokia.sdt.series60.SecretEditor"
		baseComponent="com.nokia.sdt.series60.CCoeControlBase" 
		category="Editors"
		instanceNameRoot="secret" version="1.0">
		<documentation>
			<information>%information</information>
			<helpTopic></helpTopic>
			<wizardDescription></wizardDescription>
		</documentation>
		<symbian minSDKVersion="2.0" sdkName="com.nokia.series60"
			resourceType="SECRETED" className="CEikSecretEditor" />
		<designerImages 
			smallIconFile="SecretEditor_sm.png" 
			largeIconFile="SecretEditor.png"/>
				
		<attributes>
		<attribute key="cpp-class-name">CEikSecretEditor</attribute>
			<attribute key="is-dialog-content">true</attribute>
			<attribute key="is-form-content">true</attribute>
			<attribute key="is-ccoecontrol-content">true</attribute>
			<attribute key="wants-initial-focus">true</attribute>
			<attribute key="is-setting-item-list-content">true</attribute>
			<attribute key="setting-item-class-name">CAknPasswordSettingItem</attribute>
			<attribute key="setting-item-constructor-pattern">{0},\nCAknPasswordSettingItem::EAlpha,\n{1}</attribute>
			<attribute key="data-model-cpp-type">TDes</attribute>
			<attribute key="is-dataquery-content">true</attribute>
			<attribute key="dataquery-className">CAknTextQueryDialog</attribute>
			<attribute key="rss-control-type-enum">EEikCtSecretEd</attribute>
		</attributes>
	
		<properties>
			<property name="text" category="Data" type="localizedString"
				descriptionKey="textDescription" />
			<property name="maxLength" category="Data" type="integer" default="8"
				descriptionKey="maxLengthDescription" />
		</properties>

		<extensionProperties name="container">
			<enumProperty name="font" category="Appearance" 
				type="com.nokia.sdt.series60.CEikonEnv.SystemFont"
				descriptionKey="fontDescription" />
			<enumProperty name="alignment" category="Appearance" 
				type="com.nokia.sdt.graphics.tTestAlign"
				descriptionKey="alignmentDescription" />
		</extensionProperties>

		<implementations>
			<implementation>
				<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
				<interface id="com.nokia.sdt.datamodel.adapter.IDirectLabelEdit"/>
				<interface id="com.nokia.sdt.datamodel.adapter.IDirectImageEdit"/>
				<interface id="com.nokia.sdt.datamodel.adapter.IImagePropertyRenderingInfo"/>
				<interface id="com.nokia.sdt.datamodel.adapter.IComponentValidator"/>
				<script file="SecretEditor.js" prototype="SecretEditorVisual"/>
			</implementation>
			<implementation>
				<interface id="com.nokia.sdt.datamodel.adapter.IPropertyExtenders"/>
				<script file="onlyContainerParent_propertyExtenders.js" prototype="OnlyContainerParentPropertyExtenders"/>
			</implementation>
		</implementations>

	<sourceMapping>
		<mapResource struct="SECRETED" headers="eikon.rh">
			<mapSimpleMember property="maxLength" member="num_letters"/>
		</mapResource>
		<select property="text">
			<choice value="">
			</choice>
			<choice>
				<mapResource struct="TBUF" headers="eikon.rh" id="text">
					<mapSimpleMember property="text" member="buf" />
				</mapResource>
			</choice>
		</select>
	</sourceMapping>

	<sourceGen forms="Dialog Container AknDataQuerySetData AknDataQuerySetData1 AknDataQuerySetData2">
	
		<useTemplate ids="INIT_FROM_DIALOG" />
		<useTemplate ids="INIT_FROM_CONTAINER" />
		<useTemplateGroup ids="CONTAINER_CHILD_CONTRIBS" />
		<useTemplate ids="INIT_FROM_SETTINGS_LIST" />
		
		<useTemplateGroup ids="CLASS_CONTRIBS" />
		<useTemplate ids="LAYOUT_CONTROLS" />

			<inline>
this.getCppSystemIncludes(contribs, [ "barsread.h", "stringloader.h",
									"gdi.h", "eikseced.h", "eikenv.h" ]);
			</inline>

			<template id="INIT_TEXT" phase="Initialize" forms="Container Dialog Form"><![CDATA[
<% // don't emit any code if the text setting is blank
   if (properties.text.length > 0) {
%>	{
	HBufC* text = StringLoader::LoadLC( ${Engine.getGeneratedResource(instance, "text").toUpperCase() } );
	${instanceMemberName}->SetText( *text );
	CleanupStack::PopAndDestroy( text );
	}<% } %>
]]>			</template>

		<template form="AknDataQuerySetData" phase="SetData"><![CDATA[
<% // don't emit any code if the text setting is blank
   if (properties.text.length > 0) {
%>	HBufC* text = StringLoader::LoadLC( ${Engine.getGeneratedResource(instance, "text").toUpperCase() } );
	aData.Copy( *text );
	CleanupStack::PopAndDestroy( text );
<% } %>
]]>		</template>

		<template form="AknDataQuerySetData1" phase="SetData"><![CDATA[
<% // don't emit any code if the text setting is blank
   if (properties.text.length > 0) {
%>	HBufC* text1 = StringLoader::LoadLC( ${Engine.getGeneratedResource(instance, "text").toUpperCase() } );
	aData1.Copy( *text1 );
	CleanupStack::PopAndDestroy( text1 );
<% } %>
]]>		</template>

		<template form="AknDataQuerySetData2" phase="SetData"><![CDATA[
<% // don't emit any code if the text setting is blank
   if (properties.text.length > 0) {
%>	HBufC* text2 = StringLoader::LoadLC( ${Engine.getGeneratedResource(instance, "text").toUpperCase() } );
	aData2.Copy( *text2 );
	CleanupStack::PopAndDestroy( text2 );
<% } %>
]]>		</template>

			<template id="INIT_TEXT_2" phase="Initialize" form="Container"><![CDATA[
${instanceMemberName}->AknSetAlignment( CGraphicsContext::${properties.alignment} );
${instanceMemberName}->AknSetFont( *iEikonEnv->${properties.font}() );
]]>			</template>

<!-- NOTE: secret editors are cleared out when edited

		<template id="INIT_TEXT_3" phase="Initialize" forms="SettingsList"><![CDATA[
<% if (properties.text.length > 0) {
	if (properties.text.length > properties.maxLength ) {
		error(formatString(lookupString("stringExceedsBuffer"), instanceName));
}%>	{
	HBufC* text = StringLoader::LoadLC( ${Engine.getGeneratedResource(instance, "text").toUpperCase() } );
<%	this.setupSettingItem(contribs, 1, instance, "text->Des()");
%>	CleanupStack::PopAndDestroy( text );
	}<% } %>
]]>		</template>

-->

		<useTemplateGroup ids="GenerateCommonControlEvents GenerateStateChangedEvent"/>
		<useTemplateGroup ids="GenerateRequestingFocusEvent GenerateRequestingExitEvent"/>
		<useTemplateGroup ids="GenerateRequestingCancelEvent GenerateInteractionRefusedEvent"/>
		<useTemplateGroup ids="GeneratePrepareFocusTransitionEvent"/>

		<useTemplateGroup ids="GenerateEditingStartedEvent GenerateEditingStoppedEvent" />

	</sourceGen>
		
	</component>
</componentDefinition>
	