mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
that should do it for now for bug reports
This commit is contained in:
parent
116348751b
commit
000b13db27
7 changed files with 35 additions and 294 deletions
|
@ -31,7 +31,6 @@ set(drkonqi_SRCS
|
|||
debugger.cpp
|
||||
debuggerlaunchers.cpp
|
||||
debuggermanager.cpp
|
||||
applicationdetailsexamples.cpp
|
||||
gdbhighlighter.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -37,10 +37,9 @@
|
|||
#include "debuggermanager.h"
|
||||
#include "debuggerlaunchers.h"
|
||||
#include "drkonqi_globals.h"
|
||||
#include "systeminformation.h"
|
||||
|
||||
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) :
|
||||
KDialog(parent),
|
||||
|
@ -56,8 +55,6 @@ DrKonqiDialog::DrKonqiDialog(QWidget * parent) :
|
|||
m_tabWidget = new KTabWidget(this);
|
||||
setMainWidget(m_tabWidget);
|
||||
|
||||
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int)));
|
||||
|
||||
buildIntroWidget();
|
||||
m_tabWidget->addTab(m_introWidget, i18nc("@title:tab general information", "&General"));
|
||||
|
||||
|
@ -71,6 +68,8 @@ DrKonqiDialog::DrKonqiDialog(QWidget * parent) :
|
|||
resize(minimumSize());
|
||||
KConfigGroup config(KGlobal::config(), "General");
|
||||
restoreDialogSize(config);
|
||||
|
||||
m_backtraceWidget->generateBacktrace();
|
||||
}
|
||||
|
||||
DrKonqiDialog::~DrKonqiDialog()
|
||||
|
@ -81,13 +80,6 @@ DrKonqiDialog::~DrKonqiDialog()
|
|||
KGlobal::deref();
|
||||
}
|
||||
|
||||
void DrKonqiDialog::tabIndexChanged(int index)
|
||||
{
|
||||
if (index == m_tabWidget->indexOf(m_backtraceWidget)) {
|
||||
m_backtraceWidget->generateBacktrace();
|
||||
}
|
||||
}
|
||||
|
||||
void DrKonqiDialog::buildIntroWidget()
|
||||
{
|
||||
const CrashedApplication *crashedApp = DrKonqi::crashedApplication();
|
||||
|
@ -108,7 +100,7 @@ void DrKonqiDialog::buildIntroWidget()
|
|||
"to the KDE bug tracking system. Do not forget to include "
|
||||
"the backtrace from the <interface>Developer Information</interface> "
|
||||
"tab.</para>",
|
||||
QLatin1String(DRKONQI_REPORT_BUG_URL));
|
||||
QLatin1String(BUG_REPORT_URL));
|
||||
} else if (KCmdLineArgs::parsedArgs()->isSet("safer")) {
|
||||
reportMessage = i18nc("@info", "<para>The reporting assistant is disabled because "
|
||||
"the crash handler dialog was started in safe mode."
|
||||
|
@ -243,11 +235,27 @@ void DrKonqiDialog::enableDebugMenu(bool debuggerRunning)
|
|||
|
||||
void DrKonqiDialog::startBugReportAssistant()
|
||||
{
|
||||
BacktraceGenerator *btGenerator = DrKonqi::debuggerManager()->backtraceGenerator();
|
||||
QString query = QString(BUG_REPORT_URL) + "/new?title=&body=";
|
||||
query += btGenerator->backtrace();
|
||||
const CrashedApplication *crashedApp = DrKonqi::crashedApplication();
|
||||
BugReportAddress appReportAddress = crashedApp->bugReportAddress();
|
||||
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)
|
||||
|
|
|
@ -54,8 +54,6 @@ private Q_SLOTS:
|
|||
void buildIntroWidget();
|
||||
void buildDialogButtons();
|
||||
|
||||
void tabIndexChanged(int);
|
||||
|
||||
private:
|
||||
KTabWidget * m_tabWidget;
|
||||
|
||||
|
|
|
@ -35,19 +35,12 @@
|
|||
#include <KConfigGroup>
|
||||
#include <kdeversion.h>
|
||||
|
||||
static const QString OS_UNSPECIFIED = "unspecified";
|
||||
static const QString PLATFORM_UNSPECIFIED = "unspecified";
|
||||
|
||||
SystemInformation::SystemInformation(QObject * parent)
|
||||
: QObject(parent)
|
||||
, m_bugzillaOperatingSystem(OS_UNSPECIFIED)
|
||||
, m_bugzillaPlatform(PLATFORM_UNSPECIFIED)
|
||||
{
|
||||
// NOTE: the relative order is important here
|
||||
m_bugzillaOperatingSystem = fetchOSBasicInformation();
|
||||
m_operatingSystem = fetchOSDetailInformation();
|
||||
|
||||
tryToSetBugzillaPlatform();
|
||||
m_system = fetchOSDetailInformation();
|
||||
m_release = fetchOSReleaseInformation();
|
||||
|
||||
KConfigGroup config(KGlobal::config(), "SystemInformation");
|
||||
m_compiledSources = config.readEntry("CompiledSources", false);
|
||||
|
@ -60,116 +53,6 @@ SystemInformation::~SystemInformation()
|
|||
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.
|
||||
//if the values change on the server side, they need to be updated here as well.
|
||||
QString SystemInformation::fetchOSBasicInformation() const
|
||||
|
@ -206,9 +89,7 @@ QString SystemInformation::fetchOSBasicInformation() const
|
|||
|
||||
QString SystemInformation::fetchOSDetailInformation() const
|
||||
{
|
||||
//Get complete OS string (and fallback to base string)
|
||||
QString operatingSystem = m_bugzillaOperatingSystem;
|
||||
|
||||
QString operatingSystem = "unspecified";
|
||||
#ifdef HAVE_UNAME
|
||||
struct utsname buf;
|
||||
if (uname(&buf) == -1) {
|
||||
|
@ -252,29 +133,14 @@ QString SystemInformation::fetchOSReleaseInformation() const
|
|||
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;
|
||||
}
|
||||
|
||||
QString SystemInformation::bugzillaPlatform() const
|
||||
{
|
||||
return m_bugzillaPlatform;
|
||||
}
|
||||
|
||||
void SystemInformation::setBugzillaPlatform(const QString & platform)
|
||||
{
|
||||
m_bugzillaPlatform = platform;
|
||||
}
|
||||
|
||||
QString SystemInformation::lsbRelease() const
|
||||
{
|
||||
return m_lsbRelease;
|
||||
return m_release;
|
||||
}
|
||||
|
||||
bool SystemInformation::compiledSources() const
|
||||
|
|
|
@ -29,13 +29,8 @@ class SystemInformation: public QObject
|
|||
explicit SystemInformation(QObject * parent = 0);
|
||||
~SystemInformation();
|
||||
|
||||
QString bugzillaPlatform() const;
|
||||
void setBugzillaPlatform(const QString &);
|
||||
|
||||
QString operatingSystem() const;
|
||||
QString bugzillaOperatingSystem() const;
|
||||
|
||||
QString lsbRelease() const;
|
||||
QString system() const;
|
||||
QString release() const;
|
||||
|
||||
bool compiledSources() const;
|
||||
void setCompiledSources(bool);
|
||||
|
@ -43,24 +38,13 @@ class SystemInformation: public QObject
|
|||
QString kdeVersion() const;
|
||||
QString qtVersion() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void lsbReleaseFinished();
|
||||
|
||||
private:
|
||||
QString fetchOSBasicInformation() const;
|
||||
QString fetchOSDetailInformation() const;
|
||||
QString fetchOSReleaseInformation() const;
|
||||
|
||||
QString guessBugzillaPlatform(const QString&) const;
|
||||
|
||||
void tryToSetBugzillaPlatform();
|
||||
void tryToSetBugzillaPlatformFromExternalInfo();
|
||||
|
||||
QString m_operatingSystem;
|
||||
QString m_bugzillaOperatingSystem;
|
||||
QString m_bugzillaPlatform;
|
||||
|
||||
QString m_lsbRelease;
|
||||
QString m_system;
|
||||
QString m_release;
|
||||
|
||||
bool m_compiledSources;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue