epoc32/include/mw/aknpasswordsettingpage.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/aknpasswordsettingpage.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/aknpasswordsettingpage.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,657 @@
     1.4 -aknpasswordsettingpage.h
     1.5 +/*
     1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description: 
    1.19 +*     Support for passwords in Settings Pages
    1.20 +*
    1.21 +*
    1.22 +*/
    1.23 +
    1.24 +
    1.25 +#ifndef __AKNPASSWORDSETTINGPAGE__
    1.26 +#define __AKNPASSWORDSETTINGPAGE__ 
    1.27 +
    1.28 +#include <eikdef.h>
    1.29 +#include <eikbtgpc.h>
    1.30 +
    1.31 +// for the alphanumeric secret editor:
    1.32 +#include <eikseced.h>
    1.33 +#include <aknsettingpage.h>
    1.34 +
    1.35 +const TInt KDefaultAlphaPasswordLength = 12;
    1.36 +const TInt KDefaultNumericPasswordLength = 4;
    1.37 +
    1.38 +/** 
    1.39 + * Structure to hold the required resources for a password confirmation sequence 
    1.40 + * This holds 3 resource IDs.  One for a query, and a note each for 
    1.41 + * success or failure
    1.42 + * This structure contains the information read in from a AVKON_PASSWORD_CONFIRMATION
    1.43 + * resource structure.
    1.44 + */
    1.45 +class SAknConfirmationResource 
    1.46 +{
    1.47 +public:
    1.48 +
    1.49 +	/**
    1.50 +	* Resource for the password query, if non-zero
    1.51 +	*/
    1.52 +	TInt iEntryQueryResourceId;
    1.53 +	/** 
    1.54 +	* Resource for the success note, if non-zero
    1.55 +	*/
    1.56 +	TInt iSuccessNoteResourceId;
    1.57 +	/** 
    1.58 +	* Resource for the failure note, if non-zero
    1.59 +	*/
    1.60 +	TInt iFailureNoteResourceId;
    1.61 +};
    1.62 +
    1.63 +
    1.64 +/**
    1.65 + * Base class for Password editors to ensure that their general functionality is 
    1.66 + * consistent.  
    1.67 + * 
    1.68 + * All contained-editor-specific stuff should be in the derived classes.
    1.69 + *
    1.70 + * THIS CLASS IS NOT INSTANTIATABLE
    1.71 + * 
    1.72 + */
    1.73 +class CAknPasswordSettingPage : public CAknSettingPage
    1.74 +{
    1.75 +public:
    1.76 +	/**
    1.77 +	*
    1.78 +	* Modes to be used for the matching of password texts
    1.79 +	*
    1.80 +	*/
    1.81 +	enum TAknPasswordMatchingMode
    1.82 +	{
    1.83 +	ECaseSensitive,
    1.84 +	ECaseInsensitive
    1.85 +	};
    1.86 +public:
    1.87 +	/**
    1.88 +	 * Simple constructor depending only on a single resource Id and the new and old password.
    1.89 +	 * Editor resource is given via the link in the setting page resource. 
    1.90 +	 *
    1.91 +	 * @param aSettingPageResourceId		Setting Page to use (if present)
    1.92 +	 * @param aNewPassword
    1.93 +	 * @param aOldPassword					password to be checked against
    1.94 +	 */
    1.95 +	IMPORT_C CAknPasswordSettingPage(
    1.96 +		TInt aResourceID, 
    1.97 +		TDes& aNewPassword, 
    1.98 +		const TDesC& aOldPassword);
    1.99 +
   1.100 +	/**
   1.101 +	 * Constructor that allows separate setting page and editor resources
   1.102 +	 * 
   1.103 +	 * This constructor allows the use of setting page using only the editor resource.  Other combinations are also possible
   1.104 +	 *
   1.105 +	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
   1.106 +	 *
   1.107 +	 *		Editor Resource		Setting Page Resource
   1.108 +	 *			present				present				Both are used (but text & number overridden)
   1.109 +	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
   1.110 +	 *			present				= 0					Default Avkon SP resource if used + this editor resource
   1.111 +	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
   1.112 +	 *	 i) control type is present, 
   1.113 +	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
   1.114 +	 *
   1.115 +	 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
   1.116 +	 * cannot initialize such a member without allocation or having an internal dummy buffer.
   1.117 +	 * This descriptor must be owned by the client since not copy is taken until ExecuteLD()
   1.118 +	 *
   1.119 +	 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other 
   1.120 +	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
   1.121 +	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed).  Note, however, that text or number given via the 
   1.122 +	 * specific API for setting them, WILL override resource.
   1.123 +	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
   1.124 +	 * 
   1.125 +	 * @param aSettingTitleText	Text at top of setting pane; EXTERNALLY OWNED
   1.126 +	 * @param aSettingNumber		Number at top left (if present)
   1.127 +	 * @param aControlType			Determines the type constructed and how its resource is read
   1.128 +	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
   1.129 +	 * @param aSettingPageResourceId		Setting Page to use (if present)
   1.130 +	 * @param aNewPassword			Descriptor for the new password
   1.131 +	 * @param aOldPassword			Descriptor for the old password
   1.132 +	 */
   1.133 +
   1.134 +	IMPORT_C CAknPasswordSettingPage(	const TDesC* aSettingTitleText, 
   1.135 +								TInt aSettingNumber, 
   1.136 +								TInt aControlType,
   1.137 +								TInt aEditorResourceId, 
   1.138 +								TInt aSettingPageResourceId,	
   1.139 +								TDes& aNewPassword, 
   1.140 +								const TDesC& aOldPassword );
   1.141 +
   1.142 +
   1.143 +	/**
   1.144 +	* Set the resource Id set for the old password confirmation sequence. 
   1.145 +	* Resource Id should be for a AVKON_PASSWORD_CONFIRMATION structure
   1.146 +	*
   1.147 +	* @param resource for old password sequence
   1.148 +	*/
   1.149 +	IMPORT_C void SetOldPasswordConfirmationResourceId( TInt aOldPasswordConfirmationResourceId ); 
   1.150 +
   1.151 +	/** 
   1.152 +	* Set the resource Id set for the new password confirmation sequence
   1.153 +	* Resource Id should be for a AVKON_PASSWORD_CONFIRMATION structure
   1.154 +	*
   1.155 +	* @param resource for new password sequence
   1.156 +	*/
   1.157 +	IMPORT_C void SetNewPasswordConfirmationResourceId( TInt aNewPasswordConfirmationResourceId );
   1.158 +	
   1.159 +	/**
   1.160 +	* Sets the matching mode to be used in the password validation
   1.161 +	* @param	one of ECaseSensitive or ECaseInsensitive
   1.162 +	*/
   1.163 +	IMPORT_C void SetMatchingMode( TAknPasswordMatchingMode aMode );
   1.164 +	
   1.165 +	/**
   1.166 +	* Returns the matching mode to be used in the password validation
   1.167 +	* @return	one of ECaseSensitive or ECaseInsensitive
   1.168 +	*/
   1.169 +	IMPORT_C TAknPasswordMatchingMode MatchingMode();
   1.170 +	
   1.171 +	
   1.172 +	/**
   1.173 +	* Sets the maximum length of the password. The user will not be able to enter
   1.174 +	* more than this number of characters/keys
   1.175 +	*
   1.176 +	* @param	set the max length
   1.177 +	*/
   1.178 +	IMPORT_C void SetMaxPasswordLength( TInt aLength );
   1.179 +	
   1.180 +	
   1.181 +	/** 
   1.182 +	* Access the maximum password length
   1.183 +	*
   1.184 +	* @return the maximum length
   1.185 +	*/
   1.186 +	IMPORT_C TInt MaxPasswordLength() const;
   1.187 +
   1.188 +    /**
   1.189 +    *  From CCoeControl
   1.190 +    */
   1.191 +    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   1.192 +protected:
   1.193 +
   1.194 +	/**
   1.195 +	* Implementation of CAknSettingPage framework method
   1.196 +	* Called when the client's value is updated. Frequency of calling depends 
   1.197 +	* upon the flag passed to ExecuteLD()
   1.198 +	*
   1.199 +	*/
   1.200 +	IMPORT_C virtual void UpdateSettingL();
   1.201 +	
   1.202 +	
   1.203 +	/** 
   1.204 +	* Implementation of CAknSettingPage framework method
   1.205 +	* Perform necessary operations when the user accepts. 
   1.206 +	* Default implementation has password checking 
   1.207 +	*/
   1.208 +	IMPORT_C virtual void AcceptSettingL();
   1.209 +	
   1.210 +	
   1.211 +	/**
   1.212 +	* Acts upon changes in the hosted control's state. 
   1.213 +	*
   1.214 +	* @param	aControl	The control changing its state (not used)
   1.215 +	* @param	aEventType	The type of control event 
   1.216 +	*/
   1.217 +	IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType );	
   1.218 +	
   1.219 +	
   1.220 +	/** 
   1.221 +	* Implementation of CAknSettingPage framework method
   1.222 +	*  
   1.223 +	* Method called after full construction and activation of the setting page
   1.224 +	*/
   1.225 +	IMPORT_C virtual void PostDisplayInitL();
   1.226 +	
   1.227 +	/** 
   1.228 +	* Implementation of CAknSettingPage framework method
   1.229 +	* Called after display of the setting page, but before the start of the 
   1.230 +	* setting page "waiting".  
   1.231 +	*
   1.232 +	* If overidden, would normally hold a query.
   1.233 +	*
   1.234 +	* @return	ETrue if OK to carry on; EFalse if setting it to be abandoned
   1.235 +	*
   1.236 +	*/
   1.237 +	IMPORT_C virtual TBool PostDisplayCheckL();
   1.238 +	
   1.239 +	
   1.240 +	/** 
   1.241 +	* Implementation of CAknSettingPage framework method
   1.242 +	*
   1.243 +	*/
   1.244 +	IMPORT_C virtual TBool OkToExitL(TBool aAccept);
   1.245 +
   1.246 +	/** 
   1.247 +	* Implementation of CCoeControl framework method
   1.248 +	* Called when the control has its size changed
   1.249 +	*/
   1.250 +	IMPORT_C virtual void SizeChanged();
   1.251 +	
   1.252 +	/** 
   1.253 +	* Implementation of CCoeControl framework method
   1.254 +	* Called when required to draw
   1.255 +	*/
   1.256 +	IMPORT_C void Draw(const TRect& aRect) const;
   1.257 +
   1.258 +	/**
   1.259 +	* Only implemented in the derived classes
   1.260 +	* Updates the text in the referenced password descriptor using a utility routine.
   1.261 +	*
   1.262 +	*/
   1.263 +	virtual void UpdateTextL() = 0;
   1.264 +
   1.265 +	/**
   1.266 +	* Framework for password handling
   1.267 +	* Called when the old password is to be confirmed
   1.268 +	* @param	aPassword	old password
   1.269 +	* @param	aResourceId	AVKON_PASSWORD_CONFIRMATION id to use
   1.270 +	*/
   1.271 +	IMPORT_C virtual TBool ExecuteOldPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId );
   1.272 +		
   1.273 +	/**
   1.274 +	* Framework for password handling
   1.275 +	* Called when the new password is to be confirmed
   1.276 +	* @param	aPassword	new password
   1.277 +	* @param	aResourceId	AVKON_PASSWORD_CONFIRMATION id to use
   1.278 +	*/
   1.279 +	IMPORT_C virtual TBool ExecuteNewPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId );
   1.280 +		
   1.281 +	/**
   1.282 +	* Framework for password handling
   1.283 +	* Called to compare the two passwords
   1.284 +	* @param	reference (old) password
   1.285 +	* @param	candidate password; password just entered
   1.286 +	*/
   1.287 +	IMPORT_C virtual TInt ComparePasswords( const TDesC& aRefPassword, const TDesC& aCandidatePassword, TAknPasswordMatchingMode ) const;
   1.288 +
   1.289 +	/**
   1.290 +	* Utility method
   1.291 +	* Access to the old password confirmation resource
   1.292 +	* @return	id for AVKON_PASSWORD_CONFIRMATION structure
   1.293 +	*/
   1.294 +	IMPORT_C TInt OldPasswordConfirmationResourceId() const;
   1.295 +
   1.296 +	/**
   1.297 +	* Utility method
   1.298 +	* Access to the new password confirmation resource
   1.299 +	* @return	id for AVKON_PASSWORD_CONFIRMATION structure
   1.300 +	*/
   1.301 +	IMPORT_C TInt NewPasswordConfirmationResourceId() const;
   1.302 +
   1.303 +	/**
   1.304 +	* Utility method
   1.305 +	* Read in the confirmation resource structure
   1.306 +	* @param	aPasswordResourceId		id to use
   1.307 +	* @param	aResourceGroup		structure to fill
   1.308 +	*/
   1.309 +	IMPORT_C void ReadConfirmationResourceL( TInt aPasswordResourceId, SAknConfirmationResource& aResourceGroup );
   1.310 +
   1.311 +	/**
   1.312 +	* Utility method
   1.313 +	* Run the password confirmation
   1.314 +	*/
   1.315 +	IMPORT_C TBool DoPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId, TAknPasswordMatchingMode aMatchMode, TInt& aTries );
   1.316 +
   1.317 +	/**
   1.318 +	* Utility method
   1.319 +	* Access to new password candidate
   1.320 +	*/
   1.321 +
   1.322 +	IMPORT_C TDes& NewPassword() const;
   1.323 +
   1.324 +	/**
   1.325 +	* Utility method
   1.326 +	* Access to old password
   1.327 +	*/
   1.328 +	IMPORT_C const TDesC& OldPassword() const;
   1.329 +
   1.330 +//
   1.331 +// CoeControl Framework and reserved methods
   1.332 +//
   1.333 +protected:
   1.334 +
   1.335 +/**
   1.336 + * Writes the internal state of the control and its components to aStream.
   1.337 + * Does nothing in release mode.
   1.338 + * Designed to be overidden and base called by subclasses.
   1.339 + *
   1.340 + * @param	aWriteSteam		A connected write stream
   1.341 + */	
   1.342 +	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
   1.343 +
   1.344 +private: 
   1.345 +
   1.346 +/**
   1.347 + *	Reserved method derived from CCoeControl
   1.348 + */
   1.349 +	IMPORT_C virtual void Reserved_2();
   1.350 +
   1.351 +private:
   1.352 +    /**
   1.353 +    * From CAknControl
   1.354 +    */
   1.355 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.356 +
   1.357 +/**
   1.358 + * New reserved methods for CAknSettingPage hierarchy
   1.359 + */ 
   1.360 +private: 
   1.361 +	IMPORT_C virtual void CAknSettingPage_Reserved_1();
   1.362 +	IMPORT_C virtual void CAknSettingPage_Reserved_2();
   1.363 +
   1.364 +private:
   1.365 +	TDes& iNewPassword;
   1.366 +	const TDesC& iOldPassword;
   1.367 +	TInt iOldPasswordConfirmationResourceId;
   1.368 +	TInt iNewPasswordConfirmationResourceId;
   1.369 +	TAknPasswordMatchingMode iMatchingMode;
   1.370 +	TInt iMaxPasswordLength;
   1.371 +
   1.372 +	TAknLayoutRect iSecretEditorLayoutRect;
   1.373 +	TAknLayoutRect iHorizontalShadow;
   1.374 +	TAknLayoutRect iVerticalShadow;
   1.375 +	TAknLayoutRect iOutlineFrame;
   1.376 +
   1.377 +	TInt iSpare_1;
   1.378 +
   1.379 +};
   1.380 +
   1.381 +
   1.382 +/** 
   1.383 + *
   1.384 + * This class is used for alphanumeric passwords
   1.385 + *
   1.386 + */
   1.387 +
   1.388 +class CAknAlphaPasswordSettingPage : public CAknPasswordSettingPage
   1.389 +{
   1.390 +public:
   1.391 +	/**
   1.392 +	 * Simple constructor depending only on a single resource Id and the new and old password.
   1.393 +	 * Editor resource is given via the link in the setting page resource. 
   1.394 +	 *
   1.395 +	 * @param aSettingPageResourceId		Setting Page to use (if present)
   1.396 +	 * @param aNewPassword
   1.397 +	 * @param aOldPassword					password to be checked against
   1.398 +	 */
   1.399 +	IMPORT_C CAknAlphaPasswordSettingPage(
   1.400 +		TInt aResourceID, 
   1.401 +		TDes& aNewPassword, 
   1.402 +		const TDesC& aOldPassword);
   1.403 +	/**
   1.404 +	 * Constructor that allows separate setting page and editor resources
   1.405 +	 * 
   1.406 +	 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
   1.407 +	 *
   1.408 +	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
   1.409 +	 *
   1.410 +	 *		Editor Resource		Setting Page Resource
   1.411 +	 *			present				present				Both are used (but text & number overridden)
   1.412 +	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
   1.413 +	 *			present				= 0					Default Avkon SP resource if used + this editor resource
   1.414 +	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
   1.415 +	 *	 i) control type is present, 
   1.416 +	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
   1.417 +	 *
   1.418 +	 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
   1.419 +	 * cannot initialize such a member without allocation or having an internal dummy buffer.
   1.420 +	 * This descriptor must be owned by the client since not copy is taken until ExecuteLD()
   1.421 +	 *
   1.422 +	 * Rules for text and numbers: The rules are the same for both:  (non-zero length) text or number other 
   1.423 +	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
   1.424 +	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the 
   1.425 +	 * specific API for setting them, WILL override resource.
   1.426 +	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
   1.427 +	 * 
   1.428 +	 * @param aSettingTitleText		Text at top of setting pane; EXTERNALLY OWNED
   1.429 +	 * @param aSettingNumber		Number at top left (if present)
   1.430 +	 * @param aControlType			Determines the type constructed and how its resource is read
   1.431 +	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
   1.432 +	 * @param aSettingPageResourceId		Setting Page to use (if present)
   1.433 +	 * @param aNewPassword			Descriptor for the new password
   1.434 +	 * @param aOldPassword			Descriptor for the old password
   1.435 +	 */
   1.436 +	IMPORT_C CAknAlphaPasswordSettingPage(	const TDesC* aSettingTitleText, 
   1.437 +								TInt aSettingNumber, 
   1.438 +								TInt aControlType,
   1.439 +								TInt aEditorResourceId, 
   1.440 +								TInt aSettingPageResourceId,	
   1.441 +								TDes& aNewPassword, 
   1.442 +								const TDesC& aOldPassword );
   1.443 +
   1.444 +	/**
   1.445 +	*
   1.446 +	* 2nd stage construction.  This uses stored values from the constructor to allocate the 
   1.447 +	* required aggregate objects, and then set the Date value. 
   1.448 +	*
   1.449 +	*/
   1.450 +	IMPORT_C virtual void ConstructL();
   1.451 +
   1.452 +	/**
   1.453 +	* Type specific access to hosted editor
   1.454 +	* @return	the hosted (alpha secret) editor
   1.455 +	*/
   1.456 +	IMPORT_C CEikSecretEditor* AlphaPasswordEditor();
   1.457 +
   1.458 +    /**
   1.459 +     * From CCoeControl.     
   1.460 +     * Handles pointer events
   1.461 +     * @param aPointerEvent     The pointer event.
   1.462 +     */	 
   1.463 +    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   1.464 +
   1.465 +protected:
   1.466 +	/**
   1.467 +	* Destructor
   1.468 +	*/
   1.469 +	IMPORT_C virtual ~CAknAlphaPasswordSettingPage();
   1.470 +
   1.471 +    /**
   1.472 +	* From CAknPasswordSettingPage - Implemented in this class
   1.473 +	* Copy text from the editor to the client's descriptor
   1.474 +	*/
   1.475 +	IMPORT_C virtual void UpdateTextL();
   1.476 +
   1.477 +	/**
   1.478 +	* Framework for password handling
   1.479 +	* Called to compare the two passwords
   1.480 +	* @param	reference (old) password
   1.481 +	* @param	candidate password; password just entered
   1.482 +	*/
   1.483 +	IMPORT_C virtual TInt ComparePasswords( const TDesC& aRefPassword, const TDesC& aCandidatePassword, TAknPasswordMatchingMode ) const;
   1.484 +
   1.485 +//
   1.486 +// CoeControl Framework and reserved methods
   1.487 +//
   1.488 +protected:
   1.489 +
   1.490 +/**
   1.491 + * Writes the internal state of the control and its components to aStream.
   1.492 + * Does nothing in release mode.
   1.493 + * Designed to be overidden and base called by subclasses.
   1.494 + *
   1.495 + * @param	aWriteSteam		A connected write stream
   1.496 + */	
   1.497 +	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
   1.498 +
   1.499 +private:
   1.500 +
   1.501 +/**
   1.502 + *	Reserved method derived from CCoeControl
   1.503 + */
   1.504 +	IMPORT_C virtual void Reserved_2();
   1.505 +
   1.506 +private:
   1.507 +    /**
   1.508 +    * From CAknControl
   1.509 +    */
   1.510 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.511 +
   1.512 +/**
   1.513 + * New reserved methods for CAknSettingPage hierarchy
   1.514 + */ 
   1.515 +private: 
   1.516 +	IMPORT_C virtual void CAknSettingPage_Reserved_1();
   1.517 +	IMPORT_C virtual void CAknSettingPage_Reserved_2();
   1.518 +
   1.519 +private:
   1.520 +    TInt iSpare;
   1.521 +};
   1.522 +
   1.523 +
   1.524 +/** 
   1.525 + *
   1.526 + * This class is used for numeric passwords.  The API uses text descriptors rather than
   1.527 + * integers for the PIN numbers as this is the usage
   1.528 + *
   1.529 + */
   1.530 +
   1.531 +#include <aknnumseced.h>
   1.532 +
   1.533 +class CAknNumericPasswordSettingPage : public CAknPasswordSettingPage
   1.534 +{
   1.535 +public:
   1.536 +	/**
   1.537 +	 * Simple constructor depending only on a single resource Id and the new and old password.
   1.538 +	 * Editor resource is given via the link in the setting page resource. 
   1.539 +	 *
   1.540 +	 * @param aSettingPageResourceId		Setting Page to use (if present)
   1.541 +	 * @param aNewPassword
   1.542 +	 * @param aOldPassword					password to be checked against
   1.543 +	 */
   1.544 +	IMPORT_C CAknNumericPasswordSettingPage(
   1.545 +		TInt aResourceID, 
   1.546 +		TDes& aNewPassword, 
   1.547 +		const TDesC& aOldPassword);
   1.548 +	/**
   1.549 +	 * Constructor that allows separate setting page and editor resources
   1.550 +	 * 
   1.551 +	 * This constructor allows the use of setting page using only the editor resource.  Other combinations are also possible
   1.552 +	 *
   1.553 +	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
   1.554 +	 *
   1.555 +	 *		Editor Resource		Setting Page Resource
   1.556 +	 *			present				present				Both are used (but text & number overridden)
   1.557 +	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
   1.558 +	 *			present				= 0					Default Avkon SP resource if used + this editor resource
   1.559 +	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
   1.560 +	 *	 i) control type is present, 
   1.561 +	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
   1.562 +	 *
   1.563 +	 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
   1.564 +	 * cannot initialize such a member without allocation or having an internal dummy buffer.
   1.565 +	 * This descriptor must be owned by the client since not copy is taken until ExecuteLD()
   1.566 +	 *
   1.567 +	 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other 
   1.568 +	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
   1.569 +	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the 
   1.570 +	 * specific API for setting them, WILL override resource.
   1.571 +	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
   1.572 +	 * 
   1.573 +	 * @param aSettingTitleText	Text at top of setting pane; EXTERNALLY OWNED
   1.574 +	 * @param aSettingNumber		Number at top left (if present)
   1.575 +	 * @param aControlType			Determines the type constructed and how its resource is read
   1.576 +	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
   1.577 +	 * @param aSettingPageResourceId		Setting Page to use (if present)
   1.578 +	 * @param aNewPassword			Descriptor for the new password
   1.579 +	 * @param aOldPassword			Descriptor for the old password
   1.580 +	 */
   1.581 +	IMPORT_C CAknNumericPasswordSettingPage(	const TDesC* aSettingTitleText, 
   1.582 +								TInt aSettingNumber, 
   1.583 +								TInt aControlType,
   1.584 +								TInt aEditorResourceId, 
   1.585 +								TInt aSettingPageResourceId,	
   1.586 +								TDes& aNewPassword, 
   1.587 +								const TDesC& aOldPassword );
   1.588 +
   1.589 +	/**
   1.590 +	*
   1.591 +	* 2nd stage construction.  This uses stored values from the conststuctor to allocate the 
   1.592 +	* required aggregate objects, and then set the Date value. 
   1.593 +	*
   1.594 +	*/
   1.595 +	IMPORT_C virtual void ConstructL();
   1.596 +	
   1.597 +	/**
   1.598 +	* Type specific access to hosted editor
   1.599 +	* @return	the hosted (numeric secret) editor
   1.600 +	*/
   1.601 +	IMPORT_C CAknNumericSecretEditor* NumericPasswordEditor();
   1.602 +
   1.603 +    /**
   1.604 +    * From CCoeControl.     
   1.605 +    * Handles pointer events
   1.606 +    * @param aPointerEvent     The pointer event.
   1.607 +    */
   1.608 +    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   1.609 +
   1.610 +protected:
   1.611 +	/**
   1.612 +	* Destructor
   1.613 +	*/
   1.614 +	IMPORT_C virtual ~CAknNumericPasswordSettingPage();
   1.615 +
   1.616 +    /**
   1.617 +	* From CAknPasswordSettingPage - Implemented in this class
   1.618 +	* Copy text from the editor to the client's descriptor
   1.619 +	*/
   1.620 +	IMPORT_C virtual void UpdateTextL();
   1.621 +
   1.622 +//
   1.623 +// CoeControl Framework and reserved methods
   1.624 +//
   1.625 +protected:
   1.626 +
   1.627 +/**
   1.628 + * Writes the internal state of the control and its components to aStream.
   1.629 + * Does nothing in release mode.
   1.630 + * Designed to be overidden and base called by subclasses.
   1.631 + *
   1.632 + * @param	aWriteSteam		A connected write stream
   1.633 + */	
   1.634 +	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
   1.635 +
   1.636 +private:
   1.637 +   
   1.638 +/**
   1.639 + *	Reserved method derived from CCoeControl
   1.640 + */
   1.641 +	IMPORT_C virtual void Reserved_2();
   1.642 +
   1.643 +private:
   1.644 +    /**
   1.645 +    * From CAknControl
   1.646 +    */
   1.647 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.648 +
   1.649 +/**
   1.650 + * New reserved methods for CAknSettingPage hierarchy
   1.651 + */ 
   1.652 +private: 
   1.653 +	IMPORT_C virtual void CAknSettingPage_Reserved_1();
   1.654 +	IMPORT_C virtual void CAknSettingPage_Reserved_2();
   1.655 +
   1.656 +private:
   1.657 +    TInt iSpare;
   1.658 +};
   1.659 +
   1.660 +
   1.661 +#endif