File indexing completed on 2025-01-05 04:58:21

0001 /*
0002   SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 
0008 #pragma once
0009 #include "pimcommonakonadi_export.h"
0010 #include <QByteArray>
0011 #include <QString>
0012 
0013 namespace PimCommon
0014 {
0015 /**
0016  * @brief The CollectionTypeUtil class
0017  * @author Laurent Montel <montel@kde.org>
0018  */
0019 class PIMCOMMONAKONADI_EXPORT CollectionTypeUtil
0020 {
0021 public:
0022     CollectionTypeUtil();
0023     ~CollectionTypeUtil();
0024 
0025     static QByteArray kolabFolderType();
0026     static QByteArray kolabIncidencesFor();
0027     static QByteArray kolabSharedSeen();
0028 
0029     enum FolderContentsType {
0030         ContentsTypeMail = 0,
0031         ContentsTypeCalendar,
0032         ContentsTypeContact,
0033         ContentsTypeNote,
0034         ContentsTypeTask,
0035         ContentsTypeJournal,
0036         ContentsTypeConfiguration,
0037         ContentsTypeFreebusy,
0038         ContentsTypeFile,
0039         ContentsTypeLast = ContentsTypeFile
0040     };
0041 
0042     enum IncidencesFor {
0043         IncForNobody,
0044         IncForAdmins,
0045         IncForReaders,
0046     };
0047 
0048     [[nodiscard]] CollectionTypeUtil::IncidencesFor incidencesForFromString(const QString &string);
0049     [[nodiscard]] CollectionTypeUtil::FolderContentsType typeFromKolabName(const QByteArray &name);
0050     [[nodiscard]] QString folderContentDescription(CollectionTypeUtil::FolderContentsType type);
0051     [[nodiscard]] QByteArray kolabNameFromType(CollectionTypeUtil::FolderContentsType type);
0052     [[nodiscard]] QString incidencesForToString(CollectionTypeUtil::IncidencesFor type);
0053     [[nodiscard]] CollectionTypeUtil::FolderContentsType contentsTypeFromString(const QString &type);
0054     [[nodiscard]] QString typeNameFromKolabType(const QByteArray &type);
0055     [[nodiscard]] QString iconNameFromContentsType(CollectionTypeUtil::FolderContentsType type);
0056 };
0057 }