File indexing completed on 2024-07-14 14:38:37

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KBUGREPORT_H
0009 #define KBUGREPORT_H
0010 
0011 #include <QDialog>
0012 #include <kxmlgui_export.h>
0013 #include <memory>
0014 
0015 class KAboutData;
0016 class KBugReportPrivate;
0017 
0018 /**
0019  * @class KBugReport kbugreport.h KBugReport
0020  *
0021  * @short A dialog box for sending bug reports.
0022  *
0023  * All the information needed by the dialog box
0024  * (program name, version, bug-report address, etc.)
0025  * comes from the KAboutData class.
0026  * Make sure you create an instance of KAboutData and call
0027  * KAboutData::setApplicationData(<aboutData>).
0028  *
0029  * \image html kbugreport.png "KBugReport"
0030  *
0031  * @author David Faure <faure@kde.org>
0032  */
0033 class KXMLGUI_EXPORT KBugReport : public QDialog
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     /**
0039      * Creates a bug-report dialog.
0040      * Note that you shouldn't have to do this manually,
0041      * since KHelpMenu takes care of the menu item
0042      * for "Report Bug..." and of creating a KBugReport dialog.
0043      */
0044     explicit KBugReport(const KAboutData &aboutData, QWidget *parent = nullptr);
0045 
0046     /**
0047      * Destructor
0048      */
0049     ~KBugReport() override;
0050 
0051     /**
0052      * The message body of the bug report
0053      * @return The message body of the bug report.
0054      */
0055     QString messageBody() const;
0056 
0057     /**
0058      * Sets the message body of the bug report.
0059      */
0060     void setMessageBody(const QString &messageBody);
0061 
0062     /**
0063      * OK has been clicked
0064      */
0065     void accept() override;
0066 
0067 protected:
0068     /**
0069      * A complete copy of the bug report
0070      * @return QString copy of the bug report.
0071      */
0072     QString text() const;
0073 
0074     /**
0075      * Attempt to e-mail the bug report.
0076      * @return true on success
0077      */
0078     bool sendBugReport();
0079 
0080     void closeEvent(QCloseEvent *e) override;
0081 
0082 private:
0083     friend class KBugReportPrivate;
0084     std::unique_ptr<KBugReportPrivate> const d;
0085 
0086     Q_DISABLE_COPY(KBugReport)
0087 };
0088 
0089 #endif