|
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: |
|
15 * Header file for class NotesModel. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef NOTESMODEL_H |
|
20 #define NOTESMODEL_H |
|
21 |
|
22 // System includes |
|
23 #include <QObject> |
|
24 #include <QModelIndex> |
|
25 |
|
26 // User includes |
|
27 #include "notesmodeldefines.h" |
|
28 #include "notestest_global.h" |
|
29 |
|
30 // Forward declarations |
|
31 class QAbstractItemModel; |
|
32 class QStandardItemModel; |
|
33 class AgendaUtil; |
|
34 class AgendaEntry; |
|
35 |
|
36 NOTES_TEST_CLASS(TestNotesModel) |
|
37 |
|
38 class NOTESMODEL_EXPORT NotesModel : public QObject |
|
39 { |
|
40 Q_OBJECT |
|
41 |
|
42 public: |
|
43 NotesModel(AgendaUtil *mAgendaUtil, QObject *parent = 0); |
|
44 virtual ~NotesModel(); |
|
45 |
|
46 public: |
|
47 QAbstractItemModel *sourceModel(); |
|
48 |
|
49 signals: |
|
50 void rowAdded(QModelIndex index); |
|
51 |
|
52 private slots: |
|
53 void populateSourceModel(); |
|
54 void updateSourceModel(ulong id); |
|
55 void populateSourceModel(QList<ulong> ids); |
|
56 void addEntryToModel(ulong id); |
|
57 void removeEntryFromModel(ulong id); |
|
58 void handleInstanceViewCreationCompleted(int status); |
|
59 |
|
60 private: |
|
61 void modifyEntryInModel(ulong id, int row); |
|
62 void appendNotesToModel(QList<AgendaEntry> &agendaEntryList); |
|
63 void appendInCompTodosToModel(QList<AgendaEntry> &agendaEntryList); |
|
64 void appendCompTodosToModel(QList<AgendaEntry> &agendaEntryList); |
|
65 bool insertNoteToModel(QModelIndex &index, ulong id); |
|
66 bool insertInCompTodoToModel(QModelIndex &index, ulong id); |
|
67 bool insertCompTodoToModel(QModelIndex &index, ulong id); |
|
68 QString dateFormatString(); |
|
69 QString timeFormatString(); |
|
70 |
|
71 private: |
|
72 QStandardItemModel *mSourceModel; |
|
73 AgendaUtil *mAgendaUtil; |
|
74 |
|
75 int mNotesCount; |
|
76 int mInCompTodoCount; |
|
77 int mCompTodoCount; |
|
78 |
|
79 private: |
|
80 NOTES_TEST_FRIEND_CLASS(TestNotesModel) |
|
81 }; |
|
82 |
|
83 #endif // NOTESMODEL_H |
|
84 |
|
85 // End of file --Don't remove this |