Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KAlarm
Commits
3d723001
Commit
3d723001
authored
Apr 01, 2022
by
David Jarvie
Browse files
Allow build without KAuth header files having been installed
parent
2131a145
Pipeline
#158015
passed with stage
in 1 minute and 44 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
3d723001
...
...
@@ -178,7 +178,6 @@ set(kalarm_bin_SRCS ${libkalarm_SRCS} ${resources_SRCS}
templatepickdlg.cpp
templatedlg.cpp
templatemenuaction.cpp
wakedlg.cpp
migratekde4files.cpp
akonadicollectionsearch.cpp
birthdaydlg.h
...
...
@@ -230,10 +229,15 @@ set(kalarm_bin_SRCS ${libkalarm_SRCS} ${resources_SRCS}
templatepickdlg.h
templatedlg.h
templatemenuaction.h
wakedlg.h
migratekde4files.h
akonadicollectionsearch.h
)
if
(
ENABLE_WAKE_FROM_SUSPEND
)
set
(
kalarm_bin_SRCS
${
kalarm_bin_SRCS
}
wakedlg.cpp
wakedlg.h
)
endif
()
ki18n_wrap_ui
(
kalarm_bin_SRCS
wakedlg.ui
...
...
src/functions.cpp
View file @
3d723001
...
...
@@ -45,6 +45,7 @@ using namespace KCalendarCore;
#include
<KToggleAction>
#include
<KLocalizedString>
#if ENABLE_WAKE_FROM_SUSPEND
#include
<kauth_version.h>
#if KAUTH_VERSION >= QT_VERSION_CHECK(5, 92, 0)
#include
<KAuth/ActionReply>
...
...
@@ -52,6 +53,7 @@ using namespace KCalendarCore;
#else
#include
<KAuth>
#endif
#endif
#include
<KStandardShortcut>
#include
<KFileItem>
#include
<KJobWidgets>
...
...
@@ -487,8 +489,10 @@ UpdateResult deleteEvents(QVector<KAEvent>& events, Resource& resource, bool arc
if
(
events
.
isEmpty
())
return
UpdateResult
(
UPDATE_OK
);
UpdateStatusData
status
;
#if ENABLE_WAKE_FROM_SUSPEND
bool
deleteWakeFromSuspendAlarm
=
false
;
const
QString
wakeFromSuspendId
=
checkRtcWakeConfig
().
value
(
0
);
#endif
QSet
<
Resource
>
resources
;
// resources which events have been deleted from
for
(
int
i
=
0
,
end
=
events
.
count
();
i
<
end
;
++
i
)
{
...
...
@@ -520,8 +524,10 @@ UpdateResult deleteEvents(QVector<KAEvent>& events, Resource& resource, bool arc
else
status
.
appendFailed
(
i
);
#if ENABLE_WAKE_FROM_SUSPEND
if
(
id
==
wakeFromSuspendId
)
deleteWakeFromSuspendAlarm
=
true
;
#endif
// Remove "Don't show error messages again" for this alarm
setDontShowErrors
(
EventId
(
*
event
));
...
...
@@ -545,9 +551,11 @@ UpdateResult deleteEvents(QVector<KAEvent>& events, Resource& resource, bool arc
if
(
status
.
status
!=
UPDATE_OK
&&
msgParent
)
displayUpdateError
(
msgParent
,
ERR_DELETE
,
status
,
showKOrgErr
);
#if ENABLE_WAKE_FROM_SUSPEND
// Remove any wake-from-suspend scheduled for a deleted alarm
if
(
deleteWakeFromSuspendAlarm
&&
!
wakeFromSuspendId
.
isEmpty
())
cancelRtcWake
(
msgParent
,
wakeFromSuspendId
);
#endif
return
status
.
status
;
}
...
...
@@ -713,8 +721,10 @@ UpdateResult enableEvents(QVector<KAEvent>& events, bool enable, QWidget* msgPar
if
(
events
.
isEmpty
())
return
UpdateResult
(
UPDATE_OK
);
UpdateStatusData
status
;
#if ENABLE_WAKE_FROM_SUSPEND
bool
deleteWakeFromSuspendAlarm
=
false
;
const
QString
wakeFromSuspendId
=
checkRtcWakeConfig
().
value
(
0
);
#endif
QSet
<
ResourceId
>
resourceIds
;
// resources whose events have been updated
for
(
int
i
=
0
,
end
=
events
.
count
();
i
<
end
;
++
i
)
{
...
...
@@ -724,8 +734,10 @@ UpdateResult enableEvents(QVector<KAEvent>& events, bool enable, QWidget* msgPar
{
event
->
setEnabled
(
enable
);
#if ENABLE_WAKE_FROM_SUSPEND
if
(
!
enable
&&
event
->
id
()
==
wakeFromSuspendId
)
deleteWakeFromSuspendAlarm
=
true
;
#endif
// Update the event in the calendar file
const
KAEvent
newev
=
ResourcesCalendar
::
updateEvent
(
*
event
);
...
...
@@ -769,9 +781,11 @@ UpdateResult enableEvents(QVector<KAEvent>& events, bool enable, QWidget* msgPar
if
(
status
.
status
!=
UPDATE_OK
&&
msgParent
)
displayUpdateError
(
msgParent
,
ERR_ADD
,
status
);
#if ENABLE_WAKE_FROM_SUSPEND
// Remove any wake-from-suspend scheduled for a disabled alarm
if
(
deleteWakeFromSuspendAlarm
&&
!
wakeFromSuspendId
.
isEmpty
())
cancelRtcWake
(
msgParent
,
wakeFromSuspendId
);
#endif
return
status
.
status
;
}
...
...
@@ -1230,6 +1244,7 @@ void editNewTemplate(const KAEvent& preset, QWidget* parent)
::
editNewTemplate
(
EditAlarmDlg
::
Type
(
0
),
preset
,
parent
);
}
#if ENABLE_WAKE_FROM_SUSPEND
/******************************************************************************
* Check the config as to whether there is a wake-on-suspend alarm pending, and
* if so, delete it from the config if it has expired.
...
...
@@ -1333,6 +1348,7 @@ bool setRtcWakeTime(unsigned triggerTime, QWidget* parent)
}
return
true
;
}
#endif // ENABLE_WAKE_FROM_SUSPEND
}
// namespace KAlarm
namespace
...
...
src/functions.h
View file @
3d723001
...
...
@@ -10,6 +10,7 @@
/** @file functions.h - miscellaneous functions */
#include
"config-kalarm.h"
#include
"editdlg.h"
#include
"eventid.h"
#include
"kalarmcalendar/kaevent.h"
...
...
@@ -301,10 +302,12 @@ bool importAlarms(Resource& resource, QWidget* parent);
bool
exportAlarms
(
const
QVector
<
KAEvent
>&
events
,
QWidget
*
parent
);
void
displayKOrgUpdateError
(
QWidget
*
parent
,
UpdateError
,
const
UpdateResult
&
korgError
,
int
nAlarms
=
0
);
#if ENABLE_WAKE_FROM_SUSPEND
QStringList
checkRtcWakeConfig
(
bool
checkEventExists
=
false
);
void
deleteRtcWakeConfig
();
void
cancelRtcWake
(
QWidget
*
msgParent
,
const
QString
&
eventId
=
QString
());
bool
setRtcWakeTime
(
unsigned
triggerTime
,
QWidget
*
parent
);
#endif
bool
convertTimeString
(
const
QByteArray
&
timeString
,
KADateTime
&
dateTime
,
const
KADateTime
&
defaultDt
=
KADateTime
(),
bool
allowTZ
=
true
);
...
...
src/functions_p.h
View file @
3d723001
/*
* functions_p.h - private declarations for miscellaneous functions
* Program: kalarm
* SPDX-FileCopyrightText: 2009
, 2011
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2009
-2022
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include
"config-kalarm.h"
#include
<QObject>
class
EditAlarmDlg
;
...
...
@@ -30,8 +32,10 @@ public:
QWidget
*
mMsgParent
;
#if ENABLE_WAKE_FROM_SUSPEND
public
Q_SLOTS
:
void
cancelRtcWake
();
#endif
private:
static
Private
*
mInstance
;
...
...
src/kalarmapp.cpp
View file @
3d723001
...
...
@@ -776,11 +776,13 @@ bool KAlarmApp::quitIf(int exitCode, bool force)
// KAlarm is started again before application exit completes!
qCDebug
(
KALARM_LOG
)
<<
"KAlarmApp::quitIf:"
<<
exitCode
<<
": quitting"
;
MessageDisplay
::
stopAudio
(
true
);
#if ENABLE_WAKE_FROM_SUSPEND
if
(
mCancelRtcWake
)
{
KAlarm
::
setRtcWakeTime
(
0
,
nullptr
);
KAlarm
::
deleteRtcWakeConfig
();
}
#endif
delete
mAlarmTimer
;
// prevent checking for alarms after deleting calendars
mAlarmTimer
=
nullptr
;
mInitialised
=
false
;
// prevent processQueue() from running
...
...
@@ -806,6 +808,7 @@ void KAlarmApp::doQuit(QWidget* parent)
KStandardGuiItem
::
cancel
(),
Preferences
::
QUIT_WARN
)
!=
KMessageBox
::
Continue
)
return
;
#if ENABLE_WAKE_FROM_SUSPEND
if
(
!
KAlarm
::
checkRtcWakeConfig
(
true
).
isEmpty
())
{
// A wake-on-suspend alarm is set
...
...
@@ -816,6 +819,7 @@ void KAlarmApp::doQuit(QWidget* parent)
return
;
mCancelRtcWake
=
true
;
}
#endif
if
(
!
Preferences
::
autoStart
())
{
int
option
=
KMessageBox
::
No
;
...
...
@@ -1653,7 +1657,11 @@ void KAlarmApp::setAlarmsEnabled(bool enabled)
mAlarmsEnabled
=
enabled
;
Q_EMIT
alarmEnabledToggled
(
enabled
);
if
(
!
enabled
)
#if ENABLE_WAKE_FROM_SUSPEND
KAlarm
::
cancelRtcWake
(
nullptr
);
#else
;
#endif
else
if
(
!
mProcessingQueue
)
checkNextDueAlarm
();
}
...
...
@@ -1808,8 +1816,10 @@ int KAlarmApp::handleEvent(const EventId& id, QueuedAction action, bool findUniq
{
Q_ASSERT
(
!
(
int
(
action
)
&
~
int
(
QueuedAction
::
ActionMask
)));
#if ENABLE_WAKE_FROM_SUSPEND
// Delete any expired wake-on-suspend config data
KAlarm
::
checkRtcWakeConfig
();
#endif
const
QString
eventID
(
id
.
eventId
());
KAEvent
event
=
ResourcesCalendar
::
event
(
id
,
findUniqueId
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment