Changeset View
Changeset View
Standalone View
Standalone View
src/bugzillaintegration/duplicatefinderjob.h
Show All 31 Lines | |||||
32 | * If a duplicate is found result is emitted instantly | 32 | * If a duplicate is found result is emitted instantly | ||
33 | */ | 33 | */ | ||
34 | class DuplicateFinderJob : public KJob | 34 | class DuplicateFinderJob : public KJob | ||
35 | { | 35 | { | ||
36 | Q_OBJECT | 36 | Q_OBJECT | ||
37 | public: | 37 | public: | ||
38 | struct Result | 38 | struct Result | ||
39 | { | 39 | { | ||
40 | Result() | | |||
41 | : duplicate(0), | | |||
42 | parentDuplicate(0), | | |||
43 | status(BugReport::UnknownStatus), | | |||
44 | resolution(BugReport::UnknownResolution) | | |||
45 | {} | | |||
46 | | ||||
47 | /** | 40 | /** | ||
48 | * First duplicate that was found, it might be that | 41 | * First duplicate that was found, it might be that | ||
49 | * this one is a duplicate itself, though this is still | 42 | * this one is a duplicate itself, though this is still | ||
50 | * useful for example to inform the user that their | 43 | * useful for example to inform the user that their | ||
51 | * backtrace is a duplicate of this bug, which is | 44 | * backtrace is a duplicate of this bug, which is | ||
52 | * tracked at another number though. | 45 | * tracked at another number though. | ||
53 | * | 46 | * | ||
54 | * @note 0 means that there is no duplicate | 47 | * @note 0 means that there is no duplicate | ||
55 | * @see parrentDuplicate | 48 | * @see parrentDuplicate | ||
56 | */ | 49 | */ | ||
57 | int duplicate; | 50 | int duplicate = 0; | ||
58 | 51 | | |||
59 | /** | 52 | /** | ||
60 | * This always points to the parent bug, i.e. | 53 | * This always points to the parent bug, i.e. | ||
61 | * the bug that has no duplicates itself. | 54 | * the bug that has no duplicates itself. | ||
62 | * If this is 0 it means that there are no duplicates | 55 | * If this is 0 it means that there are no duplicates | ||
63 | */ | 56 | */ | ||
64 | int parentDuplicate; | 57 | int parentDuplicate = 0; | ||
65 | | ||||
66 | BugReport::Status status; | | |||
67 | 58 | | |||
68 | BugReport::Resolution resolution; | 59 | Bugzilla::Bug::Status status = Bugzilla::Bug::Status::Unknown; | ||
60 | Bugzilla::Bug::Resolution resolution = Bugzilla::Bug::Resolution::Unknown; | ||||
69 | }; | 61 | }; | ||
70 | 62 | | |||
71 | DuplicateFinderJob(const QList<int> &bugIds, BugzillaManager *manager, QObject *parent = nullptr); | 63 | DuplicateFinderJob(const QList<int> &bugIds, BugzillaManager *manager, QObject *parent = nullptr); | ||
72 | ~DuplicateFinderJob() override; | 64 | ~DuplicateFinderJob() override; | ||
73 | 65 | | |||
74 | void start() override; | 66 | void start() override; | ||
75 | 67 | | |||
76 | /** | 68 | /** | ||
77 | * Call this after result has been emitted to | 69 | * Call this after result has been emitted to | ||
78 | * get the result | 70 | * get the result | ||
79 | */ | 71 | */ | ||
80 | Result result() const; | 72 | Result result() const; | ||
81 | 73 | | |||
82 | private Q_SLOTS: | 74 | private Q_SLOTS: | ||
83 | void slotBugReportFetched(const BugReport &bug, QObject *owner); | 75 | void slotBugReportFetched(const Bugzilla::Bug::Ptr &bug, QObject *owner); | ||
84 | void slotBugReportError(const QString &message, QObject *owner); | 76 | void slotBugReportError(const QString &message, QObject *owner); | ||
85 | 77 | | |||
86 | private: | 78 | private: | ||
87 | void analyzeNextBug(); | 79 | void analyzeNextBug(); | ||
88 | void fetchBug(const QString &bugId); | 80 | void fetchBug(int bugId); | ||
89 | 81 | | |||
90 | private: | 82 | private: | ||
91 | BugzillaManager *m_manager = nullptr; | 83 | BugzillaManager *m_manager = nullptr; | ||
92 | QList<int> m_bugIds; | 84 | QList<int> m_bugIds; | ||
93 | Result m_result; | 85 | Result m_result; | ||
94 | }; | 86 | }; | ||
95 | #endif | 87 | #endif |