diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,6 @@ find_package(KF5KontactInterface ${KONTACTINTERFACE_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) -find_package(KF5FollowupReminder ${KDEPIM_APPS_LIB_VERSION_LIB} CONFIG REQUIRED) find_package(KF5Gravatar ${LIBGRAVATAR_VERSION_LIB} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION_LIB} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION_LIB} CONFIG REQUIRED) diff --git a/agents/followupreminderagent/CMakeLists.txt b/agents/followupreminderagent/CMakeLists.txt --- a/agents/followupreminderagent/CMakeLists.txt +++ b/agents/followupreminderagent/CMakeLists.txt @@ -10,9 +10,16 @@ followupremindermanager.cpp followupremindernoanswerdialog.cpp followupreminderinfowidget.cpp + followupreminderinfo.cpp + followupreminderutil.cpp ${followupreminderagent_job_SRCS} ) + +kconfig_add_kcfg_files(followupreminderagent_SRCS + followupreminderagentsettings.kcfgc + ) + ecm_qt_declare_logging_category(followupreminderagent_SRCS HEADER followupreminderagent_debug.h IDENTIFIER FOLLOWUPREMINDERAGENT_LOG CATEGORY_NAME org.kde.pim.followupreminderagent DESCRIPTION "kmail (followupreminderagent)" OLD_CATEGORY_NAMES log_followupreminderagent @@ -45,18 +52,14 @@ ########################### Agent executable ################################ add_executable(akonadi_followupreminder_agent followupreminderagent.cpp) - - - target_link_libraries(akonadi_followupreminder_agent followupreminderagent KF5::AkonadiCore KF5::AkonadiMime KF5::AkonadiAgentBase KF5::Mime KF5::CalendarCore KF5::DBusAddons - KF5::FollowupReminder Qt5::Widgets KF5::Notifications KF5::I18n @@ -96,5 +99,4 @@ KF5::AkonadiCore KF5::XmlGui KF5::I18n - KF5::FollowupReminder ) diff --git a/agents/followupreminderagent/autotests/CMakeLists.txt b/agents/followupreminderagent/autotests/CMakeLists.txt --- a/agents/followupreminderagent/autotests/CMakeLists.txt +++ b/agents/followupreminderagent/autotests/CMakeLists.txt @@ -7,12 +7,12 @@ # Convenience macro to add unit tests. macro( followupreminder_agent _source ) - set( _test ${_source} ../followupreminderinfowidget.cpp ../jobs/followupremindershowmessagejob.cpp ../followupremindernoanswerdialog.cpp ${followupreminderagent_test_SRCS} ${autotest_categories_followupreminderagent_SRCS}) + set( _test ${_source} ${followupreminderagent_test_SRCS} ${autotest_categories_followupreminderagent_SRCS}) get_filename_component( _name ${_source} NAME_WE ) ecm_add_test(${_test} TEST_NAME ${_name} NAME_PREFIX "followupreminder-" - LINK_LIBRARIES Qt5::Test KF5::AkonadiCore KF5::FollowupReminder Qt5::Widgets KF5::I18n KF5::XmlGui KF5::Service + LINK_LIBRARIES followupreminderagent Qt5::Test KF5::AkonadiCore Qt5::Widgets KF5::I18n KF5::XmlGui KF5::Service ) endmacro() diff --git a/agents/followupreminderagent/autotests/followupreminderconfigtest.cpp b/agents/followupreminderagent/autotests/followupreminderconfigtest.cpp --- a/agents/followupreminderagent/autotests/followupreminderconfigtest.cpp +++ b/agents/followupreminderagent/autotests/followupreminderconfigtest.cpp @@ -18,8 +18,9 @@ */ #include "followupreminderconfigtest.h" -#include -#include +#include "../followupreminderutil.h" +#include "../followupreminderinfo.h" + #include #include #include diff --git a/agents/followupreminderagent/autotests/followupreminderinfotest.cpp b/agents/followupreminderagent/autotests/followupreminderinfotest.cpp --- a/agents/followupreminderagent/autotests/followupreminderinfotest.cpp +++ b/agents/followupreminderagent/autotests/followupreminderinfotest.cpp @@ -18,7 +18,8 @@ */ #include "followupreminderinfotest.h" -#include +#include "../followupreminderinfo.h" + #include #include #include diff --git a/agents/followupreminderagent/autotests/followupremindernoanswerdialogtest.cpp b/agents/followupreminderagent/autotests/followupremindernoanswerdialogtest.cpp --- a/agents/followupreminderagent/autotests/followupremindernoanswerdialogtest.cpp +++ b/agents/followupreminderagent/autotests/followupremindernoanswerdialogtest.cpp @@ -20,7 +20,8 @@ #include "followupremindernoanswerdialogtest.h" #include "../followupremindernoanswerdialog.h" #include "../followupreminderinfowidget.h" -#include +#include "../followupreminderinfo.h" + #include #include #include diff --git a/agents/followupreminderagent/followupreminderagent.cpp b/agents/followupreminderagent/followupreminderagent.cpp --- a/agents/followupreminderagent/followupreminderagent.cpp +++ b/agents/followupreminderagent/followupreminderagent.cpp @@ -19,10 +19,10 @@ #include "followupreminderagent.h" #include "followupremindermanager.h" -#include +#include "followupreminderutil.h" #include "followupreminderadaptor.h" #include "followupreminderagentsettings.h" -#include +#include "followupreminderinfo.h" #include diff --git a/agents/followupreminderagent/followupreminderagentsettings.kcfg b/agents/followupreminderagent/followupreminderagentsettings.kcfg new file mode 100644 --- /dev/null +++ b/agents/followupreminderagent/followupreminderagentsettings.kcfg @@ -0,0 +1,12 @@ + + + + + + true + + + diff --git a/agents/followupreminderagent/followupreminderagentsettings.kcfgc b/agents/followupreminderagent/followupreminderagentsettings.kcfgc new file mode 100644 --- /dev/null +++ b/agents/followupreminderagent/followupreminderagentsettings.kcfgc @@ -0,0 +1,6 @@ +# Code generation options for kconfig_compiler +File=followupreminderagentsettings.kcfg +ClassName=FollowUpReminderAgentSettings +Singleton=true +Mutators=true + diff --git a/agents/followupreminderagent/followupreminderinfo.h b/agents/followupreminderagent/followupreminderinfo.h new file mode 100644 --- /dev/null +++ b/agents/followupreminderagent/followupreminderinfo.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2014-2020 Laurent Montel + + 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 the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef FOLLOWUPREMINDERINFO_H +#define FOLLOWUPREMINDERINFO_H + +#include +#include + +class KConfigGroup; +namespace FollowUpReminder { + +/** Follow up reminder information. */ +class FollowUpReminderInfo +{ +public: + FollowUpReminderInfo(); + FollowUpReminderInfo(const KConfigGroup &config); + FollowUpReminderInfo(const FollowUpReminderInfo &info); + + //Can be invalid. + Q_REQUIRED_RESULT Akonadi::Item::Id originalMessageItemId() const; + void setOriginalMessageItemId(Akonadi::Item::Id value); + + Q_REQUIRED_RESULT Akonadi::Item::Id todoId() const; + void setTodoId(Akonadi::Item::Id value); + + Q_REQUIRED_RESULT bool isValid() const; + + Q_REQUIRED_RESULT QString messageId() const; + void setMessageId(const QString &messageId); + + void setTo(const QString &to); + Q_REQUIRED_RESULT QString to() const; + + Q_REQUIRED_RESULT QDate followUpReminderDate() const; + void setFollowUpReminderDate(const QDate &followUpReminderDate); + + void writeConfig(KConfigGroup &config, qint32 identifier); + + Q_REQUIRED_RESULT QString subject() const; + void setSubject(const QString &subject); + + bool operator ==(const FollowUpReminderInfo &other) const; + + Q_REQUIRED_RESULT bool answerWasReceived() const; + void setAnswerWasReceived(bool answerWasReceived); + + Q_REQUIRED_RESULT Akonadi::Item::Id answerMessageItemId() const; + void setAnswerMessageItemId(Akonadi::Item::Id answerMessageItemId); + + Q_REQUIRED_RESULT qint32 uniqueIdentifier() const; + void setUniqueIdentifier(qint32 uniqueIdentifier); + +private: + void readConfig(const KConfigGroup &config); + Akonadi::Item::Id mOriginalMessageItemId = -1; + Akonadi::Item::Id mAnswerMessageItemId = -1; + Akonadi::Item::Id mTodoId = -1; + QString mMessageId; + QDate mFollowUpReminderDate; + QString mTo; + QString mSubject; + qint32 mUniqueIdentifier = -1; + bool mAnswerWasReceived = false; +}; +} + +QDebug operator<<(QDebug debug, const FollowUpReminder::FollowUpReminderInfo &info); + +#endif // FOLLOWUPREMINDERINFO_H diff --git a/agents/followupreminderagent/followupreminderinfo.cpp b/agents/followupreminderagent/followupreminderinfo.cpp new file mode 100644 --- /dev/null +++ b/agents/followupreminderagent/followupreminderinfo.cpp @@ -0,0 +1,201 @@ +/* + Copyright (C) 2014-2020 Laurent Montel + + 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 the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "followupreminderinfo.h" + +#include +using namespace FollowUpReminder; + +FollowUpReminderInfo::FollowUpReminderInfo() +{ +} + +FollowUpReminderInfo::FollowUpReminderInfo(const KConfigGroup &config) +{ + readConfig(config); +} + +FollowUpReminderInfo::FollowUpReminderInfo(const FollowUpReminderInfo &info) +{ + mFollowUpReminderDate = info.followUpReminderDate(); + mOriginalMessageItemId = info.originalMessageItemId(); + mMessageId = info.messageId(); + mTo = info.to(); + mSubject = info.subject(); + mAnswerWasReceived = info.answerWasReceived(); + mAnswerMessageItemId = info.answerMessageItemId(); + mUniqueIdentifier = info.uniqueIdentifier(); + mTodoId = info.todoId(); +} + +void FollowUpReminderInfo::readConfig(const KConfigGroup &config) +{ + if (config.hasKey(QStringLiteral("followUpReminderDate"))) { + mFollowUpReminderDate = QDate::fromString(config.readEntry("followUpReminderDate"), Qt::ISODate); + } + mOriginalMessageItemId = config.readEntry("itemId", -1); + mMessageId = config.readEntry("messageId", QString()); + mTo = config.readEntry("to", QString()); + mSubject = config.readEntry("subject", QString()); + mAnswerWasReceived = config.readEntry("answerWasReceived", false); + mAnswerMessageItemId = config.readEntry("answerMessageItemId", -1); + mTodoId = config.readEntry("todoId", -1); + mUniqueIdentifier = config.readEntry("identifier", -1); +} + +qint32 FollowUpReminderInfo::uniqueIdentifier() const +{ + return mUniqueIdentifier; +} + +void FollowUpReminderInfo::setUniqueIdentifier(qint32 uniqueIdentifier) +{ + mUniqueIdentifier = uniqueIdentifier; +} + +Akonadi::Item::Id FollowUpReminderInfo::answerMessageItemId() const +{ + return mAnswerMessageItemId; +} + +void FollowUpReminderInfo::setAnswerMessageItemId(Akonadi::Item::Id answerMessageId) +{ + mAnswerMessageItemId = answerMessageId; +} + +bool FollowUpReminderInfo::answerWasReceived() const +{ + return mAnswerWasReceived; +} + +void FollowUpReminderInfo::setAnswerWasReceived(bool answerWasReceived) +{ + mAnswerWasReceived = answerWasReceived; +} + +QString FollowUpReminderInfo::subject() const +{ + return mSubject; +} + +void FollowUpReminderInfo::setSubject(const QString &subject) +{ + mSubject = subject; +} + +void FollowUpReminderInfo::writeConfig(KConfigGroup &config, qint32 identifier) +{ + if (mFollowUpReminderDate.isValid()) { + config.writeEntry("followUpReminderDate", mFollowUpReminderDate.toString(Qt::ISODate)); + } + setUniqueIdentifier(identifier); + config.writeEntry("messageId", mMessageId); + config.writeEntry("itemId", mOriginalMessageItemId); + config.writeEntry("to", mTo); + config.writeEntry("subject", mSubject); + config.writeEntry("answerWasReceived", mAnswerWasReceived); + config.writeEntry("answerMessageItemId", mAnswerMessageItemId); + config.writeEntry("todoId", mTodoId); + config.writeEntry("identifier", identifier); + config.sync(); +} + +Akonadi::Item::Id FollowUpReminderInfo::originalMessageItemId() const +{ + return mOriginalMessageItemId; +} + +void FollowUpReminderInfo::setOriginalMessageItemId(Akonadi::Item::Id value) +{ + mOriginalMessageItemId = value; +} + +Akonadi::Item::Id FollowUpReminderInfo::todoId() const +{ + return mTodoId; +} + +void FollowUpReminderInfo::setTodoId(Akonadi::Item::Id value) +{ + mTodoId = value; +} + +bool FollowUpReminderInfo::isValid() const +{ + return !mMessageId.isEmpty() + && mFollowUpReminderDate.isValid() + && !mTo.isEmpty(); +} + +QString FollowUpReminderInfo::messageId() const +{ + return mMessageId; +} + +void FollowUpReminderInfo::setMessageId(const QString &messageId) +{ + mMessageId = messageId; +} + +void FollowUpReminderInfo::setTo(const QString &to) +{ + mTo = to; +} + +QString FollowUpReminderInfo::to() const +{ + return mTo; +} + +QDate FollowUpReminderInfo::followUpReminderDate() const +{ + return mFollowUpReminderDate; +} + +void FollowUpReminderInfo::setFollowUpReminderDate(const QDate &followUpReminderDate) +{ + mFollowUpReminderDate = followUpReminderDate; +} + +bool FollowUpReminderInfo::operator==(const FollowUpReminderInfo &other) const +{ + return mOriginalMessageItemId == other.originalMessageItemId() + && mMessageId == other.messageId() + && mTo == other.to() + && mFollowUpReminderDate == other.followUpReminderDate() + && mSubject == other.subject() + && mAnswerWasReceived == other.answerWasReceived() + && mAnswerMessageItemId == other.answerMessageItemId() + && mUniqueIdentifier == other.uniqueIdentifier() + && mTodoId == other.todoId(); +} + +QDebug operator<<(QDebug d, const FollowUpReminderInfo &other) +{ + d << "mOriginalMessageItemId: " << other.originalMessageItemId(); + d << "mMessageId: " << other.messageId(); + d << "mTo: " << other.to(); + d << "mFollowUpReminderDate: " << other.followUpReminderDate(); + d << "mSubject: " << other.subject(); + d << "mAnswerWasReceived: " << other.answerWasReceived(); + d << "mAnswerMessageItemId: " << other.answerMessageItemId(); + d << "mUniqueIdentifier: " << other.uniqueIdentifier(); + d << "mTodoId: " << other.todoId(); + + return d; +} diff --git a/agents/followupreminderagent/followupreminderinfowidget.cpp b/agents/followupreminderagent/followupreminderinfowidget.cpp --- a/agents/followupreminderagent/followupreminderinfowidget.cpp +++ b/agents/followupreminderagent/followupreminderinfowidget.cpp @@ -17,8 +17,8 @@ Boston, MA 02110-1301, USA. */ #include "followupreminderinfowidget.h" -#include -#include +#include "followupreminderinfo.h" +#include "followupreminderutil.h" #include "jobs/followupremindershowmessagejob.h" #include "followupreminderagent_debug.h" @@ -108,7 +108,7 @@ void FollowUpReminderInfoWidget::load() { - KSharedConfig::Ptr config = KSharedConfig::openConfig(); + auto config = FollowUpReminder::FollowUpReminderUtil::defaultConfig(); const QStringList filterGroups = config->groupList().filter(QRegularExpression(followUpItemPattern())); const int numberOfItem = filterGroups.count(); for (int i = 0; i < numberOfItem; ++i) { diff --git a/agents/followupreminderagent/followupremindermanager.cpp b/agents/followupreminderagent/followupremindermanager.cpp --- a/agents/followupreminderagent/followupremindermanager.cpp +++ b/agents/followupreminderagent/followupremindermanager.cpp @@ -19,11 +19,12 @@ #include "followupremindermanager.h" #include "followupreminderagent_debug.h" -#include -#include +#include "followupreminderinfo.h" +#include "followupreminderutil.h" #include "followupremindernoanswerdialog.h" #include "jobs/followupreminderjob.h" #include "jobs/followupreminderfinishtaskjob.h" + #include #include diff --git a/agents/followupreminderagent/followupremindernoanswerdialog.cpp b/agents/followupreminderagent/followupremindernoanswerdialog.cpp --- a/agents/followupreminderagent/followupremindernoanswerdialog.cpp +++ b/agents/followupreminderagent/followupremindernoanswerdialog.cpp @@ -19,10 +19,9 @@ #include "followupremindernoanswerdialog.h" #include "followupreminderinfowidget.h" +#include "followupreminderinfo.h" #include "followupreminderagent_debug.h" -#include - #include #include diff --git a/agents/followupreminderagent/followupreminderutil.h b/agents/followupreminderagent/followupreminderutil.h new file mode 100644 --- /dev/null +++ b/agents/followupreminderagent/followupreminderutil.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2014-2020 Laurent Montel + + 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 the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef FOLLOWUPREMINDERUTIL_H +#define FOLLOWUPREMINDERUTIL_H + +#include + +namespace FollowUpReminder { +class FollowUpReminderInfo; + +/** Follow up reminder utilities. */ +namespace FollowUpReminderUtil { +Q_REQUIRED_RESULT bool followupReminderAgentWasRegistered(); + +Q_REQUIRED_RESULT bool followupReminderAgentEnabled(); + +void reload(); + +void forceReparseConfiguration(); + +KSharedConfig::Ptr defaultConfig(); + +void writeFollowupReminderInfo(KSharedConfig::Ptr config, FollowUpReminder::FollowUpReminderInfo *info, bool forceReload); + +Q_REQUIRED_RESULT bool removeFollowupReminderInfo(KSharedConfig::Ptr config, const QList &listRemove, bool forceReload = false); + +Q_REQUIRED_RESULT QString followUpReminderPattern(); + +} +} + +#endif // FOLLOWUPREMINDERUTIL_H diff --git a/agents/followupreminderagent/followupreminderutil.cpp b/agents/followupreminderagent/followupreminderutil.cpp new file mode 100644 --- /dev/null +++ b/agents/followupreminderagent/followupreminderutil.cpp @@ -0,0 +1,140 @@ +/* + Copyright (C) 2014-2020 Laurent Montel + + 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 the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "followupreminderutil.h" +#include "followupreminderinfo.h" +#include + +#include +#include "followupreminderagentsettings.h" + +namespace { +QString serviceName() +{ + return Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent, + QStringLiteral("akonadi_followupreminder_agent")); +} + +QString dbusPath() +{ + return QStringLiteral("/FollowUpReminder"); +} +} + +bool FollowUpReminder::FollowUpReminderUtil::followupReminderAgentWasRegistered() +{ + QDBusInterface interface(serviceName(), dbusPath()); + return interface.isValid(); +} + +bool FollowUpReminder::FollowUpReminderUtil::followupReminderAgentEnabled() +{ + return FollowUpReminderAgentSettings::self()->enabled(); +} + +void FollowUpReminder::FollowUpReminderUtil::reload() +{ + QDBusInterface interface(serviceName(), dbusPath()); + if (interface.isValid()) { + interface.call(QStringLiteral("reload")); + } +} + +void FollowUpReminder::FollowUpReminderUtil::forceReparseConfiguration() +{ + FollowUpReminderAgentSettings::self()->save(); + FollowUpReminderAgentSettings::self()->config()->reparseConfiguration(); +} + +KSharedConfig::Ptr FollowUpReminder::FollowUpReminderUtil::defaultConfig() +{ + return KSharedConfig::openConfig(QStringLiteral("akonadi_followupreminder_agentrc"), KConfig::SimpleConfig); +} + +void FollowUpReminder::FollowUpReminderUtil::writeFollowupReminderInfo(KSharedConfig::Ptr config, FollowUpReminder::FollowUpReminderInfo *info, bool forceReload) +{ + if (!info || !info->isValid()) { + return; + } + + KConfigGroup general = config->group(QStringLiteral("General")); + int value = general.readEntry("Number", 0); + int identifier = info->uniqueIdentifier(); + if (identifier == -1) { + identifier = value; + } + ++value; + + const QString groupName = FollowUpReminder::FollowUpReminderUtil::followUpReminderPattern().arg(identifier); + // first, delete all filter groups: + const QStringList filterGroups = config->groupList(); + for (const QString &group : filterGroups) { + if (group == groupName) { + config->deleteGroup(group); + } + } + KConfigGroup group = config->group(groupName); + info->writeConfig(group, identifier); + + general.writeEntry("Number", value); + + config->sync(); + config->reparseConfiguration(); + if (forceReload) { + reload(); + } +} + +bool FollowUpReminder::FollowUpReminderUtil::removeFollowupReminderInfo(KSharedConfig::Ptr config, const QList &listRemove, bool forceReload) +{ + if (listRemove.isEmpty()) { + return false; + } + + bool needSaveConfig = false; + KConfigGroup general = config->group(QStringLiteral("General")); + int value = general.readEntry("Number", 0); + + for (qint32 identifier : listRemove) { + const QString groupName = FollowUpReminder::FollowUpReminderUtil::followUpReminderPattern().arg(identifier); + const QStringList filterGroups = config->groupList(); + for (const QString &group : filterGroups) { + if (group == groupName) { + config->deleteGroup(group); + --value; + needSaveConfig = true; + } + } + } + if (needSaveConfig) { + general.writeEntry("Number", value); + + config->sync(); + config->reparseConfiguration(); + if (forceReload) { + reload(); + } + } + return needSaveConfig; +} + +QString FollowUpReminder::FollowUpReminderUtil::followUpReminderPattern() +{ + return QStringLiteral("FollowupReminderItem %1"); +} diff --git a/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.cpp b/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.cpp --- a/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.cpp +++ b/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.cpp @@ -18,11 +18,12 @@ */ #include "followupreminderfinishtaskjob.h" -#include +#include "followupreminderinfo.h" +#include "followupreminderagent_debug.h" + #include #include #include -#include "followupreminderagent_debug.h" #include FollowUpReminderFinishTaskJob::FollowUpReminderFinishTaskJob(Akonadi::Item::Id id, QObject *parent) diff --git a/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml b/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml --- a/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml +++ b/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml @@ -14,5 +14,16 @@ + + + + + + + + + + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -348,7 +348,6 @@ KF5::PimTextEdit KF5::MessageViewer KF5::SendLater - KF5::FollowupReminder KF5::IconThemes KF5::XmlGui KF5::Completion diff --git a/src/autotests/CMakeLists.txt b/src/autotests/CMakeLists.txt --- a/src/autotests/CMakeLists.txt +++ b/src/autotests/CMakeLists.txt @@ -20,7 +20,7 @@ set( kmail_createfollowupreminderonexistingmessagejobtest_source createfollowupreminderonexistingmessagejobtest.cpp ../job/createfollowupreminderonexistingmessagejob.cpp ../kmail_debug.cpp) add_executable( createfollowupreminderonexistingmessagejobtest ${kmail_createfollowupreminderonexistingmessagejobtest_source}) ecm_mark_as_test(kmail_createfollowupreminderonexistingmessagejobtest) -target_link_libraries( createfollowupreminderonexistingmessagejobtest Qt5::Test Qt5::Widgets KF5::AkonadiCore KF5::CalendarCore KF5::Mime KF5::FollowupReminder KF5::MessageComposer) +target_link_libraries( createfollowupreminderonexistingmessagejobtest Qt5::Test Qt5::Widgets KF5::AkonadiCore KF5::CalendarCore KF5::Mime KF5::MessageComposer) set( kmail_cryptostateindicatorwidgettest_source cryptostateindicatorwidgettest.cpp ../editor/widgets/cryptostateindicatorwidget.cpp) diff --git a/src/editor/kmcomposerwin.cpp b/src/editor/kmcomposerwin.cpp --- a/src/editor/kmcomposerwin.cpp +++ b/src/editor/kmcomposerwin.cpp @@ -67,8 +67,6 @@ #include #include -#include - #include #include @@ -87,6 +85,7 @@ #include #include +#include #ifndef QT_NO_CURSOR #include @@ -111,6 +110,7 @@ #include #include #include +#include #include #include #include @@ -1386,7 +1386,7 @@ mFollowUpToggleAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("appointment-new")), i18n("Create Follow Up Reminder..."), this); actionCollection()->addAction(QStringLiteral("follow_up_mail"), mFollowUpToggleAction); connect(mFollowUpToggleAction, &KToggleAction::triggered, this, &KMComposerWin::slotFollowUpMail); - mFollowUpToggleAction->setEnabled(FollowUpReminder::FollowUpReminderUtil::followupReminderAgentEnabled()); + mFollowUpToggleAction->setEnabled(MessageComposer::FollowUpReminder::isAvailableAndEnabled()); mPluginEditorManagerInterface->initializePlugins(); mPluginEditorCheckBeforeSendManagerInterface->initializePlugins();