From d804380b0f146367fcc1a5fe72463a351dbb514d Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Wed, 8 Nov 2023 14:00:28 +0100 Subject: [PATCH 1/2] Remove crash test function from global scope --- src/gui/application.cpp | 16 ---------------- src/gui/application.h | 3 --- src/gui/owncloudgui.cpp | 6 +++--- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index a16007f3781..d625252a763 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -193,22 +193,6 @@ void Application::slotCleanup() AccountManager::instance()->shutdown(); } -void Application::slotCrash() -{ - Utility::crash(); -} - -void Application::slotCrashEnforce() -{ - OC_ENFORCE(1 == 0); -} - - -void Application::slotCrashFatal() -{ - qFatal("la Qt fatale"); -} - AccountStatePtr Application::addNewAccount(AccountPtr newAccount) { auto *accountMan = AccountManager::instance(); diff --git a/src/gui/application.h b/src/gui/application.h index 8ae203d041a..a897d761236 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -59,9 +59,6 @@ class Application : public QObject AccountStatePtr addNewAccount(AccountPtr newAccount); public slots: - void slotCrash(); - void slotCrashEnforce(); - void slotCrashFatal(); /** * Will download a virtual file, and open the result. * The argument is the filename of the virtual file (including the extension) diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index d670561ea0c..e874ed6d84f 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -640,9 +640,9 @@ void ownCloudGui::updateContextMenu() if (_app->debugMode()) { auto *crashMenu = _contextMenu->addMenu(QStringLiteral("Debug actions")); - crashMenu->addAction(QStringLiteral("Crash now - Div by zero"), _app, &Application::slotCrash); - crashMenu->addAction(QStringLiteral("Crash now - ENFORCE()"), _app, &Application::slotCrashEnforce); - crashMenu->addAction(QStringLiteral("Crash now - qFatal"), _app, &Application::slotCrashFatal); + crashMenu->addAction(QStringLiteral("Crash now - Div by zero"), _app, [] { Utility::crash(); }); + crashMenu->addAction(QStringLiteral("Crash now - ENFORCE()"), _app, [] { OC_ENFORCE(1 == 0); }); + crashMenu->addAction(QStringLiteral("Crash now - qFatal"), _app, [] { qFatal("la Qt fatale"); }); } _contextMenu->addSeparator(); From 1bd2f3333e62b302e8308e0a4f9ffbd039ac1467 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Wed, 8 Nov 2023 14:01:31 +0100 Subject: [PATCH 2/2] Remove dead code --- src/gui/application.cpp | 7 ------- src/gui/application.h | 3 --- 2 files changed, 10 deletions(-) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index d625252a763..5ac1b9373cf 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -252,13 +252,6 @@ void Application::openVirtualFile(const QString &filename) }); } -void Application::tryTrayAgain() -{ - qCInfo(lcApplication) << "Trying tray icon, tray available:" << QSystemTrayIcon::isSystemTrayAvailable(); - if (!_gui->contextMenuVisible()) - _gui->hideAndShowTray(); -} - bool Application::eventFilter(QObject *obj, QEvent *event) { #ifdef Q_OS_MAC diff --git a/src/gui/application.h b/src/gui/application.h index a897d761236..6f3608c250e 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -65,9 +65,6 @@ public slots: */ void openVirtualFile(const QString &filename); - /// Attempt to show() the tray icon again. Used if no systray was available initially. - void tryTrayAgain(); - protected: bool eventFilter(QObject *obj, QEvent *event) override;