File indexing completed on 2024-04-21 05:50:37

0001 /*
0002     SPDX-FileCopyrightText: 2008-2022 Rolf Eike Beer <kde@opensource.sf-tec.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 #ifndef KGPGSIGNABLENODE_H
0007 #define KGPGSIGNABLENODE_H
0008 
0009 #include "KGpgExpandableNode.h"
0010 #include "KGpgSignNode.h"
0011 
0012 /**
0013  * @brief An object that may have KGpgSignNode children
0014  *
0015  * This class represents an object that may be signed, i.e. key nodes,
0016  * user ids, user attributes, and subkeys.
0017  */
0018 class KGpgSignableNode : public KGpgExpandableNode
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     typedef QList<KGpgSignableNode *> List;
0024     typedef QList<const KGpgSignableNode *> const_List;
0025 
0026     explicit KGpgSignableNode(KGpgExpandableNode *parent = nullptr);
0027     ~KGpgSignableNode() override = default;
0028 
0029     KGpgSignNode::List getSignatures(void) const;
0030     /**
0031      * @brief count signatures
0032      * @return the number of signatures to this object
0033      *
0034      * This does not include the number of signatures to child objects.
0035      */
0036     virtual QString getSignCount() const;
0037 
0038     bool operator<(const KGpgSignableNode &other) const;
0039     bool operator<(const KGpgSignableNode *other) const;
0040 
0041     /**
0042      * @brief returns the key node this node belongs to
0043      * @returns this node if the node itself is a key or it's parent otherwise
0044      */
0045     virtual KGpgKeyNode *getKeyNode(void) = 0;
0046     virtual const KGpgKeyNode *getKeyNode(void) const = 0;
0047 };
0048 
0049 #endif /* KGPGSIGNABLENODE_H */