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

Bug 407544: Fix crash when creating new KAlarm resource

The alarm type specification in the resource edit dialog was handled
incorrectly since refactoring, and caused a crash.
parent aca064a3
/*
* Copyright © 2018 Daniel Vrátil <dvratil@kde.org>
* Copyright © 2019 David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
......@@ -38,6 +39,12 @@ public:
mWidget->setMonitorEnabled(false);
}
bool save() const override
{
mSettings->setAlarmTypes(CalEvent::mimeTypes(mTypeSelector->alarmType()));
return SingleFileResourceConfigBase<SETTINGS_NAMESPACE::Settings>::save();
}
private:
QScopedPointer<AlarmTypeRadioWidget> mTypeSelector;
};
......
/*
* kalarmresource.cpp - Akonadi resource for KAlarm
* Program: kalarm
* Copyright © 2009-2014 by David Jarvie <djarvie@kde.org>
* Copyright © 2009-2019 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
......@@ -65,15 +65,6 @@ KAlarmResource::~KAlarmResource()
{
}
/******************************************************************************
* Save extra settings after the configuration dialog has been accepted.
*/
void KAlarmResource::applyConfigurationChanges()
{
mSettings->setAlarmTypes(CalEvent::mimeTypes(mTypeSelector->alarmType()));
mSettings->save();
}
/******************************************************************************
* Reimplemented to fetch collection attributes after creating the collection.
*/
......
/*
* kalarmresource.h - Akonadi resource for KAlarm
* Program: kalarm
* Copyright © 2009-2014 by David Jarvie <djarvie@kde.org>
* Copyright © 2009-2019 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
......@@ -57,20 +57,17 @@ private Q_SLOTS:
void updateFormat(KJob *);
void setCompatibility(KJob *);
protected:
void applyConfigurationChanges() override;
private:
void checkFileCompatibility(const Akonadi::Collection & = Akonadi::Collection(), bool createAttribute = false);
Akonadi::CollectionFetchJob *fetchCollection(const char *slot);
AlarmTypeRadioWidget *mTypeSelector = nullptr;
KACalendar::Compat mCompatibility;
KACalendar::Compat mFileCompatibility; // calendar file compatibility found by readFromFile()
int mVersion; // calendar format version
int mFileVersion; // calendar format version found by readFromFile()
bool mHaveReadFile; // the calendar file has been read
bool mFetchedAttributes; // attributes have been fetched after initialisation
KACalendar::Compat mFileCompatibility; // calendar file compatibility found by readFromFile()
int mVersion; // calendar format version
int mFileVersion; // calendar format version found by readFromFile()
bool mHaveReadFile; // the calendar file has been read
bool mFetchedAttributes; // attributes have been fetched after initialisation
};
#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