File indexing completed on 2024-06-23 05:18:37

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "sendlaterutil.h"
0008 #include "sendlaterinterface.h"
0009 #include "sendlaterutil_p.h"
0010 
0011 #include <Akonadi/ServerManager>
0012 
0013 #include <Akonadi/ServerManager>
0014 
0015 using namespace MessageComposer;
0016 
0017 QString SendLaterUtil::agentServiceName()
0018 {
0019     using Akonadi::ServerManager;
0020     return ServerManager::agentServiceName(ServerManager::Agent, QStringLiteral("akonadi_sendlater_agent"));
0021 }
0022 
0023 QString SendLaterUtil::dbusPath()
0024 {
0025     return QStringLiteral("/SendLaterAgent");
0026 }
0027 
0028 bool SendLaterUtil::sentLaterAgentWasRegistered()
0029 {
0030     return org::freedesktop::Akonadi::SendLaterAgent{agentServiceName(), dbusPath(), QDBusConnection::sessionBus()}.isValid();
0031 }
0032 
0033 bool SendLaterUtil::sentLaterAgentEnabled()
0034 {
0035     org::freedesktop::Akonadi::SendLaterAgent iface{agentServiceName(), dbusPath(), QDBusConnection::sessionBus()};
0036     return iface.isValid() && iface.enabledAgent();
0037 }