Warning, file /plasma/drkonqi/src/bugzillaintegration/libbugzilla/models/bug.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2019-2022 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef BUG_H
0008 #define BUG_H
0009 
0010 #include <QObject>
0011 #include <QPointer>
0012 
0013 #include <QVariant>
0014 
0015 #include "comment.h"
0016 
0017 namespace Bugzilla
0018 {
0019 // Models a bugzilla bug.
0020 class Bug : public QObject
0021 {
0022 public:
0023     enum class Status {
0024         Unknown, // First value is default if QMetaEnum can't map the key.
0025         UNCONFIRMED,
0026         CONFIRMED,
0027         ASSIGNED,
0028         REOPENED,
0029         RESOLVED,
0030         NEEDSINFO,
0031         VERIFIED,
0032         CLOSED,
0033     };
0034     Q_ENUM(Status)
0035 
0036     enum class Resolution {
0037         Unknown, // First value is default if QMetaEnum can't map the key.
0038         NONE, // Fake value, expresses unresolved. On the REST side this is an empty string.
0039         FIXED,
0040         INVALID,
0041         WONTFIX,
0042         LATER,
0043         REMIND,
0044         DUPLICATE,
0045         WORKSFORME,
0046         MOVED,
0047         UPSTREAM,
0048         DOWNSTREAM,
0049         WAITINGFORINFO,
0050         BACKTRACE,
0051         UNMAINTAINED,
0052     };
0053     Q_ENUM(Resolution)
0054 
0055 private:
0056     Q_OBJECT
0057     Q_PROPERTY(qint64 id READ id MEMBER m_id NOTIFY changed)
0058     Q_PROPERTY(QString product READ product MEMBER m_product NOTIFY changed)
0059     Q_PROPERTY(QString component READ component MEMBER m_component NOTIFY changed)
0060     Q_PROPERTY(QString summary READ summary MEMBER m_summary NOTIFY changed)
0061     Q_PROPERTY(QString version READ version MEMBER m_version NOTIFY changed)
0062     Q_PROPERTY(bool is_open READ is_open MEMBER m_is_open NOTIFY changed)
0063     // maybe should be camel mapped, who knows
0064     Q_PROPERTY(QString op_sys READ op_sys MEMBER m_op_sys NOTIFY changed)
0065     Q_PROPERTY(QString priority READ priority MEMBER m_priority NOTIFY changed)
0066     Q_PROPERTY(QString severity READ severity MEMBER m_severity NOTIFY changed)
0067     Q_PROPERTY(Status status READ status MEMBER m_status NOTIFY changed)
0068     Q_PROPERTY(Resolution resolution READ resolution MEMBER m_resolution NOTIFY changed)
0069     Q_PROPERTY(qint64 dupe_of READ dupe_of MEMBER m_dupe_of NOTIFY changed)
0070 
0071     // Custom fields (versionfixedin etc) are only available via customField().
0072 
0073 public:
0074     using Ptr = QPointer<Bug>;
0075 
0076     explicit Bug(const QVariantHash &object, QObject *parent = nullptr);
0077 
0078     qint64 id() const;
0079     void setId(qint64 id);
0080 
0081     QVariant customField(const char *key);
0082 
0083     Status status() const;
0084     Resolution resolution() const;
0085     QString summary() const;
0086     QString version() const;
0087     QString product() const;
0088     QString component() const;
0089     QString op_sys() const;
0090     QString priority() const;
0091     QString severity() const;
0092     bool is_open() const;
0093     qint64 dupe_of() const;
0094 
0095 Q_SIGNALS:
0096     void commentsChanged();
0097     void changed();
0098 
0099 private:
0100     qint64 m_id = -1;
0101     QString m_product;
0102     QString m_component;
0103     QString m_summary;
0104     QString m_version;
0105     bool m_is_open = false;
0106     QString m_op_sys;
0107     QString m_priority;
0108     QString m_severity;
0109     Status m_status = Status::Unknown;
0110     Resolution m_resolution = Resolution::Unknown;
0111     qint64 m_dupe_of = -1;
0112 };
0113 
0114 } // namespace Bugzilla
0115 
0116 Q_DECLARE_METATYPE(Bugzilla::Bug *);
0117 
0118 #endif // BUG_H