EventEditor.hpp Example File
calendar/src/EventEditor.hpp
#ifndef EVENTEDITOR_HPP
#define EVENTEDITOR_HPP
#include <bb/cascades/DropDown>
#include <bb/pim/calendar/CalendarService>
#include <bb/pim/calendar/EventKey>
#include <QtCore/QObject>
class EventEditor : public QObject
{
Q_OBJECT
Q_PROPERTY(QString subject READ subject WRITE setSubject NOTIFY subjectChanged)
Q_PROPERTY(QString location READ location WRITE setLocation NOTIFY locationChanged)
Q_PROPERTY(QDateTime startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
Q_PROPERTY(QDateTime endTime READ endTime WRITE setEndTime NOTIFY endTimeChanged)
Q_PROPERTY(int folderId READ folderId WRITE setFolderId NOTIFY folderIdChanged)
Q_PROPERTY(int accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged)
Q_PROPERTY(Mode mode READ mode WRITE setMode NOTIFY modeChanged)
Q_ENUMS(Mode)
public:
enum Mode {
CreateMode,
EditMode
};
EventEditor(bb::pim::calendar::CalendarService *service, QObject *parent = 0);
void setMode(Mode mode);
Mode mode() const;
Q_INVOKABLE void initializeFolderDropDown(bb::cascades::DropDown *downDown);
public Q_SLOTS:
void loadEvent(const bb::pim::calendar::EventKey &eventKey);
void saveEvent();
void reset();
Q_SIGNALS:
void subjectChanged();
void locationChanged();
void startTimeChanged();
void endTimeChanged();
void folderIdChanged();
void accountIdChanged();
void modeChanged();
private:
void setSubject(const QString &subject);
QString subject() const;
void setLocation(const QString &location);
QString location() const;
void setStartTime(const QDateTime &startTime);
QDateTime startTime() const;
void setEndTime(const QDateTime &endTime);
QDateTime endTime() const;
void setFolderId(int folderId);
int folderId() const;
void setAccountId(int accountId);
int accountId() const;
bb::pim::calendar::CalendarService* m_calendarService;
bb::pim::calendar::EventKey m_eventKey;
QString m_subject;
QString m_location;
QDateTime m_startTime;
QDateTime m_endTime;
int m_folderId;
int m_accountId;
Mode m_mode;
};
#endif