uidesigner/com.nokia.sdt.series60.componentlibrary/components/transient/WaitDialog.component
changeset 0 fb279309251b
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- Copyright (c) 2006 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 <componentDefinition xmlns="http://www.nokia.com/sdt/emf/component" 
       
    10 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       
    11 
       
    12 	<component baseComponent="com.nokia.sdt.series60.NonLayoutBase" 
       
    13 		friendlyName="%friendlyName" 
       
    14 		qualifiedName="com.nokia.sdt.series60.WaitDialog" 
       
    15 		category="NotesDialogs"
       
    16 		instanceNameRoot="waitDialog"
       
    17 		version="1.0">
       
    18 		<documentation>
       
    19 			<information>%information</information>
       
    20 		</documentation>
       
    21 		<symbian sdkName="com.nokia.series60" minSDKVersion="2.0" 
       
    22 			className="CAknWaitDialog" classHelpTopic=""
       
    23 			resourceType="AVKON_CONFIRMATION_QUERY" resourceHelpTopic="" />
       
    24 		<designerImages smallIconFile="WaitDialog_sm.png" 
       
    25 			largeIconFile="WaitDialog.png"/>
       
    26 		<attributes>
       
    27 			<attribute key="is-transient-object">true</attribute>
       
    28 			<attribute key="is-non-resizable-or-moveable-layout-object">true</attribute>
       
    29 		</attributes>
       
    30 		
       
    31 		<properties>
       
    32 			<compoundProperty name="location" type="com.nokia.sdt.series60.locationProperty" category="Hidden"
       
    33 				editorClass="com.nokia.sdt.symbian.ui.editors.ReadOnlySummaryEditorFactory"/>
       
    34 			<compoundProperty name="size" type="com.nokia.sdt.series60.sizeProperty" category="Hidden"
       
    35 				editorClass="com.nokia.sdt.symbian.ui.editors.ReadOnlySummaryEditorFactory"/>
       
    36 			<property name="text" type="localizedString" default="Please wait..." category="Data"
       
    37 				descriptionKey="textDescription"
       
    38 				editorClass="com.nokia.sdt.symbian.ui.editors.ScalableTextEditorFactory" />
       
    39 			<enumProperty name="tone" type="com.nokia.sdt.series60.Query.tone" category="Data"
       
    40 				descriptionKey="toneDescription" />
       
    41 			<property name="visibilityDelay" type="boolean" category="Behavior"
       
    42 				descriptionKey="visibilityDelayDescription" default="true" />
       
    43 			<property name="canceledHandlerCode" type="string" category="Hidden"/>
       
    44 		</properties>
       
    45 		
       
    46 		<events defaultEventName="canceled">
       
    47 			<event name="canceled" category="Basic" 
       
    48 				   handlerNameTemplate="Handle{title(name)}CanceledL"
       
    49 			    descriptionKey="canceledDescription"
       
    50 				/>
       
    51 		</events>
       
    52 		
       
    53 		<implementations>
       
    54 			<implementation>
       
    55 				<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
       
    56 				<interface id="com.nokia.sdt.datamodel.adapter.IDirectLabelEdit"/>
       
    57 				<interface id="com.nokia.sdt.datamodel.adapter.ILayout"/>
       
    58 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentInstancePropertyListener"/> 
       
    59 				<script file="WaitDialog.js" prototype="WaitDialog"/>
       
    60 			</implementation>
       
    61 		</implementations>
       
    62 		
       
    63 		<sourceMapping>
       
    64 			<mapResource struct="DIALOG" headers="avkon.rh avkon.rsg eikon.rh">
       
    65 				<mapBitmaskMember property="." member="flags" includedProperties="" >
       
    66 					<!-- initial blank entry forces bits on -->
       
    67 					<mapBitmaskValue properties="" value="EAknWaitNoteFlags" />
       
    68 				</mapBitmaskMember>
       
    69 				<mapFixedMember member="buttons" value="R_AVKON_SOFTKEYS_CANCEL" />			
       
    70 		        <mapResourceMember property="." member="items[0]" struct="DLG_LINE" headers="avkon.rh">
       
    71 					<mapFixedMember member="type" value="EAknCtNote" />			
       
    72 					<mapEnumMember property="." member="id" uniqueValue="*"
       
    73 						nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_DIALOG_LINE_ID" />
       
    74 		        	<mapResourceMember property="." member="control" struct="AVKON_NOTE" headers="avkon.rh">
       
    75 						<mapFixedMember member="layout" value="EWaitLayout" />			
       
    76 						<mapSimpleMember property="text" member="singular_label" />
       
    77 						<mapFixedMember member="animation" value="R_QGN_GRAF_WAIT_BAR_ANIM" />
       
    78 			        </mapResourceMember>
       
    79 		        </mapResourceMember>
       
    80 			</mapResource>
       
    81 		</sourceMapping>
       
    82 		
       
    83 		<sourceGen>
       
    84 		
       
    85 			<template phase="HeaderIncludes"><![CDATA[
       
    86 #include <aknwaitdialog.h>
       
    87 ]]>			</template>
       
    88 
       
    89 			<template phase="ClassMethods">
       
    90 void Execute${instanceName$title}LD( const TDesC* aOverrideText = NULL );
       
    91 void Remove${instanceName$title}L();
       
    92 			</template>
       
    93 			
       
    94 			<template phase="InstanceVariables">
       
    95 CAknWaitDialog* ${instanceMemberName};
       
    96 			</template>	
       
    97 			
       
    98 				<template phase="Destroy">
       
    99 TRAPD( err_${instanceName$title}, Remove${instanceName$title}L() );
       
   100 				</template>
       
   101 			
       
   102 			<defineLocation id="ExecuteMethodLocation" baseLocation="MAIN_FILE" 
       
   103 				owned="true"
       
   104 				location="function(${className}::Execute${instanceName$title}LD(const TDesC*))">
       
   105 				<template>
       
   106 /**
       
   107  * Execute the wait dialog for ${instanceName}. This routine returns
       
   108  * while the dialog is showing. It will be closed and destroyed when
       
   109  * Remove${instanceName$title}L() or the user selects the Cancel soft key.
       
   110  * @param aOverrideText optional override text. When null the text configured
       
   111  * in the UI Designer is used.
       
   112  */
       
   113 void ${className}::Execute${instanceName$title}LD( const TDesC* aOverrideText )
       
   114 	{
       
   115 	}
       
   116 				</template>
       
   117 			</defineLocation>
       
   118 			<template location="ExecuteMethodLocation"><![CDATA[
       
   119 <% var visibilityDelayOff = (!instance.properties.visibilityDelay) ? "ETrue" : "EFalse"; 
       
   120 %>${instanceMemberName} = new ( ELeave ) CAknWaitDialog( 
       
   121 		reinterpret_cast< CEikDialog** >( &${instanceMemberName} ), ${visibilityDelayOff} );
       
   122 <% if (properties.tone != "ENoTone") { 
       
   123 %>${instanceMemberName}->SetTone( CAknNoteDialog::${properties.tone} );
       
   124 <% } 
       
   125 %>if ( aOverrideText != NULL )
       
   126 	{
       
   127 	${instanceMemberName}->SetTextL( *aOverrideText );
       
   128 	}
       
   129 ${instanceMemberName}->ExecuteLD( ${resourceName$upper} );
       
   130 ]]>			</template>
       
   131 
       
   132 			<defineLocation id="RemoveMethodLocation" baseLocation="MAIN_FILE" 
       
   133 				owned="true"
       
   134 				location="function(${className}::Remove${instanceName$title}L())">
       
   135 				<template>
       
   136 /**
       
   137  * Close and dispose of the wait dialog for ${instanceName}
       
   138  */
       
   139 void ${className}::Remove${instanceName$title}L()
       
   140 	{
       
   141 	}
       
   142 				</template>
       
   143 			</defineLocation>
       
   144 			<template location="RemoveMethodLocation"><![CDATA[
       
   145 if ( ${instanceMemberName} != NULL )
       
   146 	{
       
   147 	${instanceMemberName}->SetCallback( NULL );
       
   148 	${instanceMemberName}->ProcessFinishedL();    // deletes the dialog
       
   149 	${instanceMemberName} = NULL;
       
   150 	}<% if (instance.events['canceled'] != null) {%>
       
   151 delete ${instanceMemberName}Callback;
       
   152 ${instanceMemberName}Callback = NULL;
       
   153 <% } %>
       
   154  ]]>			</template>
       
   155 
       
   156 <!-- BEGIN EVENT canceled -->
       
   157 			<templateGroup id="ProgressDialogCanceledEvent" ifEvents="canceled">
       
   158 
       
   159 				<template phase="InstanceVariables">
       
   160 class CProgressDialogCallback;
       
   161 CProgressDialogCallback* ${instanceMemberName}Callback;
       
   162 				</template>	
       
   163 			
       
   164 				<template id="HandlerDecl" phase="UserHandlers"><![CDATA[
       
   165 void ${event.handlerName}( CAknProgressDialog* aDialog );
       
   166 ]]>				</template>
       
   167 
       
   168 				<defineLocation id="MProgressDialogCallbackSupport" baseLocation="CLASS"
       
   169 						owned="false" 
       
   170 						location="region(MProgressDialogCallback support)">
       
   171 					<template><![CDATA[
       
   172 private: <% contrib.indentAdjust(-1); %>
       
   173 typedef void ( ${handlerClassName}::*ProgressDialogEventHandler )( 
       
   174 		CAknProgressDialog* aProgressDialog );
       
   175 
       
   176 /**
       
   177  * This is a helper class for progress/wait dialog callbacks. It routes the dialog's
       
   178  * cancel notification to the handler function for the cancel event.
       
   179  */
       
   180 class CProgressDialogCallback : public CBase, public MProgressDialogCallback
       
   181 	{ 
       
   182 	public:
       
   183 		CProgressDialogCallback( 
       
   184 				${handlerClassName}* aHandlerObj, 
       
   185 				CAknProgressDialog* aDialog, 
       
   186 				ProgressDialogEventHandler aHandler ) :
       
   187 			handlerObj( aHandlerObj ), dialog( aDialog ), handler( aHandler )
       
   188 			{}
       
   189 			
       
   190 		void DialogDismissedL( TInt aButtonId ) 
       
   191 			{
       
   192 			( handlerObj->*handler )( dialog );
       
   193 			}
       
   194 	private:
       
   195 		${handlerClassName}* handlerObj;
       
   196 		CAknProgressDialog* dialog;
       
   197 		ProgressDialogEventHandler handler;
       
   198 	};
       
   199 	
       
   200 ]]>					</template>
       
   201 				</defineLocation>
       
   202 				<template id="RealizeMProgressDialogCallbackSupport" location="MProgressDialogCallbackSupport"/>
       
   203 				
       
   204 				<template location="ExecuteMethodLocation"><![CDATA[
       
   205 ${instanceMemberName}Callback = new ( ELeave ) CProgressDialogCallback( 
       
   206 	this, ${instanceMemberName}, &${handlerClassName}::${event.handlerName} );
       
   207 ${instanceMemberName}->SetCallback( ${instanceMemberName}Callback );
       
   208 ]]>				</template>
       
   209 				
       
   210 				<defineLocation id="ProgressDialogCanceledHandler" baseLocation="MAIN_FILE"
       
   211 					owned="false"
       
   212 					isEventHandler="true"
       
   213 					location="function(${handlerClassName}::${event.handlerName}(CAknProgressDialog*))">
       
   214 					<template><![CDATA[
       
   215 /** 
       
   216  * Handle the canceled event.
       
   217  */
       
   218 void ${handlerClassName}::${event.handlerName}( CAknProgressDialog* /* aDialog */ )
       
   219 	{
       
   220 <% var code = instance.properties.canceledHandlerCode;
       
   221    if (code != "") { 
       
   222 %>	${code} 
       
   223 <% } else { 
       
   224 %>	// TODO: implement ${event.eventName} event handler
       
   225 <% } %>	}
       
   226 ]]>				
       
   227 					</template>
       
   228 				</defineLocation>
       
   229 				<template id="RealizeHandler" location="ProgressDialogCanceledHandler"/>
       
   230 
       
   231 			</templateGroup>
       
   232 <!-- END EVENT canceled -->
       
   233 
       
   234 		</sourceGen>
       
   235 	</component>
       
   236 	
       
   237 </componentDefinition>