homescreenplugins/videochplugin/inc/videochpublisher.h
branchRCL_3
changeset 10 112a725ff2c2
parent 9 5294c000a26d
child 11 8970fbd719ec
equal deleted inserted replaced
9:5294c000a26d 10:112a725ff2c2
     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 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:    CVcxNsChPublisher class declaration*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VCXNSCHPUBLISHER_H
       
    21 #define VCXNSCHPUBLISHER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include "videocontentharvesterplugin.hrh"
       
    27 
       
    28 class MLiwInterface;
       
    29 class CLiwGenericParamList;
       
    30 class CVcxNsChPublishableData;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * Class for handling data content for matrix menu's
       
    36  * tvvideo -suite.
       
    37  * 
       
    38  * Data to show is saved into Content Publishing
       
    39  * database using Liw -framework. After publishing, it is
       
    40  * up to menu definition to update appropriate fields.  
       
    41  *
       
    42  * Class has also a methods for backing up wanted content.
       
    43  * Backing up in this sence means saving the data to the 
       
    44  * content publishing database using different content id.
       
    45  * 
       
    46  *
       
    47  *  @lib vcxnscontentharverterplugin.dll
       
    48  */
       
    49 class CVcxNsChPublisher : public CBase
       
    50     {
       
    51 public:
       
    52     // Constructors and destructor
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~CVcxNsChPublisher();
       
    58 
       
    59     /**
       
    60      * Two-phased constructor.
       
    61      * 
       
    62      * @param MLiwInterface* a pointer to sapi's Liw -inteface to publish data to     
       
    63      * @param CVcxNsChPublishableData* a pointer to data to publish
       
    64      * 
       
    65      * @return CVcxNsChPublisher*
       
    66      */
       
    67     static CVcxNsChPublisher* NewL( MLiwInterface* aCPInterface, 
       
    68                                     CVcxNsChPublishableData* aData );
       
    69 
       
    70     /**
       
    71      * Two-phased constructor.
       
    72      * 
       
    73      * @param MLiwInterface* a pointer to sapi's Liw -inteface to publish data to    
       
    74      * @param CVcxNsChPublishableData* a pointer to data to publish
       
    75      * 
       
    76      * @return  CVcxNsChPublisher*
       
    77      */
       
    78     static CVcxNsChPublisher* NewLC( MLiwInterface* aCPInterface,
       
    79                                      CVcxNsChPublishableData* aData );
       
    80 
       
    81 private:
       
    82 
       
    83     /**
       
    84      * Constructor for performing 1st stage construction
       
    85      * 
       
    86      * @param MLiwInterface* a pointer to sapi's Liw -inteface to publish data to    
       
    87      * @param CVcxNsChPublishableData* a pointer to data to publish
       
    88      * 
       
    89      */
       
    90     CVcxNsChPublisher( MLiwInterface* aCPInterface,  
       
    91                        CVcxNsChPublishableData* aData );
       
    92 
       
    93     /**
       
    94      * EPOC default constructor for performing 2nd stage construction
       
    95      */
       
    96     void ConstructL();
       
    97     
       
    98 public: // new methods
       
    99     
       
   100     /**
       
   101      * Method calls PublishContentL for all content -types defined
       
   102      * 
       
   103      */
       
   104     void PublishAllL();
       
   105     
       
   106     /**
       
   107      * Method publishes content for given content type.
       
   108      * Data is fetched from the iPublishableData.
       
   109      * 
       
   110      * @param TVCxNsCPContentType content type to publish 
       
   111      * 
       
   112      */
       
   113     void PublishContentL( TVCxNsCPContentType aContentType );
       
   114     
       
   115     
       
   116     /**
       
   117      * Method deletes all defined content from the CP database
       
   118      * 
       
   119      * @param TVCxNsCPContentType content type to delete 
       
   120      * 
       
   121      */
       
   122     void DeleteContentL( TVCxNsCPContentType aContentType );
       
   123     
       
   124     /**
       
   125      * Method reads data content from the CP database.
       
   126      * 
       
   127      * Data is saved to iPublishableData
       
   128      * 
       
   129      * @param TVCxNsCPContentType content type to read
       
   130      * 
       
   131      */
       
   132     void ReadContentL( TVCxNsCPContentType aContentType );
       
   133     
       
   134     /**
       
   135      * Method backs up data content from the CP database.
       
   136      * Basically backing up means that same data is saved back
       
   137      * to the CP using different content id value than for the 
       
   138      * values used for the content to be shown in matrix menu.
       
   139      * 
       
   140      * if aRefreshFrDB is ETrue, local data content that is used to 
       
   141      * backup is updated from the CP DB before backing up.
       
   142      * 
       
   143      * if aRefreshFrDB is EFalse, local data content that is used to 
       
   144      * backup is not updated, but writtendirectly to backup db. 
       
   145      * 
       
   146      * @param TVCxNsCPContentType content type to backup
       
   147      * @param aReadFrDB see definition above
       
   148      * 
       
   149      */
       
   150     void BackupContentL( TVCxNsCPContentType aContentType, TBool aRefreshFrDB = ETrue );
       
   151     
       
   152     /**
       
   153      * Method reads backed up data content from the CP and
       
   154      * saves it locally to the data containers in iPublishableData.
       
   155      * After data is restored succesfully, backup content is removed 
       
   156      * from the CP.
       
   157      * 
       
   158      * In case backed up data needs to be shown in the menu,
       
   159      * PublishContentL -needs to be called after restore. 
       
   160      * 
       
   161      * @param TVCxNsCPContentType content type restore.
       
   162      * 
       
   163      */
       
   164     void RestoreBackupL( TVCxNsCPContentType aContentType );
       
   165        
       
   166 private:
       
   167     
       
   168     /**
       
   169      * Helper method to extract data from CLiwDefaultMap for 
       
   170      * tvvideosuite needs
       
   171      * 
       
   172      * @param aContentType type 
       
   173      * @param aDataRoot a map containing result data gotten from CP 
       
   174      * 
       
   175      * @return KErrNone if data gotten ok
       
   176      */
       
   177     void ReadCPResultDataRootL( TVCxNsCPContentType& aContentType, CLiwDefaultMap* aDataRoot );
       
   178     
       
   179     /**
       
   180      * Method executes given command to CP database concerning
       
   181      * given contenttype
       
   182      * 
       
   183      * @param aContentType type 
       
   184      * @param aCmd command to execute
       
   185      * @param aInParam parameters in
       
   186      * @param aOutParam parameters out
       
   187      * 
       
   188      */
       
   189     void ExecCPCommandL(  TVCxNsCPContentType& aContentType,   
       
   190                           const TDesC8& aCmd,
       
   191                           CLiwGenericParamList* aInParam,
       
   192                           CLiwGenericParamList* aOutParam);
       
   193     
       
   194 private: // DATA
       
   195     
       
   196     /**
       
   197      * Instance of CPS interface used for update with CPS.
       
   198      * Not owned
       
   199      */
       
   200     MLiwInterface* iCPSInterface;
       
   201     
       
   202     /**
       
   203      * pointer to actual data to be published
       
   204      * Not owned
       
   205      */
       
   206     CVcxNsChPublishableData* iPublishableData;
       
   207     
       
   208     /**
       
   209      * contenttype id string used to fetch content.
       
   210      * KContentDefaultId == "menucontentid" for normal data to be shown in matrix
       
   211      * KContentBackupId == "backucontentpid" for backed up data content
       
   212      */
       
   213     TPtrC iContentId;
       
   214 
       
   215     };
       
   216 
       
   217 #endif // VCXNSCHPUBLISHER_H