Commit 60558b38 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add more virtual method

parent d7c769b6
......@@ -46,6 +46,18 @@ Akonadi::Collection::Id ExportCalendarsJobInterfaceTestImpl::convertFolderPathTo
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
QString ExportCalendarsJobInterfaceTestImpl::convertToFullCollectionPath(const qlonglong collectionValue)
{
ResourceConverterTest resourceConverterTest;
return resourceConverterTest.convertToFullCollectionPath(collectionValue);
}
void ExportCalendarsJobInterfaceTestImpl::convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey)
{
ResourceConverterTest converter;
converter.convertCollectionListToRealPath(group, currentKey);
}
ExportCalendarsJobInterfaceTest::ExportCalendarsJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -34,6 +34,8 @@ public:
protected:
void exportArchiveResource() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
};
class ExportCalendarsJobInterfaceTest : public QObject
......
......@@ -29,7 +29,6 @@
#include <QFile>
#include <QDir>
#include <QColor>
#include "resourceconverterimpl.h"
#include <QStandardPaths>
#include <exportresourcearchivejob.h>
......@@ -94,16 +93,14 @@ void ExportCalendarJobInterface::backupConfig()
if (korganizerConfig->hasGroup(globalCollectionsStr)) {
KConfigGroup group = korganizerConfig->group(globalCollectionsStr);
const QString selectionKey(QStringLiteral("Selection"));
ResourceConverterImpl converter;
converter.convertCollectionListToRealPath(group, selectionKey);
convertCollectionListToRealPath(group, selectionKey);
}
const QString collectionTreeViewStr(QStringLiteral("CollectionTreeView"));
if (korganizerConfig->hasGroup(collectionTreeViewStr)) {
KConfigGroup group = korganizerConfig->group(collectionTreeViewStr);
const QString selectionKey(QStringLiteral("Expansion"));
ResourceConverterImpl converter;
converter.convertCollectionListToRealPath(group, selectionKey);
convertCollectionListToRealPath(group, selectionKey);
}
korganizerConfig->sync();
......@@ -129,8 +126,7 @@ void ExportCalendarJobInterface::backupConfig()
for (const QString &key : keyList) {
const int collectionValue = key.toInt(&found);
if (found && collectionValue != -1) {
ResourceConverterImpl resourceConverter;
const QString realPath = resourceConverter.convertToFullCollectionPath(collectionValue);
const QString realPath = convertToFullCollectionPath(collectionValue);
const QColor color = group.readEntry(key, QColor());
group.writeEntry(realPath, color);
group.deleteEntry(key);
......
......@@ -36,6 +36,8 @@ public:
protected:
virtual void exportArchiveResource() = 0;
void slotCheckBackupConfig();
virtual Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) = 0;
virtual void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) = 0;
private:
void slotCheckBackupResource();
......
......@@ -55,6 +55,13 @@ Akonadi::Collection::Id ExportCalendarJobInterfaceImpl::convertFolderPathToColle
return converter.convertFolderPathToCollectionId(path);
}
void ExportCalendarJobInterfaceImpl::convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey)
{
ResourceConverterImpl converter;
converter.convertCollectionListToRealPath(group, currentKey);
}
void ExportCalendarJobInterfaceImpl::slotCalendarJobTerminated()
{
if (wasCanceled()) {
......@@ -108,3 +115,10 @@ void ExportCalendarJobInterfaceImpl::slotWriteNextArchiveResource()
QTimer::singleShot(0, this, &ExportCalendarJobInterfaceImpl::slotCheckBackupConfig);
}
}
QString ExportCalendarJobInterfaceImpl::convertToFullCollectionPath(const qlonglong collectionValue)
{
ResourceConverterImpl converter;
return converter.convertToFullCollectionPath(collectionValue);
}
......@@ -34,6 +34,8 @@ public:
protected:
void exportArchiveResource() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
private:
void slotCalendarJobTerminated();
......
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