Commit 29b74edc authored by David Jarvie's avatar David Jarvie
Browse files

Allow build without KAuth (disables wake-from-suspend alarms)

Instead of "Add option to not build/install KAuth helper", this renames
the option and removes wake-from-suspend alarms from the user interface.
Wake-from-suspend alarms are now disabled if KAuth is not found.
parent a847de4c
Pipeline #147943 passed with stage
in 3 minutes and 37 seconds
......@@ -59,8 +59,16 @@ set(CALENDARUTILS_LIB_VERSION "5.19.40")
option(FILE_RESOURCES "Use file system resources instead of Akonadi resources." TRUE)
option (ENABLE_WAKE_FROM_SUSPEND "Enable wake-from-suspend alarms (requires KAuth)" ON)
if (ENABLE_WAKE_FROM_SUSPEND)
find_package(KF5Auth ${KF5_MIN_VERSION})
if (NOT KF5Auth_FOUND)
set(ENABLE_WAKE_FROM_SUSPEND OFF)
endif()
endif()
add_feature_info(WAKE_FROM_SUSPEND ${ENABLE_WAKE_FROM_SUSPEND} "Wake-from-suspend alarms")
# Find KF5 packages
find_package(KF5Auth ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarCore ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_MIN_VERSION} REQUIRED)
......@@ -127,9 +135,6 @@ ecm_set_disabled_deprecation_versions(QT 5.15.2 KF 5.92.0)
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
option(ENABLE_KAUTH_HELPER "Build and install KAuth helper" ON)
add_feature_info(KAUTH_HELPER ${ENABLE_KAUTH_HELPER} "Build and install KAuth helper")
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
if (USE_UNITY_CMAKE_SUPPORT)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
......
......@@ -319,7 +319,7 @@ install(FILES data/kalarm.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
########### KAuth helper ###############
if(ENABLE_KAUTH_HELPER)
if (ENABLE_WAKE_FROM_SUSPEND)
add_executable(kalarm_helper rtcwakeaction.cpp rtcwakeaction.h ${libkalarm_common_SRCS})
target_link_libraries(kalarm_helper KF5::AuthCore KF5::I18n)
install(TARGETS kalarm_helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
......
......@@ -2,3 +2,6 @@
/* Define to 1 if you have the Xlib */
#cmakedefine01 KDEPIM_HAVE_X11
/* Define to 1 if wake-from-suspend is enabled */
#cmakedefine01 ENABLE_WAKE_FROM_SUSPEND
......@@ -34,6 +34,7 @@
#include "lib/messagebox.h"
#include "lib/synchtimer.h"
#include "kalarmcalendar/alarmtext.h"
#include "config-kalarm.h"
#include "kalarm_debug.h"
#include <Akonadi/Item>
......@@ -504,11 +505,13 @@ void MainWindow::initActions()
actions->setDefaultShortcut(mActionEnable, QKeySequence(Qt::CTRL | Qt::Key_B));
connect(mActionEnable, &QAction::triggered, this, &MainWindow::slotEnable);
QAction* action = new QAction(i18nc("@action", "Wake From Suspend..."), this);
actions->addAction(QStringLiteral("wakeSuspend"), action);
connect(action, &QAction::triggered, this, &MainWindow::slotWakeFromSuspend);
#if ENABLE_WAKE_FROM_SUSPEND
QAction* waction = new QAction(i18nc("@action", "Wake From Suspend..."), this);
actions->addAction(QStringLiteral("wakeSuspend"), waction);
connect(waction, &QAction::triggered, this, &MainWindow::slotWakeFromSuspend);
#endif
action = KAlarm::createStopPlayAction(this);
QAction* action = KAlarm::createStopPlayAction(this);
actions->addAction(QStringLiteral("stopAudio"), action);
KGlobalAccel::setGlobalShortcut(action, QList<QKeySequence>()); // allow user to set a global shortcut
......@@ -921,7 +924,9 @@ void MainWindow::slotSpreadWindowsShortcut()
*/
void MainWindow::slotWakeFromSuspend()
{
#if ENABLE_WAKE_FROM_SUSPEND
(WakeFromSuspendDlg::create(this))->show();
#endif
}
/******************************************************************************
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment