[office/crow-translate] src: Add a Report Bug action to the tray menu

Maciej Bonin <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 250d01006332f19bed4266c862e1be786622d8b5 by Maciej Bonin, on behalf of Mauritius Clemens.
Committed on 16/08/2026 at 14:07.
Pushed by pillowtrucker into branch 'master'.

Add a Report Bug action to the tray menu

Opens the crow-translate issue tracker with the app version and operating
system pre-filled in the description, so reports arrive with useful context.

M  +21   -0    src/trayicon.cpp
M  +1    -0    src/trayicon.h

https://invent.kde.org/office/crow-translate/-/commit/250d01006332f19bed4266c862e1be786622d8b5

diff --git a/src/trayicon.cpp b/src/trayicon.cpp
index 7f624d9b..af85748c 100644
--- a/src/trayicon.cpp
+++ b/src/trayicon.cpp
@@ -9,9 +9,15 @@
 
 #include "mainwindow.h"
 
+#include <QAction>
+#include <QCoreApplication>
+#include <QDesktopServices>
 #include <QFileInfo>
 #include <QGuiApplication>
 #include <QMenu>
+#include <QSysInfo>
+#include <QUrl>
+#include <QUrlQuery>
 
 TrayIcon::TrayIcon(MainWindow *parent)
     : QSystemTrayIcon(parent)
@@ -20,6 +26,20 @@ TrayIcon::TrayIcon(MainWindow *parent)
     , m_openSettingsAction(m_trayMenu->addAction(QIcon::fromTheme(QStringLiteral("preferences-other")), tr("Settings"), parent, &MainWindow::openSettings))
     , m_quitAction(m_trayMenu->addAction(QIcon::fromTheme(QStringLiteral("application-exit")), tr("Quit"), parent, &MainWindow::quit))
 {
+    m_reportBugAction = m_trayMenu->addAction(tr("Report Bug…"));
+    connect(m_reportBugAction, &QAction::triggered, this, []() {
+        QUrl url(QStringLiteral("https://bugs.kde.org/enter_bug.cgi"));
+        QUrlQuery query;
+        query.addQueryItem(QStringLiteral("product"), QStringLiteral("Crow Translate"));
+        query.addQueryItem(QStringLiteral("component"), QStringLiteral("general"));
+        query.addQueryItem(QStringLiteral("format"), QStringLiteral("__default__"));
+        query.addQueryItem(QStringLiteral("short_desc"), QString());
+        query.addQueryItem(QStringLiteral("comment"),
+                           QStringLiteral("Version: %1\nOperating system: %2\n\nWhat happened and what did you expect?\n").arg(QCoreApplication::applicationVersion(), QSysInfo::prettyProductName()));
+        url.setQuery(query);
+        QDesktopServices::openUrl(url);
+    });
+
     setToolTip(APPLICATION_NAME);
     setContextMenu(m_trayMenu);
 
@@ -43,6 +63,7 @@ void TrayIcon::retranslateMenu()
 {
     m_showMainWindowAction->setText(tr("Show window"));
     m_openSettingsAction->setText(tr("Settings"));
+    m_reportBugAction->setText(tr("Report Bug…"));
     m_quitAction->setText(tr("Quit"));
 }
 
diff --git a/src/trayicon.h b/src/trayicon.h
index 60ca2a9f..f010936b 100644
--- a/src/trayicon.h
+++ b/src/trayicon.h
@@ -34,6 +34,7 @@ private:
     QMenu *m_trayMenu;
     QAction *m_showMainWindowAction;
     QAction *m_openSettingsAction;
+    QAction *m_reportBugAction = nullptr;
     QAction *m_quitAction;
 
     int m_translationNotificaitonTimeout = AppSettings::defaultTranslationNotificationTimeout();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.