commonuis/CommonDialogs/src/CAknMemorySelectionEventHandler.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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 "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:  The event handler to handle events of list box in dialog.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_AKNMEMORYSELECTIONEVENTHANDLER_H
       
    21 #define C_AKNMEMORYSELECTIONEVENTHANDLER_H
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "MAknCommonDialogsEventObserver.h"
       
    27 
       
    28 class MAknMemorySelectionModel;
       
    29 class MAknMemorySelectionObserver;
       
    30 class MAknMemorySelectionDriveObserver;
       
    31 class CCoeEnv;
       
    32 class CActiveDriveMonitor;
       
    33 class CActiveRemotePropertySubscriber;
       
    34 
       
    35 /**
       
    36  *  A class that handles events reported from an UI class in memory selection.
       
    37  *
       
    38  *  @lib CommonDialogs.lib
       
    39  *  @since S60 1.2
       
    40  */
       
    41 NONSHARABLE_CLASS(CAknMemorySelectionEventHandler)
       
    42     : public CBase,
       
    43       public MAknCommonDialogsEventObserver
       
    44     {
       
    45 public:
       
    46 
       
    47 // Constructors and destructors
       
    48 
       
    49     /**
       
    50      * Static constructor.
       
    51      * Do not use aObserver parameter, useless now.
       
    52      *
       
    53      * @param aCoeEnv A pointer to control environment.
       
    54      * @param aModel A pointer to memory selection model.
       
    55      * @param aObserver A pointer to an observer which is asked if the
       
    56      *                  selected item can be selected.
       
    57      * @return Returns a pointer to an instance of itself.
       
    58      */
       
    59     static CAknMemorySelectionEventHandler* NewL(
       
    60         CCoeEnv* aCoeEnv,
       
    61         MAknMemorySelectionModel* aModel,
       
    62         MAknMemorySelectionObserver* aObserver );
       
    63 
       
    64 
       
    65     ~CAknMemorySelectionEventHandler();
       
    66 
       
    67 // Functions from base classes
       
    68 
       
    69     /**
       
    70      * From MAknCommonEventObserver.
       
    71      */
       
    72     TAction HandleEventL(
       
    73         TEvent aEvent,
       
    74         TInt& aFocusedItemIndex,
       
    75         TInt& aTopItemIndex,
       
    76         CEikButtonGroupContainer* aContainer );
       
    77 
       
    78 // New functions
       
    79 
       
    80     /**
       
    81      * Start to listen NotifyDisk & activate the AO
       
    82      */
       
    83     void StartNotifyDisk(
       
    84         MAknMemorySelectionDriveObserver* aMemoryCardObserver,
       
    85         TBool aHasRemoteDrive = EFalse );
       
    86 
       
    87     /**
       
    88      * Stop listening NotifyDisk & deactivate the AO
       
    89      */
       
    90     void StopNotifyDisk();
       
    91 
       
    92 private:
       
    93 
       
    94 // Constructors and destructors
       
    95 
       
    96     void ConstructL();
       
    97 
       
    98     /**
       
    99      * Constructor.
       
   100      * @param aCoeEnv A pointer to control environment.
       
   101      * @param aModel A pointer to memory selection model.
       
   102      * @param aObserver A pointer to an observer which is
       
   103      *        asked if the selected item can be selected.
       
   104      */
       
   105     CAknMemorySelectionEventHandler(
       
   106         CCoeEnv* aCoeEnv,
       
   107         MAknMemorySelectionModel* aModel,
       
   108         MAknMemorySelectionObserver* aObserver );
       
   109 
       
   110 // New methods
       
   111 
       
   112     /**
       
   113      * Displays password query dialog.
       
   114      * @param aPwd Descriptor where the entered password is stored.
       
   115      * @param aResourceId A resource id for query dialog.
       
   116      * @return Returns query dialog return value.
       
   117      */
       
   118     TInt ShowSimplePwdQueryL( TDes& aPwd, TInt aResourceId ) const;
       
   119 
       
   120     /**
       
   121      * Converts 16-bit descriptor to 8-bit password descriptor.
       
   122      * @param aWord Password that user entered.
       
   123      * @param aConverted Converted 8-bit password descriptor.
       
   124      */
       
   125     void ConvertCharsToPwd( TDesC& aWord, TDes8& aConverted ) const;
       
   126 
       
   127     /**
       
   128      * Tries to unlock the MMC with given password.
       
   129      * @param aPswd MMC password.
       
   130      */
       
   131     TBool UnlockMMC( TMediaPassword& aPswd ) const;
       
   132 
       
   133     /**
       
   134      * Launches password requester and tries to unlock drive.
       
   135      * @return Returns ETrue if drive was unlocked.
       
   136      * @param aDrive The drive to be unlocked.
       
   137      */
       
   138     TBool TryToUnlockDriveL( TDriveNumber aDrive );
       
   139 
       
   140 private:    // Data
       
   141 
       
   142     // Ref: Control environment
       
   143     CCoeEnv* iCoeEnv;
       
   144 
       
   145     // Ref: Model
       
   146     MAknMemorySelectionModel* iModel;
       
   147 
       
   148     /**
       
   149     * Ref: Observer, useless when multiple drive supported.
       
   150     */
       
   151     MAknMemorySelectionObserver* iObserver;
       
   152 
       
   153     /**
       
   154      * Own: drive's monitor
       
   155      */
       
   156     CActiveDriveMonitor* iDriveMonitor;
       
   157     
       
   158     /**
       
   159      * Own: subscriber for remote drive's connection
       
   160      */
       
   161     CActiveRemotePropertySubscriber* iRemotePropertySubscriber;
       
   162     
       
   163     TBool iCanceledAllActions;
       
   164     };
       
   165 
       
   166 #endif // C_AKNMEMORYSELECTIONEVENTHANDLER_H