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 "exportmailfolderattributejobtestimpl.h"
0008 #include "mail/exportmailjobinterface.h"
0009 #include <QMap>
0010 
0011 ExportMailFolderAttributeJobTestImpl::ExportMailFolderAttributeJobTestImpl(QObject *parent)
0012     : ExportMailFolderAttributeJob{parent}
0013 {
0014 }
0015 
0016 void ExportMailFolderAttributeJobTestImpl::fetchAttributes()
0017 {
0018     QMap<QString, ImportExportMailUtil::AttributeInfo> lstAttributeInfo;
0019     for (int i = 0; i < 10; ++i) {
0020         ImportExportMailUtil::AttributeInfo att;
0021         att.displayAttribute = QByteArrayLiteral("foo") + QByteArray::number(i);
0022         att.expireAttribute = QByteArrayLiteral("bla") + QByteArray::number(i);
0023         att.favoriteAttribute = QByteArrayLiteral("blu") + QByteArray::number(i);
0024         att.folderAttribute = QByteArrayLiteral("bli") + QByteArray::number(i);
0025         lstAttributeInfo.insert(mInterface->convertToFullCollectionPath(i), att);
0026     }
0027     // Only folderAttribute
0028     {
0029         const int index = 12;
0030         ImportExportMailUtil::AttributeInfo att;
0031         att.folderAttribute = QByteArrayLiteral("kul") + QByteArray::number(index);
0032         lstAttributeInfo.insert(mInterface->convertToFullCollectionPath(index), att);
0033     }
0034     // Only favoriteAttribute
0035     {
0036         const int index = 13;
0037         ImportExportMailUtil::AttributeInfo att;
0038         att.favoriteAttribute = QByteArrayLiteral("klo") + QByteArray::number(index);
0039         lstAttributeInfo.insert(mInterface->convertToFullCollectionPath(index), att);
0040     }
0041     // Only display
0042     {
0043         const int index = 14;
0044         ImportExportMailUtil::AttributeInfo att;
0045         att.displayAttribute = QByteArrayLiteral("osd") + QByteArray::number(index);
0046         lstAttributeInfo.insert(mInterface->convertToFullCollectionPath(index), att);
0047     }
0048     // Only expire
0049     {
0050         const int index = 15;
0051         ImportExportMailUtil::AttributeInfo att;
0052         att.expireAttribute = QByteArrayLiteral("plo") + QByteArray::number(index);
0053         lstAttributeInfo.insert(mInterface->convertToFullCollectionPath(index), att);
0054     }
0055 
0056     storeFileFolderAttribute(lstAttributeInfo);
0057 }
0058 
0059 #include "moc_exportmailfolderattributejobtestimpl.cpp"