that should do it for now for bug reports

This commit is contained in:
Ivailo Monev 2014-12-02 15:58:23 +00:00
parent 116348751b
commit 000b13db27
7 changed files with 35 additions and 294 deletions

View file

@ -31,7 +31,6 @@ set(drkonqi_SRCS
debugger.cpp debugger.cpp
debuggerlaunchers.cpp debuggerlaunchers.cpp
debuggermanager.cpp debuggermanager.cpp
applicationdetailsexamples.cpp
gdbhighlighter.cpp gdbhighlighter.cpp
) )

View file

@ -1,76 +0,0 @@
/*******************************************************************
* applicationdetailsexamples.cpp
* Copyright 2010 Dario Andres Rodriguez <andresbajotierra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************/
#include "applicationdetailsexamples.h"
#include <KLocalizedString>
#include "drkonqi.h"
#include "crashedapplication.h"
ApplicationDetailsExamples::ApplicationDetailsExamples(QObject * parent)
: QObject(parent)
{
QString binaryName = DrKonqi::crashedApplication()->fakeExecutableBaseName();
if (binaryName == QLatin1String("plasma-desktop")) {
m_examples = i18nc("@info examples about information the user can provide",
"Widgets you have in your desktop and panels (both official and unofficial), "
"desktop settings (wallpaper plugin, themes), activities, and dashboard configuration.");
} else if (binaryName == QLatin1String("kwin")) {
m_examples = i18nc("@info examples about information the user can provide",
"State of Desktop Effects (Compositing), kind of effects enabled, window decoration, "
"and specific window rules and configuration.");
} else if (binaryName == QLatin1String("konqueror") ||
binaryName == QLatin1String("rekonq")) {
m_examples = i18nc("@info examples about information the user can provide",
"sites you were visiting, number of opened tabs, plugins you have installed, "
"and any other non-default setting.");
} else if (binaryName == QLatin1String("dolphin")) {
m_examples = i18nc("@info examples about information the user can provide",
"File view mode, grouping and sorting settings, preview settings, and directory you were browsing.");
} else if (binaryName == QLatin1String("kopete")) {
m_examples = i18nc("@info examples about information the user can provide",
"Instant Messaging protocols you use, and plugins you have installed (official and unofficial).");
} else if (binaryName == QLatin1String("kmail")) {
m_examples = i18nc("@info examples about information the user can provide",
"Mail protocols and account-types you use.");
} else if (binaryName == QLatin1String("kwrite") ||
binaryName == QLatin1String("kate") ||
binaryName == QLatin1String("kword")) {
m_examples = i18nc("@info examples about information the user can provide",
"Type of the document you were editing.");
} else if (binaryName == QLatin1String("juk") ||
binaryName == QLatin1String("amarok") ||
binaryName == QLatin1String("dragon") ||
binaryName == QLatin1String("kaffeine")) {
m_examples = i18nc("@info examples about information the user can provide",
"Type of media (extension and format) you were watching and/or listening to.");
}
}
bool ApplicationDetailsExamples::hasExamples() const
{
return !m_examples.isEmpty();
}
QString ApplicationDetailsExamples::examples() const
{
return m_examples;
}

View file

@ -1,38 +0,0 @@
/*******************************************************************
* applicationdetailsexamples.h
* Copyright 2010 Dario Andres Rodriguez <andresbajotierra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************/
#ifndef APPLICATIONDETAILSEXAMPLES__H
#define APPLICATIONDETAILSEXAMPLES__H
#include <QtCore/QObject>
#include <QtCore/QString>
class ApplicationDetailsExamples : QObject
{
Q_OBJECT
public:
explicit ApplicationDetailsExamples(QObject * parent);
bool hasExamples() const;
QString examples() const;
private:
QString m_examples;
};
#endif

View file

