File indexing completed on 2024-04-21 16:12:15

0001 /*******************************************************************
0002  * productmapping.h
0003  * SPDX-FileCopyrightText: 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
0004  * SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  *
0008  ******************************************************************/
0009 
0010 #ifndef PRODUCTMAPPING__H
0011 #define PRODUCTMAPPING__H
0012 
0013 #include <QObject>
0014 #include <QString>
0015 #include <QStringList>
0016 
0017 #include "bugzillaintegration/libbugzilla/clients/productclient.h"
0018 
0019 class Product;
0020 class BugzillaManager;
0021 class CrashedApplication;
0022 
0023 /**
0024  * Maps our crashed entity to a bugzilla product/component/version.
0025  */
0026 class ProductMapping : public QObject
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit ProductMapping(const CrashedApplication *, BugzillaManager *, QObject *parent = nullptr);
0031 
0032     QString bugzillaProduct() const;
0033     // If bugzillaProduct is a fallback product, then this is non-empty original product string we tried to find.
0034     QString bugzillaProductOriginal() const;
0035     QString bugzillaComponent() const;
0036     QString bugzillaVersion() const;
0037     QStringList relatedBugzillaProducts() const;
0038 
0039     bool bugzillaProductDisabled() const;
0040     bool bugzillaVersionDisabled() const;
0041 
0042     Q_SIGNAL void resolved();
0043 
0044 private Q_SLOTS:
0045     void checkProductInfo(const Bugzilla::Product::Ptr);
0046     // Fall back to generic product because the product failed to resolve.
0047     void fallBackToKDE();
0048 
0049 private:
0050     void map(const QString &);
0051     void mapUsingInternalFile(const QString &);
0052     void getRelatedProductsUsingInternalFile(const QString &);
0053 
0054     QStringList m_relatedBugzillaProducts;
0055     QString m_bugzillaProduct;
0056     QString m_bugzillaProductOriginal;
0057     QString m_bugzillaComponent;
0058 
0059     QString m_bugzillaVersionString;
0060 
0061     const CrashedApplication *m_crashedAppPtr = nullptr;
0062     BugzillaManager *m_bugzillaManagerPtr = nullptr;
0063 
0064     bool m_bugzillaProductDisabled;
0065     bool m_bugzillaVersionDisabled;
0066     bool m_hasExternallyProvidedProductName = false;
0067 
0068     QMetaObject::Connection m_productInfoErrorConnection;
0069 };
0070 
0071 #endif