Verified Commit 4d1b1131 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Kill libKF5FollowupReminder library

The code has been dissolved partially into messagecomposer and
partially into the FollowUp Reminder Agent in KMail.
parent f2c9027d
......@@ -71,7 +71,6 @@ endif()
add_definitions(-DQT_NO_FOREACH)
add_definitions(-DQT_NO_KEYWORDS)
add_subdirectory(libfollowupreminder)
add_subdirectory(libsendlater)
add_subdirectory(kaddressbookgrantlee)
add_subdirectory(kaddressbookimportexport)
......
ecm_setup_version(PROJECT VARIABLE_PREFIX FOLLOWUPREMINDER
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/followupreminder_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5FollowupReminderConfigVersion.cmake"
SOVERSION 5
)
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5FollowupReminder")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5FollowupReminderConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5FollowupReminderConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5FollowupReminderConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5FollowupReminderConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KF5FollowupReminderTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5FollowupReminderTargets.cmake NAMESPACE KF5::)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/followupreminder_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)
add_subdirectory(src)
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/KF5FollowupReminderTargets.cmake")
add_definitions(-DTRANSLATION_DOMAIN=\"libfollowupreminder\")
set(followupreminderlib_SRCS
followupreminderinfo.cpp
followupreminderutil.cpp
)
kconfig_add_kcfg_files(followupreminderlib_SRCS
settings/followupreminderagentsettings.kcfgc
)
add_library( KF5FollowupReminder ${followupreminderlib_SRCS} )
generate_export_header(KF5FollowupReminder BASE_NAME followupreminder)
add_library(KF5::FollowupReminder ALIAS KF5FollowupReminder)
target_link_libraries(KF5FollowupReminder
PRIVATE
KF5::ConfigGui
KF5::CoreAddons
Qt5::DBus
KF5::AkonadiCore
)
target_include_directories(KF5FollowupReminder INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/FollowupReminder/;${KDE_INSTALL_INCLUDEDIR_KF5}/followupreminder>")
set_target_properties(KF5FollowupReminder PROPERTIES
VERSION ${FOLLOWUPREMINDER_VERSION_STRING}
SOVERSION ${FOLLOWUPREMINDER_SOVERSION}
EXPORT_NAME FollowupReminder
)
install(TARGETS
KF5FollowupReminder
EXPORT KF5FollowupReminderTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)
ecm_generate_headers(FollowupReminder_Camelcase_HEADERS
HEADER_NAMES
FollowUpReminderInfo
FollowUpReminderUtil
REQUIRED_HEADERS FollowupReminder_HEADERS
PREFIX FollowupReminder
)
ecm_generate_pri_file(BASE_NAME FollowupReminder
LIB_NAME KF5FollowupReminder
DEPS "" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/FollowupReminder
)
install(FILES
${FollowupReminder_Camelcase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/FollowupReminder
COMPONENT Devel
)
install(FILES
${FollowupReminder_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/followupreminder_export.h
${CMAKE_CURRENT_BINARY_DIR}/followupreminderagentsettings.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/followupreminder
COMPONENT Devel
)
install(FILES
${PRI_FILENAME}
DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
#! /bin/sh
$XGETTEXT `find . -name '*.h' -o -name '*.cpp' | grep -v '/autotests/'` -o $podir/libfollowupreminder.pot
/*
Copyright (C) 2014-2020 Laurent Montel <montel@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 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 <KConfigGroup>
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;
}
/*
Copyright (C) 2014-2020 Laurent Montel <montel@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 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 <AkonadiCore/Item>
#include <QDate>
#include "followupreminder_export.h"
class KConfigGroup;
namespace FollowUpReminder {
/** Follow up reminder information. */
class FOLLOWUPREMINDER_EXPORT 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;
};
}
FOLLOWUPREMINDER_EXPORT QDebug operator<<(QDebug debug, const FollowUpReminder::FollowUpReminderInfo &info);
#endif // FOLLOWUPREMINDERINFO_H
/*
Copyright (C) 2014-2020 Laurent Montel <montel@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 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 <AkonadiCore/ServerManager>
#include <QDBusInterface>
#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<qint32> &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");
}
/*
Copyright (C) 2014-2020 Laurent Montel <montel@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 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 "followupreminder_export.h"
#include <KSharedConfig>
namespace FollowUpReminder {
class FollowUpReminderInfo;
/** Follow up reminder utilities. */
namespace FollowUpReminderUtil {
Q_REQUIRED_RESULT FOLLOWUPREMINDER_EXPORT bool followupReminderAgentWasRegistered();
Q_REQUIRED_RESULT FOLLOWUPREMINDER_EXPORT bool followupReminderAgentEnabled();
FOLLOWUPREMINDER_EXPORT void reload();
FOLLOWUPREMINDER_EXPORT void forceReparseConfiguration();
FOLLOWUPREMINDER_EXPORT KSharedConfig::Ptr defaultConfig();
FOLLOWUPREMINDER_EXPORT void writeFollowupReminderInfo(KSharedConfig::Ptr config, FollowUpReminder::FollowUpReminderInfo *info, bool forceReload);
Q_REQUIRED_RESULT FOLLOWUPREMINDER_EXPORT bool removeFollowupReminderInfo(KSharedConfig::Ptr config, const QList<qint32> &listRemove, bool forceReload = false);
Q_REQUIRED_RESULT FOLLOWUPREMINDER_EXPORT QString followUpReminderPattern();
}
}
#endif // FOLLOWUPREMINDERUTIL_H
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="akonadi_followupreminder_agentrc" />
<group name="General">
<entry name="enabled" key="enabled" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>
# Code generation options for kconfig_compiler
File=followupreminderagentsettings.kcfg
ClassName=FollowUpReminderAgentSettings
Singleton=true
Mutators=true
Visibility=FOLLOWUPREMINDER_EXPORT
IncludeFiles=followupreminder_export.h
......@@ -8,7 +8,6 @@ deprecated: false
libraries:
- cmake: "KF5::KaddressbookGrantlee"
- cmake: "KF5::KaddressbookImportExport"
- cmake: "KF5::FollowupReminder"
- cmake: "KF5::SendLater"
public_lib: true
......