File indexing completed on 2024-12-22 05:05:24

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "importmailfolderattributejobtestimpl.h"
0008 #include <QFile>
0009 ImportMailFolderAttributeJobTestImpl::ImportMailFolderAttributeJobTestImpl(QObject *parent)
0010     : ImportMailFolderAttributeJob{parent}
0011 {
0012 }
0013 
0014 ImportMailFolderAttributeJobTestImpl::~ImportMailFolderAttributeJobTestImpl()
0015 {
0016 }
0017 
0018 void ImportMailFolderAttributeJobTestImpl::applyAttributes(const QMap<Akonadi::Collection::Id, ImportExportMailUtil::AttributeInfo> &map)
0019 {
0020     QMapIterator<Akonadi::Collection::Id, ImportExportMailUtil::AttributeInfo> indexDisplayMap(map);
0021     QFile data(mExtractPath + QStringLiteral("/config/mailfolderattributes"));
0022     if (data.open(QFile::WriteOnly | QFile::Truncate)) {
0023         QTextStream out(&data);
0024         while (indexDisplayMap.hasNext()) {
0025             indexDisplayMap.next();
0026             out << "Collection " << indexDisplayMap.key() << " display " << indexDisplayMap.value().displayAttribute << " expire "
0027                 << indexDisplayMap.value().expireAttribute << " favorite " << indexDisplayMap.value().favoriteAttribute << " folder "
0028                 << indexDisplayMap.value().folderAttribute << "\n";
0029         }
0030     }
0031     restoreFileFolderAttribute();
0032 }
0033 
0034 #include "moc_importmailfolderattributejobtestimpl.cpp"