|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: Encapsulates a edit feed dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FEEDS_EDIT_FEED_DIALOG_H |
|
20 #define FEEDS_EDIT_FEED_DIALOG_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <aknform.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // MACROS |
|
29 |
|
30 // DATA TYPES |
|
31 |
|
32 // FUNCTION PROTOTYPES |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CAknViewAppUi; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 |
|
40 /** |
|
41 * Encapsulates a edit feed dialog. |
|
42 * @lib FeedsEngine.lib |
|
43 * @since 3.0 |
|
44 */ |
|
45 class MFeedsEditFeedDialogObserver |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Called when a feed's name and/or url is changed -- this is called |
|
50 * after both IsValidFeedName and IsValidFeedUrl are called. |
|
51 * |
|
52 * @since 3.0 |
|
53 * @param aName The feed's new name. |
|
54 * @param aUrl The feed's new url. |
|
55 * @param aFreq The frequency for auto updating. |
|
56 * @return void. |
|
57 */ |
|
58 virtual void UpdateFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) = 0; |
|
59 |
|
60 /** |
|
61 * Called when a new feed is created -- this is called after both |
|
62 * IsValidFeedName and IsValidFeedUrl are called. |
|
63 * |
|
64 * @since 3.0 |
|
65 * @param aName The feed's new name. |
|
66 * @param aUrl The feed's new url. |
|
67 * @param aFreq The frequency for auto updating. |
|
68 * @return void. |
|
69 */ |
|
70 virtual void NewFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) = 0; |
|
71 |
|
72 /** |
|
73 * Validates the Feed's updated name. |
|
74 * |
|
75 * @since 3.0 |
|
76 * @param aName The feed's new name. |
|
77 * @param aIsEditing True if the edit dialog was opened to edit a feed. |
|
78 * @return ETrue if the value is valid. |
|
79 */ |
|
80 virtual TBool IsFeedNameValidL(const TDesC* aName, TBool aIsEditing) = 0; |
|
81 |
|
82 /** |
|
83 * Validates the Feed's updated url. |
|
84 * |
|
85 * @since 3.0 |
|
86 * @param aUrl The feed's new url. |
|
87 * @return ETrue if the value is valid. |
|
88 */ |
|
89 virtual TBool IsFeedUrlValidL(const TDesC* aUrl) = 0; |
|
90 }; |
|
91 |
|
92 |
|
93 class CFeedsEditFeedDialog: public CAknForm |
|
94 { |
|
95 public: |
|
96 /** |
|
97 * Two-phased constructor. |
|
98 */ |
|
99 static CFeedsEditFeedDialog* NewL(MFeedsEditFeedDialogObserver& aObserver, |
|
100 CAknViewAppUi* aAppUi, |
|
101 const TDesC& aName, const TDesC& aUrl, TInt aFreq); |
|
102 |
|
103 /** |
|
104 * Two-phased constructor. |
|
105 */ |
|
106 static CFeedsEditFeedDialog* NewL(MFeedsEditFeedDialogObserver& aObserver, |
|
107 CAknViewAppUi* aAppUi); |
|
108 |
|
109 /** |
|
110 * Destructor. |
|
111 */ |
|
112 virtual ~CFeedsEditFeedDialog(); |
|
113 |
|
114 public: |
|
115 |
|
116 /** |
|
117 * Takes any action required when the current line is changed |
|
118 * to aControlId |
|
119 * |
|
120 * @since 7.1 |
|
121 * @param aControlId The control ID |
|
122 * @return void |
|
123 */ |
|
124 void LineChangedL( TInt aControlId ); |
|
125 |
|
126 /** |
|
127 * Handles the auto update freuency modification commands |
|
128 * |
|
129 * @since 7.1 |
|
130 * @return void |
|
131 */ |
|
132 void HandleFreqCmdL(); |
|
133 |
|
134 /** |
|
135 * Pops up a custom dialog to allow user to set setting items |
|
136 * |
|
137 * @since 7.1 |
|
138 * @param aTitle The title of the field. |
|
139 * @param aValues The values of the radio buttons. |
|
140 * @param aCurentItem The currently selected item |
|
141 * @return TInt The newly selected value from the radio buttons. |
|
142 */ |
|
143 TInt ShowRadioButtonSettingPageL(TDesC& aTitle, |
|
144 CDesCArrayFlat* aValues, |
|
145 TInt aCurrentItem ); |
|
146 |
|
147 /** |
|
148 * Shows an information dialog, with an ok soft key. |
|
149 * |
|
150 * @since 7.1 |
|
151 * @param aNoteText Text to display. |
|
152 * @return void |
|
153 */ |
|
154 void ShowInfoDialogwithOkSoftKeyL( const TDesC& aNoteText ); |
|
155 |
|
156 |
|
157 public: // From CAknForm |
|
158 /** |
|
159 * Called to setup the options menu with the dialog is active. |
|
160 * |
|
161 * @since ? |
|
162 * @param aResourceId The resource id of the menu. |
|
163 * @param aMenuPane The menu. |
|
164 * @return void. |
|
165 */ |
|
166 virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
167 |
|
168 /** |
|
169 * Called by the framework whenever the 'Save' menu item is selected. |
|
170 * |
|
171 * @since ? |
|
172 * @return ETrue if the form data has been saved, otherwise EFalse. |
|
173 */ |
|
174 virtual TBool SaveFormDataL(); |
|
175 |
|
176 /** |
|
177 * Called by the framework before the form is initialised. |
|
178 * |
|
179 * @since ? |
|
180 * @return void. |
|
181 */ |
|
182 virtual void PreLayoutDynInitL(); |
|
183 |
|
184 /** |
|
185 * Post-layout dialog initialisation. |
|
186 * |
|
187 * @since 7.1 |
|
188 * @return void. |
|
189 */ |
|
190 void PostLayoutDynInitL(); |
|
191 |
|
192 /** |
|
193 * From CCoeControl. |
|
194 * Handles pointer events |
|
195 * |
|
196 * @since 7.1 |
|
197 * @param Details of pointer event. |
|
198 * @return void. |
|
199 */ |
|
200 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
201 |
|
202 /** |
|
203 * Handle button press. Same as base class method, except calling |
|
204 * HandleFreqCmdL in the case of auto Update modifications. |
|
205 * |
|
206 * @since 7.1 |
|
207 * @param aButtonId Button pressed. |
|
208 * @return ETrue if the dialog should exit. |
|
209 */ |
|
210 TBool OkToExitL( TInt aButtonId ); |
|
211 |
|
212 |
|
213 /** |
|
214 * Called by the framework to process the options menu. |
|
215 * |
|
216 * @since ? |
|
217 * @param aCommandId The command. |
|
218 * @return void. |
|
219 */ |
|
220 virtual void ProcessCommandL(TInt aCommandId); |
|
221 |
|
222 /** |
|
223 * Handle key events. |
|
224 * |
|
225 * @since 7.1 |
|
226 * @param aKeyEvent Details of key event. |
|
227 * @param aType Type of key event. |
|
228 * @return EKeyWasConsumed if the key was handled else EKeyWasNotConsumed. |
|
229 */ |
|
230 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
231 TEventCode aType); |
|
232 |
|
233 #ifdef __SERIES60_HELP |
|
234 /** |
|
235 * Get help context for the control. |
|
236 * |
|
237 * @since ? |
|
238 * @param aContext The context that is filled in. |
|
239 * @return None. |
|
240 */ |
|
241 virtual void GetHelpContext(TCoeHelpContext& aContext) const; |
|
242 #endif // __SERIES60_HELP |
|
243 |
|
244 |
|
245 private: // New methods |
|
246 /** |
|
247 * C++ default constructor. |
|
248 */ |
|
249 CFeedsEditFeedDialog (MFeedsEditFeedDialogObserver& aObserver, |
|
250 CAknViewAppUi* aAppUi, |
|
251 const TDesC& aName, const TDesC& aUrl, TInt aFreq); |
|
252 |
|
253 /** |
|
254 * Loads the form data before the form is displayed. |
|
255 * |
|
256 * @since ? |
|
257 * @return ETrue if the form data has been saved, otherwise EFalse. |
|
258 */ |
|
259 void LoadFormValuesFromDataL(); |
|
260 |
|
261 |
|
262 private: |
|
263 MFeedsEditFeedDialogObserver& iObserver; |
|
264 CAknViewAppUi* iAppUi; // not owned |
|
265 TBool iIsNewFeed; |
|
266 TBool iExitDialog; |
|
267 |
|
268 const TDesC& iName; |
|
269 const TDesC& iUrl; |
|
270 TInt iFreq; |
|
271 TInt iPreviousFreq; |
|
272 TInt iSelectedDlgLine; |
|
273 TBool iActionCancelled; |
|
274 }; |
|
275 |
|
276 #endif // FEEDS_EDIT_FEED_DIALOG_H |
|
277 |
|
278 // End of File |