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

Merge branch 'release/20.08'

parents e956ee21 41a04389
Pipeline #36263 passed with stage
in 13 minutes and 36 seconds
......@@ -3,7 +3,7 @@ KAlarm Change Log
=== Version 3.1.0 (KDE Applications 20.12) --- 24 September 2020 ===
+ Add option to show alarm message as a notification instead of in a window [KDE Bug 345922]
=== Version 3.0.2 (KDE Applications 20.08.2) --- 28 September 2020 ===
=== Version 3.0.2 (KDE Applications 20.08.2) --- 3 October 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.
......@@ -11,6 +11,7 @@ KAlarm Change Log
+ Display alarms in time order on startup (fixes regression).
+ Allow alarm list and template list to be sorted by clicking headers.
+ Fix inability to edit an existing calendar resource's configuration.
+ Fix memory leaks.
=== Version 3.0.1 (KDE Applications 20.08.1) --- 24 August 2020 ===
+ Fix inability to create alarms from templates, or load templates in edit dialogue [KDE Bug 425751]
......
......@@ -41,6 +41,7 @@ void SynchTimer::connecT(QObject* receiver, const char* member)
return; // the slot is already connected, so ignore request
connect(mTimer, SIGNAL(timeout()), receiver, member);
mConnections.append(connection);
connect(receiver, &QObject::destroyed, this, &SynchTimer::slotReceiverGone);
if (!mTimer->isActive())
{
connect(mTimer, &QTimer::timeout, this, &SynchTimer::slotTimer);
......@@ -145,11 +146,18 @@ DailyTimer* DailyTimer::fixedInstance(const QTime& timeOfDay, bool create)
void DailyTimer::disconnect(const QTime& timeOfDay, QObject* receiver, const char* member)
{
DailyTimer* timer = fixedInstance(timeOfDay, false);
if (!timer)
return;
timer->disconnecT(receiver, member);
if (!timer->hasConnections())
delete timer;
if (timer)
timer->disconnecT(receiver, member);
}
/******************************************************************************
* Disconnect from the timer. The timer is deleted if no longer used.
*/
void DailyTimer::disconnecT(QObject* receiver, const char* member)
{
SynchTimer::disconnecT(receiver, member);
if (!hasConnections())
deleteLater();
}
/******************************************************************************
......
......@@ -44,7 +44,7 @@ protected:
SynchTimer();
virtual void start() = 0;
void connecT(QObject* receiver, const char* member);
void disconnecT(QObject* receiver, const char* member = nullptr);
virtual void disconnecT(QObject* receiver, const char* member = nullptr);
bool hasConnections() const { return !mConnections.isEmpty(); }
QTimer* mTimer;
......@@ -130,6 +130,16 @@ public:
*/
static void disconnect(const QTime& timeOfDay, QObject* receiver, const char* member = nullptr);
protected:
/** Construct an instance.
* The constructor is protected to ensure that for variable timers, only
* derived classes can construct instances. This ensures that multiple
* timers are not created for the same use.
*/
DailyTimer(const QTime&, bool fixed);
void disconnecT(QObject* receiver, const char* member = nullptr) override;
/** Change the time at which this variable timer triggers.
* @param newTimeOfDay New time at which the timer should trigger.
* @param triggerMissed If true, and if @p newTimeOfDay < @p oldTimeOfDay, and if the current
......@@ -141,14 +151,6 @@ public:
/** Return the current time of day at which this variable timer triggers. */
QTime timeOfDay() const { return mTime; }
protected:
/** Construct an instance.
* The constructor is protected to ensure that for variable timers, only
* derived classes can construct instances. This ensures that multiple
* timers are not created for the same use.
*/
DailyTimer(const QTime&, bool fixed);
/** Return the instance which triggers at the specified fixed time of day,
* optionally creating a new instance if necessary.
* @param timeOfDay Time at which the timer triggers.
......
......@@ -85,7 +85,7 @@ FileResourceDataModel::FileResourceDataModel(QObject* parent)
connect(resources, &Resources::resourcePopulated,
this, &FileResourceDataModel::slotResourceLoaded);
connect(resources, &Resources::resourceToBeRemoved,
this, &FileResourceDataModel::slotRemoveResource);
this, &FileResourceDataModel::removeResource);
connect(resources, &Resources::eventsAdded,
this, &FileResourceDataModel::slotEventsAdded);
connect(resources, &Resources::eventUpdated,
......@@ -128,6 +128,8 @@ FileResourceDataModel::~FileResourceDataModel()
mInstance = nullptr;
mInstanceIsOurs = false;
}
while (!mResources.isEmpty())
removeResource(mResources.first());
delete Resources::instance();
}
......@@ -622,18 +624,21 @@ void FileResourceDataModel::addResource(Resource& resource)
* slotResourceSettingsChanged(Deleted) being triggered, leading to crashes when
* data from the resource's events is fetched.
*/
void FileResourceDataModel::slotRemoveResource(Resource& resource)
void FileResourceDataModel::removeResource(Resource& resource)
{
qCDebug(KALARM_LOG) << "FileResourceDataModel::slotRemoveResource" << resource.displayName();
qCDebug(KALARM_LOG) << "FileResourceDataModel::removeResource" << resource.displayName();
int row = mResources.indexOf(resource);
if (row < 0)
return;
Resource r(resource); // in case 'resource' is a reference to the copy in mResources
int count = 0;
beginRemoveRows(QModelIndex(), row, row);
mResources.removeAt(row);
mResourceNodes[Resource()].removeAt(row);
auto it = mResourceNodes.find(resource);
QVector<Node*>& resourceNodes = mResourceNodes[Resource()];
delete resourceNodes.at(row);
resourceNodes.removeAt(row);
auto it = mResourceNodes.find(r);
if (it != mResourceNodes.end())
{
count = removeResourceEvents(it.value());
......
......@@ -114,7 +114,7 @@ private Q_SLOTS:
void addResource(Resource&);
void slotResourceLoaded(Resource&);
void slotResourceSettingsChanged(Resource&, ResourceType::Changes);
void slotRemoveResource(Resource&);
void removeResource(Resource&);
void slotEventsAdded(Resource&, const QList<KAEvent>&);
void slotEventUpdated(Resource&, const KAEvent&);
bool deleteEvents(Resource&, const QList<KAEvent>&);
......
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