Warning, file /plasma/drkonqi/src/bugzillaintegration/libbugzilla/models/bugfield.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 BUGFIELD_H
0008 #define BUGFIELD_H
0009 
0010 #include <QObject>
0011 #include <QPointer>
0012 #include <QVariantHash>
0013 
0014 namespace Bugzilla
0015 {
0016 /// https://bugzilla.readthedocs.io/en/5.0/api/core/v1/field.html
0017 class BugFieldValue : public QObject
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(QString name READ name MEMBER m_name NOTIFY changed)
0021     // not mapped because of lazyness and lack of need
0022     //    Q_PROPERTY(int sort_key READ sort_key WRITE setSort_key)
0023     //    // visibility_values not mapped
0024     //    Q_PROPERTY(bool is_active READ is_active WRITE setIs_active)
0025     //    Q_PROPERTY(QString description READ description WRITE setDescription)
0026     //    Q_PROPERTY(bool is_open READ is_open WRITE setIs_open)
0027     //    // can_change_to not mapped
0028 public:
0029     explicit BugFieldValue(const QVariantHash &obj, QObject *parent = nullptr);
0030 
0031     QString name() const;
0032 
0033 Q_SIGNALS:
0034     void changed();
0035 
0036 private:
0037     QString m_name;
0038 };
0039 
0040 /// https://bugzilla.readthedocs.io/en/5.0/api/core/v1/field.html
0041 class BugField : public QObject
0042 {
0043     Q_OBJECT
0044     // Not mapped for lazyness and lack of need:
0045     //    Q_PROPERTY(int id READ id WRITE setId)
0046     //    Q_PROPERTY(Type type READ type WRITE setType)
0047     //    Q_PROPERTY(bool is_custom READ is_custom WRITE setIs_custom)
0048     //    Q_PROPERTY(QString name READ name WRITE setName)
0049     //    Q_PROPERTY(QString display_name READ display_name WRITE setDisplay_name)
0050     //    Q_PROPERTY(bool is_mandatory READ is_mandatory WRITE setIs_mandatory)
0051     //    Q_PROPERTY(bool is_on_bug_entry READ is_on_bug_entry WRITE setIs_on_bug_entry)
0052     //    Q_PROPERTY(QString visibility_field READ visibility_field WRITE setVisibility_field)
0053     //    Q_PROPERTY(QString value_field READ value_field WRITE setValue_field)
0054     Q_PROPERTY(QList<BugFieldValue *> values READ values MEMBER m_values NOTIFY changed)
0055 public:
0056     enum class Type {
0057         Invalid = -1,
0058         Unknown = 0,
0059         SingleLineString = 1,
0060         SingleValue = 2,
0061         MultipleValue = 3,
0062         MultiLineText = 4,
0063         DateTime = 5,
0064         BugId = 6,
0065         SeeAlso = 7,
0066         Keywords = 8,
0067         Date = 9,
0068         Integer = 10,
0069     };
0070 
0071     using Ptr = QPointer<BugField>;
0072 
0073     explicit BugField(const QVariantHash &obj, QObject *parent = nullptr);
0074 
0075     QList<BugFieldValue *> values() const;
0076 
0077 Q_SIGNALS:
0078     void changed();
0079 
0080 private:
0081     static void registerVariantConverters();
0082 
0083     QList<BugFieldValue *> m_values;
0084 };
0085 
0086 } // namespace Bugzilla
0087 
0088 #endif // BUGFIELD_H