45
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: CalenAgendaViewWidget class definition.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CALENAGENDAVIEWWIDGET_H
|
|
19 |
#define CALENAGENDAVIEWWIDGET_H
|
|
20 |
|
|
21 |
// System includes
|
|
22 |
#include <QGraphicsLinearLayout>
|
|
23 |
#include <QDateTime>
|
|
24 |
#include <QPointer>
|
|
25 |
#include <hbwidget.h>
|
|
26 |
|
|
27 |
// User includes
|
|
28 |
|
|
29 |
// Forward declarations
|
|
30 |
class QStandardItemModel;
|
|
31 |
class QGraphicsSceneMouseEvent; // TODO: Remove this after gestures are supported
|
|
32 |
class HbAbstractViewItem;
|
|
33 |
class HbGroupBox;
|
|
34 |
class HbListView;
|
|
35 |
class QPluginLoader;
|
|
36 |
class HbLabel;
|
|
37 |
class HbAction;
|
|
38 |
class HbDateTimePicker;
|
|
39 |
class XQSettingsManager;
|
|
40 |
class MCalenServices;
|
|
41 |
class CalenAgendaView;
|
|
42 |
class AgendaEntry;
|
|
43 |
class CalenDocLoader;
|
|
44 |
class CalenEventListViewItem;
|
|
45 |
class NotesEditor;
|
|
46 |
|
|
47 |
/**
|
|
48 |
* @class CalenAgendaViewWidget
|
|
49 |
* @brief The content widget for the agenda view.
|
|
50 |
* It is responsible for showing all the events &/ to-do's
|
|
51 |
* (if any) for a particular day selected by the user
|
|
52 |
*/
|
|
53 |
class CalenAgendaViewWidget : public HbWidget
|
|
54 |
{
|
|
55 |
Q_OBJECT
|
|
56 |
|
|
57 |
public:
|
|
58 |
|
|
59 |
/**
|
|
60 |
* @brief Constructor
|
|
61 |
* @param services The reference to the MCalenServices object
|
|
62 |
* @param docLoader The document loader object
|
|
63 |
*/
|
|
64 |
IMPORT_C CalenAgendaViewWidget(MCalenServices &services,
|
|
65 |
CalenDocLoader *docLoader);
|
|
66 |
|
|
67 |
/**
|
|
68 |
* @brief Default C++ destructor
|
|
69 |
*/
|
|
70 |
IMPORT_C ~CalenAgendaViewWidget();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* @brief Initializes the widget to show all the events/to-do's
|
|
74 |
* for the selected day
|
|
75 |
* @param view Pointer to the view to which this is the content
|
|
76 |
*/
|
|
77 |
void setupWidget(CalenAgendaView *view);
|
|
78 |
|
|
79 |
/**
|
|
80 |
* @brief Prepares the widget to be shown.
|
|
81 |
* Initializes the widget with the day's events and other details
|
|
82 |
*/
|
|
83 |
void showWidget();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* @brief Called from the view whenever the orientation of the
|
|
87 |
* device changes
|
|
88 |
*/
|
|
89 |
void orientationChanged(Qt::Orientation);
|
|
90 |
|
|
91 |
/**
|
|
92 |
* @brief Callback function to handle system locale change
|
|
93 |
*/
|
|
94 |
void handleLocaleChange();
|
|
95 |
|
|
96 |
/**
|
|
97 |
* @brief clears the list model from the view
|
|
98 |
*/
|
|
99 |
void clearListModel();
|
|
100 |
|
51
|
101 |
/**
|
|
102 |
* @brief Opens the editor to create a new entry
|
|
103 |
*/
|
|
104 |
void createNewEvent();
|
|
105 |
|
45
|
106 |
private:
|
|
107 |
|
|
108 |
/**
|
|
109 |
* @brief Sets the context based on the item selected by the user
|
|
110 |
* @param entry The entry using which the context is deduced
|
|
111 |
*/
|
|
112 |
void setContextFromHighlight(AgendaEntry entry);
|
|
113 |
|
|
114 |
/**
|
|
115 |
* @brief Initializes the child widgets of this widget
|
|
116 |
*/
|
|
117 |
void initChildWidgets();
|
|
118 |
|
|
119 |
/**
|
|
120 |
* @brief Populates the list with the events for the current day.
|
|
121 |
* Does nothing if the day has no events. To be called whenever
|
|
122 |
* the view has to be refreshed
|
|
123 |
*/
|
|
124 |
void populateListWidget();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* @brief Gets the instance list for day
|
|
128 |
*/
|
|
129 |
void getInstanceList();
|
|
130 |
|
|
131 |
/**
|
|
132 |
* @brief Sets the heading text to show the date for which this
|
|
133 |
* widget is being shown
|
|
134 |
*/
|
|
135 |
void setHeadingText();
|
|
136 |
|
|
137 |
/**
|
|
138 |
* @brief Creates and adds an item to the list at position index
|
|
139 |
* @param index The position in the list when the item is added
|
|
140 |
* @param entry The entry whose details must be shown in the item
|
|
141 |
*/
|
|
142 |
void createListItem(int index, AgendaEntry entry);
|
|
143 |
|
|
144 |
/**
|
|
145 |
* @brief Creates and add a list item for the event
|
|
146 |
* @param index The position in the list when the item is added
|
|
147 |
* @param entry The entry whose details must be shown in the item
|
|
148 |
*/
|
|
149 |
void addTimedEventToList(int index, AgendaEntry entry);
|
|
150 |
|
|
151 |
/**
|
|
152 |
* @brief Creates and add a list item for the event which is non timed
|
|
153 |
* @param index The position in the list when the item is added
|
|
154 |
* @param entry The entry whose details must be shown in the item
|
|
155 |
*/
|
|
156 |
void addNonTimedEventToList(int index, AgendaEntry entry);
|
|
157 |
|
|
158 |
/**
|
|
159 |
* @brief Sets strecthing to list items showing non-timed events
|
|
160 |
*/
|
|
161 |
void handleListItemStretching(Qt::Orientation orientation);
|
|
162 |
|
|
163 |
/**
|
|
164 |
* @brief Returns the index in the list to which scrolling must
|
|
165 |
* happen. For ex: After creating a new event, the list must scroll
|
|
166 |
* to the newly created event
|
|
167 |
*/
|
|
168 |
int getIndexToScrollTo();
|
|
169 |
|
|
170 |
/**
|
|
171 |
* @brief To Show and hide regional plugin label depends upon settings
|
|
172 |
*/
|
|
173 |
|
|
174 |
void showHideRegionalInformation();
|
51
|
175 |
|
45
|
176 |
|
|
177 |
private slots:
|
|
178 |
|
|
179 |
/**
|
|
180 |
* @brief Opens the entry at position index in the list for
|
|
181 |
* editing in the editor. Does nothing if the index is invalid
|
|
182 |
*/
|
|
183 |
void editEntry();
|
|
184 |
|
|
185 |
/**
|
|
186 |
* @brief Opens the entry at position index in the list for
|
|
187 |
* viewing in the viewer. Does nothing if the index is invalid
|
|
188 |
*/
|
|
189 |
void viewEntry();
|
|
190 |
|
|
191 |
/**
|
|
192 |
* @brief Deletes the entry at position index in the list.
|
|
193 |
* Does nothing if the list is empty
|
|
194 |
*/
|
|
195 |
void deleteEntry();
|
|
196 |
|
|
197 |
/**
|
|
198 |
* @brief Marks a to-do as done
|
|
199 |
*/
|
|
200 |
void markAsDone();
|
|
201 |
|
|
202 |
/**
|
|
203 |
* @brief Handles long press on a particular item. Presents a
|
|
204 |
* context menu with various operations that the user can
|
|
205 |
* perform
|
|
206 |
* @param ite, The index item which is being long pressed
|
|
207 |
* @param coords The (x, y) co-ordinates where the long tap has
|
|
208 |
* occured
|
|
209 |
*/
|
|
210 |
void itemLongPressed(HbAbstractViewItem *item, const QPointF &coords);
|
|
211 |
|
|
212 |
/**
|
|
213 |
* @brief Handles user selection on a particular item of a
|
|
214 |
* particular event in the list. Default action is to view it
|
|
215 |
* @param index Index of the item which was selected
|
|
216 |
*/
|
|
217 |
void itemActivated(const QModelIndex &index);
|
|
218 |
|
|
219 |
/**
|
|
220 |
* @brief Called whenever a editing a to-do is completed
|
|
221 |
* @param status Inidcates if the editing was successful or not
|
|
222 |
*/
|
|
223 |
void noteEditingCompleted(bool status);
|
|
224 |
|
|
225 |
/**
|
|
226 |
* @brief Callback function for navigating to today's agenda
|
|
227 |
* This option must be available only if the view is showing
|
|
228 |
* events for some day other than the current day
|
|
229 |
*/
|
|
230 |
void goToToday();
|
|
231 |
|
|
232 |
/**
|
|
233 |
* @brief This slot connected to aboutToClose()signal of contextmenu
|
|
234 |
* To reset the flag of mLongTapEventFlag
|
|
235 |
*/
|
|
236 |
void contextMenuClosed();
|
|
237 |
|
|
238 |
/**
|
|
239 |
* @brief Called when contextMenu item is triggered
|
|
240 |
*/
|
|
241 |
void contextManuTriggered(HbAction *action);
|
|
242 |
|
|
243 |
private:
|
|
244 |
/**
|
|
245 |
* @var mDate
|
|
246 |
* @brief Stores the date for which this widget is being shown
|
|
247 |
*/
|
|
248 |
QDateTime mDate;
|
|
249 |
|
|
250 |
/**
|
|
251 |
* @var mInstanceArray
|
|
252 |
* @brief Holds the list of instances for the day
|
|
253 |
*/
|
|
254 |
QList<AgendaEntry> mInstanceArray;
|
|
255 |
|
|
256 |
/**
|
|
257 |
* @var mHeadingLabel
|
|
258 |
* @brief The heading widget which shows the date
|
|
259 |
*/
|
|
260 |
HbGroupBox *mHeadingLabel;
|
|
261 |
|
|
262 |
/**
|
|
263 |
* @var mEventsList
|
|
264 |
* @brief The list view which shows the list of events
|
|
265 |
*/
|
|
266 |
HbListView *mEventsList;
|
|
267 |
|
|
268 |
/**
|
|
269 |
* @var mServices
|
|
270 |
* @brief The reference to the MCalenServices object
|
|
271 |
*/
|
|
272 |
MCalenServices &mServices;
|
|
273 |
|
|
274 |
/**
|
|
275 |
* @var mView
|
|
276 |
* @brief The pointer to the view
|
|
277 |
*/
|
|
278 |
CalenAgendaView *mView;
|
|
279 |
|
|
280 |
/**
|
|
281 |
* @var mDocLoader
|
|
282 |
* @brief The pointer to the document loader which has
|
|
283 |
* loaded this widget
|
|
284 |
*/
|
|
285 |
CalenDocLoader *mDocLoader;
|
|
286 |
|
|
287 |
/**
|
|
288 |
* @var mListViewPrototype
|
|
289 |
* @brief Acts as the item prototype for list view.
|
|
290 |
* Allows providing own layout for list items
|
|
291 |
*/
|
|
292 |
CalenEventListViewItem *mListViewPrototype;
|
|
293 |
|
|
294 |
/**
|
|
295 |
* @var mEmptyListLabel
|
|
296 |
* @brief The pointer to the empty view label
|
|
297 |
*/
|
|
298 |
HbLabel *mEmptyListLabel;
|
|
299 |
|
|
300 |
/**
|
|
301 |
* @var mListModel
|
|
302 |
* @brief The event list model
|
|
303 |
*/
|
|
304 |
QStandardItemModel *mListModel;
|
|
305 |
|
|
306 |
/**
|
|
307 |
* @var mSelectedIndex
|
|
308 |
* @brief Stores the index of the item being acted upon
|
|
309 |
* Since there is no focus, it becomes necessary to store the
|
|
310 |
* index of the item on which user is performing some action
|
|
311 |
*/
|
|
312 |
int mSelectedIndex;
|
|
313 |
|
|
314 |
/**
|
|
315 |
* @var NotesEditorPluginLoader
|
|
316 |
* @brief Pointer to the notes editor plugin loader
|
|
317 |
*/
|
|
318 |
QPointer<QPluginLoader> mNotesEditorPluginLoader;
|
|
319 |
|
|
320 |
/**
|
|
321 |
* @var mDatePicker
|
|
322 |
* @brief The date picker component
|
|
323 |
*/
|
|
324 |
HbDateTimePicker *mDatePicker;
|
|
325 |
|
|
326 |
/**
|
|
327 |
* @var mRegionalPluginLayout
|
|
328 |
* @brief Regional Plugin layout pointer
|
|
329 |
*/
|
|
330 |
QGraphicsLinearLayout* mRegionalPluginLayout;
|
|
331 |
|
|
332 |
/**
|
|
333 |
* @var mRegionalInfoGroupBox
|
|
334 |
* @brief Regional Plugin Info groupbox
|
|
335 |
*/
|
|
336 |
HbGroupBox *mRegionalInfoGroupBox;
|
|
337 |
|
|
338 |
/**
|
|
339 |
* @var mSettingsManager
|
|
340 |
* @brief Setting Manager pointer
|
|
341 |
*/
|
|
342 |
|
|
343 |
XQSettingsManager *mSettingsManager;
|
|
344 |
|
|
345 |
/**
|
|
346 |
* @var mLongTapeventFlag
|
|
347 |
* @brief Set flag true if contextmenu is opened
|
|
348 |
*/
|
|
349 |
bool mLongTapEventFlag;
|
|
350 |
|
|
351 |
/**
|
|
352 |
* @var mNotesPluginLoaded
|
|
353 |
* @brief Holds notes editor plugin load info.
|
|
354 |
*/
|
|
355 |
bool mNotesPluginLoaded;
|
|
356 |
|
|
357 |
};
|
|
358 |
|
|
359 |
#endif //CALENAGENDAVIEWWIDGET_H
|
|
360 |
|
|
361 |
// End of file --Don't remove this.
|