Commit a492229f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Astyle kdelibs

parent fe49c595
......@@ -488,7 +488,7 @@ void VCardImportExportPluginInterface::exportVCard()
QLatin1Char(QLatin1Char('_')) +
list[ 0 ].familyName() +
QLatin1String(".vcf")))
, QString(), Q_NULLPTR, options);
, QString(), Q_NULLPTR, options);
if (url.isEmpty()) { // user canceled export
return;
}
......
......@@ -229,7 +229,7 @@ QString FancyHeaderStyle::format(KMime::Message *message) const
}
}
if (strategy->showHeader(QStringLiteral("disposition-notification-to"))){
if (strategy->showHeader(QStringLiteral("disposition-notification-to"))) {
if (auto hrd = message->headerByType("Disposition-Notification-To")) {
const QString to = hrd->asUnicodeString();
headerStr.append(QStringLiteral("<tr><th>%1</th>\n"
......
......@@ -30,7 +30,7 @@
#include <AkonadiCore/AttributeFactory>
#include <AkonadiCore/ItemFetchJob>
EventModel::EventModel(QObject* parent)
EventModel::EventModel(QObject *parent)
: Akonadi::CalendarBase(parent)
, mMonitor(Q_NULLPTR)
{
......@@ -54,44 +54,43 @@ void EventModel::createMonitor()
mMonitor->fetchCollection(true);
connect(mMonitor, &Akonadi::Monitor::itemAdded,
this, [this](const Akonadi::Item &item) {
// This is super-ugly, but the only way how to insert into CalendarBase
// without having direct access to CalendarBasePrivate.
// changeId is luckily ignored by CalendarBase.
incidenceChanger()->createFinished(0, item, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
});
this, [this](const Akonadi::Item & item) {
// This is super-ugly, but the only way how to insert into CalendarBase
// without having direct access to CalendarBasePrivate.
// changeId is luckily ignored by CalendarBase.
incidenceChanger()->createFinished(0, item, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
});
connect(mMonitor, &Akonadi::Monitor::itemChanged,
this, [this](const Akonadi::Item &item) {
const KCalCore::Incidence::Ptr incidence = item.payload<KCalCore::Incidence::Ptr>();
if (!incidence) {
return; // HUH?!
}
const KCalCore::Incidence::Ptr oldIncidence = this->incidence(incidence->instanceIdentifier());
if (!oldIncidence) {
// Change for event we don't know about -> discard
return;
}
// Unfortunately the plasma applet does not handle event moves
// so we have to simulate via remove+add
if (oldIncidence->allDay() != incidence->allDay()
|| oldIncidence->dtStart() != incidence->dtStart()
|| oldIncidence->dateTime(KCalCore::IncidenceBase::RoleEnd) != incidence->dateTime(KCalCore::IncidenceBase::RoleEnd)) {
incidenceChanger()->deleteFinished(0, { item.id() }, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
incidenceChanger()->createFinished(0, item, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
} else {
incidenceChanger()->modifyFinished(0, item, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
}
});
this, [this](const Akonadi::Item & item) {
const KCalCore::Incidence::Ptr incidence = item.payload<KCalCore::Incidence::Ptr>();
if (!incidence) {
return; // HUH?!
}
const KCalCore::Incidence::Ptr oldIncidence = this->incidence(incidence->instanceIdentifier());
if (!oldIncidence) {
// Change for event we don't know about -> discard
return;
}
// Unfortunately the plasma applet does not handle event moves
// so we have to simulate via remove+add
if (oldIncidence->allDay() != incidence->allDay()
|| oldIncidence->dtStart() != incidence->dtStart()
|| oldIncidence->dateTime(KCalCore::IncidenceBase::RoleEnd) != incidence->dateTime(KCalCore::IncidenceBase::RoleEnd)) {
incidenceChanger()->deleteFinished(0, { item.id() }, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
incidenceChanger()->createFinished(0, item, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
} else {
incidenceChanger()->modifyFinished(0, item, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
}
});
connect(mMonitor, &Akonadi::Monitor::itemRemoved,
this, [this](const Akonadi::Item &item) {
incidenceChanger()->deleteFinished(0, { item.id() }, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
});
this, [this](const Akonadi::Item & item) {
incidenceChanger()->deleteFinished(0, { item.id() }, Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
});
connect(mMonitor, &Akonadi::Monitor::collectionRemoved,
this, &EventModel::removeCalendar);
}
void EventModel::addCalendar(const Akonadi::Collection &col)
{
if (!mCols.contains(col)) {
......@@ -128,7 +127,6 @@ Akonadi::Collection EventModel::collection(qint64 id) const
return it == mCols.cend() ? Akonadi::Collection(id) : *it;
}
void EventModel::populateCollection(const Akonadi::Collection &col)
{
qCDebug(PIMEVENTSPLUGIN_LOG) << "Populating events from collection" << col.id();
......@@ -140,11 +138,11 @@ void EventModel::populateCollection(const Akonadi::Collection &col)
connect(job, &Akonadi::ItemFetchJob::itemsReceived,
this, &EventModel::onItemsReceived);
connect(job, &Akonadi::ItemFetchJob::result,
job, [this, col](KJob *job) {
mFetchJobs.remove(col.id());
auto fetch = qobject_cast<Akonadi::ItemFetchJob*>(job);
qCDebug(PIMEVENTSPLUGIN_LOG) << "Received" << fetch->count() << "events for collection" << col.id();
});
job, [this, col](KJob * job) {
mFetchJobs.remove(col.id());
auto fetch = qobject_cast<Akonadi::ItemFetchJob *>(job);
qCDebug(PIMEVENTSPLUGIN_LOG) << "Received" << fetch->count() << "events for collection" << col.id();
});
}
void EventModel::onItemsReceived(const Akonadi::Item::List &items)
......@@ -152,7 +150,7 @@ void EventModel::onItemsReceived(const Akonadi::Item::List &items)
qCDebug(PIMEVENTSPLUGIN_LOG) << "Batch: received" << items.count() << "items";
for (const auto &item : items) {
incidenceChanger()->createFinished(0, item,
Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
Akonadi::IncidenceChanger::ResultCodeSuccess, QString());
}
}
......
......@@ -49,9 +49,9 @@ PimCalendarsModel::PimCalendarsModel(QObject *parent)
mEtm->setItemPopulationStrategy(Akonadi::EntityTreeModel::NoItemPopulation);
mEtm->setListFilter(Akonadi::CollectionFetchScope::Enabled);
connect(mEtm, &Akonadi::EntityTreeModel::collectionTreeFetched,
this, [this]() {
sort(0, Qt::AscendingOrder);
});
this, [this]() {
sort(0, Qt::AscendingOrder);
});
setSourceModel(mEtm);
......
......@@ -30,7 +30,7 @@ class ETMCalendar;
class PimDataSource;
class PimEventsPlugin : public CalendarEvents::CalendarEventsPlugin
, public KCalCore::Calendar::CalendarObserver
, public KCalCore::Calendar::CalendarObserver
{
Q_OBJECT
Q_INTERFACES(CalendarEvents::CalendarEventsPlugin)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment