ncdengine/inc/ncdnodeicon.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006-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:   Contains MNcdNodeIcon interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_NCD_NODE_ICON_H
       
    20 #define M_NCD_NODE_ICON_H
       
    21 
       
    22 
       
    23 #include <e32cmn.h>
       
    24 
       
    25 #include "catalogsbase.h"
       
    26 #include "ncdinterfaceids.h"
       
    27 
       
    28 
       
    29 class MNcdDownloadOperation;
       
    30 class MNcdDownloadOperationObserver;
       
    31 
       
    32 
       
    33 /**
       
    34  *  Provides functions to handle the icon of the node.
       
    35  *  This interface supposes that a node has only one icon.
       
    36  *  The MIME type of the icon may be found automatically
       
    37  *  from the icon data by Symbian methods.
       
    38  *
       
    39  *  
       
    40  */
       
    41 class MNcdNodeIcon : public virtual MCatalogsBase
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Unique identifier for the interface, required for all MCatalogsBase interfaces.
       
    48      *
       
    49      * 
       
    50      */
       
    51     enum { KInterfaceUid = ENcdNodeIconUid };
       
    52 
       
    53 
       
    54     /**
       
    55      * Gives the icon id. This id can be used by UI
       
    56      * to identify icons that have already been retrieved by LoadIconL.
       
    57      * So, icons can be more efficiently shared between different nodes.
       
    58      * 
       
    59      * 
       
    60      * @return Id of the loaded icon. If the protocol has not defined
       
    61      * any value, an empty string is returned.
       
    62      */
       
    63     virtual const TDesC& IconId() const = 0;
       
    64 
       
    65 
       
    66     /**
       
    67      * Gives the mime type of the icon data.
       
    68      *
       
    69      * @note This mime type is set according to the information gotten
       
    70      * from the protocol. So, this information is available before calling
       
    71      * LoadIconL for the icon item of the given index.
       
    72      *
       
    73      * @note Current implementation returns always KNullDesC
       
    74      * 
       
    75      * @return The mime type of the icon data. The type is
       
    76      * given as a text according to the standards that define MIME types.
       
    77      * Ownership is transferred. If the protocol has not defined
       
    78      * any value, an empty string is returned.
       
    79      */
       
    80     virtual const TDesC& IconMimeType() const = 0;
       
    81 
       
    82 
       
    83     /**
       
    84      * Downloads the icon file. The icon is not handled by the engine,
       
    85      * the icon data should be handled by the user of this interface as it sees fit.
       
    86      *
       
    87      * @note The reference count of the operation object is increased by one. 
       
    88      * So, Release() function of the operation should be called when the operation 
       
    89      * is not needed anymore.
       
    90      *
       
    91      * @note If a download operation has already been started for the specified
       
    92      *  icon, the already existing operation object is returned.
       
    93      *
       
    94      * 
       
    95      * @param aObserver Observer for the operation. NULL if no observer
       
    96      *  should be called. Will override previous observer
       
    97      *  for the operation, in case the operation already existed. 
       
    98      * @return Pointer to an operation object that can 
       
    99      * be used to check the progressing of the icon loading operation. Counted,
       
   100      * Release() must be called after use.
       
   101      * @exception Leave System wide error codes.
       
   102      *  KNcdErrorParallelOperationNotAllowed if a parallel client is running
       
   103      *  an operation for the same metadata. See MNcdOperation for full explanation.
       
   104      */ 
       
   105     virtual MNcdDownloadOperation* LoadIconL( 
       
   106         MNcdDownloadOperationObserver* aObserver ) = 0;
       
   107 
       
   108 
       
   109     /**
       
   110      * Gives the data of the loaded icon.
       
   111      *
       
   112      * 
       
   113      * @return Pointer to data of the loaded icon. Ownership is transferred.
       
   114      * A NULL pointer if the icon has not been loaded for the node.
       
   115      * @exception Leave System wide error codes.
       
   116      */
       
   117     virtual HBufC8* IconDataL() = 0;
       
   118 
       
   119 
       
   120 protected:
       
   121 
       
   122     /**
       
   123      * Destructor.
       
   124      * 
       
   125      * @see MCatalogsBase::~MCatalogsBase()
       
   126      */
       
   127     virtual ~MNcdNodeIcon() {}
       
   128     
       
   129     };
       
   130 
       
   131 
       
   132 #endif // M_NCD_NODE_ICON_H