Commit 3ca74bc1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

implement resource converter

parent 6864051f
......@@ -64,6 +64,7 @@ set(pimdataexporter_LIB_SRCS
exportresourcearchivejob.cpp
pimdataimportdatainfofile.cpp
resourceconverterbase.cpp
resourceconverterimpl.cpp
)
ecm_qt_declare_logging_category(pimdataexporter_LIB_SRCS HEADER pimdataexportcore_debug.h IDENTIFIER PIMDATAEXPORTERCORE_LOG CATEGORY_NAME org.kde.pim.pimdataexportercore
......
......@@ -22,7 +22,6 @@
#include <KConfigGroup>
#include <QDir>
#include <QFileInfo>
#include <MailCommon/MailUtil>
ResourceConverterBase::ResourceConverterBase()
{
......@@ -85,7 +84,7 @@ void ResourceConverterBase::convertCollectionIdsToRealPath(KConfigGroup &group,
}
const qlonglong collectionId = str.toLongLong(&found);
if (found) {
const QString realPath = MailCommon::Util::fullCollectionPath(Akonadi::Collection(collectionId));
const QString realPath = convertToFullCollectionPath(collectionId);
if (!realPath.isEmpty()) {
newValue << realPath;
}
......@@ -112,7 +111,7 @@ void ResourceConverterBase::convertCollectionListToRealPath(KConfigGroup &group,
bool found = false;
const qlonglong collectionValue = collection.toLongLong(&found);
if (found && collectionValue != -1) {
const QString realPath = MailCommon::Util::fullCollectionPath(Akonadi::Collection(collectionValue));
const QString realPath = convertToFullCollectionPath(collectionValue);
if (!realPath.isEmpty()) {
result << realPath;
}
......@@ -138,7 +137,7 @@ void ResourceConverterBase::convertCollectionToRealPath(KConfigGroup &group, con
bool found = false;
const qlonglong collectionValue = collectionId.toLongLong(&found);
if (found && collectionValue != -1) {
const QString realPath = MailCommon::Util::fullCollectionPath(Akonadi::Collection(collectionValue));
const QString realPath = convertToFullCollectionPath(collectionValue);
group.writeEntry(currentKey, realPath);
} else {
group.deleteEntry(currentKey);
......
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "resourceconverterimpl.h"
#include <MailCommon/MailUtil>
ResourceConverterImpl::ResourceConverterImpl()
{
}
ResourceConverterImpl::~ResourceConverterImpl()
{
}
QString ResourceConverterImpl::convertToFullCollectionPath(const qlonglong collectionValue)
{
return MailCommon::Util::fullCollectionPath(Akonadi::Collection(collectionValue));
}
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef RESOURCECONVERTERIMPL_H
#define RESOURCECONVERTERIMPL_H
#include "resourceconverterbase.h"
#include "pimdataexporter_export.h"
class PIMDATAEXPORTER_EXPORT ResourceConverterImpl : public ResourceConverterBase
{
public:
ResourceConverterImpl();
~ResourceConverterImpl() override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
};
#endif // RESOURCECONVERTERIMPL_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