File indexing completed on 2025-01-05 04:54:59
0001 /* 0002 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@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 "eventcontroller.h" 0030 0031 #include <KCalendarCore/Event> 0032 class KUBE_EXPORT InvitationController : public EventController 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 enum InvitationMethod { 0038 Reply, 0039 Request, 0040 Cancel 0041 }; 0042 Q_ENUM(InvitationMethod); 0043 0044 enum InvitationEventState { 0045 New, 0046 Existing, 0047 Update 0048 }; 0049 Q_ENUM(InvitationEventState); 0050 0051 KUBE_CONTROLLER_PROPERTY(QByteArray, Uid, uid) 0052 KUBE_CONTROLLER_PROPERTY(ParticipantStatus, State, state) 0053 KUBE_CONTROLLER_PROPERTY(InvitationMethod, Method, method) 0054 KUBE_CONTROLLER_PROPERTY(InvitationEventState, EventState, eventState) 0055 KUBE_CONTROLLER_PROPERTY(QString, Name, name) 0056 KUBE_CONTROLLER_PROPERTY(QDateTime, RecurrenceId, recurrenceId) 0057 0058 KUBE_CONTROLLER_ACTION(accept) 0059 KUBE_CONTROLLER_ACTION(decline) 0060 0061 public: 0062 explicit InvitationController(); 0063 0064 Q_INVOKABLE void loadICal(const QString &message); 0065 0066 private: 0067 void handleRequest(KCalendarCore::Event::Ptr icalEvent); 0068 void handleReply(KCalendarCore::Event::Ptr icalEvent); 0069 void handleCancellation(KCalendarCore::Event::Ptr icalEvent); 0070 void storeEvent(ParticipantStatus); 0071 KAsync::Job<ParticipantStatus> findAttendeeStatus(); 0072 Sink::ApplicationDomain::Event mExistingEvent; 0073 KCalendarCore::Event::Ptr mLoadedIcalEvent; 0074 };