From 91abf9d3299162738451d6ada08bc82f8a4910bc Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 6 Oct 2022 23:18:13 +0300 Subject: [PATCH] drkonqi: open the crashed application bug report address as is Signed-off-by: Ivailo Monev --- drkonqi/CMakeLists.txt | 1 - drkonqi/drkonqi.cpp | 9 --- drkonqi/drkonqi.h | 3 - drkonqi/drkonqidialog.cpp | 23 +------ drkonqi/systeminformation.cpp | 113 ---------------------------------- drkonqi/systeminformation.h | 46 -------------- 6 files changed, 1 insertion(+), 194 deletions(-) delete mode 100644 drkonqi/systeminformation.cpp delete mode 100644 drkonqi/systeminformation.h diff --git a/drkonqi/CMakeLists.txt b/drkonqi/CMakeLists.txt index 7a5c7a52..d53e350a 100644 --- a/drkonqi/CMakeLists.txt +++ b/drkonqi/CMakeLists.txt @@ -21,7 +21,6 @@ set(drkonqi_SRCS drkonqi.cpp drkonqibackends.cpp detachedprocessmonitor.cpp - systeminformation.cpp crashedapplication.cpp debugger.cpp debuggerlaunchers.cpp diff --git a/drkonqi/drkonqi.cpp b/drkonqi/drkonqi.cpp index 60108e07..1628c793 100644 --- a/drkonqi/drkonqi.cpp +++ b/drkonqi/drkonqi.cpp @@ -54,19 +54,16 @@ #include #include -#include "systeminformation.h" #include "crashedapplication.h" #include "drkonqibackends.h" DrKonqi::DrKonqi() { m_backend = new KCrashBackend(); - m_systemInformation = new SystemInformation(); } DrKonqi::~DrKonqi() { - delete m_systemInformation; delete m_backend; } @@ -120,12 +117,6 @@ void DrKonqi::cleanup() delete instance(); } -//static -SystemInformation *DrKonqi::systemInformation() -{ - return instance()->m_systemInformation; -} - //static DebuggerManager* DrKonqi::debuggerManager() { diff --git a/drkonqi/drkonqi.h b/drkonqi/drkonqi.h index a0282bc6..736b7741 100644 --- a/drkonqi/drkonqi.h +++ b/drkonqi/drkonqi.h @@ -20,7 +20,6 @@ #include #include -class SystemInformation; class DebuggerManager; class CrashedApplication; class AbstractDrKonqiBackend; @@ -31,7 +30,6 @@ public: static bool init(); static void cleanup(); - static SystemInformation *systemInformation(); static DebuggerManager *debuggerManager(); static CrashedApplication *crashedApplication(); @@ -42,7 +40,6 @@ private: ~DrKonqi(); static DrKonqi *instance(); - SystemInformation *m_systemInformation; AbstractDrKonqiBackend *m_backend; }; diff --git a/drkonqi/drkonqidialog.cpp b/drkonqi/drkonqidialog.cpp index a8afb13c..2fa45c93 100644 --- a/drkonqi/drkonqidialog.cpp +++ b/drkonqi/drkonqidialog.cpp @@ -37,7 +37,6 @@ #include "debuggermanager.h" #include "debuggerlaunchers.h" #include "drkonqi_globals.h" -#include "systeminformation.h" DrKonqiDialog::DrKonqiDialog(QWidget * parent) : KDialog(parent), @@ -234,27 +233,7 @@ void DrKonqiDialog::enableDebugMenu(bool debuggerRunning) void DrKonqiDialog::startBugReportAssistant() { const CrashedApplication *crashedApp = DrKonqi::crashedApplication(); - QString appReportAddress = crashedApp->bugReportAddress(); - SystemInformation *sysinfo = new SystemInformation(this); - QString backtrace = DrKonqi::debuggerManager()->backtraceGenerator()->parser()->parsedBacktrace(); - QString query; - // KDE applications use the email address by default - if (appReportAddress == QLatin1String(KDE_BUG_REPORT_EMAIL)) { - // black magic - report is done in Markdown syntax with new lines preserved - // but invokeBrowser() can call external browser and at this point KDE - // application can not be trused not to crash again (konqueror, rekonq, etc.). - query = QString("%1/new").arg(KDE_BUG_REPORT_URL); - query.append(QString("?title=%1 %2 %3").arg(crashedApp->name(), crashedApp->version(), - crashedApp->signalName())); - query.append(QString("&body=%1\nOS: %2\nRelease: %3\nKDE: %4\nKatie: %5\n%6").arg( - QUrl::toPercentEncoding("## Platform"), sysinfo->system(), - sysinfo->release(), sysinfo->kdeVersion(), sysinfo->qtVersion(), - QUrl::toPercentEncoding("## Backtrace\nPlease, copy-paste it from the DrKonqi window\n"))); - } else { - query = QString(appReportAddress); - } - - KToolInvocation::invokeBrowser(query); + KToolInvocation::invokeBrowser(crashedApp->bugReportAddress()); } void DrKonqiDialog::applicationRestarted(bool success) diff --git a/drkonqi/systeminformation.cpp b/drkonqi/systeminformation.cpp deleted file mode 100644 index 9a721e36..00000000 --- a/drkonqi/systeminformation.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************* -* systeminformation.cpp -* Copyright 2009 Dario Andres Rodriguez -* Copyright 2009 George Kiagiadakis -* -* 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 . -* -******************************************************************/ - -#include - -#include "systeminformation.h" - -#include -#include -#include - -#include - -#include -#include - -SystemInformation::SystemInformation(QObject * parent) - : QObject(parent) -{ - // NOTE: the relative order is important here - m_system = fetchOSDetailInformation(); - m_release = fetchOSReleaseInformation(); -} - -SystemInformation::~SystemInformation() -{ -} - -QString SystemInformation::fetchOSDetailInformation() const -{ - QString operatingSystem = "unspecified"; - struct utsname buf; - if (::uname(&buf) == -1) { - kDebug() << "call to uname failed" << ::strerror(errno); - } else { - operatingSystem = QString::fromLocal8Bit(buf.sysname) + ' ' - + QString::fromLocal8Bit(buf.release) + ' ' - + QString::fromLocal8Bit(buf.machine); - } - return operatingSystem; -} - -QString SystemInformation::fetchOSReleaseInformation() const -{ - QFile data("/etc/os-release"); - if (!data.open(QIODevice::ReadOnly | QIODevice::Text)) { - return QString(); - } - - QMap distroInfos; - - QTextStream in(&data); - while (!in.atEnd()) { - const QString line = in.readLine(); - - // its format is one simple NAME=VALUE per line - // don't use QString.split() here since its value might contain '='' - const int index = line.indexOf('='); - if ( index != -1 ) { - const QString key = line.left(index); - QString value = line.mid(index+1); - value = value.trimmed(); - if(value.startsWith("'") or value.startsWith("\"")) { - value.remove(0, 1); - } - if(value.endsWith("'") or value.endsWith("\"")) { - value.chop(1); - } - distroInfos.insert(key, value); - } - } - - // the PRETTY_NAME entry should be the most appropriate one, - // but I could be wrong. - return distroInfos.value("PRETTY_NAME", "unspecified"); -} - -QString SystemInformation::system() const -{ - return m_system; -} - -QString SystemInformation::release() const -{ - return m_release; -} - -QString SystemInformation::kdeVersion() const -{ - return KDE::versionString(); -} - -QString SystemInformation::qtVersion() const -{ - return qVersion(); -} diff --git a/drkonqi/systeminformation.h b/drkonqi/systeminformation.h deleted file mode 100644 index f42dd577..00000000 --- a/drkonqi/systeminformation.h +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************* -* systeminformation.h -* Copyright 2009 Dario Andres Rodriguez -* -* 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 . -* -******************************************************************/ - -#ifndef SYSTEMINFORMATION__H -#define SYSTEMINFORMATION__H - -#include - -class SystemInformation: public QObject -{ - Q_OBJECT - public: - explicit SystemInformation(QObject * parent = 0); - ~SystemInformation(); - - QString system() const; - QString release() const; - - QString kdeVersion() const; - QString qtVersion() const; - - private: - QString fetchOSDetailInformation() const; - QString fetchOSReleaseInformation() const; - - QString m_system; - QString m_release; -}; - -#endif