NoteEditor.hpp Example File
notebook/src/NoteEditor.hpp
#ifndef NOTEEDITOR_HPP
#define NOTEEDITOR_HPP
#include <bb/pim/notebook/NotebookEntryDescription>
#include <bb/pim/notebook/NotebookEntryId>
#include <bb/pim/notebook/NotebookService>
#include <QtCore/QObject>
class NoteEditor : public QObject
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
Q_PROPERTY(QDateTime dueDateTime READ dueDateTime WRITE setDueDateTime NOTIFY dueDateTimeChanged)
Q_PROPERTY(bool completed READ completed WRITE setCompleted NOTIFY completedChanged)
Q_PROPERTY(Mode mode READ mode WRITE setMode NOTIFY modeChanged)
Q_ENUMS(Mode)
public:
enum Mode {
CreateMode,
EditMode
};
NoteEditor(bb::pim::notebook::NotebookService *service, QObject *parent = 0);
void setMode(Mode mode);
Mode mode() const;
public Q_SLOTS:
void loadNote(const bb::pim::notebook::NotebookEntryId ¬eId);
void saveNote();
void reset();
Q_SIGNALS:
void titleChanged();
void descriptionChanged();
void dueDateTimeChanged();
void completedChanged();
void modeChanged();
private:
void setTitle(const QString &title);
QString title() const;
void setDescription(const QString &description);
QString description() const;
void setDueDateTime(const QDateTime &dueDateTime);
QDateTime dueDateTime() const;
void setCompleted(bool completed);
bool completed() const;
bb::pim::notebook::NotebookService *m_notebookService;
bb::pim::notebook::NotebookEntryId m_noteId;
QString m_title;
bb::pim::notebook::NotebookEntryDescription m_description;
QDateTime m_dueDateTime;
bool m_completed;
Mode m_mode;
};
#endif