epoc32/include/mw/aknpasswordsettingpage.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*     Support for passwords in Settings Pages
williamr@2
    16
*
williamr@2
    17
*
williamr@2
    18
*/
williamr@2
    19
williamr@2
    20
williamr@2
    21
#ifndef __AKNPASSWORDSETTINGPAGE__
williamr@2
    22
#define __AKNPASSWORDSETTINGPAGE__ 
williamr@2
    23
williamr@2
    24
#include <eikdef.h>
williamr@2
    25
#include <eikbtgpc.h>
williamr@2
    26
williamr@2
    27
// for the alphanumeric secret editor:
williamr@2
    28
#include <eikseced.h>
williamr@2
    29
#include <aknsettingpage.h>
williamr@2
    30
williamr@2
    31
const TInt KDefaultAlphaPasswordLength = 12;
williamr@2
    32
const TInt KDefaultNumericPasswordLength = 4;
williamr@2
    33
williamr@2
    34
/** 
williamr@2
    35
 * Structure to hold the required resources for a password confirmation sequence 
williamr@2
    36
 * This holds 3 resource IDs.  One for a query, and a note each for 
williamr@2
    37
 * success or failure
williamr@2
    38
 * This structure contains the information read in from a AVKON_PASSWORD_CONFIRMATION
williamr@2
    39
 * resource structure.
williamr@2
    40
 */
williamr@2
    41
class SAknConfirmationResource 
williamr@2
    42
{
williamr@2
    43
public:
williamr@2
    44
williamr@2
    45
	/**
williamr@2
    46
	* Resource for the password query, if non-zero
williamr@2
    47
	*/
williamr@2
    48
	TInt iEntryQueryResourceId;
williamr@2
    49
	/** 
williamr@2
    50
	* Resource for the success note, if non-zero
williamr@2
    51
	*/
williamr@2
    52
	TInt iSuccessNoteResourceId;
williamr@2
    53
	/** 
williamr@2
    54
	* Resource for the failure note, if non-zero
williamr@2
    55
	*/
williamr@2
    56
	TInt iFailureNoteResourceId;
williamr@2
    57
};
williamr@2
    58
williamr@2
    59
williamr@2
    60
/**
williamr@2
    61
 * Base class for Password editors to ensure that their general functionality is 
williamr@2
    62
 * consistent.  
williamr@2
    63
 * 
williamr@2
    64
 * All contained-editor-specific stuff should be in the derived classes.
williamr@2
    65
 *
williamr@2
    66
 * THIS CLASS IS NOT INSTANTIATABLE
williamr@2
    67
 * 
williamr@2
    68
 */
williamr@2
    69
