[calamares] Hook up to KDSAG again (instead of DBus activation)

This commit is contained in:
Adriaan de Groot 2022-06-26 23:06:31 +02:00
parent 784f591dee
commit 86d3932a16
4 changed files with 22 additions and 18 deletions

View File

@ -1,3 +1,5 @@
set(KDSINGLEAPPLICATION_STATIC ON)
set(KDSINGLEAPPLICATION_SRCS kdsingleapplication.cpp kdsingleapplication_localsocket.cpp) set(KDSINGLEAPPLICATION_SRCS kdsingleapplication.cpp kdsingleapplication_localsocket.cpp)
set(KDSINGLEAPPLICATION_INSTALLABLE_INCLUDES kdsingleapplication.h kdsingleapplication_lib.h) set(KDSINGLEAPPLICATION_INSTALLABLE_INCLUDES kdsingleapplication.h kdsingleapplication_lib.h)
@ -11,6 +13,7 @@ else()
add_library(kdsingleapplication SHARED ${KDSINGLEAPPLICATION_INSTALLABLE_INCLUDES} ${KDSINGLEAPPLICATION_SRCS}) add_library(kdsingleapplication SHARED ${KDSINGLEAPPLICATION_INSTALLABLE_INCLUDES} ${KDSINGLEAPPLICATION_SRCS})
target_compile_definitions(kdsingleapplication PRIVATE KDSINGLEAPPLICATION_SHARED_BUILD) target_compile_definitions(kdsingleapplication PRIVATE KDSINGLEAPPLICATION_SHARED_BUILD)
endif() endif()
set_target_properties( kdsingleapplication PROPERTIES AUTOMOC TRUE )
set(KDSINGLEAPPLICATION_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/kdsingleapplication) set(KDSINGLEAPPLICATION_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/kdsingleapplication)

View File

@ -321,7 +321,7 @@ if(ECM_FOUND)
include(KDEInstallDirs) include(KDEInstallDirs)
endif() endif()
find_package(KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons) find_package(KF5 QUIET COMPONENTS CoreAddons Crash)
set_package_properties( set_package_properties(
KF5::CoreAddons KF5::CoreAddons
PROPERTIES PROPERTIES
@ -330,14 +330,6 @@ set_package_properties(
URL "https://api.kde.org/frameworks/kcoreaddons/" URL "https://api.kde.org/frameworks/kcoreaddons/"
PURPOSE "About Calamares" PURPOSE "About Calamares"
) )
set_package_properties(
KF5::DBusAddons
PROPERTIES
TYPE REQUIRED
DESCRIPTION "Classes for DBus activation"
URL "https://api.kde.org/frameworks/dbusaddons/"
PURPOSE "Unique instance of Calamares"
)
if(NOT KF5Crash_FOUND) if(NOT KF5Crash_FOUND)
if(BUILD_KF5Crash) if(BUILD_KF5Crash)
message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.") message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.")
@ -551,6 +543,7 @@ include(GNUInstallDirs)
# libraries for Calamares. # libraries for Calamares.
set(Calamares_LIBRARIES calamares) set(Calamares_LIBRARIES calamares)
add_subdirectory(3rdparty/kdsingleapplication)
add_subdirectory(src) add_subdirectory(src)
add_feature_info(Python ${WITH_PYTHON} "Python job modules") add_feature_info(Python ${WITH_PYTHON} "Python job modules")

View File

@ -36,13 +36,9 @@ calamares_automoc( calamares_bin )
calamares_autouic( calamares_bin ) calamares_autouic( calamares_bin )
calamares_autorcc( calamares_bin ) calamares_autorcc( calamares_bin )
if(kdsagSources)
set_source_files_properties(${kdsagSources} PROPERTIES AUTOMOC OFF)
endif()
target_link_libraries( target_link_libraries(
calamares_bin calamares_bin
PRIVATE calamares calamaresui calamares-i18n Qt5::Core Qt5::Widgets KF5::CoreAddons KF5::DBusAddons PRIVATE calamares calamaresui calamares-i18n kdsingleapplication Qt5::Core Qt5::Widgets KF5::CoreAddons
) )
if(BUILD_KF5Crash) if(BUILD_KF5Crash)
target_link_libraries(calamares_bin PRIVATE KF5::Crash) target_link_libraries(calamares_bin PRIVATE KF5::Crash)

View File

@ -16,8 +16,10 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
// From 3rdparty/
#include "kdsingleapplication.h"
#include <KCoreAddons/KAboutData> #include <KCoreAddons/KAboutData>
#include <KDBusAddons/KDBusService>
#ifdef BUILD_KF5Crash #ifdef BUILD_KF5Crash
#include <KCrash/KCrash> #include <KCrash/KCrash>
#endif #endif
@ -26,6 +28,8 @@
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <memory>
/** @brief Gets debug-level from -D command-line-option /** @brief Gets debug-level from -D command-line-option
* *
* If unset, use LOGERROR (corresponding to -D1), although * If unset, use LOGERROR (corresponding to -D1), although
@ -124,9 +128,17 @@ main( int argc, char* argv[] )
KCrash::setFlags( KCrash::SaferDialog | KCrash::AlwaysDirectly ); KCrash::setFlags( KCrash::SaferDialog | KCrash::AlwaysDirectly );
#endif #endif
bool is_debug = handle_args( a ); std::unique_ptr< KDSingleApplication > possiblyUnique;
const bool is_debug = handle_args( a );
KDBusService service( is_debug ? KDBusService::Multiple : KDBusService::Unique ); if ( !is_debug )
{
possiblyUnique = std::make_unique< KDSingleApplication >();
if ( !possiblyUnique->isPrimaryInstance() )
{
qCritical() << "Calamares is already running.";
return 87; // EUSERS on Linux
}
}
Calamares::Settings::init( is_debug ); Calamares::Settings::init( is_debug );
if ( !Calamares::Settings::instance() || !Calamares::Settings::instance()->isValid() ) if ( !Calamares::Settings::instance() || !Calamares::Settings::instance()->isValid() )