Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nemo-qml-plugin-calendar] Expose sync failures to events. Contribute…
…s to JB#50817
  • Loading branch information
dcaliste committed Aug 17, 2020
1 parent 884f815 commit 4f8c1ce
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rpm/nemo-qml-plugin-calendar-qt5.spec
@@ -1,7 +1,7 @@
Name: nemo-qml-plugin-calendar-qt5

Summary: Calendar plugin for Nemo Mobile
Version: 0.5.10
Version: 0.5.17
Release: 1
Group: System/Libraries
License: BSD
Expand Down
1 change: 1 addition & 0 deletions src/calendardata.h
Expand Up @@ -43,6 +43,7 @@ struct Event {
CalendarEvent::Secrecy secrecy;
QString calendarUid;
CalendarEvent::Response ownerStatus = CalendarEvent::ResponseUnspecified;
CalendarEvent::SyncFailure syncFailure = CalendarEvent::NoSyncFailure;

bool operator==(const Event& other) const
{
Expand Down
5 changes: 5 additions & 0 deletions src/calendarevent.cpp
Expand Up @@ -132,6 +132,11 @@ CalendarEvent::Secrecy CalendarEvent::secrecy() const
return mManager->getEvent(mUniqueId, mRecurrenceId).secrecy;
}

CalendarEvent::SyncFailure CalendarEvent::syncFailure() const
{
return mManager->getEvent(mUniqueId, mRecurrenceId).syncFailure;
}

CalendarEvent::Response CalendarEvent::ownerStatus() const
{
return mManager->getEvent(mUniqueId, mRecurrenceId).ownerStatus;
Expand Down
11 changes: 11 additions & 0 deletions src/calendarevent.h
Expand Up @@ -65,6 +65,7 @@ class CalendarEvent : public QObject
Q_PROPERTY(QString calendarUid READ calendarUid NOTIFY calendarUidChanged)
Q_PROPERTY(QString location READ location NOTIFY locationChanged)
Q_PROPERTY(CalendarEvent::Secrecy secrecy READ secrecy NOTIFY secrecyChanged)
Q_PROPERTY(CalendarEvent::SyncFailure syncFailure READ syncFailure NOTIFY syncFailureChanged)
Q_PROPERTY(CalendarEvent::Response ownerStatus READ ownerStatus NOTIFY ownerStatusChanged)
Q_PROPERTY(bool rsvp READ rsvp NOTIFY rsvpChanged)
Q_PROPERTY(bool externalInvitation READ externalInvitation NOTIFY externalInvitationChanged)
Expand Down Expand Up @@ -115,6 +116,14 @@ class CalendarEvent : public QObject
ResponseDecline
};

enum SyncFailure {
NoSyncFailure,
UploadFailure,
UpdateFailure,
DeleteFailure
};
Q_ENUM(SyncFailure)

CalendarEvent(CalendarManager *manager, const QString &uid, const KDateTime &recurrenceId);
~CalendarEvent();

Expand All @@ -136,6 +145,7 @@ class CalendarEvent : public QObject
KDateTime recurrenceId() const;
QString recurrenceIdString() const;
Secrecy secrecy() const;
SyncFailure syncFailure() const;
Response ownerStatus() const;
bool rsvp() const;
bool externalInvitation() const;
Expand Down Expand Up @@ -163,6 +173,7 @@ private slots:
void hasRecurEndDateChanged();
void recurWeeklyDaysChanged();
void secrecyChanged();
void syncFailureChanged();
void ownerStatusChanged();
void rsvpChanged();
void externalInvitationChanged();
Expand Down
8 changes: 8 additions & 0 deletions src/calendarworker.cpp
Expand Up @@ -815,6 +815,14 @@ CalendarData::Event CalendarWorker::createEventStruct(const KCalCore::Event::Ptr
event.readOnly = mStorage->notebook(event.calendarUid)->isReadOnly();
event.recur = CalendarUtils::convertRecurrence(e);
event.recurWeeklyDays = CalendarUtils::convertDayPositions(e);
const QString &syncFailure = e->customProperty("VOLATILE", "SYNC-FAILURE");
if (syncFailure.compare("upload", Qt::CaseInsensitive) == 0) {
event.syncFailure = CalendarEvent::UploadFailure;
} else if (syncFailure.compare("update", Qt::CaseInsensitive) == 0) {
event.syncFailure = CalendarEvent::UpdateFailure;
} else if (syncFailure.compare("delete", Qt::CaseInsensitive) == 0) {
event.syncFailure = CalendarEvent::DeleteFailure;
}
bool externalInvitation = false;
const QString &calendarOwnerEmail = getNotebookAddress(e);

Expand Down

0 comments on commit 4f8c1ce

Please sign in to comment.