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

Move file resource status change handling into base class

parent fe376130
Pipeline #23377 passed with stage
in 15 minutes and 15 seconds
......@@ -629,4 +629,30 @@ KACalendar::Compat FileResource::getCompatibility(const KCalendarCore::FileStora
}
}
/******************************************************************************
* Called when the resource settings have changed.
*/
void FileResource::handleSettingsChange(Changes change)
{
qCDebug(KALARM_LOG) << "FileResource::handleSettingsChange:" << displayId();
if (change & AlarmTypes)
{
qCDebug(KALARM_LOG) << "FileResource::handleSettingsChange:" << displayId() << "Update alarm types";
load();
}
if (change & Enabled)
{
qCDebug(KALARM_LOG) << "FileResource::handleSettingsChange:" << displayId() << "Update enabled status";
if (mSettings->enabledTypes())
{
// Alarms are now enabled. Reload the calendar file because,
// although ResourceType retains its record of alarms of disabled
// types, changes are not processed when disabled calendar files
// are updated. Also, when the calendar is loaded, disabled alarm
// types are not fully processed by loaded().
load();
}
}
}
// vim: et sw=4:
......@@ -385,7 +385,7 @@ protected:
* @note Resources::notifySettingsChanged() is called after this, to
* notify clients.
*/
virtual void handleSettingsChange(Changes) {}
virtual void handleSettingsChange(Changes);
FileResourceSettings* mSettings; // the resource's configuration
int mVersion {KACalendar::IncompatibleFormat}; // the calendar format version
......
......@@ -774,17 +774,6 @@ void SingleFileResource::slotUploadJobResult(KJob* job)
void SingleFileResource::handleSettingsChange(Changes change)
{
qCDebug(KALARM_LOG) << "SingleFileResource::handleSettingsChange:" << displayId();
if (change & AlarmTypes)
{
qCDebug(KALARM_LOG) << "SingleFileResource::handleSettingsChange:" << displayId() << "Update alarm types";
load();
}
if (change & Enabled)
{
qCDebug(KALARM_LOG) << "SingleFileResource::handleSettingsChange:" << displayId() << "Update enabled status";
if (mSettings->enabledTypes())
load();
}
if (change & UpdateFormat)
{
if (mSettings->updateFormat())
......@@ -823,6 +812,7 @@ void SingleFileResource::handleSettingsChange(Changes change)
mSettings->save();
}
}
FileResource::handleSettingsChange(change);
}
// vim: et sw=4:
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