Verified Commit fd491e9e authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Remove the now unused FetchRecursiveCollectionsJob

parent 272db4c3
......@@ -61,10 +61,6 @@ set(libpimcommonakonadi_widgets_SRCS
widgets/annotationdialog.cpp
)
set(libpimcommon_job_SRCS
job/fetchrecursivecollectionsjob.cpp
)
set(libpimcommonakonadi_util_SRCS
util/createresource.cpp
util/imapresourcecapabilitiesmanager.cpp
......@@ -89,7 +85,6 @@ set(libpimcommonakonadi_SRCS
${libpimcommonakonadi_manageserversidesubscription_SRCS}
${libpimcommonakonadi_widgets_SRCS}
${libpimcommonakonadi_util_SRCS}
${libpimcommon_job_SRCS}
)
......@@ -175,14 +170,6 @@ ecm_generate_headers(PimCommonAkonadiUtil_CamelCase_HEADERS
RELATIVE util
)
ecm_generate_headers(PimCommon_CamelCasejob_HEADERS
HEADER_NAMES
FetchRecursiveCollectionsJob
REQUIRED_HEADERS PimCommon_job_HEADERS
PREFIX PimCommonAkonadi
RELATIVE job
)
ecm_generate_headers(PimCommonAkonadi_Camelcasewidgets_HEADERS
HEADER_NAMES
......@@ -236,7 +223,6 @@ ecm_generate_pri_file(BASE_NAME PimCommonAkonadi
install(FILES
${PimCommonAkonadi_Camelcasecollectionpage_HEADERS}
${PimCommonAkonadi_Camelcasecollectionpageattributes_HEADERS}
${PimCommon_CamelCasejob_HEADERS}
${PimCommon_Camelcaseacl_HEADERS}
${PimCommon_Camelcasefolderdialog_HEADERS}
${PimCommonAkonadi_CamelCasegenericplugins_HEADERS}
......@@ -258,7 +244,6 @@ install(FILES
${PimCommonAkonadi_casewidgets_HEADERS}
${PimCommonAkonadi_widgets_HEADERS}
${PimCommon_managerserversidesubscription_HEADERS}
${PimCommon_job_HEADERS}
${PimCommonAkonadiUtil_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/pimcommonakonadi
......
/*
Copyright (c) 2015-2020 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "fetchrecursivecollectionsjob.h"
#include "pimcommonakonadi_debug.h"
#include <CollectionFetchJob>
#include <AkonadiCore/CollectionFetchScope>
using namespace PimCommon;
class PimCommon::FetchRecursiveCollectionsJobPrivate
{
public:
FetchRecursiveCollectionsJobPrivate()
{
}
Akonadi::Collection mTopCollection;
};
FetchRecursiveCollectionsJob::FetchRecursiveCollectionsJob(QObject *parent)
: QObject(parent)
, d(new PimCommon::FetchRecursiveCollectionsJobPrivate)
{
}
FetchRecursiveCollectionsJob::~FetchRecursiveCollectionsJob()
{
delete d;
}
void FetchRecursiveCollectionsJob::start()
{
if (!d->mTopCollection.isValid()) {
qCWarning(PIMCOMMONAKONADI_LOG) << "Any collection is defined";
Q_EMIT fetchCollectionFailed();
deleteLater();
return;
}
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(d->mTopCollection, Akonadi::CollectionFetchJob::Recursive);
job->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::All);
connect(job, &Akonadi::CollectionFetchJob::result, this, &FetchRecursiveCollectionsJob::slotInitialCollectionFetchingDone);
}
void FetchRecursiveCollectionsJob::setTopCollection(const Akonadi::Collection &col)
{
d->mTopCollection = col;
}
void FetchRecursiveCollectionsJob::slotInitialCollectionFetchingDone(KJob *job)
{
if (job->error()) {
qCWarning(PIMCOMMONAKONADI_LOG) << job->errorString();
Q_EMIT fetchCollectionFailed();
deleteLater();
return;
}
Akonadi::CollectionFetchJob *fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
Q_EMIT fetchCollectionFinished(fetchJob->collections() << d->mTopCollection);
deleteLater();
}
/*
Copyright (c) 2015-2020 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef FETCHRECURSIVECOLLECTIONSJOB_H
#define FETCHRECURSIVECOLLECTIONSJOB_H
#include <Collection>
#include <QObject>
#include "pimcommonakonadi_export.h"
class KJob;
namespace PimCommon {
class FetchRecursiveCollectionsJobPrivate;
/**
* @brief The FetchRecursiveCollectionsJob class
* @author Laurent Montel <montel@kde.org>
*/
class PIMCOMMONAKONADI_EXPORT FetchRecursiveCollectionsJob : public QObject
{
Q_OBJECT
public:
explicit FetchRecursiveCollectionsJob(QObject *parent = nullptr);
~FetchRecursiveCollectionsJob();
void setTopCollection(const Akonadi::Collection &col);
void start();
Q_SIGNALS:
void fetchCollectionFinished(const Akonadi::Collection::List &list);
void fetchCollectionFailed();
private:
void slotInitialCollectionFetchingDone(KJob *job);
FetchRecursiveCollectionsJobPrivate *const d;
};
}
#endif // FETCHRECURSIVECOLLECTIONSJOB_H
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