|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Class includes information about one bookmark. |
|
16 * It has handle to Bookmark engine for adding bookmark. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CWMLBMSUBITEM_H |
|
23 #define CWMLBMSUBITEM_H |
|
24 |
|
25 // INCLUDES |
|
26 #include "WmlSubItemBase.h" |
|
27 |
|
28 #include <FavouritesDb.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 class CFavouritesItem; |
|
33 class CFavouritesItemList; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * CWmlBMSubItem holds information of a one bookmark item. |
|
39 */ |
|
40 NONSHARABLE_CLASS( CWmlBMSubItem ) : public CWmlSubItemBase |
|
41 { |
|
42 |
|
43 public: // construction / destruction |
|
44 |
|
45 /** |
|
46 * First stage constructor. |
|
47 */ |
|
48 static CWmlBMSubItem* NewL(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~CWmlBMSubItem(); |
|
54 |
|
55 public: //from CWmlSubItemBase |
|
56 |
|
57 /** |
|
58 * Adds value for bookmark field. |
|
59 * @param aFieldValue Value of the field to be added. |
|
60 * @param aFieldEnum OTA parser specific enum of the field to add. |
|
61 * @exception Leaves if invalid value or field is being added. |
|
62 */ |
|
63 void AddFieldL( const TDesC& aFieldValue, const TInt aFieldEnum ); |
|
64 |
|
65 /** |
|
66 * Returns the count of fields in this item. |
|
67 * @return Number of fields. |
|
68 */ |
|
69 TInt FieldCount() const; |
|
70 |
|
71 /** |
|
72 * Interface for getting the label and value of a field at |
|
73 * certain index. |
|
74 * @param aIndex Pointer to field which data is to be retrieved. |
|
75 * 0 <= aIndex < GetFieldCount() |
|
76 * @return reference to a class holding both label and value of a field. |
|
77 * @exception Leaves if index is out of range. |
|
78 */ |
|
79 CMsgNameValue* GetFieldDataAtLC( const TInt aIndex ); |
|
80 |
|
81 /** |
|
82 * Check the item validity. |
|
83 * @return ETrue if the item is valid, EFalse if it's not. |
|
84 */ |
|
85 TBool IsValidL(); |
|
86 |
|
87 private: // from CWmlSubItemBase |
|
88 |
|
89 /** |
|
90 * Initialize all the member variable to their initial state. |
|
91 * So if leave occurs nothing about the aborted operation is |
|
92 * not saved. |
|
93 */ |
|
94 void DoInitialize(); |
|
95 |
|
96 /** |
|
97 * @see WmlSubItemBase::NameMaxLength |
|
98 */ |
|
99 TInt NameMaxLength(); |
|
100 |
|
101 /** |
|
102 * @see WmlSubItemBase::NameLC |
|
103 */ |
|
104 HBufC* NameLC(); |
|
105 |
|
106 /** |
|
107 * @see WmlSubItemBase::SetNameL |
|
108 */ |
|
109 void SetNameL( const TDesC& aName ); |
|
110 |
|
111 /** |
|
112 * @See WmlSubItemBase::DefaultNameLC |
|
113 */ |
|
114 HBufC* DefaultNameLC(); |
|
115 |
|
116 /** |
|
117 * @See WmlSubItemBase::DoQueryNewNameLC |
|
118 */ |
|
119 HBufC* DoQueryNewNameLC( const TDesC& aName ); |
|
120 |
|
121 /** |
|
122 * @See WmlSubItemBase::DoRenameQueryL |
|
123 */ |
|
124 TBool DoRenameQueryL( const TDesC& aName ); |
|
125 |
|
126 /** |
|
127 * @See WmlSubItemBase::IsNameValidL |
|
128 */ |
|
129 TBool IsNameValidL( const TDesC& aName, TBool aUpdateList ); |
|
130 |
|
131 /** |
|
132 * @See WmlSubItemBase::PreStoreL |
|
133 */ |
|
134 void PreStoreL( const TBool aShowPreferredQuery ); |
|
135 |
|
136 /** |
|
137 * @See WmlSubItemBase::StoreL |
|
138 */ |
|
139 void StoreL(); |
|
140 |
|
141 /** |
|
142 * @See WmlSubItemBase::PostStoreL |
|
143 */ |
|
144 void PostStoreL( const TBool aShowNote, |
|
145 const TInt aPreferredInformation, |
|
146 const TBool aCreateBookmarkIfNotSetAsDefault ); |
|
147 |
|
148 private: // new |
|
149 |
|
150 /** |
|
151 * Does the construction. |
|
152 */ |
|
153 void ConstructL(); |
|
154 |
|
155 /** |
|
156 * Get the reference to the bookmark database. |
|
157 * If the database is not already created this |
|
158 * creates one. |
|
159 * @return a reference to the bookmark database. |
|
160 */ |
|
161 RFavouritesDb& BookmarkDb2L(); |
|
162 |
|
163 private: // data |
|
164 |
|
165 /** |
|
166 * Item used for internal storage and for adding bookmark to |
|
167 * Favourites Database. |
|
168 */ |
|
169 CFavouritesItem* iBMItem; |
|
170 |
|
171 /** |
|
172 * Bookmark database. Don't use this directly, |
|
173 * use BookmarkDbL method instead. |
|
174 */ |
|
175 RFavouritesDb iBookmarkDb; |
|
176 |
|
177 /** |
|
178 * Bookmark database session. |
|
179 */ |
|
180 RFavouritesSession iSession; |
|
181 |
|
182 /** |
|
183 * Indicates if this bookmark is valid. |
|
184 * Bookmark is valid when it has at least url defined. |
|
185 */ |
|
186 TBool iIsValid; |
|
187 |
|
188 /** |
|
189 * |
|
190 */ |
|
191 CFavouritesItemList* iItemList; |
|
192 |
|
193 private: // friend declarations |
|
194 |
|
195 /// Let the asyncronousitemsaver to access saving methods. |
|
196 friend class CWmlAsyncronousItemSaver; |
|
197 |
|
198 /// For directly saving bookmark. |
|
199 friend class CWmlAPSubItem; |
|
200 }; |
|
201 |
|
202 #endif // CWMLBMSUBITEM_H |
|
203 |
|
204 // End of file |