diff --git a/CMakeLists.txt b/CMakeLists.txt index 9db89d5..bf14c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,138 +1,140 @@ project(kinfocenter) set(PROJECT_VERSION "5.13.80") cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) set(QT_MIN_VERSION "5.7.0") set(KF5_MIN_VERSION "5.30") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Completion Config ConfigWidgets CoreAddons Crash DBusAddons DocTools I18n IconThemes KCMUtils KIO Service Solid WidgetsAddons + WindowSystem XmlGui Declarative Package Solid ) if(${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL") find_package(OpenGL) set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries" URL "http://www.opengl.org" TYPE OPTIONAL ) else() find_package(OpenGLES) set_package_properties(OpenGLES PROPERTIES DESCRIPTION "The OpenGLES libraries" URL "http://www.khronos.org/opengles" TYPE OPTIONAL ) endif() find_package(EGL) set_package_properties(EGL PROPERTIES TYPE OPTIONAL PURPOSE "Required for OpenGL Information Module" ) find_package(KF5Wayland CONFIG) set_package_properties(KF5Wayland PROPERTIES TYPE OPTIONAL ) add_feature_info("KF5Wayland" KF5Wayland_FOUND "Required for Wayland Compositor Information Module") if(NOT APPLE) find_package(X11) set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" URL "http://www.x.org" TYPE OPTIONAL PURPOSE "Required for building the X11 based workspace" ) if(X11_FOUND) set(HAVE_X11 TRUE) endif() else() set(X11_FOUND False) endif() configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h) configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS) if(NOT CMAKE_VERSION VERSION_LESS "3.10.0" AND KF5_VERSION VERSION_LESS "5.42.0") # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. # 3.10+ lets us provide more macro names that require automoc. # KF5 >= 5.42 takes care itself of adding its macros in its cmake config files list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "K_PLUGIN_FACTORY_WITH_JSON" "K_PLUGIN_FACTORY") endif() add_subdirectory( Categories ) add_subdirectory( kcontrol/menus ) add_subdirectory( Modules ) include(ECMOptionalAddSubdirectory) ecm_optional_add_subdirectory( doc ) include_directories( ToolTips ) set( kinfocenter_SRCS infocenter.cpp main.cpp sidepanel.cpp kcmcontainer.cpp kcmtreeitem.cpp kcmcategoryitem.cpp infokcmmodel.cpp infokcmproxymodel.cpp ToolTips/tooltipmanager.cpp ) add_executable( kinfocenter ${kinfocenter_SRCS} ) target_compile_definitions(kinfocenter PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}") target_link_libraries( kinfocenter KF5::Completion KF5::ConfigWidgets KF5::CoreAddons KF5::Crash KF5::DBusAddons KF5::I18n KF5::IconThemes KF5::KCMUtils KF5::Service KF5::Solid KF5::WidgetsAddons + KF5::WindowSystem KF5::XmlGui ) ##install install( TARGETS kinfocenter ${INSTALL_TARGETS_DEFAULT_ARGS} ) install( PROGRAMS org.kde.kinfocenter.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( FILES kinfocenterui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kinfocenter ) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/main.cpp b/main.cpp index ba9aa9c..9472640 100644 --- a/main.cpp +++ b/main.cpp @@ -1,77 +1,82 @@ /* * main.cpp * * Copyright (C) 2010 David Hubner * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ //Local #include "main.h" //KDE #include #include #include #include #include +#include //Qt #include KicApp::KicApp(int &argc, char **argv) : QApplication(argc, argv) { QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); KLocalizedString::setApplicationDomain("kinfocenter"); const auto displayName = i18n("Info Center"); KAboutData aboutData( QStringLiteral("kinfocenter"), displayName, PROJECT_VERSION, displayName, KAboutLicense::GPL, i18n("Copyright 2009-2018 KDE")); aboutData.addAuthor(i18n("David Hubner"),i18n("Current Maintainer"), QStringLiteral("hubnerd@ntlworld.com")); aboutData.addAuthor(i18n("Helge Deller"), i18n("Previous Maintainer"), QStringLiteral("deller@kde.org")); aboutData.addAuthor(i18n("Matthias Hoelzer-Kluepfel"),QString(), QStringLiteral("hoelzer@kde.org")); aboutData.addAuthor(i18n("Matthias Elter"), QString(), QStringLiteral("elter@kde.org")); aboutData.addAuthor(i18n("Matthias Ettrich"), QString(), QStringLiteral("ettrich@kde.org")); aboutData.addAuthor(i18n("Waldo Bastian"), QString(), QStringLiteral("bastian@kde.org")); aboutData.addAuthor(i18n("Nicolas Ternisien"), QString(), QStringLiteral("nicolas.ternisien@gmail.com")); KAboutData::setApplicationData(aboutData); QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("hwinfo"))); QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); aboutData.setupCommandLine(&parser); parser.process(*this); aboutData.processCommandLine(&parser); + auto *service = new KDBusService(KDBusService::Unique, this); + display = new KInfoCenter(); display->show(); - (void)new KDBusService(KDBusService::Unique, this); + connect(service, &KDBusService::activateRequested, this, [this]() { + KWindowSystem::forceActiveWindow(display->winId()); + }); } int main(int argc, char *argv[]) { KicApp Kic(argc, argv); KCrash::initialize(); return Kic.exec(); }