diff --git a/framework/src/domain/eventcontroller.cpp b/framework/src/domain/eventcontroller.cpp index d2885c43..d5cf2b9a 100644 --- a/framework/src/domain/eventcontroller.cpp +++ b/framework/src/domain/eventcontroller.cpp @@ -54,28 +54,28 @@ static std::pair<QStringList, QStringList> getRecipients(const QString &organize QStringList to; QStringList cc; for (const auto &a : attendees) { - const auto email = a->email(); + const auto email = a.email(); if (email.isEmpty()) { - SinkTrace() << "Attendee has no email: " << a->fullName(); + SinkTrace() << "Attendee has no email: " << a.fullName(); continue; } //Don't send ourselves an email if part of attendees if (organizerEmail == email ) { - SinkTrace() << "This is us: " << a->fullName(); + SinkTrace() << "This is us: " << a.fullName(); continue; } //No updates if the attendee has already declined - if (a->status() == KCalCore::Attendee::Declined) { - SinkTrace() << "Already declined: " << a->fullName(); + if (a.status() == KCalCore::Attendee::Declined) { + SinkTrace() << "Already declined: " << a.fullName(); continue; } - const auto prettyAddress = assembleEmailAddress(a->name(), email); + const auto prettyAddress = assembleEmailAddress(a.name(), email); - if (a->role() == KCalCore::Attendee::OptParticipant || - a->role() == KCalCore::Attendee::NonParticipant) { + if (a.role() == KCalCore::Attendee::OptParticipant || + a.role() == KCalCore::Attendee::NonParticipant) { cc << prettyAddress; } else { to << prettyAddress; @@ -99,7 +99,7 @@ QString EventController::eventToBody(const KCalCore::Event &event) body.append(QObject::tr("Attendees:")); body.append("\n"); for (const auto &attendee : event.attendees()) { - body.append(" " + attendee->fullName()); + body.append(" " + attendee.fullName()); } return body; } @@ -325,9 +325,9 @@ void EventController::populateFromEvent(const KCalCore::Event &event) setAllDay(event.allDay()); setOurEvent(true); - setOrganizer(event.organizer()->fullName()); + setOrganizer(event.organizer().fullName()); for (const auto &attendee : event.attendees()) { - attendeesController()->add({{"name", attendee->fullName()}, {"email", attendee->email()}, {"status", toStatus(attendee->status())}}); + attendeesController()->add({{"name", attendee.fullName()}, {"email", attendee.email()}, {"status", toStatus(attendee.status())}}); } } @@ -348,7 +348,7 @@ void EventController::saveToEvent(KCalCore::Event &event) KCalCore::Attendee::PartStat status = fromStatus(map["status"].value<ParticipantStatus>()); KCalCore::Attendee::Role role = KCalCore::Attendee::ReqParticipant; const auto [name, email] = parseEmailAddress(map["name"].toString()); - event.addAttendee(KCalCore::Attendee::Ptr::create(name, email, rsvp, status, role, QString{})); + event.addAttendee(KCalCore::Attendee(name, email, rsvp, status, role, QString{})); }); } diff --git a/framework/src/domain/invitationcontroller.cpp b/framework/src/domain/invitationcontroller.cpp index 735f0af8..98cdc8dc 100644 --- a/framework/src/domain/invitationcontroller.cpp +++ b/framework/src/domain/invitationcontroller.cpp @@ -113,7 +113,7 @@ void InvitationController::loadICal(const QString &ical) static void sendIMipReply(const QByteArray &accountId, const QString &from, const QString &fromName, KCalCore::Event::Ptr event, KCalCore::Attendee::PartStat status) { - const auto organizerEmail = event->organizer()->fullName(); + const auto organizerEmail = event->organizer().fullName(); if (organizerEmail.isEmpty()) { SinkWarning() << "Failed to find the organizer to send the reply to " << organizerEmail; @@ -122,7 +122,7 @@ static void sendIMipReply(const QByteArray &accountId, const QString &from, cons auto reply = KCalCore::Event::Ptr::create(*event); reply->clearAttendees(); - reply->addAttendee(KCalCore::Attendee::Ptr::create(fromName, from, false, status)); + reply->addAttendee(KCalCore::Attendee(fromName, from, false, status)); QString body; if (status == KCalCore::Attendee::Accepted) { diff --git a/framework/src/tests/invitationcontrollertest.cpp b/framework/src/tests/invitationcontrollertest.cpp --- a/framework/src/tests/invitationcontrollertest.cpp 2019-09-17 23:46:29.710823901 +0200 +++ b/framework/src/tests/invitationcontrollertest.cpp 2019-09-17 23:46:59.197700275 +0200 @@ -31,7 +31,7 @@ class InvitationControllerTest : public calcoreEvent->setLocation("location"); calcoreEvent->setDtStart(QDateTime::currentDateTime()); calcoreEvent->setOrganizer("organizer@test.com"); - calcoreEvent->addAttendee(KCalCore::Attendee::Ptr::create("John Doe", "attendee1@test.com", true, KCalCore::Attendee::NeedsAction)); + calcoreEvent->addAttendee(KCalCore::Attendee("John Doe", "attendee1@test.com", true, KCalCore::Attendee::NeedsAction)); return KCalCore::ICalFormat{}.createScheduleMessage(calcoreEvent, KCalCore::iTIPRequest); } @@ -89,11 +89,10 @@ private slots: auto event = KCalCore::ICalFormat().readIncidence(list.first().getIcal()).dynamicCast<KCalCore::Event>(); QVERIFY(event); QCOMPARE(event->uid().toUtf8(), uid); - QCOMPARE(event->organizer()->fullName(), {"organizer@test.com"}); + QCOMPARE(event->organizer().fullName(), {"organizer@test.com"}); const auto attendee = event->attendeeByMail("attendee1@test.com"); - QVERIFY(attendee); - QCOMPARE(attendee->status(), KCalCore::Attendee::Accepted); + QCOMPARE(attendee.status(), KCalCore::Attendee::Accepted); //Ensure the mail is sent to the organizer QTRY_COMPARE(Sink::Store::read<Mail>(Sink::Query{}.resourceFilter(mailtransportResourceId)).size(), 1); diff --git a/tests/teststore.cpp b/tests/teststore.cpp --- a/tests/teststore.cpp 2019-09-17 23:47:14.778921347 +0200 +++ b/tests/teststore.cpp 2019-09-17 23:47:21.424821490 +0200 @@ -190,7 +190,7 @@ static void createEvent(const QVariantMa if (object.contains("attendees")) { for (const auto &attendee : object["attendees"].toList()) { auto map = attendee.toMap(); - calcoreEvent->addAttendee(KCalCore::Attendee::Ptr::create(map["name"].toString(), map["email"].toString(), true, KCalCore::Attendee::NeedsAction, KCalCore::Attendee::ReqParticipant, QString{})); + calcoreEvent->addAttendee(KCalCore::Attendee(map["name"].toString(), map["email"].toString(), true, KCalCore::Attendee::NeedsAction, KCalCore::Attendee::ReqParticipant, QString{})); } }