Commit c424acfc authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement import unifiedmailbox config

parent 4dca22de
......@@ -943,13 +943,11 @@ void ImportMailJobInterface::importUnifiedMailBoxConfig(const KArchiveFile *arch
const QString &filename,
const QString &prefix)
{
#if 0 //PORT ME
copyToFile(archiveconfiguration, archiveconfigurationrc, filename, prefix);
KSharedConfig::Ptr archiveConfig = KSharedConfig::openConfig(archiveconfigurationrc);
copyArchiveMailAgentConfigGroup(archiveConfig, archiveConfig);
copyUnifiedMailBoxConfig(archiveConfig, archiveConfig);
archiveConfig->sync();
#endif
}
void ImportMailJobInterface::importMailArchiveConfig(const KArchiveFile *archiveconfiguration,
......@@ -1022,6 +1020,33 @@ void ImportMailJobInterface::copyMailArchiveConfig(const KSharedConfig::Ptr &arc
}
}
void ImportMailJobInterface::copyUnifiedMailBoxConfig(const KSharedConfig::Ptr &archiveConfigOrigin, const KSharedConfig::Ptr &archiveConfigDestination)
{
#if 0
const QString archiveGroupPattern = QStringLiteral("FolderArchiveAccount ");
const QStringList archiveList = archiveConfigOrigin->groupList().filter(archiveGroupPattern);
for (const QString &str : archiveList) {
const QString resourcename = str.right(str.length() - archiveGroupPattern.length());
if (!resourcename.isEmpty()) {
KConfigGroup oldGroup = archiveConfigOrigin->group(str);
QString newResourceName;
if (mHashResources.contains(resourcename)) {
newResourceName = mHashResources.value(resourcename);
const Akonadi::Collection::Id id = convertPathToId(oldGroup.readEntry(QStringLiteral("topLevelCollectionId")));
if (id != -1) {
KConfigGroup newGroup(archiveConfigDestination, archiveGroupPattern + newResourceName);
oldGroup.copyTo(&newGroup);
newGroup.writeEntry(QStringLiteral("topLevelCollectionId"), id);
}
}
oldGroup.deleteGroup();
}
}
#endif
}
void ImportMailJobInterface::copyArchiveMailAgentConfigGroup(const KSharedConfig::Ptr &archiveConfigOrigin, const KSharedConfig::Ptr &archiveConfigDestination)
{
// adapt id
......@@ -1301,7 +1326,6 @@ void ImportMailJobInterface::mergeLdapConfig(const KArchiveFile *archivefile, co
void ImportMailJobInterface::mergeUnifiedMailBoxConfig(const KArchiveFile *archivefile, const QString &filename, const QString &prefix)
{
#if 0 //FIXME
QDir dir(mTempDirName);
dir.mkdir(prefix);
......@@ -1312,9 +1336,8 @@ void ImportMailJobInterface::mergeUnifiedMailBoxConfig(const KArchiveFile *archi
KSharedConfig::Ptr importingMailArchiveConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + filename);
copyMailArchiveConfig(importingMailArchiveConfig, existingConfig);
copyUnifiedMailBoxConfig(importingMailArchiveConfig, existingConfig);
existingConfig->sync();
#endif
}
......
......@@ -80,6 +80,7 @@ private:
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 copyUnifiedMailBoxConfig(const KSharedConfig::Ptr &archiveConfigOrigin, const KSharedConfig::Ptr &archiveConfigDestination);
void importUnifiedMailBoxConfig(const KArchiveFile *archiveconfiguration, const QString &archiveconfigurationrc, const QString &filename, const QString &prefix);
QHash<QString, QString> mHashResources;
......
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