Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb46945' into 'master'
Expose whether email has a calendar cancellation

See merge request mer-core/nemo-qml-plugin-email!76
  • Loading branch information
llewelld committed Jan 13, 2021
2 parents 31ea5a8 + f27852b commit 561a181
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
6 changes: 3 additions & 3 deletions rpm/nemo-qml-plugin-email-qt5.spec
@@ -1,6 +1,6 @@
Name: nemo-qml-plugin-email-qt5
Summary: Email plugin for Nemo Mobile
Version: 0.6.0
Version: 0.6.17
Release: 1
Group: System/Libraries
License: BSD and LGPLv2+
Expand All @@ -15,8 +15,8 @@ BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5Concurrent)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(QmfMessageServer)
BuildRequires: pkgconfig(QmfClient)
BuildRequires: pkgconfig(QmfMessageServer) >= 4.0.4+git127
BuildRequires: pkgconfig(QmfClient) >= 4.0.4+git127
BuildRequires: pkgconfig(accounts-qt5)
Conflicts: nemo-qml-plugin-email-qt5-offline

Expand Down
9 changes: 8 additions & 1 deletion src/emailmessage.cpp
@@ -1,6 +1,7 @@
/*
* Copyright 2011 Intel Corporation.
* Copyright (C) 2013-2019 Jolla Ltd.
* Copyright (C) 2013-2020 Jolla Ltd.
* Copyright (C) 2021 Open Mobile Platform LLC.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
Expand Down Expand Up @@ -550,6 +551,11 @@ bool EmailMessage::hasCalendarInvitation() const
return (m_msg.status() & QMailMessageMetaData::CalendarInvitation) != 0;
}

bool EmailMessage::hasCalendarCancellation() const
{
return (m_msg.status() & QMailMessageMetaData::CalendarCancellation) != 0;
}

EmailMessage::AttachedDataStatus EmailMessage::calendarInvitationStatus() const
{
return m_calendarStatus;
Expand Down Expand Up @@ -1218,6 +1224,7 @@ void EmailMessage::emitMessageReloadedSignals()
emit attachmentsChanged();
emit calendarInvitationUrlChanged();
emit hasCalendarInvitationChanged();
emit hasCalendarCancellationChanged();
emit calendarInvitationStatusChanged();
emit calendarInvitationBodyChanged();
emit calendarInvitationSupportsEmailResponsesChanged();
Expand Down
6 changes: 5 additions & 1 deletion src/emailmessage.h
@@ -1,6 +1,7 @@
/*
* Copyright 2011 Intel Corporation.
* Copyright (C) 2013-2019 Jolla Ltd.
* Copyright (C) 2013-2020 Jolla Ltd.
* Copyright (C) 2021 Open Mobile Platform LLC.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
Expand Down Expand Up @@ -36,6 +37,7 @@ class Q_DECL_EXPORT EmailMessage : public QObject
Q_PROPERTY(QString body READ body WRITE setBody NOTIFY bodyChanged)
Q_PROPERTY(QString calendarInvitationUrl READ calendarInvitationUrl NOTIFY calendarInvitationUrlChanged FINAL)
Q_PROPERTY(bool hasCalendarInvitation READ hasCalendarInvitation NOTIFY hasCalendarInvitationChanged FINAL)
Q_PROPERTY(bool hasCalendarCancellation READ hasCalendarCancellation NOTIFY hasCalendarCancellationChanged FINAL)
Q_PROPERTY(AttachedDataStatus calendarInvitationStatus READ calendarInvitationStatus NOTIFY calendarInvitationStatusChanged FINAL)
Q_PROPERTY(QString calendarInvitationBody READ calendarInvitationBody NOTIFY calendarInvitationBodyChanged)
Q_PROPERTY(bool calendarInvitationSupportsEmailResponses READ calendarInvitationSupportsEmailResponses NOTIFY calendarInvitationSupportsEmailResponsesChanged)
Expand Down Expand Up @@ -136,6 +138,7 @@ class Q_DECL_EXPORT EmailMessage : public QObject
QString body();
QString calendarInvitationUrl();
bool hasCalendarInvitation() const;
bool hasCalendarCancellation() const;
AttachedDataStatus calendarInvitationStatus() const;
QString calendarInvitationBody() const;
bool calendarInvitationSupportsEmailResponses() const;
Expand Down Expand Up @@ -200,6 +203,7 @@ class Q_DECL_EXPORT EmailMessage : public QObject
void bccChanged();
void calendarInvitationUrlChanged();
void hasCalendarInvitationChanged();
void hasCalendarCancellationChanged();
void calendarInvitationStatusChanged();
void calendarInvitationBodyChanged();
bool calendarInvitationSupportsEmailResponsesChanged();
Expand Down
6 changes: 5 additions & 1 deletion src/emailmessagelistmodel.cpp
@@ -1,6 +1,7 @@
/*
* Copyright 2011 Intel Corporation.
* Copyright (C) 2012-2019 Jolla Ltd.
* Copyright (C) 2012-2020 Jolla Ltd.
* Copyright (C) 2021 Open Mobile Platform LLC.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
Expand Down Expand Up @@ -63,6 +64,7 @@ EmailMessageListModel::EmailMessageListModel(QObject *parent)
roles[MessageSizeSectionRole] = "sizeSection";
roles[MessageFolderIdRole] = "folderId";
roles[MessageParsedSubject] = "parsedSubject";
roles[MessageHasCalendarCancellationRole] = "hasCalendarCancellation";

m_key = key();
m_sortKey = QMailMessageSortKey::timeStamp(Qt::DescendingOrder);
Expand Down Expand Up @@ -234,6 +236,8 @@ QVariant EmailMessageListModel::data(const QModelIndex & index, int role) const
subject.replace(QRegExp("<\\s*img", Qt::CaseInsensitive), "<no-img");
subject.replace(QRegExp("<\\s*a", Qt::CaseInsensitive), "<no-a");
return subject;
} else if (role == MessageHasCalendarCancellationRole) {
return (messageMetaData.status() & QMailMessageMetaData::CalendarCancellation) != 0;
}

return QMailMessageListModel::data(index, role);
Expand Down
6 changes: 4 additions & 2 deletions src/emailmessagelistmodel.h
@@ -1,6 +1,7 @@
/*
* Copyright 2011 Intel Corporation.
* Copyright (C) 2012-2019 Jolla Ltd.
* Copyright (C) 2012-2020 Jolla Ltd.
* Copyright (C) 2021 Open Mobile Platform LLC.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
Expand Down Expand Up @@ -69,7 +70,8 @@ class Q_DECL_EXPORT EmailMessageListModel : public QMailMessageListModel
MessageHasSignatureRole, // returns true if message is numerically signed, false otherwise
MessageSizeSectionRole, // returns size section (0-2)
MessageFolderIdRole, // returns parent folder id for the message
MessageParsedSubject // returns the message subject parsed against a pre-defined regular expression
MessageParsedSubject, // returns the message subject parsed against a pre-defined regular expression
MessageHasCalendarCancellationRole, // returns 1 if message has a calendar cancellation, 0 otherwise
};

enum Priority { LowPriority, NormalPriority, HighPriority };
Expand Down

0 comments on commit 561a181

Please sign in to comment.