Commit 0b726676 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove dependancy against akonadi

parent a9183b57
......@@ -341,7 +341,7 @@ void AbstractImportExportJob::backupResourceFile(const Akonadi::AgentInstance &a
const QString identifier = agent.identifier();
const QString archivePath = defaultPath + identifier + QLatin1Char('/');
QString url = Utils::resourcePath(agent);
QString url = Utils::resourcePath(identifier);
if (!url.isEmpty()) {
QFileInfo fi(url);
QString filename = fi.fileName();
......
......@@ -93,7 +93,7 @@ void ExportAddressbookJob::slotWriteNextArchiveResource()
if (identifier.contains(QLatin1String("akonadi_vcarddir_resource_")) || identifier.contains(QLatin1String("akonadi_contacts_resource_"))) {
const QString archivePath = Utils::addressbookPath() + identifier + QLatin1Char('/');
const QString url = Utils::resourcePath(agent, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/contacts/"));
const QString url = Utils::resourcePath(identifier, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/contacts/"));
if (!mAgentPaths.contains(url)) {
mAgentPaths << url;
if (!url.isEmpty()) {
......
......@@ -94,7 +94,7 @@ void ExportAlarmJob::slotWriteNextArchiveResource()
if (identifier.contains(QLatin1String("akonadi_kalarm_dir_resource_"))) {
const QString archivePath = Utils::alarmPath() + identifier + QLatin1Char('/');
const QString url = Utils::resourcePath(agent);
const QString url = Utils::resourcePath(identifier);
if (!mAgentPaths.contains(url)) {
mAgentPaths << url;
if (!url.isEmpty()) {
......
......@@ -96,7 +96,7 @@ void ExportCalendarJob::slotWriteNextArchiveResource()
if (identifier.contains(QLatin1String("akonadi_icaldir_resource_"))) {
const QString archivePath = Utils::calendarPath() + identifier + QLatin1Char('/');
const QString url = Utils::resourcePath(agent);
const QString url = Utils::resourcePath(identifier);
if (!mAgentPaths.contains(url)) {
mAgentPaths << url;
if (!url.isEmpty()) {
......
......@@ -155,7 +155,7 @@ void ExportMailJob::slotWriteNextArchiveResource()
|| identifier.contains(QLatin1String("akonadi_mixedmaildir_resource_"))) {
const QString archivePath = Utils::mailsPath() + identifier + QLatin1Char('/');
const QString url = Utils::resourcePath(agent);
const QString url = Utils::resourcePath(identifier);
if (!mAgentPaths.contains(url)) {
mAgentPaths << url;
if (!url.isEmpty()) {
......
......@@ -60,7 +60,7 @@ void ExportNotesJobInterfaceImpl::slotWriteNextArchiveResource()
if (identifier.contains(QLatin1String("akonadi_akonotes_resource_"))) {
const QString archivePath = Utils::notePath() + identifier + QLatin1Char('/');
QString url = Utils::resourcePath(agent);
QString url = Utils::resourcePath(identifier);
if (!mAgentPaths.contains(url) && QDir(url).exists()) {
mAgentPaths << url;
if (!url.isEmpty()) {
......
......@@ -22,7 +22,6 @@
#include <KConfigGroup>
#include <QDir>
#include <QFileInfo>
#include <AkonadiCore/AgentInstance>
#include <MailCommon/MailUtil>
ResourceConverter::ResourceConverter()
......@@ -32,7 +31,7 @@ ResourceConverter::ResourceConverter()
QString ResourceConverter::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
QString newUrl = Utils::resourcePath(resourceConfig);
QString newUrl = ResourceConverter::resourcePath(resourceConfig);
if (!newUrl.contains(QDir::homePath())) {
QFileInfo fileInfo(newUrl);
fileInfo.fileName();
......@@ -144,9 +143,9 @@ void ResourceConverter::convertCollectionToRealPath(KConfigGroup &group, const Q
}
}
QString ResourceConverter::resourcePath(const Akonadi::AgentInstance &agent, const QString &defaultPath)
QString ResourceConverter::resourcePath(const QString &agentIdentifier, const QString &defaultPath)
{
const QString agentFileName = agent.identifier() + QStringLiteral("rc");
const QString agentFileName = agentIdentifier + QStringLiteral("rc");
const QString configFileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + agentFileName;
KSharedConfigPtr resourceConfig = KSharedConfig::openConfig(configFileName);
......
......@@ -23,19 +23,16 @@
#include "pimdataexporter_export.h"
#include <QString>
#include <KSharedConfig>
namespace Akonadi {
class AgentInstance;
}
class PIMDATAEXPORTER_EXPORT ResourceConverter
{
public:
ResourceConverter();
QString agentFileName(const QString &filename);
QString resourcePath(const Akonadi::AgentInstance &agent, const QString &defaultPath = QString());
QString resourcePath(const QString &agentIdentifier, const QString &defaultPath = QString());
void convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey);
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey);
void convertCollectionIdsToRealPath(KConfigGroup &group, const QString &currentKey, const QString &prefixCollection = QString());
QString resourcePath(const KSharedConfigPtr &resourceConfig, const QString &defaultPath);
QString resourcePath(const KSharedConfigPtr &resourceConfig, const QString &defaultPath = QString());
QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData);
};
......
......@@ -223,9 +223,9 @@ void Utils::convertCollectionToRealPath(KConfigGroup &group, const QString &curr
}
}
QString Utils::resourcePath(const Akonadi::AgentInstance &agent, const QString &defaultPath)
QString Utils::resourcePath(const QString &agentIdentifier, const QString &defaultPath)
{
const QString agentFileName = agent.identifier() + QStringLiteral("rc");
const QString agentFileName = agentIdentifier + QStringLiteral("rc");
const QString configFileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + agentFileName;
KSharedConfigPtr resourceConfig = KSharedConfig::openConfig(configFileName);
......
......@@ -100,7 +100,7 @@ void convertCollectionListToRealPath(KConfigGroup &group, const QString &current
void convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey);
void convertCollectionIdsToRealPath(KConfigGroup &group, const QString &currentKey, const QString &prefixCollection = QString());
Q_REQUIRED_RESULT QString resourcePath(const Akonadi::AgentInstance &agent, const QString &defaultPath = QString());
Q_REQUIRED_RESULT QString resourcePath(const QString &agentIdentifier, const QString &defaultPath = QString());
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData);
Q_REQUIRED_RESULT QString storeResources(KZip *archive, const QString &identifier, const QString &path);
KZip *openZip(const QString &filename, QString &errorMsg);
......
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