|
1 /* |
|
2 * Copyright (c) 2006-2007 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: The model of the CSrchUiResFolderContainer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_SEARCH_RESULT_FOLDER_MODEL_H |
|
23 #define C_SEARCH_RESULT_FOLDER_MODEL_H |
|
24 |
|
25 // System Includes |
|
26 #include <bamdesca.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CSrchUiResFolder; |
|
30 class CSrchUiGeneral; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Adapts the model data for CSrchUiResFolderContainer. |
|
36 * |
|
37 * Adapter pattern is implemented here to adapt CSrchUiResFolderModel into |
|
38 * MDesCArray which is needed by all listboxes |
|
39 * (CSrchUiResFolderContainer owns 1 listbox control). |
|
40 * |
|
41 * @lib srchuigenui.lib |
|
42 */ |
|
43 NONSHARABLE_CLASS( CSrchUiResFolderModel ) : public CBase, |
|
44 public MDesCArray |
|
45 { |
|
46 public: // Symbian Constructors and destructor |
|
47 /** |
|
48 * Symbian OS 2 phased constructor |
|
49 * |
|
50 * @param aGeneralsrchUi Search UI. |
|
51 * @return A pointer to the created instance of |
|
52 * CSrchUiResFolderModel. |
|
53 */ |
|
54 static CSrchUiResFolderModel* NewL(CSrchUiGeneral* aGeneralsrchUi); |
|
55 |
|
56 /** |
|
57 * Symbian OS 2 phased constructor |
|
58 * |
|
59 * @param aGeneralsrchUi Search UI. |
|
60 * @return A pointer to the created instance of |
|
61 * CSrchUiResFolderModel. |
|
62 */ |
|
63 static CSrchUiResFolderModel* NewLC(CSrchUiGeneral* aGeneralsrchUi); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CSrchUiResFolderModel(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Setter for iOpenedFolder. |
|
74 * |
|
75 * @param aOpenedFolder Pointer to the subfolder that must |
|
76 * be displayed on the UI. |
|
77 */ |
|
78 void SetOpenedFolder( CSrchUiResFolder* aOpenedFolder ); |
|
79 |
|
80 /** |
|
81 * Returns the icon offset, knowing the search result folder. |
|
82 * Icon offsets (CSearchAppUi, ListBoxIconsArrayL) |
|
83 * From the folder, the content type id can be found. |
|
84 * From the content type id, the CSearchContentType object can be |
|
85 * found (see CDocument, iUsableContentTypeArray). |
|
86 * From the CSearchContentType, the icon offset can be found |
|
87 * |
|
88 * @param aFolder Folder wherefrom the icon offset must be returned. |
|
89 * |
|
90 * @return Icon offset for the specified 'folder' |
|
91 */ |
|
92 TInt GetFolderIconIndex( const CSrchUiResFolder& aFolder ) const; |
|
93 |
|
94 public: // Functions from base classes |
|
95 /** |
|
96 * From MDesCArray |
|
97 * Returns the number of descriptor elements in the array. |
|
98 */ |
|
99 TInt MdcaCount() const; |
|
100 |
|
101 /** |
|
102 * From MDesCArray |
|
103 * @param aIndex Index of the descriptor element. |
|
104 * Returns a non-modifiable pointer descriptor representing the |
|
105 * descriptor element located at position aIndex within the array. |
|
106 */ |
|
107 TPtrC16 MdcaPoint( TInt aIndex ) const; |
|
108 |
|
109 private: // More constructors |
|
110 /** |
|
111 * Performs the first phase of two phase construction. |
|
112 */ |
|
113 CSrchUiResFolderModel(); |
|
114 |
|
115 /** |
|
116 * Performs the second phase construction. |
|
117 */ |
|
118 void ConstructL(CSrchUiGeneral* aGeneralsrchUi); |
|
119 |
|
120 private: // Data |
|
121 /* Buffer used for making correct string format needed by listbox items. |
|
122 * mutable because the method is const and member variable must be modifiable. |
|
123 * |
|
124 * own. |
|
125 */ |
|
126 HBufC* iBuffer; |
|
127 |
|
128 /* Pointer to the subfolder currently visible on UI. |
|
129 * not own. |
|
130 */ |
|
131 CSrchUiResFolder* iOpenedFolder; |
|
132 |
|
133 // Number of results found in the subfolder currently visible on UI |
|
134 mutable TInt iOpenedFolderSubFolderCount; |
|
135 |
|
136 /* Pointer to the general search ui |
|
137 * not own. |
|
138 */ |
|
139 CSrchUiGeneral* iGeneralsrchUi; |
|
140 }; |
|
141 |
|
142 #endif // C_SEARCH_RESULT_FOLDER_MODEL_H |
|
143 |
|
144 // End of File |