1 | /******************************************************************* |
2 | * reportassistantpages_bugzilla.h |
3 | * Copyright 2009, 2011 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__H |
21 | #define REPORTASSISTANTPAGES__BUGZILLA__H |
22 | |
23 | #include "reportassistantpage.h" |
24 | |
25 | #include "reportassistantpages_base.h" |
26 | |
27 | #include "ui_assistantpage_bugzilla_login.h" |
28 | #include "ui_assistantpage_bugzilla_information.h" |
29 | #include "ui_assistantpage_bugzilla_preview.h" |
30 | #include "ui_assistantpage_bugzilla_send.h" |
31 | |
32 | namespace KWallet { class Wallet; } |
33 | class KCapacityBar; |
34 | |
35 | /** Bugzilla login **/ |
36 | class BugzillaLoginPage: public ReportAssistantPage |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | explicit BugzillaLoginPage(ReportAssistantDialog *); |
42 | ~BugzillaLoginPage(); |
43 | |
44 | void aboutToShow(); |
45 | bool isComplete(); |
46 | |
47 | private Q_SLOTS: |
48 | void loginClicked(); |
49 | void loginFinished(bool); |
50 | void loginError(const QString &, const QString &); |
51 | |
52 | void walletLogin(); |
53 | |
54 | void updateLoginButtonStatus(); |
55 | |
56 | Q_SIGNALS: |
57 | void loggedTurnToNextPage(); |
58 | |
59 | private: |
60 | bool kWalletEntryExists(const QString&); |
61 | void openWallet(); |
62 | bool canSetCookies(); |
63 | |
64 | Ui::AssistantPageBugzillaLogin ui; |
65 | |
66 | KWallet::Wallet * m_wallet; |
67 | bool m_walletWasOpenedBefore; |
68 | }; |
69 | |
70 | /** Title and details page **/ |
71 | class BugzillaInformationPage : public ReportAssistantPage |
72 | { |
73 | Q_OBJECT |
74 | |
75 | public: |
76 | explicit BugzillaInformationPage(ReportAssistantDialog *); |
77 | |
78 | void aboutToShow(); |
79 | void aboutToHide(); |
80 | |
81 | bool isComplete(); |
82 | bool showNextPage(); |
83 | |
84 | private Q_SLOTS: |
85 | void showTitleExamples(); |
86 | void showDescriptionHelpExamples(); |
87 | |
88 | void checkTexts(); |
89 | |
90 | private: |
91 | int currentDescriptionCharactersCount(); |
92 | |
93 | Ui::AssistantPageBugzillaInformation ui; |
94 | KCapacityBar * m_textCompleteBar; |
95 | |
96 | bool m_textsOK; |
97 | bool m_distributionComboSetup; |
98 | bool m_distroComboVisible; |
99 | |
100 | int m_requiredCharacters; |
101 | }; |
102 | |
103 | /** Preview report page **/ |
104 | class BugzillaPreviewPage : public ReportAssistantPage |
105 | { |
106 | Q_OBJECT |
107 | |
108 | public: |
109 | explicit BugzillaPreviewPage(ReportAssistantDialog *); |
110 | |
111 | void aboutToShow(); |
112 | |
113 | private: |
114 | Ui::AssistantPageBugzillaPreview ui; |
115 | }; |
116 | |
117 | /** Send crash report page **/ |
118 | class BugzillaSendPage : public ReportAssistantPage |
119 | { |
120 | Q_OBJECT |
121 | |
122 | public: |
123 | explicit BugzillaSendPage(ReportAssistantDialog *); |
124 | |
125 | void aboutToShow(); |
126 | |
127 | private Q_SLOTS: |
128 | void sent(int); |
129 | void sendError(const QString &, const QString &); |
130 | |
131 | void retryClicked(); |
132 | void finishClicked(); |
133 | |
134 | void openReportContents(); |
135 | |
136 | private: |
137 | Ui::AssistantPageBugzillaSend ui; |
138 | QString reportUrl; |
139 | |
140 | QPointer<KDialog> m_contentsDialog; |
141 | |
142 | Q_SIGNALS: |
143 | void finished(bool); |
144 | |
145 | }; |
146 | |
147 | class UnhandledErrorDialog: public KDialog |
148 | { |
149 | Q_OBJECT |
150 | |
151 | public: |
152 | UnhandledErrorDialog(QWidget * parent, const QString &, const QString &); |
153 | |
154 | private Q_SLOTS: |
155 | void saveErrorMessage(); |
156 | |
157 | private: |
158 | QString m_extendedHTMLError; |
159 | }; |
160 | |
161 | #endif |
162 | |