Commit 4dca22de authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Prepare to import UnifiedMailBoxConfig

parent 7331c7be
Pipeline #95716 failed with stage
in 2 minutes and 27 seconds
......@@ -666,6 +666,23 @@ void ImportMailJobInterface::restoreConfig()
}
}
const QString unifiedMailBoxStr(QStringLiteral("akonadi_unifiedmailbox_agentrc"));
const KArchiveEntry *unifiedMailBoxEntry = mArchiveDirectory->entry(Utils::configsPath() + unifiedMailBoxStr);
if (unifiedMailBoxEntry && unifiedMailBoxEntry->isFile()) {
const auto archiveconfiguration = static_cast<const KArchiveFile *>(archivemailentry);
const QString unifiedMailBoxrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + unifiedMailBoxStr;
if (QFileInfo::exists(unifiedMailBoxrc)) {
const int result = mergeConfigMessageBox(unifiedMailBoxStr);
if (result == KMessageBox::Yes) {
importUnifiedMailBoxConfig(archiveconfiguration, unifiedMailBoxrc, unifiedMailBoxStr, Utils::configsPath());
} else if (result == KMessageBox::No) {
mergeUnifiedMailBoxConfig(archiveconfiguration, unifiedMailBoxStr, Utils::configsPath());
}
} else {
importUnifiedMailBoxConfig(archiveconfiguration, unifiedMailBoxrc, unifiedMailBoxStr, Utils::configsPath());
}
}
const QString templatesconfigurationrcStr(QStringLiteral("templatesconfigurationrc"));
const KArchiveEntry *templatesconfigurationentry = mArchiveDirectory->entry(Utils::configsPath() + templatesconfigurationrcStr);
if (templatesconfigurationentry && templatesconfigurationentry->isFile()) {
......@@ -920,15 +937,29 @@ void ImportMailJobInterface::restoreIdentity()
QTimer::singleShot(0, this, &ImportMailJobInterface::slotNextStep);
}
void ImportMailJobInterface::importMailArchiveConfig(const KArchiveFile *archiveconfiguration,
void ImportMailJobInterface::importUnifiedMailBoxConfig(const KArchiveFile *archiveconfiguration,
const QString &archiveconfigurationrc,
const QString &filename,
const QString &prefix)
{
#if 0 //PORT ME
copyToFile(archiveconfiguration, archiveconfigurationrc, filename, prefix);
KSharedConfig::Ptr archiveConfig = KSharedConfig::openConfig(archiveconfigurationrc);
copyArchiveMailAgentConfigGroup(archiveConfig, archiveConfig);
archiveConfig->sync();
#endif
}
void ImportMailJobInterface::importMailArchiveConfig(const KArchiveFile *archiveconfiguration,
const QString &archiveconfigurationrc,
const QString &filename,
const QString &prefix)
{
copyToFile(archiveconfiguration, archiveconfigurationrc, filename, prefix);
KSharedConfig::Ptr archiveConfig = KSharedConfig::openConfig(archiveconfigurationrc);
// TODO fix FolderArchiveAccount
copyArchiveMailAgentConfigGroup(archiveConfig, archiveConfig);
archiveConfig->sync();
}
......@@ -1268,6 +1299,25 @@ void ImportMailJobInterface::mergeLdapConfig(const KArchiveFile *archivefile, co
grpExisting.sync();
}
void ImportMailJobInterface::mergeUnifiedMailBoxConfig(const KArchiveFile *archivefile, const QString &filename, const QString &prefix)
{
#if 0 //FIXME
QDir dir(mTempDirName);
dir.mkdir(prefix);
const QString copyToDirName(mTempDirName + QLatin1Char('/') + prefix);
archivefile->copyTo(copyToDirName);
KSharedConfig::Ptr existingConfig = KSharedConfig::openConfig(filename);
KSharedConfig::Ptr importingMailArchiveConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + filename);
copyMailArchiveConfig(importingMailArchiveConfig, existingConfig);
existingConfig->sync();
#endif
}
void ImportMailJobInterface::mergeKmailSnippetConfig(const KArchiveFile *archivefile, const QString &filename, const QString &prefix)
{
// TODO
......
......@@ -77,8 +77,10 @@ private:
void copyArchiveMailAgentConfigGroup(const KSharedConfig::Ptr &archiveConfigOrigin, const KSharedConfig::Ptr &archiveConfigDestination);
void copyMailArchiveConfig(const KSharedConfig::Ptr &archiveConfigOrigin, const KSharedConfig::Ptr &archiveConfigDestination);
void mergeMailArchiveConfig(const KArchiveFile *archivefile, const QString &filename, const QString &prefix);
void mergeUnifiedMailBoxConfig(const KArchiveFile *archivefile, const QString &filename, const QString &prefix);
void mergeSieveTemplate(const KArchiveFile *archivefile, const QString &filename, const QString &prefix);
void importSimpleFilesInDirectory(const QString &relativePath);
void importUnifiedMailBoxConfig(const KArchiveFile *archiveconfiguration, const QString &archiveconfigurationrc, const QString &filename, const QString &prefix);
QHash<QString, QString> mHashResources;
QStringList mFileList;
......
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