Warning, file /plasma/drkonqi/src/bugzillaintegration/libbugzilla/models/bug.cpp 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 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 #include "bug.h"
0008 
0009 #include <QDebug>
0010 
0011 namespace Bugzilla
0012 {
0013 Bug::Bug(const QVariantHash &obj, QObject *parent)
0014     : QObject(parent)
0015 {
0016     for (auto it = obj.constBegin(); it != obj.constEnd(); ++it) {
0017         setProperty(qPrintable(it.key()), it.value());
0018     }
0019 
0020     // Enums are auto-translated from strings so long as the string is equal
0021     // to the stringified enum key. Fail if the mapping failed.
0022     const QString status = obj.value(QStringLiteral("status")).toString();
0023     if (m_status == Status::Unknown) {
0024         // Intentionally uncategorized. Very important warning!
0025         qWarning() << "Drkonqi status mapping failed on bug" << id() << ":" << status << "Please file a bug at bugs.kde.org";
0026     }
0027 
0028     const QString resolution = obj.value(QStringLiteral("resolution")).toString();
0029     if (resolution.isEmpty() && m_resolution == Resolution::Unknown) {
0030         m_resolution = Resolution::NONE;
0031         // The empty string is unresolved. This is expected and shouldn't trip
0032         // the mapping guard.
0033     } else if (m_resolution == Resolution::Unknown) {
0034         // Intentionally uncategorized. Very important warning!
0035         qWarning() << "Drkonqi resolution mapping failed on bug" << id() << ":" << resolution << "Please file a bug at bugs.kde.org";
0036     }
0037 }
0038 
0039 Bug::Resolution Bug::resolution() const
0040 {
0041     return m_resolution;
0042 }
0043 
0044 QString Bug::summary() const
0045 {
0046     return m_summary;
0047 }
0048 
0049 QString Bug::version() const
0050 {
0051     return m_version;
0052 }
0053 
0054 QString Bug::product() const
0055 {
0056     return m_product;
0057 }
0058 
0059 QString Bug::component() const
0060 {
0061     return m_component;
0062 }
0063 
0064 QString Bug::op_sys() const
0065 {
0066     return m_op_sys;
0067 }
0068 
0069 QString Bug::priority() const
0070 {
0071     return m_priority;
0072 }
0073 
0074 QString Bug::severity() const
0075 {
0076     return m_severity;
0077 }
0078 
0079 bool Bug::is_open() const
0080 {
0081     return m_is_open;
0082 }
0083 
0084 qint64 Bug::dupe_of() const
0085 {
0086     return m_dupe_of;
0087 }
0088 
0089 qint64 Bug::id() const
0090 {
0091     return m_id;
0092 }
0093 
0094 QVariant Bug::customField(const char *key)
0095 {
0096     return property(key);
0097 }
0098 
0099 Bug::Status Bug::status() const
0100 {
0101     return m_status;
0102 }
0103 
0104 } // namespace Bugzilla