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

Fix some error messages not being displayed

parent c3b0d545
KAlarm Change Log
=== Version 2.14.0 (KDE Applications 20.04) --- 25 January 2020 ===
=== Version 2.14.0 (KDE Applications 20.04) --- 27 March 2020 ===
+ Warn user if archiving but no default archived alarms calendar is set.
+ Fix some error messages not being displayed.
+ Refactor to use generic resource classes (part 2).
=== Version 2.13.3 (KDE Applications 19.12.3) --- 20 February 2020 ===
......
......@@ -948,7 +948,7 @@ Resource& AkonadiDataModel::updateResource(const Collection& collection) const
/******************************************************************************
* Display a message to the user.
*/
void AkonadiDataModel::slotResourceMessage(Resource&, ResourceType::MessageType type, const QString& message, const QString& details)
void AkonadiDataModel::slotResourceMessage(ResourceType::MessageType type, const QString& message, const QString& details)
{
handleResourceMessage(type, message, details);
}
......
......@@ -97,7 +97,7 @@ public:
private Q_SLOTS:
/** Called when a resource notifies a message to display to the user. */
void slotResourceMessage(Resource&, ResourceType::MessageType, const QString& message, const QString& details);
void slotResourceMessage(ResourceType::MessageType, const QString& message, const QString& details);
Q_SIGNALS:
/** Signal emitted when the Akonadi server has stopped. */
......
/*
* eventmodel.cpp - model containing flat list of events
* Program: kalarm
* Copyright © 2007-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2007-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -266,8 +266,8 @@ QVariant AlarmListModel::headerData(int section, Qt::Orientation orientation, in
/*=============================================================================
= Class: TemplateListModel
= Filter proxy model containing all alarm templates for specified alarm types
= in enabled resources.
= Filter proxy model containing all alarm templates, optionally for specified
= alarm action types (display, email, etc.) in enabled resources.
=============================================================================*/
TemplateListModel* TemplateListModel::mAllInstance = nullptr;
......
/*
* eventmodel.h - model containing flat list of events
* Program: kalarm
* Copyright © 2010-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2010-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -161,8 +161,8 @@ private:
/*=============================================================================
= Class: TemplateListModel
= Filter proxy model containing all alarm templates for specified alarm types
= in enabled resources.
= Filter proxy model containing all alarm templates, optionally for specified
= alarm action types (display, email, etc.) in enabled resources.
=============================================================================*/
class TemplateListModel : public EventListModel
{
......
......@@ -222,8 +222,7 @@ QVariant ResourceListModel::data(const QModelIndex& index, int role) const
/*=============================================================================
= Class: ResourceCheckListModel
= Proxy model providing a checkable list of all Resources. A Resource's
= checked status is equivalent to whether it is selected or not.
= Proxy model providing a checkable list of all Resources.
= An alarm type is specified, whereby Resources which are enabled for that
= alarm type are checked; Resources which do not contain that alarm type, or
= which are disabled for that alarm type, are unchecked.
......@@ -457,9 +456,8 @@ QByteArray ResourceCheckListModel::debugType(const char* func) const
/*=============================================================================
= Class: ResourceFilterCheckListModel
= Proxy model providing a checkable resource list. The model contains all
= alarm types, but returns only one type at any given time. The selected alarm
= type may be changed as desired.
= Proxy model providing a checkable resource list, filtered to contain only one
= alarm type. The selected alarm type may be changed as desired.
=============================================================================*/
ResourceFilterCheckListModel::ResourceFilterCheckListModel(QObject* parent)
: QSortFilterProxyModel(parent)
......
/*
* resourcemodel.h - models containing flat list of resources
* Program: kalarm
* Copyright © 2010-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2010-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -133,8 +133,7 @@ private:
/*=============================================================================
= Class: ResourceCheckListModel
= Proxy model providing a checkable list of all Resources. A Resource's
= checked status is equivalent to whether it is selected or not.
= Proxy model providing a checkable list of all Resources.
= An alarm type is specified, whereby Resources which are enabled for that
= alarm type are checked; Resources which do not contain that alarm type, or
= which are disabled for that alarm type, are unchecked.
......@@ -182,9 +181,8 @@ private:
/*=============================================================================
= Class: ResourceFilterCheckListModel
= Proxy model providing a checkable resource list. The model contains all
= alarm types, but returns only one type at any given time. The selected alarm
= type may be changed as desired.
= Proxy model providing a checkable resource list, filtered to contain only one
= alarm type. The selected alarm type may be changed as desired.
=============================================================================*/
class ResourceFilterCheckListModel : public QSortFilterProxyModel
{
......
......@@ -49,6 +49,7 @@ Resources* Resources::instance()
Resources::Resources()
{
qRegisterMetaType<ResourceType::MessageType>();
}
Resources::~Resources()
......@@ -518,9 +519,8 @@ void Resources::notifyResourceMessage(ResourceType* res, ResourceType::MessageTy
void Resources::notifyResourceMessage(ResourceId id, ResourceType::MessageType type, const QString& message, const QString& details)
{
Resource r = resource(id);
if (r.isValid())
Q_EMIT instance()->resourceMessage(r, type, message, details);
if (resource(id).isValid())
Q_EMIT instance()->resourceMessage(type, message, details);
}
void Resources::notifyEventsAdded(ResourceType* res, const QList<KAEvent>& events)
......
......@@ -220,7 +220,7 @@ Q_SIGNALS:
* @note Connections to this signal should use Qt::QueuedConnection type
* to allow processing to continue while the user message is displayed.
*/
void resourceMessage(Resource&, ResourceType::MessageType, const QString& message, const QString& details);
void resourceMessage(ResourceType::MessageType, const QString& message, const QString& details);
/** Emitted when events have been added to a resource.
* Events are only notified whose alarm type is enabled.
......
......@@ -458,6 +458,8 @@ private:
bool mBeingDeleted {false}; // the resource is currently being deleted
};
Q_DECLARE_METATYPE(ResourceType::MessageType)
/*=============================================================================
* Template definitions.
......
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