Commit 48609fd5 authored by Laurent Montel's avatar Laurent Montel 😁

Modify collection

parent 6313b398
Pipeline #35521 failed with stage
in 70 minutes and 20 seconds
......@@ -8,6 +8,7 @@ set(folderconfiguresettings_SRCS
folderconfiguresettingsgeneralwidget.cpp
folderconfiguresettingstemplatewidget.cpp
folderconfiguresettingsviewwidget.cpp
folderconfiguremodifycollectionjob.cpp
)
ecm_qt_declare_logging_category(folderconfiguresettings_SRCS HEADER libfolderconfiguresettings_debug.h IDENTIFIER LIBFOLDERCONFIGURESETTINGS_PLUGIN_LOG CATEGORY_NAME org.kde.pim.libfolderconfiguresettingsplugin
......
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "folderconfiguremodifycollectionjob.h"
#include "libfolderconfiguresettings_debug.h"
#include <AkonadiCore/CollectionModifyJob>
FolderConfigureModifyCollectionJob::FolderConfigureModifyCollectionJob(QObject *parent)
: QObject(parent)
{
}
FolderConfigureModifyCollectionJob::~FolderConfigureModifyCollectionJob()
{
}
void FolderConfigureModifyCollectionJob::setCollection(const Akonadi::Collection &col)
{
mCollection = col;
}
void FolderConfigureModifyCollectionJob::start()
{
Akonadi::CollectionModifyJob *job = new Akonadi::CollectionModifyJob(mCollection, this);
connect(job, &Akonadi::CollectionModifyJob::result, this, &FolderConfigureModifyCollectionJob::slotCollectionModified);
}
void FolderConfigureModifyCollectionJob::slotCollectionModified(KJob *job)
{
if (job->error()) {
qCWarning(LIBFOLDERCONFIGURESETTINGS_PLUGIN_LOG) << " Error when we modified collection";
}
deleteLater();
}
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef FOLDERCONFIGUREMODIFYCOLLECTIONJOB_H
#define FOLDERCONFIGUREMODIFYCOLLECTIONJOB_H
#include <QObject>
#include <AkonadiCore/Collection>
class KJob;
class FolderConfigureModifyCollectionJob : public QObject
{
Q_OBJECT
public:
explicit FolderConfigureModifyCollectionJob(QObject *parent = nullptr);
~FolderConfigureModifyCollectionJob();
void setCollection(const Akonadi::Collection &col);
void start();
private:
void slotCollectionModified(KJob *job);
Akonadi::Collection mCollection;
};
#endif // FOLDERCONFIGUREMODIFYCOLLECTIONJOB_H
......@@ -8,6 +8,7 @@
#include "folderconfiguresettingspagewidget.h"
#include "folderconfiguresettingstemplatewidget.h"
#include "folderconfiguresettingsviewwidget.h"
#include "folderconfiguremodifycollectionjob.h"
#include <MailCommon/CollectionExpiryWidget>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -61,7 +62,9 @@ void FolderConfigureSettingsPageWidget::save(const Akonadi::Collection::List &co
mCollectionExpiryWidget->save(settings, col, true, false);
mFolderConfigureSettingsViewWidget->save(col);
mCollectionTemplateWidget->save(col);
//TODO sync col
FolderConfigureModifyCollectionJob *job = new FolderConfigureModifyCollectionJob();
job->setCollection(col);
job->start();
}
}
}
Markdown is supported
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