upnpsharing/applicationengine/inc/upnpiconconfigurator.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 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:      Configurator class for mediaserver icons
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __UPNPICONCONFIGURATOR_H__
       
    24 #define __UPNPICONCONFIGURATOR_H__
       
    25 
       
    26 
       
    27 // Include Files
       
    28 #include <e32base.h>
       
    29 #include <upnpmediaserverclient.h>
       
    30 #include "upnpcontentserverclient.h"
       
    31 // FORWARD DECLARATIONS
       
    32 class RUpnpMediaServerClient;
       
    33 class CActiveSchedulerWait;
       
    34 class CRepository;
       
    35 class CUPnPFileSharingEngineAO;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39  *  Active object class for add icons
       
    40  *  Handles add icons.
       
    41  *  @lib upnpapplicationengine.lib
       
    42  *  @since S60 3.1
       
    43  */
       
    44 NONSHARABLE_CLASS( CUPnPIconConfigurator ): public CActive
       
    45     {
       
    46 
       
    47 public: // Constructors and destructor
       
    48 
       
    49     /**
       
    50      * C++ default constructor.
       
    51      * @since S60 3.1
       
    52      * @param CUPnPFileSharingEngine*, pointer to file sharing engine
       
    53      */
       
    54     CUPnPIconConfigurator( 
       
    55         RUpnpMediaServerClient& aMediaServer, 
       
    56         CUPnPFileSharingEngineAO& aFileShareingAO );
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     virtual ~CUPnPIconConfigurator();
       
    62 
       
    63 public: // thre icon configurator interface
       
    64 
       
    65     /**
       
    66      * Checks if icons need to be configured.
       
    67      * @return ETrue if icons are not yet configured, EFalse if they are
       
    68      */
       
    69     TBool NeedToConfigureIcons();
       
    70 
       
    71     /**
       
    72      * Configure icons for upnp mediaserver
       
    73      * Asynchronous method - wakes up given active object
       
    74      * when operation is completed.
       
    75      * @return error code
       
    76      */
       
    77     void ConfigureIconsL();
       
    78 
       
    79 protected:
       
    80 
       
    81     /**
       
    82      * Function is called when active request is ready
       
    83      * @since S60 3.1
       
    84      */
       
    85     virtual void RunL();
       
    86 
       
    87     /**
       
    88      * Cancels active request
       
    89      * @since S60 3.1
       
    90      */
       
    91     virtual void DoCancel();
       
    92 
       
    93     /**
       
    94      * RunL error handler
       
    95      * @param aError Error code
       
    96      * return See CActive description
       
    97      * @since S60 3.1
       
    98      */
       
    99     TInt RunError(TInt aError);
       
   100 
       
   101 private: // own methods
       
   102 
       
   103     /**
       
   104      * Removes all icons
       
   105      */
       
   106     void RemoveIcons();
       
   107 
       
   108     /**
       
   109      * Sets first icon
       
   110      */
       
   111     void AddIcon1L();
       
   112 
       
   113     /**
       
   114      * Sets second icon
       
   115      */
       
   116     void AddIcon2L();
       
   117 
       
   118     /**
       
   119      * Sets third icon
       
   120      */
       
   121     void AddIcon3L();
       
   122 
       
   123     /**
       
   124      * Sets fourth icon
       
   125      */
       
   126     void AddIcon4L();
       
   127 
       
   128     /**
       
   129      * Resolves the absolute icon path. The icon will be searched from
       
   130      * the same drive where this DLL is located.
       
   131      * @param relativePath relative path, without the drive, beginning with \
       
   132      * @param iconPath, output, receives absolute icon path.
       
   133      */
       
   134     void ResolveIconPath( const TDesC& relativePath, TFileName& iconPath );
       
   135 
       
   136     /**
       
   137      * Checks if icons are added (from cenrep)
       
   138      * @return true (configured) of false (icons not configured)
       
   139      */
       
   140     TBool CheckIconsAddedL();
       
   141 
       
   142 public:
       
   143 
       
   144     /**
       
   145      * Marks icons configured to cenrep
       
   146      * @param aMark true (configured) or false (not configured)
       
   147      */
       
   148     static void MarkIconsAddedL( TBool aMark );
       
   149 
       
   150 private: // data
       
   151 
       
   152     enum TConfiguratorState
       
   153         {
       
   154         EStateIdle, // ready
       
   155         EStateRemoving, // removing all currently existing icons 
       
   156                         // (only in debug mode)
       
   157         EStateAdding1, // adding first icon
       
   158         EStateAdding2, // adding second icon
       
   159         EStateAdding3, // adding third icon
       
   160         EStateAdding4 // adding fourth icon
       
   161         };
       
   162 
       
   163     /**
       
   164      * mediaserver session handle
       
   165      */
       
   166     RUpnpMediaServerClient& iMediaServer;
       
   167 
       
   168     /**
       
   169      * Indicates whether the starting sharing or stopping
       
   170      * sharing is ongoing.
       
   171      */
       
   172     TConfiguratorState iState;
       
   173 
       
   174     /**
       
   175      * icon
       
   176      */   
       
   177     CUpnpIcon* iIcon1;
       
   178     CUpnpIcon* iIcon2;
       
   179     CUpnpIcon* iIcon3;
       
   180     CUpnpIcon* iIcon4;
       
   181     
       
   182     /**
       
   183      * Sharing engine's active object
       
   184      */
       
   185     CUPnPFileSharingEngineAO& iFileShareEngineAO;
       
   186     
       
   187     };
       
   188 
       
   189 #endif  // __UPNPICONCONFIGURATOR_H__
       
   190 
       
   191 // End of file