remotestoragefw/remotedriveconfigurationbiocontrol/inc/rsfwmountconfbc.h
branchRCL_3
changeset 19 88ee4cf65e19
parent 16 87c71b25c937
child 20 1aa8c82cb4cb
equal deleted inserted replaced
16:87c71b25c937 19:88ee4cf65e19
     1 /*
       
     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 "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:  Remote drive configuration BIO control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CRSFWMOUNTCONFBIOCONTROL_H
       
    20 #define CRSFWMOUNTCONFBIOCONTROL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <msgbiocontrol.h>			 // CMsgBioControl
       
    24 
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CRichBio;
       
    28 class CRsfwMountMan;
       
    29 class CRsfwMountEntry;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34  * Bio control for Remote drive settings
       
    35  */
       
    36 NONSHARABLE_CLASS(CRsfwMountConfBioControl) : 
       
    37 	public CMsgBioControl
       
    38 	{
       
    39 	public:
       
    40 	 /**
       
    41       * Two-phased constructor
       
    42       * @param aObserver Reference to the Bio control observer.
       
    43       * @param aSession Reference to Message Server session.
       
    44       * @param aId Id of the message.
       
    45       * @param aEditorOrViewerMode Flags the new Bio control as editor or viewer.
       
    46       * @param aFile filehandle.         
       
    47       * @return The newly created object.
       
    48       */
       
    49 	IMPORT_C static CMsgBioControl* NewL(MMsgBioControlObserver& aObserver,
       
    50 										 CMsvSession* aSession,
       
    51 										 TMsvId aId,
       
    52 										 TMsgBioMode aEditorOrViewerMode,	
       
    53 										 const RFile* aFile);
       
    54 	 // Destructor									 
       
    55 	~CRsfwMountConfBioControl();
       
    56 
       
    57 public: //from MMsgBioControl
       
    58 
       
    59         /**
       
    60          * Calculates and sets size for a Bio control according to aSize.
       
    61          * @param aSize A reference to the suggested size and new size.
       
    62          */
       
    63         void SetAndGetSizeL(TSize& aSize);
       
    64         
       
    65          /**
       
    66          * Adds a menu command.
       
    67          * @param aMenuPane Reference to the CEikMenuPane of the application.
       
    68          */
       
    69         void SetMenuCommandSetL(CEikMenuPane& aMenuPane);       
       
    70 
       
    71         /*
       
    72          * The command handler of the bio control.
       
    73          * The commands usually originate from a bio specific menu item being
       
    74          * selected by the user.
       
    75          * @param aCommand Id of command to be handled.
       
    76          */
       
    77         TBool HandleBioCommandL(TInt aCommand);
       
    78 
       
    79         /**
       
    80         * Returns a rectangle slice of the bio controls viewing area.
       
    81         * It is used by the CMsgEditorView class for scrolling the screen.
       
    82         * @return TRect
       
    83         */
       
    84         TRect CurrentLineRect() const;
       
    85 
       
    86         /**
       
    87          * This is used by the body container for managing focus and
       
    88          * scrolling.
       
    89          * @param aDirection The direction to be checked.
       
    90          */
       
    91         TBool IsFocusChangePossible(TMsgFocusDirection aDirection) const;
       
    92         
       
    93 
       
    94         /**
       
    95          * Returns the header text.
       
    96          * @return The header text.
       
    97          */
       
    98         HBufC* HeaderTextL(void) const;
       
    99 
       
   100         /**
       
   101          * Gives the height of the text in pixels.
       
   102          * It is used by the scrolling framework of Editor Base.
       
   103          * @return Height of the text in pixels.
       
   104          */
       
   105         TInt VirtualHeight();
       
   106 
       
   107         /**
       
   108          * Gives the cursor position in pixels.
       
   109          * It is used by the scrolling framework of Editor Base.
       
   110          * @return Cursor position in pixels.
       
   111          */
       
   112         TInt VirtualVisibleTop();
       
   113 
       
   114        /* Tells whether the cursor is in the topmost or bottom position.
       
   115          * It is used by the scrolling framework.
       
   116          * @param aLocation Specifies either top or bottom.
       
   117          * @return ETrue if the cursor is in the part specified by aLocation.
       
   118          */
       
   119         TBool IsCursorLocation(TMsgCursorLocation aLocation) const;
       
   120 
       
   121 	
       
   122 	// Functions from CCoeControl
       
   123 	TKeyResponse OfferKeyEventL(
       
   124 		const TKeyEvent& aKeyEvent,
       
   125 		TEventCode aType);
       
   126 	
       
   127 protected:
       
   128 	// Functions from CCoeControl
       
   129 	TInt CountComponentControls() const;
       
   130 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   131 	void SizeChanged();
       
   132 	void FocusChanged(TDrawNow aDrawNow);
       
   133 	void SetContainerWindowL(const CCoeControl& aContainer);
       
   134 	
       
   135 private:
       
   136 	CRsfwMountConfBioControl(
       
   137 		MMsgBioControlObserver& aObserver,
       
   138 		CMsvSession* aSession,
       
   139 		TMsvId aId,
       
   140 		TMsgBioMode aEditorOrViewerMode,
       
   141 		const RFile* aFile);
       
   142 	void ConstructL();
       
   143 
       
   144 	void DoMountL(CRsfwMountEntry*);
       
   145 	void EncodeMounterEntry(CRsfwMountEntry&, TDes&);
       
   146 	TBool isNameUniqueL(const TDesC& aFriendlyName);
       
   147 	
       
   148 	/* returns true when user has selected an unique name for the new drive
       
   149 	 *
       
   150 	 */
       
   151     TBool GetNameForNewMountL(TDes& aName);
       
   152 	
       
   153 	/**
       
   154       * Fills the viewer with data from the mount entry
       
   155       */
       
   156     void FillViewerWithDataL();
       
   157 
       
   158 	/**
       
   159       * Helper for adding to viewer.
       
   160       * @param aLabelRes Resource id for label
       
   161       * @param aValue Value text
       
   162       */
       
   163 	void AddItemL(TInt aLabelRes, const TDesC& aValue);
       
   164 
       
   165 	/**
       
   166       * Resolve the file handle of the data file that is used as input.
       
   167       * @param aFile A reference that gets the file handle.
       
   168       */
       
   169     void ResolveFileL( RFile& aFile );
       
   170     
       
   171     /**
       
   172       * This is needed because the menuPane adding is done in a different
       
   173       * way in BVA than in SMS Editor/Viewer.
       
   174       * @param aMenuPane Reference to the menu pane.
       
   175       * @param aStringRes String resource ID of the command text.
       
   176       * @param aCommandOffset Offset in the Options list.
       
   177       */
       
   178     void FileBasedAddMenuItemL(CEikMenuPane& aMenuPane,
       
   179             TInt aStringRes, TInt aCommandOffset);
       
   180 
       
   181 private:
       
   182     CRichBio* iViewer; 	// The viewer control
       
   183     
       
   184 	TBool iIsFileBased;	// ETrue if BIO Control is lauched through BVA
       
   185     
       
   186     CRsfwMountEntry* iMountEntry;  // Contains the imported mount entry
       
   187    					 		   // only one because the list in GS is not markable
       
   188 	CRsfwMountMan* iMountMan; // mount manager
       
   189 	};
       
   190 
       
   191 #endif // CRSFWMOUNTCONFBIOCONTROL_H