class CAknPasswordSettingPage : public CAknSettingPage
williamr@2
    70
{
williamr@2
    71
public:
williamr@2
    72
	/**
williamr@2
    73
	*
williamr@2
    74
	* Modes to be used for the matching of password texts
williamr@2
    75
	*
williamr@2
    76
	*/
williamr@2
    77
	enum TAknPasswordMatchingMode
williamr@2
    78
	{
williamr@2
    79
	ECaseSensitive,
williamr@2
    80
	ECaseInsensitive
williamr@2
    81
	};
williamr@2
    82
public:
williamr@2
    83
	/**
williamr@2
    84
	 * Simple constructor depending only on a single resource Id and the new and old password.
williamr@2
    85
	 * Editor resource is given via the link in the setting page resource. 
williamr@2
    86
	 *
williamr@2
    87
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
    88
	 * @param aNewPassword
williamr@2
    89
	 * @param aOldPassword					password to be checked against
williamr@2
    90
	 */
williamr@2
    91
	IMPORT_C CAknPasswordSettingPage(
williamr@2
    92
		TInt aResourceID, 
williamr@2
    93
		TDes& aNewPassword, 
williamr@2
    94
		const TDesC& aOldPassword);
williamr@2
    95
williamr@2
    96
	/**
williamr@2
    97
	 * Constructor that allows separate setting page and editor resources
williamr@2
    98
	 * 
williamr@2
    99
	 * This constructor allows the use of setting page using only the editor resource.  Other combinations are also possible
williamr@2
   100
	 *
williamr@2
   101
	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
williamr@2
   102
	 *
williamr@2
   103
	 *		Editor Resource		Setting Page Resource
williamr@2
   104
	 *			present				present				Both are used (but text & number overridden)
williamr@2
   105
	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
williamr@2
   106
	 *			present				= 0					Default Avkon SP resource if used + this editor resource
williamr@2
   107
	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
williamr@2
   108
	 *	 i) control type is present, 
williamr@2
   109
	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
williamr@2
   110
	 *
williamr@2
   111
	 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
williamr@2
   112
	 * cannot initialize such a member without allocation or having an internal dummy buffer.
williamr@2
   113
	 * This descriptor must be owned by the client since not copy is taken until ExecuteLD()
williamr@2
   114
	 *
williamr@2
   115
	 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other 
williamr@2
   116
	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
williamr@2
   117
	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed).  Note, however, that text or number given via the 
williamr@2
   118
	 * specific API for setting them, WILL override resource.
williamr@2
   119
	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
williamr@2
   120
	 * 
williamr@2
   121
	 * @param aSettingTitleText	Text at top of setting pane; EXTERNALLY OWNED
williamr@2
   122
	 * @param aSettingNumber		Number at top left (if present)
williamr@2
   123
	 * @param aControlType			Determines the type constructed and how its resource is read
williamr@2
   124
	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
williamr@2
   125
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   126
	 * @param aNewPassword			Descriptor for the new password
williamr@2
   127
	 * @param aOldPassword			Descriptor for the old password
williamr@2
   128
	 */
williamr@2
   129
williamr@2
   130
	IMPORT_C CAknPasswordSettingPage(	const TDesC* aSettingTitleText, 
williamr@2
   131
								TInt aSettingNumber, 
williamr@2
   132
								TInt aControlType,
williamr@2
   133
								TInt aEditorResourceId, 
williamr@2
   134
								TInt aSettingPageResourceId,	
williamr@2
   135
								TDes& aNewPassword, 
williamr@2
   136
								const TDesC& aOldPassword );
williamr@2
   137
williamr@2
   138
williamr@2
   139
	/**
williamr@2
   140
	* Set the resource Id set for the old password confirmation sequence. 
williamr@2
   141
	* Resource Id should be for a AVKON_PASSWORD_CONFIRMATION structure
williamr@2
   142
	*
williamr@2
   143
	* @param resource for old password sequence
williamr@2
   144
	*/
williamr@2
   145
	IMPORT_C void SetOldPasswordConfirmationResourceId( TInt aOldPasswordConfirmationResourceId ); 
williamr@2
   146
williamr@2
   147
	/** 
williamr@2
   148
	* Set the resource Id set for the new password confirmation sequence
williamr@2
   149
	* Resource Id should be for a AVKON_PASSWORD_CONFIRMATION structure
williamr@2
   150
	*
williamr@2
   151
	* @param resource for new password sequence
williamr@2
   152
	*/
williamr@2
   153
	IMPORT_C void SetNewPasswordConfirmationResourceId( TInt aNewPasswordConfirmationResourceId );
williamr@2
   154
	
williamr@2
   155
	/**
williamr@2
   156
	* Sets the matching mode to be used in the password validation
williamr@2
   157
	* @param	one of ECaseSensitive or ECaseInsensitive
williamr@2
   158
	*/
williamr@2
   159
	IMPORT_C void SetMatchingMode( TAknPasswordMatchingMode aMode );
williamr@2
   160
	
williamr@2
   161
	/**
williamr@2
   162
	* Returns the matching mode to be used in the password validation
williamr@2
   163
	* @return	one of ECaseSensitive or ECaseInsensitive
williamr@2
   164
	*/
williamr@2
   165
	IMPORT_C TAknPasswordMatchingMode MatchingMode();
williamr@2
   166
	
williamr@2
   167
	
williamr@2
   168
	/**
williamr@2
   169
	* Sets the maximum length of the password. The user will not be able to enter
williamr@2
   170
	* more than this number of characters/keys
williamr@2
   171
	*
williamr@2
   172
	* @param	set the max length
williamr@2
   173
	*/
williamr@2
   174
	IMPORT_C void SetMaxPasswordLength( TInt aLength );
williamr@2
   175
	
williamr@2
   176
	
williamr@2
   177
	/** 
williamr@2
   178
	* Access the maximum password length
williamr@2
   179
	*
williamr@2
   180
	* @return the maximum length
williamr@2
   181
	*/
williamr@2
   182
	IMPORT_C TInt MaxPasswordLength() const;
williamr@2
   183
williamr@2
   184
    /**
williamr@2
   185
    *  From CCoeControl
williamr@2
   186
    */
williamr@2
   187
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   188
protected:
williamr@2
   189
williamr@2
   190
	/**
williamr@2
   191
	* Implementation of CAknSettingPage framework method
williamr@2
   192
	* Called when the client's value is updated. Frequency of calling depends 
williamr@2
   193
	* upon the flag passed to ExecuteLD()
williamr@2
   194
	*
williamr@2
   195
	*/
williamr@2
   196
	IMPORT_C virtual void UpdateSettingL();
williamr@2
   197
	
williamr@2
   198
	
williamr@2
   199
	/** 
williamr@2
   200
	* Implementation of CAknSettingPage framework method
williamr@2
   201
	* Perform necessary operations when the user accepts. 
williamr@2
   202
	* Default implementation has password checking 
williamr@2
   203
	*/
williamr@2
   204
	IMPORT_C virtual void AcceptSettingL();
williamr@2
   205
	
williamr@2
   206
	
williamr@2
   207
	/**
williamr@2
   208
	* Acts upon changes in the hosted control's state. 
williamr@2
   209
	*
williamr@2
   210
	* @param	aControl	The control changing its state (not used)
williamr@2
   211
	* @param	aEventType	The type of control event 
williamr@2
   212
	*/
williamr@2
   213
	IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType );	
