1 | /******************************************************************* |
2 | * reportassistantpages_bugzilla_duplicates.h |
3 | * Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com> |
4 | * |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License as |
7 | * published by the Free Software Foundation; either version 2 of |
8 | * the License, or (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | * |
18 | ******************************************************************/ |
19 | |
20 | #ifndef REPORTASSISTANTPAGES__BUGZILLA__DUPLICATES_H |
21 | #define REPORTASSISTANTPAGES__BUGZILLA__DUPLICATES_H |
22 | |
23 | #include "reportassistantpage.h" |
24 | |
25 | #include "duplicatefinderjob.h" |
26 | #include "bugzillalib.h" |
27 | |
28 | #include "ui_assistantpage_bugzilla_duplicates.h" |
29 | #include "ui_assistantpage_bugzilla_duplicates_dialog.h" |
30 | #include "ui_assistantpage_bugzilla_duplicates_dialog_confirmation.h" |
31 | |
32 | class QDate; |
33 | class QTreeWidgetItem; |
34 | |
35 | class KGuiItem; |
36 | |
37 | class BugzillaReportInformationDialog; |
38 | |
39 | /** Searching for duplicates and showing report information page**/ |
40 | class BugzillaDuplicatesPage : public ReportAssistantPage |
41 | { |
42 | Q_OBJECT |
43 | |
44 | public: |
45 | explicit BugzillaDuplicatesPage(ReportAssistantDialog *); |
46 | ~BugzillaDuplicatesPage(); |
47 | |
48 | void aboutToShow(); |
49 | void aboutToHide(); |
50 | |
51 | bool isComplete(); |
52 | bool showNextPage(); |
53 | |
54 | private Q_SLOTS: |
55 | /* Search related methods */ |
56 | void searchMore(); |
57 | void performSearch(); |
58 | void stopCurrentSearch(); |
59 | |
60 | void markAsSearching(bool); |
61 | |
62 | bool canSearchMore(); |
63 | |
64 | void searchFinished(const BugMapList&); |
65 | void searchError(QString); |
66 | void analyzedDuplicates(KJob *job); |
67 | |
68 | void resetDates(); |
69 | |
70 | /* Duplicates list related methods */ |
71 | void openSelectedReport(); |
72 | void itemClicked(QTreeWidgetItem *, int); |
73 | void itemClicked(QListWidgetItem *); |
74 | void showReportInformationDialog(int, bool relatedButtonEnabled = true); |
75 | void itemSelectionChanged(); |
76 | |
77 | /* Selected duplicates list related methods */ |
78 | void addPossibleDuplicateNumber(int); |
79 | void removeSelectedDuplicate(); |
80 | |
81 | void showDuplicatesPanel(bool); |
82 | |
83 | void possibleDuplicateSelectionChanged(); |
84 | |
85 | /* Attach to bug related methods */ |
86 | void attachToBugReport(int); |
87 | void cancelAttachToBugReport(); |
88 | void informationClicked(const QString &activatedLink); |
89 | |
90 | private: |
91 | bool m_searching; |
92 | bool m_foundDuplicate; |
93 | |
94 | Ui::AssistantPageBugzillaDuplicates ui; |
95 | |
96 | //Dates of current Results |
97 | QDate m_startDate; |
98 | QDate m_endDate; |
99 | //Dates of searching process |
100 | QDate m_searchingStartDate; |
101 | QDate m_searchingEndDate; |
102 | |
103 | KGuiItem m_searchMoreGuiItem; |
104 | KGuiItem m_retrySearchGuiItem; |
105 | DuplicateFinderJob::Result m_result; |
106 | }; |
107 | |
108 | /** Internal bug-info dialog **/ |
109 | class BugzillaReportInformationDialog : public KDialog |
110 | { |
111 | Q_OBJECT |
112 | |
113 | public: |
114 | explicit BugzillaReportInformationDialog(BugzillaDuplicatesPage*parent=0); |
115 | ~BugzillaReportInformationDialog(); |
116 | |
117 | void showBugReport(int bugNumber, bool relatedButtonEnabled = true); |
118 | |
119 | void markAsDuplicate(); |
120 | void attachToBugReport(); |
121 | void cancelAssistant(); |
122 | |
123 | private Q_SLOTS: |
124 | void bugFetchFinished(BugReport,QObject *); |
125 | void bugFetchError(QString, QObject *); |
126 | |
127 | void reloadReport(); |
128 | |
129 | void relatedReportClicked(); |
130 | |
131 | void toggleShowOwnBacktrace(bool); |
132 | |
133 | Q_SIGNALS: |
134 | void possibleDuplicateSelected(int); |
135 | void attachToBugReportSelected(int); |
136 | |
137 | private: |
138 | Ui::AssistantPageBugzillaDuplicatesDialog ui; |
139 | bool m_relatedButtonEnabled; |
140 | BugzillaDuplicatesPage * m_parent; |
141 | |
142 | int m_bugNumber; |
143 | QString m_closedStateString; |
144 | int m_duplicatesCount; |
145 | }; |
146 | |
147 | class BugzillaReportConfirmationDialog : public KDialog |
148 | { |
149 | Q_OBJECT |
150 | |
151 | public: |
152 | BugzillaReportConfirmationDialog(int bugNumber, bool commonCrash, QString closedState, |
153 | BugzillaReportInformationDialog * parent); |
154 | ~BugzillaReportConfirmationDialog(); |
155 | |
156 | private Q_SLOTS: |
157 | void proceedClicked(); |
158 | |
159 | void checkProceed(); |
160 | |
161 | private: |
162 | Ui::ConfirmationDialog ui; |
163 | |
164 | BugzillaReportInformationDialog * m_parent; |
165 | |
166 | bool m_showProceedQuestion; |
167 | |
168 | int m_bugNumber; |
169 | }; |
170 | #endif |
171 | |