Commit a6d022dc authored by David Jarvie's avatar David Jarvie
Browse files

Fix resource ID numbers not working in command line & DBUS commands

Resource ID numbers were erroneously interpreted as internal resource
IDs instead of the IDs used in the config and known to the user.
parent a7bb95ab
Pipeline #111203 failed with stage
in 56 seconds
KAlarm Change Log
=== Version 3.3.4 (KDE Applications 21.12.1) --- 15 December 2021 ===
=== Version 3.3.4 (KDE Applications 21.12.1) --- 16 December 2021 ===
* Treat empty read-only, or non-existent, calendar files as loaded.
* Ensure KAlarm command line actions are performed if KAlarm is already running [KDE Bug 446749]
* Don't disable alarms after KAlarm command line action while KAlarm is already running [KDE Bug 446749]
* Fix resource ID numbers not working in command line & DBUS commands.
=== Version 3.3.3 (KDE Applications 21.12) --- 7 November 2021 ===
* Show numbers in localised form.
......
/*
* eventid.cpp - KAlarm unique event identifier for resources
* Program: kalarm
* SPDX-FileCopyrightText: 2012-2020 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2012-2021 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -58,9 +58,9 @@ ResourceId EventId::getResourceId(const QString& resourceIdString)
const ResourceId id = resourceIdString.toLongLong(&ok);
if (ok)
{
res = Resources::resource(id);
res = Resources::resourceFromDisplayId(id);
if (res.isValid())
return id;
return res.id();
}
return -1;
}
......
/*
* eventid.h - KAlarm unique event identifier for resources
* Program: kalarm
* SPDX-FileCopyrightText: 2012-2020 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2012-2021 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -38,6 +38,8 @@ public:
/** Set by event ID prefixed by optional resource ID, in the format "[rid:]eid".
* "rid" can be the resource configuration name, or the resource ID number in
* string format.
* @note The resource ID number is the ID as used in the config and as known
* to the user, not the internal ID (where different).
* @note Resources must have been created before calling this method;
* otherwise, the resource ID will be invalid (-1).
*/
......@@ -59,15 +61,20 @@ public:
/** Extract the resource and event ID strings from an ID in the format "[rid:]eid".
* "rid" can be the resource configuration name, or the resource ID number in
* string format.
* @note The resource ID number is the ID as used in the config and as known
* to the user, not the internal ID (where different).
*
* @param resourceEventId Full ID "[rid:]eid"
* @param eventId Receives the event ID "eid"
* @return The resource ID "rid".
* @return The resource ID "rid" (see note above).
*/
static QString extractIDs(const QString& resourceEventId, QString& eventId);
/** Get the numerical resource ID from a resource ID string.
* The string can be the resource configuration name, or the resource ID
* number in string format.
* @note The resource ID number is the ID as used in the config and as known
* to the user, not the internal ID (where different).
* @note Resources must have been created before calling this function;
* otherwise, the returned resource ID will be invalid (-1).
*
......
......@@ -1141,8 +1141,7 @@ void KAlarmApp::processQueue()
}
else if (exitAfter)
{
mProcessingQueue = false; // in case there is another instance
mActionQueue.clear(); // ensure that quitIf() actually exits the program
mProcessingQueue = false; // don't inhibit processing if there is another instance
quitIf((ok ? 0 : 1), exitAfterError);
return; // quitIf() can sometimes return, despite calling exit()
}
......
Markdown is supported
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