1/*******************************************************************
2* aboutbugreportingdialog.cpp
3* Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
4* Copyright 2009 A. L. Spehr <spehr@kde.org>
5*
6* This program is free software; you can redistribute it and/or
7* modify it under the terms of the GNU General Public License as
8* published by the Free Software Foundation; either version 2 of
9* the License, or (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program. If not, see <http://www.gnu.org/licenses/>.
18*
19******************************************************************/
20
21#include "aboutbugreportingdialog.h"
22
23#include <KLocalizedString>
24#include <KGlobal>
25#include <KConfig>
26#include <KIcon>
27#include <KToolInvocation>
28#include <KTextBrowser>
29
30#include "drkonqi_globals.h"
31
32AboutBugReportingDialog::AboutBugReportingDialog(QWidget * parent):
33 KDialog(parent)
34{
35 setAttribute(Qt::WA_DeleteOnClose, true);
36
37 setWindowIcon(KIcon("help-hint"));
38 setCaption(i18nc("@title title of the dialog", "About Bug Reporting - Help"));
39
40 setButtons(KDialog::Close);
41 setDefaultButton(KDialog::Close);
42
43 m_textBrowser = new KTextBrowser(this);
44 m_textBrowser->setMinimumSize(QSize(600, 300));
45 m_textBrowser->setNotifyClick(true);
46 connect(m_textBrowser, SIGNAL(urlClick(QString)), this, SLOT(handleInternalLinks(QString)));
47
48 QString text =
49
50 //Introduction
51 QString("<a name=\"%1\" /><h1>%2</h1>").arg(QLatin1String(PAGE_HELP_BEGIN_ID),
52 i18nc("@title","Information about bug reporting")) +
53 QString("<p>%1</p><p>%2</p><p>%3</p>").arg(
54 i18nc("@info/rich", "You can help us improve this software by filing a bug report."),
55 i18nc("@info/rich","<note>It is safe to close this dialog. If you do not "
56 "want to, you do not have to file a bug report.</note>"),
57 i18nc("@info/rich","In order to generate a useful bug report we need some "
58 "information about both the crash and your system. (You may also "
59 "need to install some debug packages.)")) +
60
61 //Sub-introduction
62 QString("<h1>%1</h1>").arg(i18nc("@title","Bug Reporting Assistant Guide")) +
63 QString("<p>%1</p>").arg(
64 i18nc("@info/rich","This assistant will guide you through the crash "
65 "reporting process for the KDE bug tracking system. All the "
66 "information you enter on the bug report <strong>must be written "
67 "in English</strong>, if possible, as KDE is formed internationally.")) +
68
69 //Bug Awareness Page
70 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_AWARENESS_ID),
71 i18nc("@title","What do you know about the crash?")) +
72 QString("<p>%1</p><p>%2<ul><li>%3</li><li>%4</li><li>%5</li><li>%6</li><li>%7</li><li>%8</li>"
73 "</ul>%9</p>").arg(
74 i18nc("@info/rich","In this page you need to describe how much do you know about "
75 "the desktop and the application state before it crashed."),
76 i18nc("@info/rich","If you can, describe in as much detail as possible the crash "
77 "circumstances, and what you were doing when the application crashed "
78 "(this information is going to be requested later.) You can mention: "),
79 i18nc("@info/rich crash situation example","actions you were taking inside or outside "
80 "the application"),
81 i18nc("@info/rich crash situation example","documents or images that you were using "
82 "and their type/format (later if you go to look at the report in the "
83 "bug tracking system, you can attach a file to the report)"),
84 i18nc("@info/rich crash situation example","widgets that you were running"),
85 i18nc("@info/rich crash situation example","the URL of a web site you were browsing"),
86 i18nc("@info/rich crash situation example","configuration details of the application"),
87 i18nc("@info/rich crash situation example","or other strange things you notice before "
88 "or after the crash. "),
89 i18nc("@info/rich","Screenshots can be very helpful sometimes. You can attach them to "
90 "the bug report after it is posted to the bug tracking system.")) +
91
92 //Crash Information Page
93 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_CRASHINFORMATION_ID),
94 i18nc("@title","Crash Information (backtrace)")) +
95 QString("<p>%1</p><p>%2</p><p>%3</p><p>%4</p>").arg(
96 i18nc("@info/rich","This page will generate a \"backtrace\" of the crash. This "
97 "is information that tells the developers where the application "
98 "crashed."),
99 i18nc("@info/rich", "If the crash information is not detailed enough, you may "
100 "need to install some debug packages and reload it (if the "
101 "<interface>Install Debug Symbols</interface> button is available you "
102 "can use it to automatically install the missing information.)"),
103 i18nc("@info/rich", "You can find more information about backtraces, what they mean, "
104 "and how they are useful at <link>%1</link>",QString(TECHBASE_HOWTO_DOC) ),
105 i18nc("@info/rich","Once you get a useful backtrace (or if you do not want to "
106 "install the missing debugging packages) you can continue.")) +
107
108 //Conclusions Page
109 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_CONCLUSIONS_ID),
110 i18nc("@title","Conclusions")) +
111 QString("<p>%1</p><p>%2</p><p>%3</p>").arg(
112 i18nc("@info/rich","Using the quality of the crash information gathered, "
113 "and your answers on the previous page, the assistant will "
114 "tell you if the crash is worth reporting or not."),
115 i18nc("@info/rich","If the crash is worth reporting but the application "
116 "is not supported in the KDE bug tracking system, you "
117 "will need to directly contact the maintainer of the application."),
118 i18nc("@info/rich","If the crash is listed as being not worth reporting, "
119 "and you think the assistant has made a mistake, "
120 "you can still manually report the bug by logging into the "
121 "bug tracking system. You can also go back and change information "
122 "and download debug packages.")) +
123
124 //Bugzilla Login Page
125 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_BZLOGIN_ID),
126 i18nc("@title","Login into the bug tracking system")) +
127 QString("<p>%1</p><p>%2</p><p>%3</p>").arg(
128 i18nc("@info/rich","We may need to contact you in the future to ask for "
129 "further information. As we need to keep track of the bug reports, "
130 "you "
131 "need to have an account on the KDE bug tracking system. If you do "
132 "not have one, you can create one here: <link>%1</link>",
133 QString(KDE_BUGZILLA_CREATE_ACCOUNT_URL)),
134 i18nc("@info/rich","Then, enter your username and password and "
135 "press the Login button. You can use this login to directly access the "
136 "KDE bug tracking system later."),
137 i18nc("@info/rich","The KWallet dialog may appear when pressing Login to "
138 "save your password in the KWallet password system. Also, it will "
139 "prompt you for the KWallet password upon loading to autocomplete "
140 "the login fields if you use this assistant again.")) +
141
142 //Bugzilla Duplicates Page
143 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_BZDUPLICATES_ID),
144 i18nc("@title","List of possible duplicate reports")) +
145 QString("<p>%1</p><p>%2</p><p>%3</p><p>%4</p><p><strong>%5</strong></p>").arg(
146 //needs some more string cleanup below
147 i18nc("@info/rich","This page will search the bug report system for "
148 "similar crashes which are possible duplicates of your bug. If "
149 "there are similar bug reports found, you can double click on them "
150 "to see details. Then, read the current bug report information so "
151 "you can check to see if they are similar. "),
152 i18nc("@info/rich","If you are very sure your bug is the same as another that is "
153 "previously reported, you can set your information to be attached to "
154 "the existing report."),
155 i18nc("@info/rich","If you are unsure whether your report is the same, follow the main "
156 "options to tentatively mark your crash as a duplicate of that "
157 "report. This is usually the safest thing to do. We cannot "
158 "uncombine bug reports, but we can easily merge them."),
159 i18nc("@info/rich","If not enough possible duplicates are found, or you "
160 "did not find a similar report, then you can force it to search "
161 "for more bug reports (only if the date range limit is not reached.)"),
162 i18nc("@info/rich","If you do not find any related reports, your crash information "
163 "is not useful enough, and you really cannot give additional "
164 "information about the crash context, then it is better to "
165 "not file the bug report, thereby closing the assistant.")) +
166
167 //Bugzilla Crash Information - Details Page
168 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_BZDETAILS_ID),
169 i18nc("@title","Details of the bug report and your system")) +
170 QString("<p>%1<a href=\"#%2\">%3</a></p><p>%4</p><p>%5</p>").arg(
171 i18nc("@info/rich","In this case you need to write a title and description "
172 "of the crash. Explain as best you can. "),
173 QLatin1String(PAGE_AWARENESS_ID),
174 i18nc("@title","What do you know about the crash?"),
175 i18nc("@info/rich", "You can also specify your distribution method (GNU/Linux "
176 "distribution or packaging system) or if you compiled the KDE "
177 "Platform from sources."),
178 i18nc("@info/rich", "<note>You should <strong>write those information in English</strong>.</note>")) +
179
180 //Bugzilla Send Page
181 QString("<a name=\"%1\" /><h2>%2</h2>").arg(QLatin1String(PAGE_BZSEND_ID),
182 i18nc("@title","Sending the Crash Report")) +
183 QString("<p>%1</p><p>%2</p>").arg(
184 i18nc("@info/rich","The last page will send the bug report to the bug tracking "
185 "system and will notify you when it is done. It will then show "
186 "the web address of the bug report in the KDE bug tracking system, "
187 "so that you can look at the report later."),
188 i18nc("@info/rich","If the process fails, you can click "
189 "<interface>Retry</interface> to try sending the bug report again. "
190 "If the report cannot be sent because the bug tracking system has a "
191 "problem, you can save it to a file to manually report later.")) +
192
193 QString("<h1>%1</h1><p>%2</p>").arg(
194 i18nc("@info/rich", "Thank you for being part of KDE!"),
195 i18nc("@info/rich", "If you are interested in helping us to keep the KDE bug tracker system "
196 "clean and useful, which allows the developers to be more focused on "
197 "fixing the real issues, you are welcome to "
198 "<link url='http://techbase.kde.org/Contribute/Bugsquad'>join the BugSquad team</link>."));
199
200 m_textBrowser->setText(text);
201
202 setMainWidget(m_textBrowser);
203
204 KConfigGroup config(KGlobal::config(), "AboutBugReportingDialog");
205 restoreDialogSize(config);
206}
207
208AboutBugReportingDialog::~AboutBugReportingDialog( )
209{
210 KConfigGroup config(KGlobal::config(), "AboutBugReportingDialog");
211 saveDialogSize(config);
212}
213
214void AboutBugReportingDialog::handleInternalLinks(const QString& url)
215{
216 if (!url.isEmpty()) {
217 if (url.startsWith('#')) {
218 showSection(url.mid(1,url.length()));
219 } else {
220 KToolInvocation::invokeBrowser(url);
221 }
222 }
223}
224
225void AboutBugReportingDialog::showSection(const QString& anchor)
226{
227 m_textBrowser->scrollToAnchor(anchor);
228}
229
230