|
1 /* |
|
2 * Copyright (c) 2010 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: MDS to CPIX Document fetcher |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIXDOCFETCHER_H_ |
|
20 #define CPIXDOCFETCHER_H_ |
|
21 |
|
22 #include <e32def.h> |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 #include "cdocumentfield.h" |
|
26 |
|
27 //Forward declaration |
|
28 class CSearchDocument; |
|
29 class CMdEObject; |
|
30 class CMdEObjectDef; |
|
31 |
|
32 class CCPIXDocFetcher : public CBase |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Construction |
|
37 * @return instance of CCPIXDocFetcher |
|
38 */ |
|
39 static CCPIXDocFetcher* NewL(); |
|
40 /** |
|
41 * Construction |
|
42 * @return instance of CCPIXDocFetcher |
|
43 */ |
|
44 static CCPIXDocFetcher* NewLC(); |
|
45 /** |
|
46 * Destructor |
|
47 */ |
|
48 virtual ~CCPIXDocFetcher(); |
|
49 /** |
|
50 * Get the search document from MDE object |
|
51 * @param CMdEObject& aObject mde object |
|
52 * @param TDesC& aAppClass app class require to create cpix |
|
53 * @param CMdEObjectDef& aObjectDef object def of passed object |
|
54 * @return instance of CSearchDocument document |
|
55 */ |
|
56 //Process base object properties here and let specific media handler "video" "music" |
|
57 //Overwride this in order to handle specific items client should call this method |
|
58 // from overwridden method to get common entries |
|
59 virtual CSearchDocument* GetCpixDocumentL(const CMdEObject& aObject, |
|
60 const TDesC& aAppClass, |
|
61 CMdEObjectDef& aObjectDef); |
|
62 /** |
|
63 * Utility method Add field to created document |
|
64 * @param CSearchDocument& aSearchDoc search document |
|
65 * @param TDesC& aFiledName filed name to be added |
|
66 * @param CTDesC& aValue field value |
|
67 * @return none |
|
68 */ |
|
69 void AddFiledtoDocumentL(CSearchDocument& aSearchDoc,const TDesC& aFiledName, |
|
70 const TDesC& aValue, |
|
71 TInt aConfig = CDocumentField::EStoreYes | CDocumentField::EIndexTokenized); |
|
72 |
|
73 /* |
|
74 * Get the Absolute URI without path |
|
75 * @return TDesC& URI absolute path |
|
76 */ |
|
77 const TDesC& GetUri(); |
|
78 |
|
79 /* |
|
80 * Convert Media ID from integer to descriptor for storage |
|
81 * @param aMediaId media id in integer |
|
82 * @param aMediaIDBuf reference of descriptor buffer to be filled |
|
83 */ |
|
84 void GetMediaIdDescriptor(const TUint32& aMediaId,TDes& aMediaIDBuf); |
|
85 /* |
|
86 * Get the Media ID from the filesystem and convert Media ID from integer to descriptor for storage |
|
87 * @param TDesC& aURI Uri of the object |
|
88 * @param aMediaIDBuf reference of descriptor buffer to be filled |
|
89 */ |
|
90 void GetMediaIdDescriptorFromFsL(const TDesC& aUri,TDes& aMediaIDBuf); |
|
91 /* |
|
92 * Get the file extension from uri |
|
93 * @param TDesC& aURI Uri of the object |
|
94 * @param aExtension reference of descriptor buffer to be filled with file extension |
|
95 */ |
|
96 void GetExtension(const TDesC& aUri, TDes& aExtension); |
|
97 protected: |
|
98 /* |
|
99 * second phase constructor ConstructL |
|
100 */ |
|
101 void ConstructL(); |
|
102 /* |
|
103 * Default constructor |
|
104 */ |
|
105 CCPIXDocFetcher(); //Default constructor |
|
106 private: |
|
107 /* |
|
108 * Convert URI to Absolute URI |
|
109 * exp. from f:\music\something.mp3 will be stored as \music\something.mp3 |
|
110 */ |
|
111 void SetAbsoluteURI(const TDesC& aUri); |
|
112 private: |
|
113 // File system handle |
|
114 RFs iFs; |
|
115 TBuf<KMaxFileName> iUri; //Absolute URI of MDS Items |
|
116 }; |
|
117 |
|
118 #endif /* CPIXDOCFETCHER_H_ */ |