williamr@2
   214
	
williamr@2
   215
	
williamr@2
   216
	/** 
williamr@2
   217
	* Implementation of CAknSettingPage framework method
williamr@2
   218
	*  
williamr@2
   219
	* Method called after full construction and activation of the setting page
williamr@2
   220
	*/
williamr@2
   221
	IMPORT_C virtual void PostDisplayInitL();
williamr@2
   222
	
williamr@2
   223
	/** 
williamr@2
   224
	* Implementation of CAknSettingPage framework method
williamr@2
   225
	* Called after display of the setting page, but before the start of the 
williamr@2
   226
	* setting page "waiting".  
williamr@2
   227
	*
williamr@2
   228
	* If overidden, would normally hold a query.
williamr@2
   229
	*
williamr@2
   230
	* @return	ETrue if OK to carry on; EFalse if setting it to be abandoned
williamr@2
   231
	*
williamr@2
   232
	*/
williamr@2
   233
	IMPORT_C virtual TBool PostDisplayCheckL();
williamr@2
   234
	
williamr@2
   235
	
williamr@2
   236
	/** 
williamr@2
   237
	* Implementation of CAknSettingPage framework method
williamr@2
   238
	*
williamr@2
   239
	*/
williamr@2
   240
	IMPORT_C virtual TBool OkToExitL(TBool aAccept);
williamr@2
   241
williamr@2
   242
	/** 
williamr@2
   243
	* Implementation of CCoeControl framework method
williamr@2
   244
	* Called when the control has its size changed
williamr@2
   245
	*/
williamr@2
   246
	IMPORT_C virtual void SizeChanged();
williamr@2
   247
	
williamr@2
   248
	/** 
williamr@2
   249
	* Implementation of CCoeControl framework method
williamr@2
   250
	* Called when required to draw
williamr@2
   251
	*/
