File indexing completed on 2024-06-23 05:06:46

0001 /*
0002     SPDX-FileCopyrightText: 2008 Tobias Koenig <tokoe@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadicore_export.h"
0010 
0011 #include <QMetaType>
0012 #include <QSharedDataPointer>
0013 
0014 class QIcon;
0015 class QString;
0016 #include <QStringList>
0017 class QVariant;
0018 using QVariantMap = QMap<QString, QVariant>;
0019 
0020 namespace Akonadi
0021 {
0022 class AgentTypePrivate;
0023 
0024 /**
0025  * @short A representation of an agent type.
0026  *
0027  * The agent type is a representation of an available agent, that can
0028  * be started as an agent instance.
0029  * It provides all information about the type.
0030  *
0031  * All available agent types can be retrieved from the AgentManager.
0032  *
0033  * @code
0034  *
0035  * Akonadi::AgentType::List types = Akonadi::AgentManager::self()->types();
0036  * for ( const Akonadi::AgentType &type : types ) {
0037  *   qDebug() << "Name:" << type.name() << "(" << type.identifier() << ")";
0038  * }
0039  *
0040  * @endcode
0041  *
0042  * @author Tobias Koenig <tokoe@kde.org>
0043  */
0044 class AKONADICORE_EXPORT AgentType
0045 {
0046     friend class AgentManager;
0047     friend class AgentManagerPrivate;
0048 
0049 public:
0050     /**
0051      * Describes a list of agent types.
0052      */
0053     using List = QList<AgentType>;
0054 
0055     /**
0056      * Creates a new agent type.
0057      */
0058     AgentType();
0059 
0060     /**
0061      * Creates an agent type from an @p other agent type.
0062      */
0063     AgentType(const AgentType &other);
0064 
0065     /**
0066      * Destroys the agent type.
0067      */
0068     ~AgentType();
0069 
0070     /**
0071      * Returns whether the agent type is valid.
0072      */
0073     [[nodiscard]] bool isValid() const;
0074 
0075     /**
0076      * Returns the unique identifier of the agent type.
0077      */
0078     [[nodiscard]] QString identifier() const;
0079 
0080     /**
0081      * Returns the i18n'ed name of the agent type.
0082      */
0083     [[nodiscard]] QString name() const;
0084 
0085     /**
0086      * Returns the description of the agent type.
0087      */
0088     [[nodiscard]] QString description() const;
0089 
0090     /**
0091      * Returns the name of the icon of the agent type.
0092      */
0093     [[nodiscard]] QString iconName() const;
0094 
0095     /**
0096      * Returns the icon of the agent type.
0097      */
0098     [[nodiscard]] QIcon icon() const;
0099 
0100     /**
0101      * Returns the list of supported mime types of the agent type.
0102      */
0103     [[nodiscard]] QStringList mimeTypes() const;
0104 
0105     /**
0106      * Returns the list of supported capabilities of the agent type.
0107      */
0108     [[nodiscard]] QStringList capabilities() const;
0109 
0110     /**
0111      * Returns a Map of custom properties of the agent type.
0112      * @since 4.12
0113      */
0114     [[nodiscard]] QVariantMap customProperties() const;
0115 
0116     /**
0117      * @internal
0118      * @param other other agent type
0119      */
0120     AgentType &operator=(const AgentType &other);
0121 
0122     /**
0123      * @internal
0124      * @param other other agent type
0125      */
0126     bool operator==(const AgentType &other) const;
0127 
0128 private:
0129     /// @cond PRIVATE
0130     QSharedDataPointer<AgentTypePrivate> d;
0131     /// @endcond
0132 };
0133 
0134 }
0135 
0136 Q_DECLARE_TYPEINFO(Akonadi::AgentType, Q_RELOCATABLE_TYPE);
0137 
0138 Q_DECLARE_METATYPE(Akonadi::AgentType)