File indexing completed on 2025-01-05 04:55:01

0001 /*
0002  *  Copyright (C) 2017 Michael Bohldueer, <michael.bohldueer@kdemail.net>
0003  *  Copyright (C) 2018 Christian Mollekopf, <mollekopf@kolabsys.com>
0004  *
0005  *  This program is free software; you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation; either version 2 of the License, or
0008  *  (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU General Public License along
0016  *  with this program; if not, write to the Free Software Foundation, Inc.,
0017  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 
0021 #pragma once
0022 #include "kube_export.h"
0023 
0024 #include <QString>
0025 #include <QDateTime>
0026 
0027 #include <sink/applicationdomaintype.h>
0028 
0029 #include "controller.h"
0030 
0031 class KUBE_EXPORT TodoController : public Kube::Controller
0032 {
0033     Q_OBJECT
0034 
0035     // Input properties
0036     Q_PROPERTY(QVariant todo READ getTodo WRITE loadTodo)
0037 
0038     //Interface properties
0039     KUBE_CONTROLLER_PROPERTY(QByteArray, AccountId, accountId)
0040     KUBE_CONTROLLER_PROPERTY(QString, Summary, summary)
0041     KUBE_CONTROLLER_PROPERTY(QString, Description, description)
0042     KUBE_CONTROLLER_PROPERTY(QString, Location, location)
0043     KUBE_CONTROLLER_PROPERTY(QDateTime, Start, start)
0044     KUBE_CONTROLLER_PROPERTY(QDateTime, Due, due)
0045     KUBE_CONTROLLER_PROPERTY(bool, AllDay, allDay)
0046     KUBE_CONTROLLER_PROPERTY(bool, Complete, complete)
0047     KUBE_CONTROLLER_PROPERTY(bool, Doing, doing)
0048     KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::ApplicationDomainType::Ptr, Calendar, calendar)
0049     KUBE_CONTROLLER_PROPERTY(QByteArray, CalendarId, calendarId)
0050     KUBE_CONTROLLER_PROPERTY(QByteArray, Uid, uid)
0051     KUBE_CONTROLLER_PROPERTY(QByteArray, ParentUid, parentUid)
0052 
0053     KUBE_CONTROLLER_ACTION(save)
0054 
0055 public:
0056     explicit TodoController();
0057 
0058     Q_INVOKABLE void loadTodo(const QVariant &todo);
0059     Q_INVOKABLE void remove();
0060     Q_INVOKABLE void reload();
0061 
0062     QVariant getTodo() const;
0063 
0064 private slots:
0065     void updateSaveAction();
0066 
0067 private:
0068     QVariant mTodo;
0069 };