Skip to content

Commit

Permalink
Avoid mapping to kcalcore enum
Browse files Browse the repository at this point in the history
Can define our own values. Further the participation was coerced to
boolean(?)
  • Loading branch information
pvuorela committed May 17, 2019
1 parent e539f3f commit c397856
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/calendareventquery.h
Expand Up @@ -53,15 +53,14 @@ class Person : public QObject
Q_PROPERTY(int participationRole READ participationRole CONSTANT FINAL)

public:
// mapping to KCalcore::Attendee::Role
enum AttendeeRole {
RequiredParticipant,
OptionalParticipant,
NonParticipant,
ChairParticipant
};

Person(const QString &aName, const QString &aEmail, bool aIsOrganizer, bool aParticipationRole)
Person(const QString &aName, const QString &aEmail, bool aIsOrganizer, AttendeeRole aParticipationRole)
: m_name(aName), m_email(aEmail), m_isOrganizer(aIsOrganizer), m_participationRole(aParticipationRole)
{
}
Expand Down
18 changes: 16 additions & 2 deletions src/calendarutils.cpp
Expand Up @@ -152,8 +152,22 @@ QList<QObject *> NemoCalendarUtils::convertAttendeeList(const QList<NemoCalendar
{
QList<QObject*> result;
foreach (const NemoCalendarData::Attendee &attendee, list) {
QObject *person = new Person(attendee.name, attendee.email, attendee.isOrganizer,
attendee.participationRole);
Person::AttendeeRole role;
switch (attendee.participationRole) {
case KCalCore::Attendee::ReqParticipant:
role = Person::RequiredParticipant;
break;
case KCalCore::Attendee::OptParticipant:
role = Person::OptionalParticipant;
break;
case KCalCore::Attendee::Chair:
role = Person::ChairParticipant;
break;
default:
role = Person::NonParticipant;
break;
}
QObject *person = new Person(attendee.name, attendee.email, attendee.isOrganizer, role);
result.append(person);
}

Expand Down

0 comments on commit c397856

Please sign in to comment.