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

Fix repeat-at-login alarms not triggering when KAlarm starts

parent fd8a58eb
Pipeline #34429 failed with stage
in 60 minutes and 26 seconds
KAlarm Change Log
=== Version 3.0.2 (KDE Applications 20.08.2) --- 10 September 2020 ===
=== Version 3.0.2 (KDE Applications 20.08.2) --- 16 September 2020 ===
+ Fix repeat-at-login alarms not triggering when KAlarm starts.
+ If command generating text for display alarm fails, only display error message,
not the display alarm, and don't redisplay the alarm on every restart.
+ Fix next trigger time shown as "Never" after using Try button for command display alarm, if command fails.
......
......@@ -228,10 +228,11 @@ bool KAlarmApp::initialiseTimerResources()
qCDebug(KALARM_LOG) << "KAlarmApp::initialise: initialising calendars";
Desktop::setMainWindowFunc(&mainWidget);
DataModel::initialise();
ResourcesCalendar::initialise(KALARM_NAME, KALARM_VERSION);
ResourcesCalendar* resourcesCalendar = ResourcesCalendar::create(KALARM_NAME, KALARM_VERSION);
connect(resourcesCalendar, &ResourcesCalendar::earliestAlarmChanged, this, &KAlarmApp::checkNextDueAlarm);
connect(resourcesCalendar, &ResourcesCalendar::atLoginEventAdded, this, &KAlarmApp::atLoginEventAdded);
resourcesCalendar->start();
DisplayCalendar::initialise();
connect(ResourcesCalendar::instance(), &ResourcesCalendar::earliestAlarmChanged, this, &KAlarmApp::checkNextDueAlarm);
connect(ResourcesCalendar::instance(), &ResourcesCalendar::atLoginEventAdded, this, &KAlarmApp::atLoginEventAdded);
return true;
}
return false;
......
......@@ -42,26 +42,20 @@ bool ResourcesCalendar::mHaveDisabledAlarms {false};
* different. The resources calendar contains the active alarms, archived alarms
* and alarm templates;
*/
void ResourcesCalendar::initialise(const QByteArray& appName, const QByteArray& appVersion)
ResourcesCalendar* ResourcesCalendar::create(const QByteArray& appName, const QByteArray& appVersion)
{
if (mInstance)
return nullptr;
KACalendar::setProductId(appName, appVersion);
KCalendarCore::CalFormat::setApplication(QString::fromLatin1(appName), QString::fromLatin1(KACalendar::icalProductId()));
mInstance = new ResourcesCalendar();
return mInstance;
}
/******************************************************************************
* Terminate access to the resource calendars.
*/
void ResourcesCalendar::terminate()
{
delete mInstance;
mInstance = nullptr;
}
/******************************************************************************
* Constructor for the resources calendar.
* Start resource calendar processing.
*/
ResourcesCalendar::ResourcesCalendar()
void ResourcesCalendar::start()
{
Resources* resources = Resources::instance();
connect(resources, &Resources::resourceAdded, this, &ResourcesCalendar::slotResourceAdded);
......@@ -77,6 +71,22 @@ ResourcesCalendar::ResourcesCalendar()
slotResourceAdded(resource);
}
/******************************************************************************
* Terminate access to the resource calendars.
*/
void ResourcesCalendar::terminate()
{
delete mInstance;
mInstance = nullptr;
}
/******************************************************************************
* Constructor for the resources calendar.
*/
ResourcesCalendar::ResourcesCalendar()
{
}
ResourcesCalendar::~ResourcesCalendar()
{
// Resource map should be empty, but just in case...
......
......@@ -46,7 +46,13 @@ class ResourcesCalendar : public QObject
Q_OBJECT
public:
~ResourcesCalendar() override;
static void initialise(const QByteArray& appName, const QByteArray& appVersion);
/** Create the resources calendar, to enable signal/slot connections to be made to it. */
static ResourcesCalendar* create(const QByteArray& appName, const QByteArray& appVersion);
/** Start resource calendar processing. */
void start();
static void terminate();
static KAEvent earliestAlarm();
static void setAlarmPending(const KAEvent&, bool pending = true);
......
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