diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ set(KMAILTRANSPORT_LIB_VERSION "5.11.40") set(KLDAP_LIB_VERSION "5.11.40") set(CALENDARUTILS_LIB_VERSION "5.11.40") -set(KCALENDARCORE_LIB_VERSION "5.11.42") +set(KCALENDARCORE_LIB_VERSION "5.11.44") set(CALENDARSUPPORT_LIB_VERSION "5.11.40") set(LIBKDEPIM_LIB_VERSION "5.11.40") set(EVENTVIEW_LIB_VERSION "5.11.40") diff --git a/autotests/conflictresolvertest.cpp b/autotests/conflictresolvertest.cpp --- a/autotests/conflictresolvertest.cpp +++ b/autotests/conflictresolvertest.cpp @@ -40,10 +40,9 @@ void ConflictResolverTest::addAttendee(const QString &email, const KCalCore::FreeBusy::Ptr &fb, KCalCore::Attendee::Role role) { QString name = QStringLiteral("attendee %1").arg(attendees.count()); - CalendarSupport::FreeBusyItem::Ptr item(new CalendarSupport::FreeBusyItem(KCalCore::Attendee::Ptr( - new KCalCore::Attendee(name, email, false, + CalendarSupport::FreeBusyItem::Ptr item(new CalendarSupport::FreeBusyItem(KCalCore::Attendee(name, email, false, KCalCore::Attendee::Accepted, - role)), nullptr)); + role), nullptr)); item->setFreeBusy(KCalCore::FreeBusy::Ptr(new KCalCore::FreeBusy(*fb.data()))); attendees << item; } diff --git a/autotests/testfreebusyganttproxymodel.cpp b/autotests/testfreebusyganttproxymodel.cpp --- a/autotests/testfreebusyganttproxymodel.cpp +++ b/autotests/testfreebusyganttproxymodel.cpp @@ -53,7 +53,7 @@ const QDateTime dt1(QDate(2010, 8, 24), QTime(7, 0, 0), Qt::UTC); const QDateTime dt2(QDate(2010, 8, 24), QTime(16, 0, 0), Qt::UTC); - KCalCore::Attendee::Ptr a1(new KCalCore::Attendee(QStringLiteral("fred"), QStringLiteral("fred@example.com"))); + KCalCore::Attendee a1(QStringLiteral("fred"), QStringLiteral("fred@example.com")); KCalCore::FreeBusy::Ptr fb1(new KCalCore::FreeBusy()); fb1->addPeriod(dt1, KCalCore::Duration(60 * 60)); @@ -64,7 +64,7 @@ const QDateTime dt3(QDate(2010, 8, 25), QTime(7, 0, 0), Qt::UTC); const QDateTime dt4(QDate(2010, 8, 25), QTime(16, 0, 0), Qt::UTC); - KCalCore::Attendee::Ptr a2(new KCalCore::Attendee(QStringLiteral("joe"), QStringLiteral("joe@example.com"))); + KCalCore::Attendee a2(QStringLiteral("joe"), QStringLiteral("joe@example.com")); KCalCore::FreeBusy::Ptr fb2(new KCalCore::FreeBusy()); fb2->addPeriod(dt3, KCalCore::Duration(60 * 60)); diff --git a/autotests/testindividualmaildialog.cpp b/autotests/testindividualmaildialog.cpp --- a/autotests/testindividualmaildialog.cpp +++ b/autotests/testindividualmaildialog.cpp @@ -36,12 +36,9 @@ KGuiItem buttonYes = KGuiItem(QStringLiteral("Send Email")); KGuiItem buttonNo = KGuiItem(QStringLiteral("Do not send")); - KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QStringLiteral("test1"), - QStringLiteral("test1@example.com"))); - KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QStringLiteral("test2"), - QStringLiteral("test2@example.com"))); - KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QStringLiteral("test3"), - QStringLiteral("test3@example.com"))); + KCalCore::Attendee attendee1(QStringLiteral("test1"), QStringLiteral("test1@example.com")); + KCalCore::Attendee attendee2(QStringLiteral("test2"), QStringLiteral("test2@example.com")); + KCalCore::Attendee attendee3(QStringLiteral("test3"), QStringLiteral("test3@example.com")); attendees << attendee1 << attendee2 << attendee3; diff --git a/src/attendeedata.h b/src/attendeedata.h --- a/src/attendeedata.h +++ b/src/attendeedata.h @@ -38,7 +38,7 @@ { } - explicit AttendeeData(const KCalCore::Attendee::Ptr &attendee) : KCalCore::Attendee(*attendee) + explicit AttendeeData(const KCalCore::Attendee &attendee) : KCalCore::Attendee(attendee) { } @@ -48,7 +48,7 @@ /** * Return a copy of the attendee data */ - Q_REQUIRED_RESULT KCalCore::Attendee::Ptr attendee() const; + Q_REQUIRED_RESULT KCalCore::Attendee attendee() const; }; } diff --git a/src/attendeedata.cpp b/src/attendeedata.cpp --- a/src/attendeedata.cpp +++ b/src/attendeedata.cpp @@ -37,7 +37,7 @@ return name().isEmpty() && email().isEmpty(); } -KCalCore::Attendee::Ptr AttendeeData::attendee() const +KCalCore::Attendee AttendeeData::attendee() const { - return KCalCore::Attendee::Ptr(new KCalCore::Attendee(*this)); + return KCalCore::Attendee(*this); } diff --git a/src/attendeeeditor.h b/src/attendeeeditor.h --- a/src/attendeeeditor.h +++ b/src/attendeeeditor.h @@ -49,14 +49,14 @@ AttendeeData::List attendees() const; - void addAttendee(const KCalCore::Attendee::Ptr &attendee); + void addAttendee(const KCalCore::Attendee &attendee); void removeAttendee(const AttendeeData::Ptr &attendee); void setActions(AttendeeLine::AttendeeActions actions); Q_SIGNALS: void countChanged(int); - void changed(const KCalCore::Attendee::Ptr &oldAttendee, const KCalCore::Attendee::Ptr &newAttendee); + void changed(const KCalCore::Attendee &oldAttendee, const KCalCore::Attendee &newAttendee); void editingFinished(KPIM::MultiplyingLine *); protected Q_SLOTS: diff --git a/src/attendeeeditor.cpp b/src/attendeeeditor.cpp --- a/src/attendeeeditor.cpp +++ b/src/attendeeeditor.cpp @@ -40,7 +40,7 @@ } connect(att, qOverload<>(&AttendeeLine::changed), this, &AttendeeEditor::slotCalculateTotal); - connect(att, qOverload(&AttendeeLine:: changed), this, &AttendeeEditor::changed); + connect(att, qOverload(&AttendeeLine:: changed), this, &AttendeeEditor::changed); connect(att, &AttendeeLine::editingFinished, this, &AttendeeEditor::editingFinished); } @@ -82,7 +82,7 @@ return attList; } -void AttendeeEditor::addAttendee(const KCalCore::Attendee::Ptr &attendee) +void AttendeeEditor::addAttendee(const KCalCore::Attendee &attendee) { addData(AttendeeData::Ptr(new AttendeeData(attendee))); } diff --git a/src/attendeeline.h b/src/attendeeline.h --- a/src/attendeeline.h +++ b/src/attendeeline.h @@ -122,7 +122,7 @@ Q_SIGNALS: void changed(); - void changed(const KCalCore::Attendee::Ptr &oldAttendee, const KCalCore::Attendee::Ptr &newAttendee); + void changed(const KCalCore::Attendee &oldAttendee, const KCalCore::Attendee &newAttendee); void editingFinished(KPIM::MultiplyingLine *); private: diff --git a/src/attendeeline.cpp b/src/attendeeline.cpp --- a/src/attendeeline.cpp +++ b/src/attendeeline.cpp @@ -271,7 +271,7 @@ return; } - KCalCore::Attendee::Ptr oldAttendee(mData->attendee()); + KCalCore::Attendee oldAttendee(mData->attendee()); QString email, name; KEmailAddress::extractEmailAddressAndName(mEdit->text(), email, name); @@ -287,7 +287,7 @@ clearModified(); if (!(oldAttendee == mData->attendee()) && !email.isEmpty()) { // if email is empty, we don't want to update anything - qCDebug(INCIDENCEEDITOR_LOG) << oldAttendee->email() << mData->email(); + qCDebug(INCIDENCEEDITOR_LOG) << oldAttendee.email() << mData->email(); Q_EMIT changed(oldAttendee, mData->attendee()); } } @@ -402,9 +402,7 @@ return; } - Q_EMIT changed(mData->attendee(), - KCalCore::Attendee::Ptr(new KCalCore::Attendee(QLatin1String(""), - QLatin1String("")))); + Q_EMIT changed(mData->attendee(), KCalCore::Attendee(QLatin1String(""), QLatin1String(""))); } bool AttendeeLine::canDeleteLineEdit() const diff --git a/src/attendeetablemodel.h b/src/attendeetablemodel.h --- a/src/attendeetablemodel.h +++ b/src/attendeetablemodel.h @@ -68,7 +68,7 @@ Q_REQUIRED_RESULT bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; Q_REQUIRED_RESULT bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; - Q_REQUIRED_RESULT bool insertAttendee(int position, const KCalCore::Attendee::Ptr &attendee); + Q_REQUIRED_RESULT bool insertAttendee(int position, const KCalCore::Attendee &attendee); void setAttendees(const KCalCore::Attendee::List &resources); Q_REQUIRED_RESULT KCalCore::Attendee::List attendees() const; diff --git a/src/attendeetablemodel.cpp b/src/attendeetablemodel.cpp --- a/src/attendeetablemodel.cpp +++ b/src/attendeetablemodel.cpp @@ -65,13 +65,13 @@ return QVariant(); } - KCalCore::Attendee::Ptr attendee = mAttendeeList[index.row()]; + const KCalCore::Attendee attendee = mAttendeeList[index.row()]; if (role == Qt::DisplayRole || role == Qt::EditRole) { switch (index.column()) { case Role: - return attendee->role(); + return attendee.role(); case FullName: - return attendee->fullName(); + return attendee.fullName(); case Available: { AvailableStatus available = mAttendeeAvailable[index.row()]; @@ -93,15 +93,15 @@ } } case Status: - return attendee->status(); + return attendee.status(); case CuType: - return attendee->cuType(); + return attendee.cuType(); case Response: - return attendee->RSVP(); + return attendee.RSVP(); case Name: - return attendee->name(); + return attendee.name(); case Email: - return attendee->email(); + return attendee.email(); } } if (role == AttendeeRole) { @@ -114,37 +114,37 @@ { QString email, name; if (index.isValid() && role == Qt::EditRole) { - KCalCore::Attendee::Ptr attendee = mAttendeeList[index.row()]; + KCalCore::Attendee &attendee = mAttendeeList[index.row()]; switch (index.column()) { case Role: - attendee->setRole(static_cast(value.toInt())); + attendee.setRole(static_cast(value.toInt())); break; case FullName: if (mRemoveEmptyLines && value.toString().trimmed().isEmpty()) { // Do not remove last empty line if mKeepEmpty==true // (only works if initially there is only one empty line) - if (!mKeepEmpty || !(attendee->name().isEmpty() && attendee->email().isEmpty())) { + if (!mKeepEmpty || !(attendee.name().isEmpty() && attendee.email().isEmpty())) { removeRows(index.row(), 1); return true; } } KEmailAddress::extractEmailAddressAndName(value.toString(), email, name); - attendee->setName(name); - attendee->setEmail(email); + attendee.setName(name); + attendee.setEmail(email); addEmptyAttendee(); break; case Available: mAttendeeAvailable[index.row()] = static_cast(value.toInt()); break; case Status: - attendee->setStatus(static_cast(value.toInt())); + attendee.setStatus(static_cast(value.toInt())); break; case CuType: - attendee->setCuType(static_cast(value.toInt())); + attendee.setCuType(static_cast(value.toInt())); break; case Response: - attendee->setRSVP(value.toBool()); + attendee.setRSVP(value.toBool()); break; default: return false; @@ -191,7 +191,7 @@ beginInsertRows(parent, position, position + rows - 1); for (int row = 0; row < rows; ++row) { - KCalCore::Attendee::Ptr attendee(new KCalCore::Attendee(QLatin1String(""), QLatin1String(""))); + KCalCore::Attendee attendee(QLatin1String(""), QLatin1String("")); mAttendeeList.insert(position, attendee); mAttendeeAvailable.insert(mAttendeeAvailable.begin() + position, AvailableStatus{}); } @@ -213,7 +213,7 @@ return true; } -bool AttendeeTableModel::insertAttendee(int position, const KCalCore::Attendee::Ptr &attendee) +bool AttendeeTableModel::insertAttendee(int position, const KCalCore::Attendee &attendee) { beginInsertRows(QModelIndex(), position, position); mAttendeeList.insert(position, attendee); @@ -247,8 +247,8 @@ { if (mKeepEmpty) { bool create = true; - for (const KCalCore::Attendee::Ptr &attendee : qAsConst(mAttendeeList)) { - if (attendee->fullName().isEmpty()) { + for (const KCalCore::Attendee &attendee : qAsConst(mAttendeeList)) { + if (attendee.fullName().isEmpty()) { create = false; break; } diff --git a/src/conflictresolver.h b/src/conflictresolver.h --- a/src/conflictresolver.h +++ b/src/conflictresolver.h @@ -57,16 +57,16 @@ * The attendees free busy info will be fetched * and integrated into the resolver. */ - void insertAttendee(const KCalCore::Attendee::Ptr &attendee); + void insertAttendee(const KCalCore::Attendee &attendee); void insertAttendee(const CalendarSupport::FreeBusyItem::Ptr &freebusy); /** * Removes an attendee * The attendee will no longer be considered when * resolving conflicts */ - void removeAttendee(const KCalCore::Attendee::Ptr &attendee); + void removeAttendee(const KCalCore::Attendee &attendee); /** * Clear all attendees @@ -76,7 +76,7 @@ /** * Returns whether the resolver contains the attendee */ - Q_REQUIRED_RESULT bool containsAttendee(const KCalCore::Attendee::Ptr &attendee); + Q_REQUIRED_RESULT bool containsAttendee(const KCalCore::Attendee &attendee); /** * Constrain the free time slot search to the weekdays @@ -177,7 +177,7 @@ * current mandatory role constraint. * @return true if the attendee is of one of the mandatory roles, false if not */ - bool matchesRoleConstraint(const KCalCore::Attendee::Ptr &attendee); + bool matchesRoleConstraint(const KCalCore::Attendee &attendee); void calculateConflicts(); diff --git a/src/conflictresolver.cpp b/src/conflictresolver.cpp --- a/src/conflictresolver.cpp +++ b/src/conflictresolver.cpp @@ -66,7 +66,7 @@ mCalculateTimer.setSingleShot(true); } -void ConflictResolver::insertAttendee(const KCalCore::Attendee::Ptr &attendee) +void ConflictResolver::insertAttendee(const KCalCore::Attendee&attendee) { if (!mFBModel->containsAttendee(attendee)) { mFBModel->addItem(CalendarSupport::FreeBusyItem::Ptr(new CalendarSupport::FreeBusyItem( @@ -81,7 +81,7 @@ } } -void ConflictResolver::removeAttendee(const KCalCore::Attendee::Ptr &attendee) +void ConflictResolver::removeAttendee(const KCalCore::Attendee &attendee) { mFBModel->removeAttendee(attendee); calculateConflicts(); @@ -92,7 +92,7 @@ mFBModel->clear(); } -bool ConflictResolver::containsAttendee(const KCalCore::Attendee::Ptr &attendee) +bool ConflictResolver::containsAttendee(const KCalCore::Attendee &attendee) { return mFBModel->containsAttendee(attendee); } @@ -151,10 +151,9 @@ int conflicts_count = 0; for (int i = 0; i < mFBModel->rowCount(); ++i) { QModelIndex index = mFBModel->index(i); - KCalCore::Attendee::Ptr attendee + KCalCore::Attendee attendee = mFBModel->data(index, - CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); + CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); if (!matchesRoleConstraint(attendee)) { continue; } @@ -279,10 +278,9 @@ QList filteredFBItems; for (int i = 0; i < mFBModel->rowCount(); ++i) { QModelIndex index = mFBModel->index(i); - KCalCore::Attendee::Ptr attendee + KCalCore::Attendee attendee = mFBModel->data(index, - CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); + CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); if (!matchesRoleConstraint(attendee)) { continue; } @@ -484,9 +482,9 @@ calculateConflicts(); } -bool ConflictResolver::matchesRoleConstraint(const KCalCore::Attendee::Ptr &attendee) +bool ConflictResolver::matchesRoleConstraint(const KCalCore::Attendee &attendee) { - return mMandatoryRoles.contains(attendee->role()); + return mMandatoryRoles.contains(attendee.role()); } KCalCore::Period::List ConflictResolver::availableSlots() const diff --git a/src/incidenceattendee.h b/src/incidenceattendee.h --- a/src/incidenceattendee.h +++ b/src/incidenceattendee.h @@ -76,7 +76,7 @@ private Q_SLOTS: // cheks if row is a group, that can/should be expanded - void checkIfExpansionIsNeeded(const KCalCore::Attendee::Ptr &attendee); + void checkIfExpansionIsNeeded(const KCalCore::Attendee &attendee); // results of the group search job void groupSearchResult(KJob *job); @@ -100,7 +100,7 @@ void slotFreeBusyAdded(const QModelIndex &index, int first, int last); void slotFreeBusyChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void updateFBStatus(); - void updateFBStatus(const KCalCore::Attendee::Ptr &attendee, const KCalCore::FreeBusy::Ptr &fb); + void updateFBStatus(const KCalCore::Attendee &attendee, const KCalCore::FreeBusy::Ptr &fb); void slotGroupSubstitutionAttendeeAdded(const QModelIndex &index, int first, int last); void slotGroupSubstitutionAttendeeRemoved(const QModelIndex &index, int first, int last); diff --git a/src/incidenceattendee.cpp b/src/incidenceattendee.cpp --- a/src/incidenceattendee.cpp +++ b/src/incidenceattendee.cpp @@ -221,8 +221,8 @@ KCalCore::Attendee::List attendees; const KCalCore::Attendee::List incidenceAttendees = incidence->attendees(); attendees.reserve(incidenceAttendees.count()); - for (const KCalCore::Attendee::Ptr &a : incidenceAttendees) { - attendees << KCalCore::Attendee::Ptr(new KCalCore::Attendee(*a)); + for (const KCalCore::Attendee &a : incidenceAttendees) { + attendees << KCalCore::Attendee(a); } mDataModel->setAttendees(attendees); @@ -238,20 +238,18 @@ incidence->clearAttendees(); const KCalCore::Attendee::List attendees = mDataModel->attendees(); - for (const KCalCore::Attendee::Ptr &attendee : attendees) { - Q_ASSERT(attendee); - + for (const KCalCore::Attendee &attendee : attendees) { bool skip = false; - if (attendee->fullName().isEmpty()) { + if (attendee.fullName().isEmpty()) { continue; } - if (KEmailAddress::isValidAddress(attendee->email())) { + if (KEmailAddress::isValidAddress(attendee.email())) { if (KMessageBox::warningYesNo( nullptr, i18nc("@info", "%1 does not look like a valid email address. " "Are you sure you want to invite this participant?", - attendee->email()), + attendee.email()), i18nc("@title:window", "Invalid Email Address")) != KMessageBox::Yes) { skip = true; } @@ -293,8 +291,8 @@ KCalCore::Attendee::List newList; const auto lstAttendees = mDataModel->attendees(); - for (const KCalCore::Attendee::Ptr &attendee : lstAttendees) { - if (!attendee->fullName().isEmpty()) { + for (const KCalCore::Attendee &attendee : lstAttendees) { + if (!attendee.fullName().isEmpty()) { newList.append(attendee); } } @@ -307,10 +305,10 @@ // Okay, again not the most efficient algorithm, but I'm assuming that in the // bulk of the use cases, the number of attendees is not much higher than 10 or so. - for (const KCalCore::Attendee::Ptr &attendee : originalList) { + for (const KCalCore::Attendee &attendee : originalList) { bool found = false; for (int i = 0; i < newList.count(); ++i) { - if (*(newList[i]) == *attendee) { + if (newList[i] == attendee) { newList.remove(i); found = true; break; @@ -366,27 +364,27 @@ mUi->mOrganizerCombo->addItems(uniqueList); } -void IncidenceAttendee::checkIfExpansionIsNeeded(const KCalCore::Attendee::Ptr &attendee) +void IncidenceAttendee::checkIfExpansionIsNeeded(const KCalCore::Attendee &attendee) { - QString fullname = attendee->fullName(); + QString fullname = attendee.fullName(); // stop old job - KJob *oldJob = mMightBeGroupJobs.key(attendee->uid()); + KJob *oldJob = mMightBeGroupJobs.key(attendee.uid()); if (oldJob != nullptr) { disconnect(oldJob); oldJob->deleteLater(); mMightBeGroupJobs.remove(oldJob); } - mGroupList.remove(attendee->uid()); + mGroupList.remove(attendee.uid()); if (!fullname.isEmpty()) { Akonadi::ContactGroupSearchJob *job = new Akonadi::ContactGroupSearchJob(); job->setQuery(Akonadi::ContactGroupSearchJob::Name, fullname); connect(job, &Akonadi::ContactGroupSearchJob::result, this, &IncidenceAttendee::groupSearchResult); - mMightBeGroupJobs.insert(job, attendee->uid()); + mMightBeGroupJobs.insert(job, attendee.uid()); } } @@ -439,7 +437,7 @@ const auto uid = mExpandGroupJobs.take(job); const int row = rowOfAttendee(uid); const auto attendee = dataModel()->attendees().at(row); - const QString currentEmail = attendee->email(); + const QString currentEmail = attendee.email(); const KContacts::Addressee::List groupMembers = expandJob->contacts(); bool wasACorrectEmail = false; for (const KContacts::Addressee &member : groupMembers) { @@ -452,12 +450,11 @@ if (!wasACorrectEmail) { dataModel()->removeRow(row); for (const KContacts::Addressee &member : groupMembers) { - KCalCore::Attendee::Ptr newAt(new KCalCore::Attendee( - member.realName(), member.preferredEmail(), - attendee->RSVP(), - attendee->status(), - attendee->role(), - member.uid())); + KCalCore::Attendee newAt(member.realName(), member.preferredEmail(), + attendee.RSVP(), + attendee.status(), + attendee.role(), + member.uid()); dataModel()->insertAttendee(row, newAt); } } @@ -481,16 +478,14 @@ bool rsvp = true; int pos = 0; - KCalCore::Attendee::Ptr newAt(new KCalCore::Attendee( - selection.name(), + KCalCore::Attendee newAt(selection.name(), selection.email(), rsvp, partStat, - KCalCore::Attendee::ReqParticipant - )); + KCalCore::Attendee::ReqParticipant); dataModel()->insertAttendee(pos, newAt); - mExpandGroupJobs.insert(job, newAt->uid()); + mExpandGroupJobs.insert(job, newAt.uid()); job->start(); } else { KContacts::Addressee contact; @@ -530,9 +525,9 @@ && AttendeeTableModel::FullName >= topLeft.column()) { for (int i = topLeft.row(); i <= bottomRight.row(); ++i) { QModelIndex email = dataModel()->index(i, AttendeeTableModel::Email); - KCalCore::Attendee::Ptr attendee = dataModel()->data(email, + KCalCore::Attendee attendee = dataModel()->data(email, AttendeeTableModel::AttendeeRole). - value(); + value(); if (mConflictResolver->containsAttendee(attendee)) { mConflictResolver->removeAttendee(attendee); } @@ -551,7 +546,7 @@ if (!dataModel()->data(email).toString().isEmpty()) { mConflictResolver->insertAttendee(dataModel()->data(email, AttendeeTableModel::AttendeeRole).value< - KCalCore::Attendee::Ptr>()); + KCalCore::Attendee>()); } } checkDirtyStatus(); @@ -564,7 +559,7 @@ if (!dataModel()->data(email).toString().isEmpty()) { mConflictResolver->removeAttendee(dataModel()->data(email, AttendeeTableModel::AttendeeRole).value< - KCalCore::Attendee::Ptr>()); + KCalCore::Attendee>()); } } checkDirtyStatus(); @@ -574,8 +569,8 @@ { const KCalCore::Attendee::List attendees = mDataModel->attendees(); mConflictResolver->clearAttendees(); - for (const KCalCore::Attendee::Ptr &attendee : attendees) { - if (!attendee->email().isEmpty()) { + for (const KCalCore::Attendee &attendee : attendees) { + if (!attendee.email().isEmpty()) { mConflictResolver->insertAttendee(attendee); } } @@ -591,11 +586,11 @@ QAbstractItemModel *model = mConflictResolver->model(); for (int i = first; i <= last; ++i) { QModelIndex index = model->index(i, 0, parent); - const KCalCore::Attendee::Ptr &attendee - = model->data(index, CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); + const KCalCore::Attendee &attendee + = model->data(index, CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); const KCalCore::FreeBusy::Ptr &fb = model->data(index, CalendarSupport::FreeBusyItemModel::FreeBusyRole).value(); - if (attendee) { + if (!attendee.isNull()) { updateFBStatus(attendee, fb); } } @@ -610,11 +605,11 @@ QAbstractItemModel *model = mConflictResolver->model(); for (int i = topLeft.row(); i <= bottomRight.row(); ++i) { QModelIndex index = model->index(i, 0); - const KCalCore::Attendee::Ptr &attendee - = model->data(index, CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); + const KCalCore::Attendee &attendee + = model->data(index, CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); const KCalCore::FreeBusy::Ptr &fb = model->data(index, CalendarSupport::FreeBusyItemModel::FreeBusyRole).value(); - if (attendee) { + if (!attendee.isNull()) { updateFBStatus(attendee, fb); } } @@ -625,17 +620,17 @@ QAbstractItemModel *model = mConflictResolver->model(); for (int i = 0; i < model->rowCount(); ++i) { QModelIndex index = model->index(i, 0); - const KCalCore::Attendee::Ptr &attendee - = model->data(index, CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); + const KCalCore::Attendee &attendee + = model->data(index, CalendarSupport::FreeBusyItemModel::AttendeeRole).value(); const KCalCore::FreeBusy::Ptr &fb = model->data(index, CalendarSupport::FreeBusyItemModel::FreeBusyRole).value(); - if (attendee) { + if (!attendee.isNull()) { updateFBStatus(attendee, fb); } } } -void IncidenceAttendee::updateFBStatus(const KCalCore::Attendee::Ptr &attendee, const KCalCore::FreeBusy::Ptr &fb) +void IncidenceAttendee::updateFBStatus(const KCalCore::Attendee &attendee, const KCalCore::FreeBusy::Ptr &fb) { KCalCore::Attendee::List attendees = mDataModel->attendees(); QDateTime startTime = mDateTime->currentStartDateTime(); @@ -650,7 +645,7 @@ // periods starting in the time of incidence (s >= startTime && s <= endTime) if (((*it).start() < startTime && (*it).end() > startTime) || ((*it).start() >= startTime && (*it).start() <= endTime)) { - switch (attendee->status()) { + switch (attendee.status()) { case KCalCore::Attendee::Accepted: dataModel()->setData(attendeeIndex, AttendeeTableModel::Accepted); return; @@ -692,9 +687,9 @@ && AttendeeTableModel::FullName >= topLeft.column()) { for (int i = topLeft.row(); i <= bottomRight.row(); ++i) { QModelIndex email = dataModel()->index(i, AttendeeTableModel::Email); - KCalCore::Attendee::Ptr attendee = dataModel()->data(email, + KCalCore::Attendee attendee = dataModel()->data(email, AttendeeTableModel::AttendeeRole). - value(); + value(); checkIfExpansionIsNeeded(attendee); } } @@ -706,9 +701,9 @@ Q_UNUSED(index); for (int i = first; i <= last; ++i) { QModelIndex email = dataModel()->index(i, AttendeeTableModel::Email); - KCalCore::Attendee::Ptr attendee + KCalCore::Attendee attendee = dataModel()->data(email, - AttendeeTableModel::AttendeeRole).value(); + AttendeeTableModel::AttendeeRole).value(); checkIfExpansionIsNeeded(attendee); } updateGroupExpand(); @@ -719,22 +714,22 @@ Q_UNUSED(index); for (int i = first; i <= last; ++i) { QModelIndex email = dataModel()->index(i, AttendeeTableModel::Email); - KCalCore::Attendee::Ptr attendee + KCalCore::Attendee attendee = dataModel()->data(email, - AttendeeTableModel::AttendeeRole).value(); - KJob *job = mMightBeGroupJobs.key(attendee->uid()); + AttendeeTableModel::AttendeeRole).value(); + KJob *job = mMightBeGroupJobs.key(attendee.uid()); if (job) { disconnect(job); job->deleteLater(); mMightBeGroupJobs.remove(job); } - job = mExpandGroupJobs.key(attendee->uid()); + job = mExpandGroupJobs.key(attendee.uid()); if (job) { disconnect(job); job->deleteLater(); mExpandGroupJobs.remove(job); } - mGroupList.remove(attendee->uid()); + mGroupList.remove(attendee.uid()); } updateGroupExpand(); } @@ -764,9 +759,9 @@ QModelIndex index = model->index(i, AttendeeTableModel::FullName); if (!model->data(index).toString().isEmpty()) { QModelIndex email = dataModel()->index(i, AttendeeTableModel::Email); - KCalCore::Attendee::Ptr attendee = dataModel()->data(email, + KCalCore::Attendee attendee = dataModel()->data(email, AttendeeTableModel::AttendeeRole). - value(); + value(); checkIfExpansionIsNeeded(attendee); } } @@ -797,11 +792,11 @@ partStat = KCalCore::Attendee::Accepted; rsvp = false; } - KCalCore::Attendee::Ptr newAt(new KCalCore::Attendee(a.realName(), a.preferredEmail(), + KCalCore::Attendee newAt(a.realName(), a.preferredEmail(), rsvp, partStat, KCalCore::Attendee::ReqParticipant, - a.uid())); + a.uid()); if (pos < 0) { pos = dataModel()->rowCount() - 1; } @@ -875,9 +870,8 @@ KCalCore::Attendee::PartStat status = iAmOrganizer() ? KCalCore::Attendee::Accepted : KCalCore::Attendee::NeedsAction; - KCalCore::Attendee::Ptr newAt( - new KCalCore::Attendee(name, email, rsvp, status, - KCalCore::Attendee::ReqParticipant)); + KCalCore::Attendee newAt(name, email, rsvp, status, + KCalCore::Attendee::ReqParticipant); mDataModel->insertAttendee(mDataModel->rowCount(), newAt); } @@ -995,15 +989,15 @@ qCDebug(INCIDENCEEDITOR_LOG) << "List sizes: " << originalList.count() << newList.count(); const auto lstAttendees = mDataModel->attendees(); - for (const KCalCore::Attendee::Ptr &attendee : lstAttendees) { - if (!attendee->fullName().isEmpty()) { + for (const KCalCore::Attendee &attendee : lstAttendees) { + if (!attendee.fullName().isEmpty()) { newList.append(attendee); } } // Okay, again not the most efficient algorithm, but I'm assuming that in the // bulk of the use cases, the number of attendees is not much higher than 10 or so. - for (const KCalCore::Attendee::Ptr &attendee : originalList) { + for (const KCalCore::Attendee &attendee : originalList) { bool found = false; for (int i = 0; i < newList.count(); ++i) { if (newList[i] == attendee) { @@ -1014,27 +1008,27 @@ } if (!found) { - qCDebug(INCIDENCEEDITOR_LOG) << "Attendee not found: " << attendee->email() - << attendee->name() - << attendee->status() - << attendee->RSVP() - << attendee->role() - << attendee->uid() - << attendee->cuType() - << attendee->delegate() - << attendee->delegator() + qCDebug(INCIDENCEEDITOR_LOG) << "Attendee not found: " << attendee.email() + << attendee.name() + << attendee.status() + << attendee.RSVP() + << attendee.role() + << attendee.uid() + << attendee.cuType() + << attendee.delegate() + << attendee.delegator() << "; we have:"; for (int i = 0; i < newList.count(); ++i) { - KCalCore::Attendee::Ptr attendee = newList[i]; - qCDebug(INCIDENCEEDITOR_LOG) << "Attendee: " << attendee->email() - << attendee->name() - << attendee->status() - << attendee->RSVP() - << attendee->role() - << attendee->uid() - << attendee->cuType() - << attendee->delegate() - << attendee->delegator(); + KCalCore::Attendee attendee = newList[i]; + qCDebug(INCIDENCEEDITOR_LOG) << "Attendee: " << attendee.email() + << attendee.name() + << attendee.status() + << attendee.RSVP() + << attendee.role() + << attendee.uid() + << attendee.cuType() + << attendee.delegate() + << attendee.delegator(); } return; @@ -1045,8 +1039,8 @@ int IncidenceAttendee::rowOfAttendee(const QString &uid) const { const auto attendees = dataModel()->attendees(); - const auto it = std::find_if(attendees.begin(), attendees.end(), [uid](const KCalCore::Attendee::Ptr &att) { - return att->uid() == uid; + const auto it = std::find_if(attendees.begin(), attendees.end(), [uid](const KCalCore::Attendee &att) { + return att.uid() == uid; }); return std::distance(attendees.begin(), it); } diff --git a/src/incidencedefaults.cpp b/src/incidencedefaults.cpp --- a/src/incidencedefaults.cpp +++ b/src/incidencedefaults.cpp @@ -57,7 +57,7 @@ public: /// Members KCalCore::Attachment::List mAttachments; - QVector mAttendees; + QVector mAttendees; QStringList mEmails; QString mGroupWareDomain; KCalCore::Incidence::Ptr mRelatedIncidence; @@ -67,7 +67,7 @@ /// Methods KCalCore::Person organizerAsPerson() const; - KCalCore::Attendee::Ptr organizerAsAttendee(const KCalCore::Person &organizer) const; + KCalCore::Attendee organizerAsAttendee(const KCalCore::Person &organizer) const; void todoDefaults(const KCalCore::Todo::Ptr &todo) const; void eventDefaults(const KCalCore::Event::Ptr &event) const; @@ -122,19 +122,18 @@ return organizer; } -KCalCore::Attendee::Ptr IncidenceDefaultsPrivate::organizerAsAttendee( +KCalCore::Attendee IncidenceDefaultsPrivate::organizerAsAttendee( const KCalCore::Person &organizer) const { - KCalCore::Attendee::Ptr organizerAsAttendee(new KCalCore::Attendee(QLatin1String( - ""), QLatin1String(""))); + KCalCore::Attendee organizerAsAttendee; // Really, the appropriate values (even the fall back values) should come from // organizer. (See organizerAsPerson for more details). - organizerAsAttendee->setName(organizer.name()); - organizerAsAttendee->setEmail(organizer.email()); + organizerAsAttendee.setName(organizer.name()); + organizerAsAttendee.setEmail(organizer.email()); // NOTE: Don't set the status to None, this value is not supported by the attendee // editor atm. - organizerAsAttendee->setStatus(KCalCore::Attendee::Accepted); - organizerAsAttendee->setRole(KCalCore::Attendee::ReqParticipant); + organizerAsAttendee.setStatus(KCalCore::Attendee::Accepted); + organizerAsAttendee.setRole(KCalCore::Attendee::ReqParticipant); return organizerAsAttendee; } @@ -314,8 +313,7 @@ for (it = attendees.begin(); it != attendees.end(); ++it) { QString name, email; KContacts::Addressee::parseEmailAddress(*it, name, email); - d->mAttendees << KCalCore::Attendee::Ptr( - new KCalCore::Attendee(name, email, true, KCalCore::Attendee::NeedsAction)); + d->mAttendees << KCalCore::Attendee(name, email, true, KCalCore::Attendee::NeedsAction); } } @@ -380,7 +378,7 @@ #ifdef KDEPIM_ENTERPRISE_BUILD incidence->addAttendee(d->organizerAsAttendee(organizerAsPerson)); #endif - for (const KCalCore::Attendee::Ptr &attendee : qAsConst(d->mAttendees)) { + for (const KCalCore::Attendee &attendee : qAsConst(d->mAttendees)) { incidence->addAttendee(attendee); } // Ical standard: No attendees -> must not have an organizer! diff --git a/src/incidencedialog.cpp b/src/incidencedialog.cpp --- a/src/incidencedialog.cpp +++ b/src/incidencedialog.cpp @@ -580,12 +580,12 @@ const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item); const QStringList allEmails = IncidenceEditorNG::EditorConfig::instance()->allEmails(); - KCalCore::Attendee::Ptr me = incidence->attendeeByMails(allEmails); + const KCalCore::Attendee me = incidence->attendeeByMails(allEmails); if (incidence->attendeeCount() > 1 // >1 because you won't drink alone - && me && (me->status() == KCalCore::Attendee::NeedsAction - || me->status() == KCalCore::Attendee::Tentative - || me->status() == KCalCore::Attendee::InProcess)) { + && !me.isNull() && (me.status() == KCalCore::Attendee::NeedsAction + || me.status() == KCalCore::Attendee::Tentative + || me.status() == KCalCore::Attendee::InProcess)) { // Show the invitation bar: "You are invited [accept] [decline]" mUi->mInvitationBar->show(); } else { diff --git a/src/incidenceresource.cpp b/src/incidenceresource.cpp --- a/src/incidenceresource.cpp +++ b/src/incidenceresource.cpp @@ -150,8 +150,8 @@ } QString name, email; KEmailAddress::extractEmailAddressAndName(mUi->mNewResource->text(), email, name); - KCalCore::Attendee::Ptr attendee(new KCalCore::Attendee(name, email)); - attendee->setCuType(KCalCore::Attendee::Resource); + KCalCore::Attendee attendee(name, email); + attendee.setCuType(KCalCore::Attendee::Resource); dataModel->insertAttendee(dataModel->rowCount(), attendee); } @@ -166,8 +166,8 @@ if (item) { const QString name = QString::fromLatin1(item->ldapObject().value(QStringLiteral("cn"))); const QString email = QString::fromLatin1(item->ldapObject().value(QStringLiteral("mail"))); - KCalCore::Attendee::Ptr attendee(new KCalCore::Attendee(name, email)); - attendee->setCuType(KCalCore::Attendee::Resource); + KCalCore::Attendee attendee(name, email); + attendee.setCuType(KCalCore::Attendee::Resource); dataModel->insertAttendee(dataModel->rowCount(), attendee); } } diff --git a/src/individualmailcomponentfactory.cpp b/src/individualmailcomponentfactory.cpp --- a/src/individualmailcomponentfactory.cpp +++ b/src/individualmailcomponentfactory.cpp @@ -51,26 +51,26 @@ QSet attendeesCc(QSet::fromList(addressAttribute().cc())); QStringList attendeesAutoTo, attendeesAutoCc; - for (const KCalCore::Attendee::Ptr &attendee : qAsConst(mUpdate)) { - if (attendeesTo.contains(attendee->email())) { - attendeesAutoTo.append(attendee->fullName()); + for (const KCalCore::Attendee &attendee : qAsConst(mUpdate)) { + if (attendeesTo.contains(attendee.email())) { + attendeesAutoTo.append(attendee.fullName()); } - if (attendeesCc.contains(attendee->email())) { - attendeesAutoCc.append(attendee->fullName()); + if (attendeesCc.contains(attendee.email())) { + attendeesAutoCc.append(attendee.fullName()); } } if (!attendeesAutoTo.isEmpty() || !attendeesAutoCc.isEmpty() || !addressAttribute().bcc().isEmpty()) { startQueueJob(attendeesAutoTo, addressAttribute().to(), attendeesAutoCc, addressAttribute().cc()); } QStringList attendeesComposerTo, attendeesComposerCc; - for (const KCalCore::Attendee::Ptr &attendee : qAsConst(mEdit)) { - if (attendeesTo.contains(attendee->email())) { - attendeesComposerTo.append(attendee->fullName()); + for (const KCalCore::Attendee &attendee : qAsConst(mEdit)) { + if (attendeesTo.contains(attendee.email())) { + attendeesComposerTo.append(attendee.fullName()); } - if (attendeesCc.contains(attendee->email())) { - attendeesComposerCc.append(attendee->fullName()); + if (attendeesCc.contains(attendee.email())) { + attendeesComposerCc.append(attendee.fullName()); } } if (!attendeesComposerTo.isEmpty() || !attendeesComposerCc.isEmpty()) { @@ -200,9 +200,7 @@ if (recipient == Attendees) { openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo); } else { - KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee( - mIncidence->organizer().name(), - mIncidence->organizer().email())); + KCalCore::Attendee organizer(mIncidence->organizer().name(), mIncidence->organizer().email()); openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo); } } @@ -214,9 +212,7 @@ if (recipient == Attendees) { openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo); } else { - KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee( - mIncidence->organizer().name(), - mIncidence->organizer().email())); + KCalCore::Attendee organizer(mIncidence->organizer().name(), mIncidence->organizer().email()); openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo); } } @@ -226,9 +222,7 @@ if (recipient == Attendees) { openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo); } else { - KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee( - mIncidence->organizer().name(), - mIncidence->organizer().email())); + KCalCore::Attendee organizer(mIncidence->organizer().name(), mIncidence->organizer().email()); openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo); } } diff --git a/src/individualmaildialog.h b/src/individualmaildialog.h --- a/src/individualmaildialog.h +++ b/src/individualmaildialog.h @@ -55,7 +55,7 @@ private: void updateButtonState(); - std::vector> mAttendeeDecision; + std::vector> mAttendeeDecision; QDialogButtonBox *m_buttons = nullptr; QWidget *m_detailsWidget = nullptr; }; diff --git a/src/individualmaildialog.cpp b/src/individualmaildialog.cpp --- a/src/individualmaildialog.cpp +++ b/src/individualmaildialog.cpp @@ -41,7 +41,7 @@ QGridLayout *layout = new QGridLayout(m_detailsWidget); mAttendeeDecision.reserve(attendees.size()); int row = 0; - for (const KCalCore::Attendee::Ptr &attendee : attendees) { + for (const KCalCore::Attendee &attendee : attendees) { QComboBox *options = new QComboBox(); options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Send update"), QVariant(Update)); @@ -55,7 +55,7 @@ "Choose an option for this attendee.")); mAttendeeDecision.push_back(std::make_pair(attendee, options)); - layout->addWidget(new QLabel(attendee->fullName()), row, 0); + layout->addWidget(new QLabel(attendee.fullName()), row, 0); layout->addWidget(options, row, 1); ++row; } diff --git a/src/resourcemanagement.cpp b/src/resourcemanagement.cpp --- a/src/resourcemanagement.cpp +++ b/src/resourcemanagement.cpp @@ -250,7 +250,7 @@ QString name = QString::fromUtf8(obj.attributes().value(QStringLiteral("cn"))[0]); QString email = QString::fromUtf8(obj.attributes().value(QStringLiteral("mail"))[0]); - KCalCore::Attendee::Ptr attendee(new KCalCore::Attendee(name, email)); + KCalCore::Attendee attendee(name, email); CalendarSupport::FreeBusyItem::Ptr freebusy(new CalendarSupport::FreeBusyItem(attendee, this)); mModel->clear(); mModel->addItem(freebusy); diff --git a/tests/individualmaildialog_test.cpp b/tests/individualmaildialog_test.cpp --- a/tests/individualmaildialog_test.cpp +++ b/tests/individualmaildialog_test.cpp @@ -30,9 +30,9 @@ KGuiItem buttonYes = KGuiItem(QStringLiteral("Send Email")); KGuiItem buttonNo = KGuiItem(QStringLiteral("Do not send")); - KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QStringLiteral("test1"), QStringLiteral("test1@example.com"))); - KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QStringLiteral("test2"), QStringLiteral("test2@example.com"))); - KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QStringLiteral("test3"), QStringLiteral("test3@example.com"))); + KCalCore::Attendee attendee1(QStringLiteral("test1"), QStringLiteral("test1@example.com")); + KCalCore::Attendee attendee2(QStringLiteral("test2"), QStringLiteral("test2@example.com")); + KCalCore::Attendee attendee3(QStringLiteral("test3"), QStringLiteral("test3@example.com")); attendees << attendee1 << attendee2 << attendee3;