1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the Qt Mobility Components. |
7 ** This file is part of the Qt Mobility Components. |
8 ** |
8 ** |
9 ** $QT_BEGIN_LICENSE:LGPL$ |
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
10 ** You may use this file in accordance with the terms and conditions |
12 ** You may use this file in accordance with the terms and conditions |
11 ** contained in the Technology Preview License Agreement accompanying |
13 ** contained in the Technology Preview License Agreement accompanying |
12 ** this package. |
14 ** this package. |
13 ** |
15 ** |
14 ** GNU Lesser General Public License Usage |
16 ** GNU Lesser General Public License Usage |
34 ** |
36 ** |
35 ** |
37 ** |
36 ** $QT_END_LICENSE$ |
38 ** $QT_END_LICENSE$ |
37 ** |
39 ** |
38 ****************************************************************************/ |
40 ****************************************************************************/ |
39 |
|
40 #ifndef NOTESMANAGER_H |
41 #ifndef NOTESMANAGER_H |
41 #define NOTESMANAGER_H |
42 #define NOTESMANAGER_H |
42 |
43 |
43 #include <QObject> |
44 #include <QObject> |
44 #include <QDateTime> |
45 #include <QDateTime> |
45 #include <QList> |
46 #include <QList> |
46 #include <QTimer> |
47 #include <QTimer> |
47 #include <QSqlDatabase> |
48 #include <QSqlDatabase> |
48 #include <QSqlQuery> |
49 #include <QSqlQuery> |
49 |
50 |
50 typedef struct |
51 |
51 { |
52 #ifdef DECLARATIVE |
52 int index; |
53 #include <QtDeclarative/qdeclarativelist.h> |
53 QString message; |
54 #include <QtDeclarative/qdeclarative.h> |
54 QDateTime alert; |
55 #endif |
55 } Note; |
56 |
|
57 #include "note.h" |
56 |
58 |
57 class NotesManager : public QObject |
59 class NotesManager : public QObject |
58 { |
60 { |
59 Q_OBJECT |
61 Q_OBJECT |
60 Q_PROPERTY(QDateTime alarm READ getAlarm WRITE setAlarm NOTIFY soundAlarm) |
62 Q_PROPERTY(QDateTime alarmTime READ getAlarmTime WRITE setAlarmTime NOTIFY soundAlarm) |
61 Q_PROPERTY(QString message READ getMessage WRITE setMessage) |
63 Q_PROPERTY(QString alarmMessage READ getAlarmMessage WRITE setAlarmMessage) |
|
64 #ifdef DECLARATIVE |
|
65 Q_PROPERTY(QDeclarativeListProperty<QObject> noteSet READ noteSet) |
|
66 #endif |
62 |
67 |
63 public: |
68 public: |
64 NotesManager(QObject *parent = 0); |
69 NotesManager(QObject *parent = 0); |
65 Q_INVOKABLE QList<Note> getNotes(const QString& search=QString()) const; |
70 Q_INVOKABLE QList<QObject*> getNotes(const QString& search=QString()); |
|
71 #ifdef DECLARATIVE |
|
72 QDeclarativeListProperty<QObject> noteSet(); |
|
73 #endif |
66 |
74 |
67 public slots: |
75 public slots: |
68 void addNote(const QString ¬e, const QDateTime &alarm); |
76 void addNote(const QString ¬e, const QDateTime &alarm); |
69 void removeNote(int id); |
77 void removeNote(int id); |
|
78 void setSearch(const QString &search); |
70 |
79 |
71 private: |
80 private: |
72 QDateTime m_alarm; |
81 QDateTime m_alarmTime; |
73 QString m_message; |
82 QString m_alarmMessage; |
|
83 QList<QObject *> m_notes; |
|
84 QString m_search; |
74 |
85 |
75 QDateTime getAlarm() const; |
86 QDateTime getAlarmTime() const; |
76 void setAlarm(const QDateTime &alarm); |
87 void setAlarmTime(const QDateTime &alarm); |
77 |
88 |
78 QString getMessage() const; |
89 QString getAlarmMessage() const; |
79 void setMessage(const QString &message); |
90 void setAlarmMessage(const QString &message); |
80 |
91 |
81 void nextAlarm(); |
92 void nextAlarm(); |
82 |
93 |
83 private slots: |
94 private slots: |
84 void checkAlarm(); |
95 void checkAlarm(); |