localcalendar.h 2.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/*
 * Copyright (C) 2018 Dimitris Kardarakos
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef LOCALCALENDAR_H
#define LOCALCALENDAR_H

#include <QSharedPointer>
#include <KCalCore/MemoryCalendar>
#include <KCalCore/FileStorage>

using namespace KCalCore;

class LocalCalendar : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
    Q_PROPERTY(QSharedPointer<MemoryCalendar> memorycalendar READ memorycalendar WRITE setMemorycalendar NOTIFY memorycalendarChanged)
33 34
    Q_PROPERTY(QSharedPointer<FileStorage> calendarstorage READ calendarstorage WRITE setCalendarstorage NOTIFY calendarstorageChanged)
    Q_PROPERTY(QDateTime nulldate READ nulldate CONSTANT)
35 36 37 38

public:
    explicit LocalCalendar(QObject* parent = nullptr);
    ~LocalCalendar() override;
39

40 41 42
    MemoryCalendar::Ptr memorycalendar() const;
    FileStorage::Ptr calendarstorage() const;
    QString name() const;
43
    QDateTime nulldate() const;
44 45 46 47

    void setMemorycalendar(MemoryCalendar::Ptr memoryCalendar);
    void setCalendarstorage(FileStorage::Ptr calendarStorage);
    void setName(QString calendarName);
48

49
public Q_SLOTS:
50
    void addEditTask(QString uid, QDate startDate, QString summary, QString description, int startHour, int startMinute, bool allDayFlg, QString location);
51
    void deleteTask(QString uid);
52
    int todosCount(const QDate &date) const;
53
    void deleteCalendar();
54

55 56 57 58
Q_SIGNALS:
    void memorycalendarChanged();
    void calendarstorageChanged();
    void nameChanged();
59

60 61 62
private:
    MemoryCalendar::Ptr m_calendar;
    FileStorage::Ptr m_cal_storage;
63 64
    QString m_name;
    QString m_fullpath;
65 66 67 68
};

#endif // LOCALCALENDAR_H