From a40b694b5ca301681b281fa3849f5ed5d18094e8 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 31 Jul 2024 22:44:55 +0200 Subject: [PATCH] Enable KCrash for all executables (cherry picked from commit 75bd1c694e708edfc4e8cf4d1634ab6526faa9e2) --- .kde-ci.yml | 1 + CMakeLists.txt | 2 +- app/CMakeLists.txt | 2 +- app/main.cpp | 3 +++ cli/CMakeLists.txt | 1 + cli/kdeconnect-cli.cpp | 3 +++ daemon/CMakeLists.txt | 1 + daemon/kdeconnectd.cpp | 3 +++ indicator/CMakeLists.txt | 2 +- indicator/main.cpp | 3 +++ settings/CMakeLists.txt | 2 +- settings/main.cpp | 3 +++ smsapp/CMakeLists.txt | 1 + smsapp/main.cpp | 3 +++ urlhandler/CMakeLists.txt | 2 +- urlhandler/kdeconnect-handler.cpp | 4 ++++ 16 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.kde-ci.yml b/.kde-ci.yml index fefdc8198..e9d174a5f 100644 --- a/.kde-ci.yml +++ b/.kde-ci.yml @@ -24,6 +24,7 @@ Dependencies: 'frameworks/kpeople': '@stable' 'frameworks/kwindowsystem': '@stable' 'frameworks/qqc2-desktop-style': '@stable' + 'frameworks/kcrash': '@stable' 'libraries/kirigami-addons': '@latest' - 'on': ['Linux/Qt5', 'FreeBSD/Qt5'] 'require': diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f2e78fb7..8e03e2024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia) find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications - KIO KCMUtils Service Solid Kirigami People WindowSystem GuiAddons DocTools) + KIO KCMUtils Service Solid Kirigami People WindowSystem GuiAddons DocTools Crash) if (WIN32) get_filename_component(WINDOWS_KITS_DIR diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index fd1920a66..02c4b8ae5 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -44,7 +44,7 @@ ecm_target_qml_sources(kdeconnect-app SOURCES qml/Settings.qml ) -target_link_libraries(kdeconnect-app PRIVATE Qt::Quick Qt::QuickControls2 Qt::Widgets KF6::CoreAddons KF6::I18n KF6::KCMUtils) +target_link_libraries(kdeconnect-app PRIVATE Qt::Quick Qt::QuickControls2 Qt::Widgets KF6::CoreAddons KF6::I18n KF6::KCMUtils KF6::Crash) install(TARGETS kdeconnect-app ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${KDE_INSTALL_APPDIR}) diff --git a/app/main.cpp b/app/main.cpp index 3cd3e54dc..f967db96d 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -16,6 +16,7 @@ #include "kdeconnect-version.h" #include #include +#include #include #include @@ -37,6 +38,8 @@ int main(int argc, char *argv[]) aboutData.setBugAddress("https://bugs.kde.org/enter_bug.cgi?product=kdeconnect&component=common"); KAboutData::setApplicationData(aboutData); + KCrash::initialize(); + #ifdef Q_OS_WIN KColorSchemeManager manager; QApplication::setStyle(QStringLiteral("breeze")); diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 9adab6fb5..f5adb5186 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -9,6 +9,7 @@ target_link_libraries(kdeconnect-cli kdeconnectversion KF6::CoreAddons KF6::I18n + KF6::Crash ) install(TARGETS kdeconnect-cli ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 68fa91a81..d03fe4913 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -12,6 +12,7 @@ #include #include +#include #include "interfaces/conversationmessage.h" #include "interfaces/dbushelpers.h" @@ -33,6 +34,8 @@ int main(int argc, char **argv) i18n("(C) 2015 Aleix Pol Gonzalez")); KAboutData::setApplicationData(about); + KCrash::initialize(); + about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), QStringLiteral("aleixpol@kde.org")); about.addAuthor(i18n("Albert Vaca Cintora"), QString(), QStringLiteral("albertvaka@gmail.com")); QCommandLineParser parser; diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index ef41a9307..34fb74e70 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -13,6 +13,7 @@ target_link_libraries(kdeconnectd KF6::Notifications KF6::I18n KF6::WindowSystem + KF6::Crash Qt::Widgets) ecm_mark_nongui_executable(kdeconnectd) diff --git a/daemon/kdeconnectd.cpp b/daemon/kdeconnectd.cpp index 718936d47..4f8723bdf 100644 --- a/daemon/kdeconnectd.cpp +++ b/daemon/kdeconnectd.cpp @@ -19,6 +19,7 @@ #endif #include +#include #include #include #include @@ -147,6 +148,8 @@ int main(int argc, char *argv[]) KAboutData::setApplicationData(aboutData); app.setQuitOnLastWindowClosed(false); + KCrash::initialize(); + QCommandLineParser parser; QCommandLineOption replaceOption({QStringLiteral("replace")}, i18n("Replace an existing instance")); parser.addOption(replaceOption); diff --git a/indicator/CMakeLists.txt b/indicator/CMakeLists.txt index 0e844b492..32a09595b 100644 --- a/indicator/CMakeLists.txt +++ b/indicator/CMakeLists.txt @@ -43,7 +43,7 @@ ecm_qt_declare_logging_category(kdeconnect-indicator target_include_directories(kdeconnect-indicator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/systray_actions) -target_link_libraries(kdeconnect-indicator Qt::Widgets KF6::CoreAddons KF6::I18n KF6::Notifications KF6::DBusAddons KF6::KCMUtils kdeconnectinterfaces kdeconnectcore kdeconnectversion) +target_link_libraries(kdeconnect-indicator Qt::Widgets KF6::CoreAddons KF6::I18n KF6::Notifications KF6::DBusAddons KF6::KCMUtils KF6::Crash kdeconnectinterfaces kdeconnectcore kdeconnectversion) if (WIN32) target_link_libraries(kdeconnect-indicator windowsapp) diff --git a/indicator/main.cpp b/indicator/main.cpp index 16c437416..9a61634a8 100644 --- a/indicator/main.cpp +++ b/indicator/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -56,6 +57,8 @@ int main(int argc, char **argv) i18n("(C) 2016 Aleix Pol Gonzalez")); KAboutData::setApplicationData(about); + KCrash::initialize(); + #ifdef Q_OS_WIN KColorSchemeManager manager; QApplication::setStyle(QStringLiteral("breeze")); diff --git a/settings/CMakeLists.txt b/settings/CMakeLists.txt index 0d326f024..7f5b385b9 100644 --- a/settings/CMakeLists.txt +++ b/settings/CMakeLists.txt @@ -7,7 +7,7 @@ add_executable(kdeconnect-settings ${kdeconnect_custom_icons_SRCS} ) -target_link_libraries(kdeconnect-settings kdeconnectversion KF6::I18n KF6::KCMUtils KF6::DBusAddons KF6::WindowSystem) +target_link_libraries(kdeconnect-settings kdeconnectversion KF6::I18n KF6::KCMUtils KF6::DBusAddons KF6::WindowSystem KF6::Crash) install(TARGETS kdeconnect-settings ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES org.kde.kdeconnect-settings.desktop DESTINATION ${KDE_INSTALL_APPDIR}) diff --git a/settings/main.cpp b/settings/main.cpp index f5002a267..0104ef572 100644 --- a/settings/main.cpp +++ b/settings/main.cpp @@ -12,6 +12,7 @@ #include "kdeconnect-version.h" #include #include +#include #include #include #include @@ -30,6 +31,8 @@ int main(int argc, char **argv) i18n("(C) 2018-2020 Nicolas Fella")); KAboutData::setApplicationData(about); + KCrash::initialize(); + QCommandLineParser parser; parser.addOption(QCommandLineOption(QStringLiteral("args"), i18n("Arguments for the config module"), QStringLiteral("args"))); diff --git a/smsapp/CMakeLists.txt b/smsapp/CMakeLists.txt index 1484f7c9f..078d9db8e 100644 --- a/smsapp/CMakeLists.txt +++ b/smsapp/CMakeLists.txt @@ -67,6 +67,7 @@ target_link_libraries(kdeconnect-sms PRIVATE KF6::I18n KF6::People KF6::KCMUtils + KF6::Crash ) install(TARGETS kdeconnect-sms ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/smsapp/main.cpp b/smsapp/main.cpp index 4fc4709ec..94d8b9071 100644 --- a/smsapp/main.cpp +++ b/smsapp/main.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -57,6 +58,8 @@ int main(int argc, char *argv[]) aboutData.setBugAddress(QStringLiteral("https://bugs.kde.org/enter_bug.cgi?product=kdeconnect&component=messaging-application").toUtf8()); KAboutData::setApplicationData(aboutData); + KCrash::initialize(); + #ifdef Q_OS_WIN KColorSchemeManager manager; QApplication::setStyle(QStringLiteral("breeze")); diff --git a/urlhandler/CMakeLists.txt b/urlhandler/CMakeLists.txt index 8ccc42d8c..541db2c64 100644 --- a/urlhandler/CMakeLists.txt +++ b/urlhandler/CMakeLists.txt @@ -16,7 +16,7 @@ target_link_libraries(kdeconnect-handler KF6::ConfigWidgets KF6::DBusAddons KF6::I18n - KF6::KIOCore KF6::KIOFileWidgets KF6::KIOWidgets + KF6::KIOCore KF6::KIOFileWidgets KF6::KIOWidgets KF6::Crash ) install(TARGETS kdeconnect-handler ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/urlhandler/kdeconnect-handler.cpp b/urlhandler/kdeconnect-handler.cpp index 97fd8ed51..5270a696a 100644 --- a/urlhandler/kdeconnect-handler.cpp +++ b/urlhandler/kdeconnect-handler.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,9 @@ int main(int argc, char **argv) about.addAuthor(QStringLiteral("Aleix Pol Gonzalez"), QString(), QStringLiteral("aleixpol@kde.org")); about.setProgramLogo(QIcon(QStringLiteral(":/icons/kdeconnect/kdeconnect.svg"))); KAboutData::setApplicationData(about); + + KCrash::initialize(); + KDBusService dbusService(KDBusService::Unique); #ifdef Q_OS_WIN