williamr@2
   252
	IMPORT_C void Draw(const TRect& aRect) const;
williamr@2
   253
williamr@2
   254
	/**
williamr@2
   255
	* Only implemented in the derived classes
williamr@2
   256
	* Updates the text in the referenced password descriptor using a utility routine.
williamr@2
   257
	*
williamr@2
   258
	*/
williamr@2
   259
	virtual void UpdateTextL() = 0;
williamr@2
   260
williamr@2
   261
	/**
williamr@2
   262
	* Framework for password handling
williamr@2
   263
	* Called when the old password is to be confirmed
williamr@2
   264
	* @param	aPassword	old password
williamr@2
   265
	* @param	aResourceId	AVKON_PASSWORD_CONFIRMATION id to use
williamr@2
   266
	*/
williamr@2
   267
	IMPORT_C virtual TBool ExecuteOldPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId );
williamr@2
   268
		
williamr@2
   269
	/**
williamr@2
   270
	* Framework for password handling
williamr@2
   271
	* Called when the new password is to be confirmed
williamr@2
   272
	* @param	aPassword	new password
williamr@2
   273
	* @param	aResourceId	AVKON_PASSWORD_CONFIRMATION id to use
williamr@2
   274
	*/
williamr@2
   275
	IMPORT_C virtual TBool ExecuteNewPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId );
williamr@2
   276
		
williamr@2
   277
	/**
williamr@2
   278
	* Framework for password handling
williamr@2
   279
	* Called to compare the two passwords
williamr@2
   280
	* @param	reference (old) password
williamr@2
   281
	* @param	candidate password; password just entered
williamr@2
   282
	*/
williamr@2
   283
	IMPORT_C virtual TInt ComparePasswords( const TDesC& aRefPassword, const TDesC& aCandidatePassword, TAknPasswordMatchingMode ) const;
williamr@2
   284
williamr@2
   285
	/**
williamr@2
   286
	* Utility method
williamr@2
   287
	* Access to the old password confirmation resource
williamr@2
   288
	* @return	id for AVKON_PASSWORD_CONFIRMATION structure
williamr@2
   289
	*/
williamr@2
   290
	IMPORT_C TInt OldPasswordConfirmationResourceId() const;
williamr@2
   291
williamr@2
   292
	/**
williamr@2
   293
	* Utility method
williamr@2
   294
	* Access to the new password confirmation resource
williamr@2
   295
	* @return	id for AVKON_PASSWORD_CONFIRMATION structure
williamr@2
   296
	*/
williamr@2
   297
	IMPORT_C TInt NewPasswordConfirmationResourceId() const;
williamr@2
   298
williamr@2
   299
	/**
williamr@2
   300
	* Utility method
williamr@2
   301
	* Read in the confirmation resource structure
williamr@2
   302
	* @param	aPasswordResourceId		id to use
williamr@2
   303
	* @param	aResourceGroup		structure to fill
williamr@2
   304
	*/
williamr@2
   305
	IMPORT_C void ReadConfirmationResourceL( TInt aPasswordResourceId, SAknConfirmationResource& aResourceGroup );
williamr@2
   306
williamr@2
   307
	/**
williamr@2
   308
	* Utility method
williamr@2
   309
	* Run the password confirmation
williamr@2
   310
	*/
williamr@2
   311
	IMPORT_C TBool DoPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId, TAknPasswordMatchingMode aMatchMode, TInt& aTries );
williamr@2
   312
williamr@2
   313
	/**
williamr@2
   314
	* Utility method
williamr@2
   315
	* Access to new password candidate
williamr@2
   316
	*/
williamr@2
   317
williamr@2
   318
	IMPORT_C TDes& NewPassword() const;
williamr@2
   319
williamr@2
   320
	/**
williamr@2
   321
	* Utility method
williamr@2
   322
	* Access to old password
williamr@2
   323
	*/
williamr@2
   324
	IMPORT_C const TDesC& OldPassword() const;
williamr@2
   325
williamr@2
   326
//
williamr@2
   327
