Allow creating Followup reminders through a DBus call to the agent

Summary:
The idea is for the client code to use this DBus method rather than writing to a shared
config file and triggering reload. This way it will be possible to get rid of the
intermediate libKF5FollowUpReminder library in kdepim-apps-libs.

Reviewers: mlaurent

Reviewed By: mlaurent

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D29622
wilder
Daniel Vrátil 6 years ago
parent 64e2f0826a
commit 05a7f93b38
No known key found for this signature in database
GPG Key ID: 4D69557AECB13683
  1. 15
      agents/followupreminderagent/followupreminderagent.cpp
  2. 1
      agents/followupreminderagent/followupreminderagent.h
  3. 9
      agents/followupreminderagent/followupremindermanager.cpp
  4. 1
      agents/followupreminderagent/followupremindermanager.h
  5. 9
      agents/followupreminderagent/org.freedesktop.Akonadi.FollowUpReminder.xml

@ -22,6 +22,8 @@
#include <FollowupReminder/FollowUpReminderUtil>
#include "followupreminderadaptor.h"
#include "followupreminderagentsettings.h"
#include <FollowupReminder/FollowUpReminderInfo>
#include <KMime/Message>
#include <AkonadiCore/ChangeRecorder>
@ -115,6 +117,19 @@ void FollowUpReminderAgent::reload()
}
}
void FollowUpReminderAgent::addReminder(const QString &messageId, Akonadi::Item::Id messageItemId, const QString &to, const QString &subject, const QDate &followupDate, Akonadi::Item::Id todoId)
{
auto info = new FollowUpReminder::FollowUpReminderInfo();
info->setMessageId(messageId);
info->setOriginalMessageItemId(messageItemId);
info->setTo(to);
info->setSubject(subject);
info->setFollowUpReminderDate(followupDate);
info->setTodoId(todoId);
mManager->addReminder(info);
}
QString FollowUpReminderAgent::printDebugInfo() const
{
return mManager->printDebugInfo();

@ -36,6 +36,7 @@ public:
public Q_SLOTS:
void reload();
void addReminder(const QString &messageId, Akonadi::Item::Id messageItemId, const QString &to, const QString &subject, const QDate &followupDate, Akonadi::Item::Id todoId);
protected:
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override;

@ -85,6 +85,15 @@ void FollowUpReminderManager::load(bool forceReloadConfig)
}
}
void FollowUpReminderManager::addReminder(FollowUpReminder::FollowUpReminderInfo *info)
{
if (info->isValid()) {
FollowUpReminderUtil::writeFollowupReminderInfo(FollowUpReminderUtil::defaultConfig(), info, true);
} else {
delete info;
}
}
void FollowUpReminderManager::slotReparseConfiguration()
{
load(true);

@ -36,6 +36,7 @@ public:
~FollowUpReminderManager();
void load(bool forceReloadConfig = false);
void addReminder(FollowUpReminder::FollowUpReminderInfo *reminder); // takes ownership
void checkFollowUp(const Akonadi::Item &item, const Akonadi::Collection &col);
Q_REQUIRED_RESULT QString printDebugInfo() const;

@ -11,5 +11,14 @@
<arg type="s" direction="out"/>
</method>
<method name="reload" />
<method name="addReminder">
<arg name="messageId" type="s" direction="in" />
<arg name="originalMessageItemId" type="x" direction="in" />
<arg name="to" type="s" direction="in" />
<arg name="subject" type="s" direction="in" />
<arg name="followupDate" type="(iii)" direction="in" />
<annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QDate" />
<arg name="todoId" type="x" direction="in" />
</method>
</interface>
</node>

Loading…
Cancel
Save