1/*******************************************************************
2* reportinterface.h
3* Copyright 2009, 2011 Dario Andres Rodriguez <andresbajotierra@gmail.com>
4* Copyright 2009 George Kiagiadakis <gkiagia@users.sourceforge.net>
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#ifndef REPORTINTERFACE__H
22#define REPORTINTERFACE__H
23
24#include <QtCore/QObject>
25#include <QtCore/QStringList>
26
27class BugReport;
28
29class BugzillaManager;
30class ProductMapping;
31class ApplicationDetailsExamples;
32
33class ReportInterface : public QObject
34{
35 Q_OBJECT
36public:
37 enum Reproducible { ReproducibleUnsure, ReproducibleNever,
38 ReproducibleSometimes, ReproducibleEverytime };
39
40 explicit ReportInterface(QObject *parent = 0);
41
42 void setBugAwarenessPageData(bool, Reproducible, bool, bool, bool);
43 bool isBugAwarenessPageDataUseful() const;
44
45 int selectedOptionsRating() const;
46
47 QStringList firstBacktraceFunctions() const;
48 void setFirstBacktraceFunctions(const QStringList & functions);
49
50 QString backtrace() const;
51 void setBacktrace(const QString & backtrace);
52
53 QString title() const;
54 void setTitle(const QString & text);
55
56 void setDetailText(const QString & text);
57 void setPossibleDuplicates(const QStringList & duplicatesList);
58
59 QString generateReportFullText(bool drKonqiStamp) const;
60
61 BugReport newBugReportTemplate() const;
62 void sendBugReport() const;
63
64 QStringList relatedBugzillaProducts() const;
65
66 bool isWorthReporting() const;
67
68 //Zero means creating a new bug report
69 void setAttachToBugNumber(uint);
70 uint attachToBugNumber() const;
71
72 //Zero means there is no duplicate
73 void setDuplicateId(uint);
74 uint duplicateId() const;
75
76 void setPossibleDuplicatesByQuery(const QStringList &);
77
78 BugzillaManager * bugzillaManager() const;
79 ApplicationDetailsExamples * appDetailsExamples() const;
80
81 bool userCanProvideActionsAppDesktop() const {
82 return m_provideActionsApplicationDesktop;
83 }
84
85 bool userCanProvideUnusualBehavior() const {
86 return m_provideUnusualBehavior;
87 }
88
89 bool userCanProvideApplicationConfigDetails() const {
90 return m_provideApplicationConfigurationDetails;
91 }
92
93private Q_SLOTS:
94 void sendUsingDefaultProduct() const;
95 void addedToCC();
96 void attachSent(int);
97
98Q_SIGNALS:
99 void reportSent(int);
100 void sendReportError(const QString &, const QString &);
101
102private:
103 QString generateAttachmentComment() const;
104
105 //Information the user can provide
106 bool m_userRememberCrashSituation;
107 Reproducible m_reproducible;
108 bool m_provideActionsApplicationDesktop;
109 bool m_provideUnusualBehavior;
110 bool m_provideApplicationConfigurationDetails;
111
112
113 QString m_backtrace;
114 QStringList m_firstBacktraceFunctions;
115
116 QString m_reportTitle;
117 QString m_reportDetailText;
118 QStringList m_possibleDuplicates;
119
120 QStringList m_allPossibleDuplicatesByQuery;
121
122 uint m_attachToBugNumber;
123 uint m_duplicate;
124
125 ProductMapping * m_productMapping;
126 BugzillaManager * m_bugzillaManager;
127 ApplicationDetailsExamples * m_appDetailsExamples;
128};
129
130#endif
131