// CoeControl Framework and reserved methods
williamr@2
   328
//
williamr@2
   329
protected:
williamr@2
   330
williamr@2
   331
/**
williamr@2
   332
 * Writes the internal state of the control and its components to aStream.
williamr@2
   333
 * Does nothing in release mode.
williamr@2
   334
 * Designed to be overidden and base called by subclasses.
williamr@2
   335
 *
williamr@2
   336
 * @param	aWriteSteam		A connected write stream
williamr@2
   337
 */	
williamr@2
   338
	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   339
williamr@2
   340
private: 
williamr@2
   341
williamr@2
   342
/**
williamr@2
   343
 *	Reserved method derived from CCoeControl
williamr@2
   344
 */
williamr@2
   345
	IMPORT_C virtual void Reserved_2();
williamr@2
   346
williamr@2
   347
private:
williamr@2
   348
    /**
williamr@2
   349
    * From CAknControl
williamr@2
   350
    */
williamr@2
   351
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   352
williamr@2
   353
/**
williamr@2
   354
 * New reserved methods for CAknSettingPage hierarchy
williamr@2
   355
 */ 
williamr@2
   356
private: 
williamr@2
   357
	IMPORT_C virtual void CAknSettingPage_Reserved_1();
williamr@2
   358
	IMPORT_C virtual void CAknSettingPage_Reserved_2();
williamr@2
   359
williamr@2
   360
private:
williamr@2
   361
	TDes& iNewPassword;
williamr@2
   362
	const TDesC& iOldPassword;
williamr@2
   363
	TInt iOldPasswordConfirmationResourceId;
williamr@2
   364
	TInt iNewPasswordConfirmationResourceId;
williamr@2
   365
	TAknPasswordMatchingMode iMatchingMode;
williamr@2
   366
	TInt iMaxPasswordLength;
williamr@2
   367
williamr@2
   368
	TAknLayoutRect iSecretEditorLayoutRect;
williamr@2
   369
	TAknLayoutRect iHorizontalShadow;
williamr@2
   370
	TAknLayoutRect iVerticalShadow;
williamr@2
   371
	TAknLayoutRect iOutlineFrame;
williamr@2
   372
williamr@2
   373
	TInt iSpare_1;
williamr@2
   374
williamr@2
   375
};
williamr@2
   376
williamr@2
   377
williamr@2
   378
/** 
williamr@2
   379
 *
williamr@2
   380
 * This class is used for alphanumeric passwords
williamr@2
   381
 *
williamr@2
   382
 */
williamr@2
   383
williamr@2
   384