@ -37,10 +37,9 @@
#include "debuggermanager.h" #include "debuggermanager.h"
#include "debuggerlaunchers.h" #include "debuggerlaunchers.h"
#include "drkonqi_globals.h" #include "drkonqi_globals.h"
#include "systeminformation.h"
static const char ABOUT_BUG_REPORTING_URL[] = "#aboutbugreporting"; static const char ABOUT_BUG_REPORTING_URL[] = "#aboutbugreporting";
static const char DRKONQI_REPORT_BUG_URL[] =
KDE_BUGZILLA_URL "enter_bug.cgi?product=drkonqi&format=guided";
DrKonqiDialog::DrKonqiDialog(QWidget * parent) : DrKonqiDialog::DrKonqiDialog(QWidget * parent) :
KDialog(parent), KDialog(parent),
@ -56,8 +55,6 @@ DrKonqiDialog::DrKonqiDialog(QWidget * parent) :
m_tabWidget = new KTabWidget(this); m_tabWidget = new KTabWidget(this);
setMainWidget(m_tabWidget); setMainWidget(m_tabWidget);
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int)));
buildIntroWidget(); buildIntroWidget();
m_tabWidget->addTab(m_introWidget, i18nc("@title:tab general information", "&General")); m_tabWidget->addTab(m_introWidget, i18nc("@title:tab general information", "&General"));
@ -71,6 +68,8 @@ DrKonqiDialog::DrKonqiDialog(QWidget * parent) :
resize(minimumSize()); resize(minimumSize());
KConfigGroup config(KGlobal::config(), "General"); KConfigGroup config(KGlobal::config(), "General");
restoreDialogSize(config); restoreDialogSize(config);
m_backtraceWidget->generateBacktrace();
} }
DrKonqiDialog::~DrKonqiDialog() DrKonqiDialog::~DrKonqiDialog()
@ -81,13 +80,6 @@ DrKonqiDialog::~DrKonqiDialog()
KGlobal::deref(); KGlobal::deref();
} }
void DrKonqiDialog::tabIndexChanged(int index)
{
if (index == m_tabWidget->indexOf(m_backtraceWidget)) {
m_backtraceWidget->generateBacktrace();
}
}
void DrKonqiDialog::buildIntroWidget() void DrKonqiDialog::buildIntroWidget()
{ {
const CrashedApplication *crashedApp = DrKonqi::crashedApplication(); const CrashedApplication *crashedApp = DrKonqi::crashedApplication();
@ -108,7 +100,7 @@ void DrKonqiDialog::buildIntroWidget()
"to the KDE bug tracking system. Do not forget to include " "to the KDE bug tracking system. Do not forget to include "
"the backtrace from the <interface>Developer Information</interface> " "the backtrace from the <interface>Developer Information</interface> "
"tab.</para>", "tab.</para>",
QLatin1String(DRKONQI_REPORT_BUG_URL)); QLatin1String(BUG_REPORT_URL));
} else if (KCmdLineArgs::parsedArgs()->isSet("safer")) { } else if (KCmdLineArgs::parsedArgs()->isSet("safer")) {
reportMessage = i18nc("@info", "<para>The reporting assistant is disabled because " reportMessage = i18nc("@info", "<para>The reporting assistant is disabled because "
"the crash handler dialog was started in safe mode." "the crash handler dialog was started in safe mode."
@ -243,11 +235,27 @@ void DrKonqiDialog::enableDebugMenu(bool debuggerRunning)
void DrKonqiDialog::startBugReportAssistant() void DrKonqiDialog::startBugReportAssistant()
{ {
BacktraceGenerator *btGenerator = DrKonqi::debuggerManager()->backtraceGenerator(); const CrashedApplication *crashedApp = DrKonqi::crashedApplication();
QString query = QString(BUG_REPORT_URL) + "/new?title=&body="; BugReportAddress appReportAddress = crashedApp->bugReportAddress();
query += btGenerator->backtrace(); SystemInformation *sysinfo = new SystemInformation(this);
QString query;
// KDE applications use the email address by default
if (appReportAddress == BUG_REPORT_EMAIL) {
query += QString(BUG_REPORT_URL) + "/new";
query += "?title=" + crashedApp->name();
query += " " + crashedApp->version();
query += " " + crashedApp->signalName();
query += "&body=********** Platform **********";
query += "\nOS: " + sysinfo->system();
query += "\nRelease: " + sysinfo->release();
query += "\nKDE: " + sysinfo->kdeVersion();
query += "\nQt: " + sysinfo->qtVersion();
query += "\n********** Report **********\n";
} else {
query += QString(appReportAddress);
}
KToolInvocation::invokeBrowser(KUrl(query).url()); KToolInvocation::invokeBrowser(query);
} }
void DrKonqiDialog::applicationRestarted(bool success) void DrKonqiDialog::applicationRestarted(bool success)

View file

@ -54,8 +54,6 @@ private Q_SLOTS:
void buildIntroWidget(); void buildIntroWidget();
void buildDialogButtons(); void buildDialogButtons();
void tabIndexChanged(int);
private: private:
KTabWidget * m_tabWidget; KTabWidget * m_tabWidget;

View file

@ -35,19 +35,12 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <kdeversion.h> #include <kdeversion.h>
static const QString OS_UNSPECIFIED = "unspecified";
static const QString PLATFORM_UNSPECIFIED = "unspecified";
SystemInformation::SystemInformation(QObject * parent) SystemInformation::SystemInformation(QObject * parent)
: QObject(parent) : QObject(parent)
, m_bugzillaOperatingSystem(OS_UNSPECIFIED)
, m_bugzillaPlatform(PLATFORM_UNSPECIFIED)
{ {
// NOTE: the relative order is important here // NOTE: the relative order is important here
m_bugzillaOperatingSystem = fetchOSBasicInformation(); m_system = fetchOSDetailInformation();
m_operatingSystem = fetchOSDetailInformation(); m_release = fetchOSReleaseInformation();
tryToSetBugzillaPlatform();
KConfigGroup config(KGlobal::config(), "SystemInformation"); KConfigGroup config(KGlobal::config(), "SystemInformation");
m_compiledSources = config.readEntry("CompiledSources", false); m_compiledSources = config.readEntry("CompiledSources", false);
@ -60,116 +53,6 @@ SystemInformation::~SystemInformation()
config.sync(); config.sync();
} }
void SystemInformation::tryToSetBugzillaPlatform()
{
QString platform = PLATFORM_UNSPECIFIED;
// first, try to guess bugzilla platfrom from the internal OS information
// this should work for BSDs, solaris and windows.
platform = guessBugzillaPlatform(m_bugzillaOperatingSystem);
// if the internal information is not enough, refer to external information
if (platform == PLATFORM_UNSPECIFIED) {
tryToSetBugzillaPlatformFromExternalInfo();
} else {
setBugzillaPlatform(platform);
}
}
void SystemInformation::tryToSetBugzillaPlatformFromExternalInfo()
{
//Run lsb_release async
QString lsb_release = KStandardDirs::findExe(QLatin1String("lsb_release"));
if ( !lsb_release.isEmpty() ) {
kDebug() << "found lsb_release";
KProcess *process = new KProcess();
process->setOutputChannelMode(KProcess::OnlyStdoutChannel);
process->setEnv("LC_ALL", "C");
*process << lsb_release << "-sd";
connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(lsbReleaseFinished()));
process->start();
} else {
// when lsb_release is unavailable, turn to /etc/os-release
const QString& osReleaseInfo = fetchOSReleaseInformation();
const QString& platform = guessBugzillaPlatform(osReleaseInfo);
setBugzillaPlatform(platform);
}
}
void SystemInformation::lsbReleaseFinished()
{
KProcess *process = qobject_cast<KProcess*>(sender());
Q_ASSERT(process);
m_lsbRelease = QString::fromLocal8Bit(process->readAllStandardOutput().trimmed());
process->deleteLater();
//Guess distro string
QString platform = guessBugzillaPlatform(m_lsbRelease);
// if lsb_release doesn't work well, turn to the /etc/os-release file
if (platform == PLATFORM_UNSPECIFIED) {
const QString& osReleaseInfo = fetchOSReleaseInformation();
platform = guessBugzillaPlatform(osReleaseInfo);
}
setBugzillaPlatform(platform);
}
//this function maps the distribution information to an "Hardware Platform" .
//value that is accepted by bugs.kde.org. If the values change on the server .
//side, they need to be updated here as well .
QString SystemInformation::guessBugzillaPlatform(const QString& distroInfo) const
{
if ( distroInfo.contains("suse",Qt::CaseInsensitive) ) {
return (QLatin1String("openSUSE RPMs"));
} else if ( distroInfo.contains("mint",Qt::CaseInsensitive) ) {
return (QLatin1String("Mint (Ubuntu Based)"));
} else if ( distroInfo.contains("lmde",Qt::CaseInsensitive) ) {
return (QLatin1String("Mint (Debian Based)"));
} else if ( distroInfo.contains("ubuntu",Qt::CaseInsensitive) ) {
return (QLatin1String("Ubuntu Packages"));
} else if ( distroInfo.contains("fedora",Qt::CaseInsensitive) ) {
return (QLatin1String("Fedora RPMs"));
} else if ( distroInfo.contains("redhat",Qt::CaseInsensitive) ) {
return (QLatin1String("RedHat RPMs"));
} else if ( distroInfo.contains("gentoo",Qt::CaseInsensitive) ) {
return (QLatin1String("Gentoo Packages"));
} else if ( distroInfo.contains("mandriva",Qt::CaseInsensitive) ) {
return (QLatin1String("Mandriva RPMs"));
} else if ( distroInfo.contains("mageia",Qt::CaseInsensitive) ) {
return (QLatin1String("Mageia RPMs"));
} else if ( distroInfo.contains("slack",Qt::CaseInsensitive) ) {
return (QLatin1String("Slackware Packages"));
} else if ( distroInfo.contains("pclinuxos",Qt::CaseInsensitive) ) {
return (QLatin1String("PCLinuxOS"));
} else if ( distroInfo.contains("pardus",Qt::CaseInsensitive) ) {
return (QLatin1String("Pardus Packages"));
} else if ( distroInfo.contains("freebsd",Qt::CaseInsensitive) ) {
return (QLatin1String("FreeBSD Ports"));
} else if ( distroInfo.contains("netbsd",Qt::CaseInsensitive) ) {
return (QLatin1String("NetBSD pkgsrc"));
} else if ( distroInfo.contains("openbsd",Qt::CaseInsensitive) ) {
return (QLatin1String("OpenBSD Packages"));
} else if ( distroInfo.contains("solaris",Qt::CaseInsensitive) ) {
return (QLatin1String("Solaris Packages"));
} else if ( distroInfo.contains("chakra",Qt::CaseInsensitive) ) {
return (QLatin1String("Chakra"));
} else if ( distroInfo.contains("ms windows",Qt::CaseInsensitive) ) {
return (QLatin1String("MS Windows"));
} else if ( distroInfo.contains("arch",Qt::CaseInsensitive) ) {
return (QLatin1String("Archlinux Packages"));
} else if ( distroInfo.contains("debian",Qt::CaseInsensitive) ) {
if ( distroInfo.contains("unstable",Qt::CaseInsensitive) ) {
return (QLatin1String("Debian unstable"));
} else if ( distroInfo.contains("testing",Qt::CaseInsensitive) ) {
return (QLatin1String("Debian testing"));
} else {
return (QLatin1String("Debian stable"));
}
} else {
return PLATFORM_UNSPECIFIED;
}
}
//this function maps the operating system to an OS value that is accepted by bugs.kde.org. //this function maps the operating system to an OS value that is accepted by bugs.kde.org.
//if the values change on the server side, they need to be updated here as well. //if the values change on the server side, they need to be updated here as well.
QString SystemInformation::fetchOSBasicInformation() const QString SystemInformation::fetchOSBasicInformation() const
@ -206,9 +89,7 @@ QString SystemInformation::fetchOSBasicInformation() const
QString SystemInformation::fetchOSDetailInformation() const QString SystemInformation::fetchOSDetailInformation() const
{ {
//Get complete OS string (and fallback to base string) QString operatingSystem = "unspecified";
QString operatingSystem = m_bugzillaOperatingSystem;
#ifdef HAVE_UNAME #ifdef HAVE_UNAME
struct utsname buf; struct utsname buf;
if (uname(&buf) == -1) { if (uname(&buf) == -1) {
@ -252,29 +133,14 @@ QString SystemInformation::fetchOSReleaseInformation() const
return prettyName; return prettyName;
} }
QString SystemInformation::operatingSystem() const QString SystemInformation::system() const
{ {
return m_operatingSystem; return m_system;
} }
QString SystemInformation::bugzillaOperatingSystem() const QString SystemInformation::release() const
{ {
return m_bugzillaOperatingSystem; return m_release;
}
QString SystemInformation::bugzillaPlatform() const
{
return m_bugzillaPlatform;
}
void SystemInformation::setBugzillaPlatform(const QString & platform)
{
m_bugzillaPlatform = platform;
}
QString SystemInformation::lsbRelease() const
{
return m_lsbRelease;
} }
bool SystemInformation::compiledSources() const bool SystemInformation::compiledSources() const

View file

@ -29,13 +29,8 @@ class SystemInformation: public QObject
explicit SystemInformation(QObject * parent = 0); explicit SystemInformation(QObject * parent = 0);
~SystemInformation(); ~SystemInformation();
QString bugzillaPlatform() const; QString system() const;
void setBugzillaPlatform(const QString &); QString release() const;
QString operatingSystem() const;
QString bugzillaOperatingSystem() const;
QString lsbRelease() const;
bool compiledSources() const; bool compiledSources() const;
void setCompiledSources(bool); void setCompiledSources(bool);
@ -43,24 +38,13 @@ class SystemInformation: public QObject
QString kdeVersion() const; QString kdeVersion() const;
QString qtVersion() const; QString qtVersion() const;
private Q_SLOTS:
void lsbReleaseFinished();
private: private:
QString fetchOSBasicInformation() const; QString fetchOSBasicInformation() const;
QString fetchOSDetailInformation() const; QString fetchOSDetailInformation() const;
QString fetchOSReleaseInformation() const; QString fetchOSReleaseInformation() const;
QString guessBugzillaPlatform(const QString&) const; QString m_system;
QString m_release;
void tryToSetBugzillaPlatform();
void tryToSetBugzillaPlatformFromExternalInfo();
QString m_operatingSystem;
QString m_bugzillaOperatingSystem;
QString m_bugzillaPlatform;
QString m_lsbRelease;
bool m_compiledSources; bool m_compiledSources;
}; };