epoc32/include/mw/cdownloadmgruilibregistry.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cdownloadmgruilibregistry.h
     1 /*
       
     2 * Copyright (c) 2002-2004 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 the License "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:  Supports registration of UI Lib modules.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CDOWNLOADMGRUILIBREGISTRY_H
       
    21 #define CDOWNLOADMGRUILIBREGISTRY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.H>
       
    25 #include <e32base.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CDownloadMgrUiUserInteractions;
       
    29 class CDownloadMgrUiDownloadsList;
       
    30 class RHttpDownloadMgr;
       
    31 class RHttpDownload;
       
    32 class CUiLibRegistryExtension;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  This abstarct class represents an accessor for the resources of the UI Lib Registry.
       
    38 */
       
    39 NONSHARABLE_CLASS( MDownloadMgrUiLibRegModel )
       
    40     {
       
    41     public:
       
    42 
       
    43         /**
       
    44         * Third UID of the Client App, which installed UI Lib.
       
    45         * This is the UID with which RHttpDownloadMgr was connected.
       
    46         */
       
    47         virtual TUid ClientAppUid() const = 0;
       
    48 
       
    49         /**
       
    50         * Is Downloads List installed?
       
    51         */
       
    52         virtual TBool DownloadsListInstalled() const = 0;
       
    53 
       
    54         /**
       
    55         * Reference to the Downloads List.
       
    56         */
       
    57         virtual CDownloadMgrUiDownloadsList& DownloadsList() const = 0;
       
    58 
       
    59         /**
       
    60         * Is User Interactions installed?
       
    61         */
       
    62         virtual TBool UserInteractionsInstalled() const = 0;
       
    63 
       
    64         /**
       
    65         * Reference to the User Interactions.
       
    66         */
       
    67         virtual CDownloadMgrUiUserInteractions& UserInteractions() const = 0;
       
    68 
       
    69         /**
       
    70         * Reference to the observed DMgr session.
       
    71         */
       
    72         virtual RHttpDownloadMgr& DownloadMgr() const = 0;
       
    73 
       
    74         /**
       
    75         * All download in Download Manager session.
       
    76         */
       
    77         virtual TInt DownloadCount() const = 0;
       
    78 
       
    79     };
       
    80 
       
    81 /**
       
    82 *  Supports registration of a User Interactions and a Downloads List component.
       
    83 */
       
    84 NONSHARABLE_CLASS( CDownloadMgrUiLibRegistry ) : public CBase,
       
    85                                                  public MDownloadMgrUiLibRegModel
       
    86     {
       
    87     public:  // Constructors and destructor
       
    88         
       
    89         /**
       
    90         * Two-phased constructor.
       
    91         * @param aDownloadMgr The initial Download Manager session
       
    92         */
       
    93         IMPORT_C static CDownloadMgrUiLibRegistry* NewL( RHttpDownloadMgr& aDownloadMgr );
       
    94         
       
    95         /**
       
    96         * Destructor.
       
    97         */
       
    98         IMPORT_C virtual ~CDownloadMgrUiLibRegistry();
       
    99 
       
   100     public: // New functions
       
   101 
       
   102         // ******* Register User Interactions and Downloads List
       
   103 
       
   104         /**
       
   105         * Register a User Interactions.
       
   106         * The created component will be owned by the Registry.
       
   107         * @return Reference to the constructed object.
       
   108         */
       
   109         IMPORT_C CDownloadMgrUiUserInteractions& RegisterUserInteractionsL();
       
   110 
       
   111         /**
       
   112         * Register a Downloads List.
       
   113         * The created component will be owned by the Registry.
       
   114         * @return Reference to the constructed object.
       
   115         */
       
   116         IMPORT_C CDownloadMgrUiDownloadsList& RegisterDownloadsListL();
       
   117 
       
   118     public: // Functions from MDownloadMgrUiLibRegModel
       
   119 
       
   120         virtual TUid ClientAppUid() const;
       
   121         virtual TBool DownloadsListInstalled() const;
       
   122         virtual CDownloadMgrUiDownloadsList& DownloadsList() const;
       
   123         virtual TBool UserInteractionsInstalled() const;
       
   124         virtual CDownloadMgrUiUserInteractions& UserInteractions() const;
       
   125         virtual RHttpDownloadMgr& DownloadMgr() const;
       
   126         virtual TInt DownloadCount() const;
       
   127 
       
   128     private: // Constructors
       
   129 
       
   130         /**
       
   131         * C++ default constructor.
       
   132         */
       
   133         CDownloadMgrUiLibRegistry( RHttpDownloadMgr& aDownloadMgr );
       
   134 
       
   135         /**
       
   136         * By default Symbian 2nd phase constructor is private.
       
   137         */
       
   138         void ConstructL();
       
   139 
       
   140     private: // New functions
       
   141 
       
   142         /**
       
   143         * Set registered UI components as observers of iDownloadMgr.
       
   144         */
       
   145         void SetUiComponentsAsObserversL();
       
   146 
       
   147         /**
       
   148         * Remove registered UI components as observers from iDownloadMgr.
       
   149         */
       
   150         void RemoveUiComponentsAsObservers();
       
   151 
       
   152     private: // Data
       
   153 
       
   154         CUiLibRegistryExtension* iExtension; ///< Extension class. Owned.
       
   155 
       
   156         // UI components
       
   157         CDownloadMgrUiUserInteractions* iUserInteractions; // Owned.
       
   158         CDownloadMgrUiDownloadsList*    iDownloadsList; // Owned.
       
   159 
       
   160         // Observed DM session
       
   161         RHttpDownloadMgr& iDownloadMgr; ///< Observed.
       
   162         TUid iClientAppUid;
       
   163     };
       
   164 
       
   165 #endif /* CDOWNLOADMGRUILIBREGISTRY_H */