remotestoragefw/gsplugin/inc/rsfwgsplugindrivelistcontainer.h
branchRCL_3
changeset 15 88ee4cf65e19
parent 12 87c71b25c937
child 16 1aa8c82cb4cb
equal deleted inserted replaced
12:87c71b25c937 15:88ee4cf65e19
     1 /*
       
     2 * Copyright (c) 2003 - 2005 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 control container (view) of the remote drives list view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CRSFWGSPLUGINDRIVELISTCONTAINER_H
       
    20 #define CRSFWGSPLUGINDRIVELISTCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 // System includes
       
    24 #include <eikclb.h>
       
    25 #include <akntitle.h>
       
    26 
       
    27 #include "rsfwgsplugin.hrh"
       
    28 #include "rsfwgspropertywatch.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 class CRsfwGsPlugin;
       
    33 class CRsfwMountMan;
       
    34 class CEikButtonGroupContainer;
       
    35 class CAknColumnListBox;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *  CRsfwGsPluginDriveListContainer container class
       
    41 *  @since 3.1
       
    42 *  container class for Remote Drives view
       
    43 */
       
    44 class CRsfwGsPluginDriveListContainer : public CCoeControl, 
       
    45                                                MEikListBoxObserver,
       
    46                                                MCoeForegroundObserver
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49     
       
    50     	/**
       
    51         * Constructor
       
    52         */
       
    53         CRsfwGsPluginDriveListContainer(CRsfwGsPlugin* aView);
       
    54         
       
    55         
       
    56          /**
       
    57         * Symbian OS default constructor.
       
    58         *
       
    59         * @param aRect gives the correct TRect for construction.
       
    60         */
       
    61         void ConstructL( const TRect& aRect, CRsfwMountMan* aMountMan );
       
    62 
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CRsfwGsPluginDriveListContainer();    
       
    67  
       
    68   public: // From CCoeControl
       
    69         
       
    70         /**
       
    71         * See CCoeControl
       
    72         */
       
    73         TInt CountComponentControls() const;
       
    74         
       
    75         /**
       
    76         * See CCoeControl
       
    77         */
       
    78         CCoeControl* ComponentControl( TInt aIndex ) const;
       
    79 
       
    80         /**
       
    81         * See CCoeControl
       
    82         */
       
    83         TKeyResponse OfferKeyEventL( 
       
    84             const TKeyEvent& aKeyEvent, TEventCode aType );
       
    85 
       
    86         /**
       
    87         * See CCoeControl
       
    88         */
       
    89         void SizeChanged();         
       
    90 
       
    91         /**
       
    92         * See CCoeControl
       
    93         */
       
    94         void HandleResourceChange( TInt aType );
       
    95         
       
    96         /**
       
    97          * Gets help context
       
    98          */
       
    99         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   100 
       
   101         /**
       
   102          * See CCoeControl
       
   103          */
       
   104         void FocusChanged(TDrawNow aDrawNow);
       
   105         
       
   106  public: // MCoeForegroundObserver
       
   107 
       
   108         /** Handles the drive list view coming to the foreground. */
       
   109         void HandleGainingForeground();
       
   110         /** Handles the drive list view going into the background. */
       
   111         void HandleLosingForeground();
       
   112 
       
   113         
       
   114  public: // own methods
       
   115         
       
   116         /**
       
   117         * Invokes editing on current item, in response to UI Edit command
       
   118         */
       
   119         void EditCurrentItemL();
       
   120         
       
   121         /**
       
   122         * See MEikListBoxObserver
       
   123         */
       
   124         void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   125         
       
   126         /**
       
   127         * Finds whether main list is empty
       
   128         * @return ETrue if main list is empty.
       
   129         */
       
   130         TBool IsListEmpty();
       
   131         
       
   132         /**
       
   133         * Finds whether the current item is the last item in main list
       
   134         * @return ETrue if current item is last in main list.
       
   135         */
       
   136         TBool IsLastItem();
       
   137         
       
   138         /**
       
   139         * Delete the currently focused drive. Also deletes it from CentRep
       
   140         */
       
   141         void DeleteCurrentRemoteDriveL();
       
   142         
       
   143         /**
       
   144         * Is drive connected?
       
   145         * Fetches the information from RFE
       
   146         * @param the Friendly name of the drive
       
   147         */
       
   148         TBool IsDriveConnectedL(const TDesC& aName);
       
   149         
       
   150         /**
       
   151         * Sets drive in the list to 'connected' or 'disconnected'
       
   152         * (modifies the icon)
       
   153         * @param the Friendly name of the drive
       
   154         */
       
   155         void SetDriveConnectedStateL(const TDesC& aName, TBool aConnected);
       
   156         
       
   157         /**
       
   158         * Connects the currently chose remote drive
       
   159         */
       
   160         void ConnectCurrentRemoteDriveL();
       
   161                  
       
   162         /**
       
   163         * Disconnects the remote drive
       
   164         */
       
   165         void DisconnectCurrentRemoteDriveL();
       
   166         
       
   167         /**
       
   168         * Loads remote drives from Central Repository
       
   169         * @return TInt the number of remote drives
       
   170         */
       
   171         TInt LoadRemoteDriveListArrayL();
       
   172         
       
   173         /**
       
   174         * Suggests next new remote drive name, this usually called by UI when
       
   175         * user create a new remote drive.
       
   176         * @return TDesC& new remote drive name
       
   177         */
       
   178         TDesC& GetNextRemoteDriveNameL();
       
   179         
       
   180         /**
       
   181         * Get the name of currently focused drive. Usually called by UI.
       
   182         * The pointer to buffer remains on heap, which is deleted by caller.
       
   183         * @return HBufC* pointer to currently focused remote drive name
       
   184         */
       
   185         HBufC* GetCurrentRemoteDriveNameLC();
       
   186         
       
   187          /**
       
   188         * Get the name of remote drive at index aIndex. Usually called by UI
       
   189         * @return TPtrC16 Pointer to a buffer owned by the list array
       
   190         */
       
   191         TPtrC GetRemoteDriveNameL(TInt aIndex);
       
   192         
       
   193          /**
       
   194         * Sets the model
       
   195         */   
       
   196         void SetModel(CRsfwMountMan* iMountMan);
       
   197       
       
   198          /**
       
   199         * Returns the number of remote drives in the list
       
   200         */  		
       
   201 		TInt RemoteDriveCount();
       
   202 		
       
   203         /**
       
   204         * Sets the focus
       
   205         */
       
   206         void SetFocus();
       
   207 
       
   208         /**
       
   209         * Sets the focus to given drive
       
   210         */
       
   211         void SetFocusL(const TDes& aDriveName);       
       
   212 
       
   213         /**
       
   214         * Get the ID of the current remote drive. 
       
   215         * ID is the drive letter under which the drive is mounted
       
   216         * @return TInt ID of the current remote drive
       
   217         */
       
   218        TChar GetCurrentRemoteDriveIdL();
       
   219 
       
   220 		
       
   221 		void HandleResourceChangeManual(TInt aType);
       
   222 
       
   223     private: // own methods
       
   224     
       
   225         /**
       
   226         * Perform the initial setup of the main list. Called by Constructor
       
   227         */
       
   228       void SetupListL();
       
   229           
       
   230       
       
   231         /**
       
   232         * Get Remote drive names 
       
   233         * @return CDesCArray remote drives
       
   234         */
       
   235       CDesCArray* GetRemoteDriveNamesL();
       
   236 
       
   237         /**
       
   238         * Handles the drive list view coming to the foreground.
       
   239         * Leaving variant
       
   240         */
       
   241       void HandleGainingForegroundL();
       
   242 
       
   243     public:  // data
       
   244       
       
   245       // model, not owned	
       
   246       CRsfwMountMan*           iMountMan;
       
   247       
       
   248            // for setting focus
       
   249       TInt iCurrentItemIndex;
       
   250     
       
   251     private: // data
       
   252     
       
   253     // Pointer to the main list, owned
       
   254       CAknColumnListBox* iMainList;
       
   255 
       
   256       // Pointer to the application view, not owned
       
   257       CRsfwGsPlugin* iView; // not owned
       
   258       
       
   259       // The remote drive names list array, not owned
       
   260       CDesCArray* iRemoteDriveListArray;
       
   261       
       
   262       // Buffer for holding remote drive setting name
       
   263       TBuf<KMaxFriendlyNameLength>  iSettingNewName;
       
   264       
       
   265       // Title for menu pane
       
   266       TBuf<KMaxMenuPaneTitleLength>  iTitle;
       
   267       
       
   268       // Pointer to title pane, not owned
       
   269       CAknTitlePane* iTitlePane;
       
   270       
       
   271       // P&S notifier about changes in drive connection state
       
   272       CRsfwGsPropertyWatch* iDriveConnectObserver;
       
   273       
       
   274  
       
   275     
       
   276     };
       
   277 
       
   278 #endif //CRSFWGSPLUGINDRIVELISTCONTAINER_H
       
   279             
       
   280 // End of File