class CAknAlphaPasswordSettingPage : public CAknPasswordSettingPage
williamr@2
   385
{
williamr@2
   386
public:
williamr@2
   387
	/**
williamr@2
   388
	 * Simple constructor depending only on a single resource Id and the new and old password.
williamr@2
   389
	 * Editor resource is given via the link in the setting page resource. 
williamr@2
   390
	 *
williamr@2
   391
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   392
	 * @param aNewPassword
williamr@2
   393
	 * @param aOldPassword					password to be checked against
williamr@2
   394
	 */
williamr@2
   395
	IMPORT_C CAknAlphaPasswordSettingPage(
williamr@2
   396
		TInt aResourceID, 
williamr@2
   397
		TDes& aNewPassword, 
williamr@2
   398
		const TDesC& aOldPassword);
williamr@2
   399
	/**
williamr@2
   400
	 * Constructor that allows separate setting page and editor resources
williamr@2
   401
	 * 
williamr@2
   402
	 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
williamr@2
   403
	 *
williamr@2
   404
	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
williamr@2
   405
	 *
williamr@2
   406
	 *		Editor Resource		Setting Page Resource
williamr@2
   407
	 *			present				present				Both are used (but text & number overridden)
williamr@2
   408
	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
williamr@2
   409
	 *			present				= 0					Default Avkon SP resource if used + this editor resource
williamr@2
   410
	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
williamr@2
   411
	 *	 i) control type is present, 
williamr@2
   412
	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
williamr@2
   413
	 *
williamr@2
   414
	 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
williamr@2
   415
	 * cannot initialize such a member without allocation or having an internal dummy buffer.
williamr@2
   416
	 * This descriptor must be owned by the client since not copy is taken until ExecuteLD()
williamr@2
   417
	 *
williamr@2
   418
	 * Rules for text and numbers: The rules are the same for both:  (non-zero length) text or number other 
williamr@2
   419
	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
williamr@2
   420
	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the 
williamr@2
   421
	 * specific API for setting them, WILL override resource.
williamr@2
   422
	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
williamr@2
   423
	 * 
williamr@2
   424
	 * @param aSettingTitleText		Text at top of setting pane; EXTERNALLY OWNED
williamr@2
   425
	 * @param aSettingNumber		Number at top left (if present)
williamr@2
   426
	 * @param aControlType			Determines the type constructed and how its resource is read
williamr@2
   427
	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
williamr@2
   428
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   429
	 * @param aNewPassword			Descriptor for the new password
williamr@2
   430
	 * @param aOldPassword			Descriptor for the old password
williamr@2
   431
	 */
williamr@2
   432
	IMPORT_C CAknAlphaPasswordSettingPage(	const TDesC* aSettingTitleText, 
williamr@2
   433
								TInt aSettingNumber, 
williamr@2
   434
								TInt aControlType,
williamr@2
   435
								TInt aEditorResourceId, 
williamr@2
   436
								TInt aSettingPageResourceId,	
williamr@2
   437
								TDes& aNewPassword, 
williamr@2
   438
								const TDesC& aOldPassword );
williamr@2
   439
williamr@2
   440
	/**
williamr@2
   441
	*
williamr@2
   442
	* 2nd stage construction.  This uses stored values from the constructor to allocate the 
williamr@2
   443
	* required aggregate objects, and then set the Date value. 
williamr@2
   444
	*
williamr@2
   445
	*/
williamr@2
   446
	IMPORT_C virtual void ConstructL();
williamr@2
   447
williamr@2
   448
	/**
williamr@2
   449
	* Type specific access to hosted editor
williamr@2
   450
	* @return	the hosted (alpha secret) editor
williamr@2
   451
	*/
williamr@2
   452
	IMPORT_C CEikSecretEditor* AlphaPasswordEditor();
williamr@2
   453
williamr@2
   454
    /**
williamr@2
   455
     * From CCoeControl.     
williamr@2
   456
     * Handles pointer events
williamr@2
   457
     * @param aPointerEvent     The pointer event.
williamr@2
   458
     */	 
williamr@2
   459
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   460
williamr@2
   461
protected:
williamr@2
   462
	/**
williamr@2
   463
	* Destructor
williamr@2
   464
	*/
williamr@2
   465
	IMPORT_C virtual ~CAknAlphaPasswordSettingPage();
williamr@2
   466
williamr@2
   467
    /**
williamr@2
   468
	* From CAknPasswordSettingPage - Implemented in this class
williamr@2
   469
	* Copy text from the editor to the client's descriptor
williamr@2
   470
	*/
williamr@2
   471
	IMPORT_C virtual void UpdateTextL();
williamr@2
   472
williamr@2
   473
	/**
williamr@2
   474
	* Framework for password handling
williamr@2
   475
	* Called to compare the two passwords
williamr@2
   476
	* @param	reference (old) password
williamr@2
   477
	* @param	candidate password; password just entered
williamr@2
   478
	*/
williamr@2
   479
	IMPORT_C virtual TInt ComparePasswords( const TDesC& aRefPassword, const TDesC& aCandidatePassword, TAknPasswordMatchingMode ) const;
williamr@2
   480
williamr@2
   481
//
williamr@2
   482
// CoeControl Framework and reserved methods
williamr@2
   483
//
williamr@2
   484
protected:
williamr@2
   485
williamr@2
   486
/**
williamr@2
   487
 * Writes the internal state of the control and its components to aStream.
williamr@2
   488
 * Does nothing in release mode.
williamr@2
   489
 * Designed to be overidden and base called by subclasses.
williamr@2
   490
 *
williamr@2
   491
 * @param	aWriteSteam		A connected write stream
williamr@2
   492
 */	
williamr@2
   493
	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   494
williamr@2
   495
private:
williamr@2
   496
williamr@2
   497
/**
williamr@2
   498
 *	Reserved method derived from CCoeControl
williamr@2
   499
 */
williamr@2
   500
	IMPORT_C virtual void Reserved_2();
williamr@2
   501
williamr@2
   502
private:
williamr@2
   503
    /**
williamr@2
   504
    * From CAknControl
williamr@2
   505
    */
williamr@2
   506
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   507
williamr@2
   508
/**
williamr@2
   509
 * New reserved methods for CAknSettingPage hierarchy
williamr@2
   510
 */ 
williamr@2
   511
private: 
williamr@2
   512
	IMPORT_C virtual void CAknSettingPage_Reserved_1();
williamr@2
   513
	IMPORT_C virtual void CAknSettingPage_Reserved_2();
williamr@2
   514
williamr@2
   515
private:
williamr@2
   516
    TInt iSpare;
williamr@2
   517
};
williamr@2
   518
