|
1 /* |
|
2 * Copyright (c) 2006 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 MNcdNodePreview |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_NCD_NODE_PREVIEW_H |
|
20 #define M_NCD_NODE_PREVIEW_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 class RFile; |
|
32 |
|
33 /** |
|
34 * This interface is provided if the node contains preview content. |
|
35 * One node may contain multiple preview items. |
|
36 * |
|
37 * |
|
38 */ |
|
39 class MNcdNodePreview : public virtual MCatalogsBase |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Unique identifier for the interface, required for all MCatalogsBase interfaces. |
|
46 * |
|
47 * |
|
48 */ |
|
49 enum { KInterfaceUid = ENcdNodePreviewUid }; |
|
50 |
|
51 |
|
52 /** |
|
53 * Gives the number of previews of the node. |
|
54 * |
|
55 * @note This count is given according to the protocol information |
|
56 * that informs how many previews are available. So, the information |
|
57 * can be asked before calling LoadPreviewL. But, to get the |
|
58 * data of the wanted preview, LoadPreviewL has to be called. |
|
59 * |
|
60 * @return The number of preview items. |
|
61 */ |
|
62 virtual TInt PreviewCount() const = 0; |
|
63 |
|
64 |
|
65 /** |
|
66 * IsPreviewLoadedL informs if the preview has already been loaded for the |
|
67 * node. Then, call of LoadPreviewL is not necessary. |
|
68 * |
|
69 * @param aIndex tells which one of the previews is wanted. |
|
70 * @return ETrue if the preview has already been loaded, EFalse otherwise. |
|
71 * @exception Panic ENcdPanicIndexOutOfRange Array index out of range. |
|
72 */ |
|
73 virtual TBool IsPreviewLoadedL( TInt aIndex ) const = 0; |
|
74 |
|
75 |
|
76 /** |
|
77 * Gives the mime type of the preview data. |
|
78 * |
|
79 * This mime type is set according to the information gotten |
|
80 * from the protocol if any. So, this information is available before |
|
81 * calling LoadPreviewL for the preview item of the given index. |
|
82 * |
|
83 * @note If the mime type is not received in protocol responses, it is |
|
84 * taken from Content-Type HTTP header after the preview has been downloaded |
|
85 * successfully |
|
86 * |
|
87 * @param aIndex tells which one of the previews is wanted. |
|
88 * @return The mime type of the preview data. The type is |
|
89 * given as a text according to the standards that define MIME types. |
|
90 * Ownership is transferred. If the protocol has not defined |
|
91 * any value, KNullDesC is returned. |
|
92 * @exception Panic ENcdPanicIndexOutOfRange Array index out of range. |
|
93 */ |
|
94 virtual const TDesC& PreviewMimeType( TInt aIndex ) const = 0; |
|
95 |
|
96 |
|
97 /** |
|
98 * Loads the preview data from the internet. |
|
99 * |
|
100 * @note The reference count of the operation object is increased by one. |
|
101 * So, Release() function of the operation should be called when operation |
|
102 * is not needed anymore. |
|
103 * |
|
104 * @param aIndex tells which one of the previews is wanted. |
|
105 * @param aObserver Observer for the operation. |
|
106 * @return Pointer to an operation object that handles |
|
107 * the preview data downloading. This operation can be used |
|
108 * to check the progressing of the preview download. Counted, Release() must |
|
109 * be called after use. |
|
110 * @exception Leave System wide error codes. |
|
111 * KNcdErrorParallelOperationNotAllowed if a parallel client is running |
|
112 * an operation for the same metadata. See MNcdOperation for full explanation. |
|
113 * @exception Panic ENcdPanicIndexOutOfRange Array index out of range. |
|
114 */ |
|
115 virtual MNcdDownloadOperation* LoadPreviewL( TInt aIndex, |
|
116 MNcdDownloadOperationObserver* aObserver ) = 0; |
|
117 |
|
118 |
|
119 /** |
|
120 * Gives the preview data file. |
|
121 * |
|
122 * @note RFile handle can be used to get the unifying id for example |
|
123 * using RFile::FullName. |
|
124 * @note The MIME type of the preview may be found automatically |
|
125 * from the preview data by Symbian methods. |
|
126 * |
|
127 * @param aIndex tells which one of the previews is wanted. |
|
128 * @return Handle to a file containing the preview data. Ownership is transferred. |
|
129 * So, the user has to call Close when the file is not needed anymore. |
|
130 * @exception KErrNotFound if the corresponding preview data |
|
131 * has not been downloaded for the specified preview item. |
|
132 * @exception Leave System wide error codes. |
|
133 * @exception Panic ENcdPanicIndexOutOfRange Array index out of range. |
|
134 */ |
|
135 virtual RFile PreviewFileL( TInt aIndex ) const = 0; |
|
136 |
|
137 |
|
138 protected: |
|
139 |
|
140 /** |
|
141 * Destructor. |
|
142 * |
|
143 * @see MCatalogsBase::~MCatalogsBase() |
|
144 */ |
|
145 virtual ~MNcdNodePreview() {} |
|
146 |
|
147 }; |
|
148 |
|
149 |
|
150 #endif // M_NCD_NODE_PREVIEW_H |