williamr@2
   519
williamr@2
   520
/** 
williamr@2
   521
 *
williamr@2
   522
 * This class is used for numeric passwords.  The API uses text descriptors rather than
williamr@2
   523
 * integers for the PIN numbers as this is the usage
williamr@2
   524
 *
williamr@2
   525
 */
williamr@2
   526
williamr@4
   527
#include <Aknnumseced.h>
williamr@2
   528
williamr@2
   529
class CAknNumericPasswordSettingPage : public CAknPasswordSettingPage
williamr@2
   530
{
williamr@2
   531
public:
williamr@2
   532
	/**
williamr@2
   533
	 * Simple constructor depending only on a single resource Id and the new and old password.
williamr@2
   534
	 * Editor resource is given via the link in the setting page resource. 
williamr@2
   535
	 *
williamr@2
   536
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   537
	 * @param aNewPassword
williamr@2
   538
	 * @param aOldPassword					password to be checked against
williamr@2
   539
	 */
williamr@2
   540
	IMPORT_C CAknNumericPasswordSettingPage(
williamr@2
   541
		TInt aResourceID, 
williamr@2
   542
		TDes& aNewPassword, 
williamr@2
   543
		const TDesC& aOldPassword);
williamr@2
   544
	/**
williamr@2
   545
	 * Constructor that allows separate setting page and editor resources
williamr@2
   546
	 * 
williamr@2
   547
	 * This constructor allows the use of setting page using only the editor resource.  Other combinations are also possible
williamr@2
   548
	 *
williamr@2
   549
	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
williamr@2
   550
	 *
williamr@2
   551
	 *		Editor Resource		Setting Page Resource
williamr@2
   552
	 *			present				present				Both are used (but text & number overridden)
williamr@2
   553
	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
williamr@2
   554
	 *			present				= 0					Default Avkon SP resource if used + this editor resource
williamr@2
   555
	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
williamr@2
   556
	 *	 i) control type is present, 
williamr@2
   557
	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
williamr@2
   558
	 *
williamr@2
   559
	 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
williamr@2
   560
	 * cannot initialize such a member without allocation or having an internal dummy buffer.
williamr@2
   561
	 * This descriptor must be owned by the client since not copy is taken until ExecuteLD()
williamr@2
   562
	 *
williamr@2
   563
	 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other 
williamr@2
   564
	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
williamr@2
   565
	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the 
williamr@2
   566
	 * specific API for setting them, WILL override resource.
williamr@2
   567
	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
williamr@2
   568
	 * 
williamr@2
   569
	 * @param aSettingTitleText	Text at top of setting pane; EXTERNALLY OWNED
williamr@2
   570
	 * @param aSettingNumber		Number at top left (if present)
williamr@2
   571
	 * @param aControlType			Determines the type constructed and how its resource is read
williamr@2
   572
	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
williamr@2
   573
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   574
	 * @param aNewPassword			Descriptor for the new password
williamr@2
   575
	 * @param aOldPassword			Descriptor for the old password
williamr@2
   576
	 */
williamr@2
   577
	IMPORT_C CAknNumericPasswordSettingPage(	const TDesC* aSettingTitleText, 
williamr@2
   578
								TInt aSettingNumber, 
williamr@2
   579
								TInt aControlType,
williamr@2
   580
								TInt aEditorResourceId, 
williamr@2
   581
								TInt aSettingPageResourceId,	
williamr@2
   582
								TDes& aNewPassword, 
williamr@2
   583
								const TDesC& aOldPassword );
williamr@2
   584
williamr@2
   585
	/**
williamr@2
   586
	*
williamr@2
   587
	* 2nd stage construction.  This uses stored values from the conststuctor to allocate the 
williamr@2
   588
	* required aggregate objects, and then set the Date value. 
williamr@2
   589
	*
williamr@2
   590
	*/
williamr@2
   591
	IMPORT_C virtual void ConstructL();
williamr@2
   592
	
williamr@2
   593
	/**
williamr@2
   594
	* Type specific access to hosted editor
williamr@2
   595
	* @return	the hosted (numeric secret) editor
williamr@2
   596
	*/
williamr@2
   597
	IMPORT_C CAknNumericSecretEditor* NumericPasswordEditor();
williamr@2
   598
williamr@2
   599
    /**
williamr@2
   600
    * From CCoeControl.     
williamr@2
   601
    * Handles pointer events
williamr@2
   602
    * @param aPointerEvent     The pointer event.
williamr@2
   603
    */
williamr@2
   604
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   605
williamr@2
   606
protected:
williamr@2
   607
	/**
williamr@2
   608
	* Destructor
williamr@2
   609
	*/
williamr@2
   610
	IMPORT_C virtual ~CAknNumericPasswordSettingPage();
williamr@2
   611
williamr@2
   612
    /**
williamr@2
   613
	* From CAknPasswordSettingPage - Implemented in this class
williamr@2
   614
	* Copy text from the editor to the client's descriptor
williamr@2
   615
	*/
williamr@2
   616
	IMPORT_C virtual void UpdateTextL();
williamr@2
   617
williamr@2
   618
//
williamr@2
   619
// CoeControl Framework and reserved methods
williamr@2
   620
//
williamr@2
   621
protected:
williamr@2
   622
williamr@2
   623
/**
williamr@2
   624
 * Writes the internal state of the control and its components to aStream.
williamr@2
   625
 * Does nothing in release mode.
williamr@2
   626
 * Designed to be overidden and base called by subclasses.
williamr@2
   627
 *
williamr@2
   628
 * @param	aWriteSteam		A connected write stream
williamr@2
   629
 */	
williamr@2
   630
	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   631
williamr@2
   632
private:
williamr@2
   633
   
williamr@2
   634
/**
williamr@2
   635
 *	Reserved method derived from CCoeControl
williamr@2
   636
 */
williamr@2
   637
	IMPORT_C virtual void Reserved_2();
williamr@2
   638
williamr@2
   639
private:
williamr@2
   640
    /**
williamr@2
   641
    * From CAknControl
williamr@2
   642
    */
williamr@2
   643
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   644
williamr@2
   645
/**
williamr@2
   646
 * New reserved methods for CAknSettingPage hierarchy
williamr@2
   647
 */ 
williamr@2
   648
private: 
williamr@2
   649
	IMPORT_C virtual void CAknSettingPage_Reserved_1();
williamr@2
   650
	IMPORT_C virtual void CAknSettingPage_Reserved_2();
williamr@2
   651
williamr@2
   652
private:
williamr@2
   653
    TInt iSpare;
williamr@2
   654
};
williamr@2
   655
williamr@2
   656
williamr@2
   657
#endif