Akonadi
akonadicontrol/agentmanager.cpp
92 org::freedesktop::Akonadi::AgentServer agentServerIface(Akonadi::DBus::serviceName(Akonadi::DBus::AgentServer),
109 connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &AgentManager::serviceOwnerChanged);
111 if (QDBusConnection::sessionBus().interface()->isServiceRegistered(Akonadi::DBus::serviceName(Akonadi::DBus::Server))) {
115 const QSettings settings(Akonadi::StandardDirs::agentsConfigFile(Akonadi::StandardDirs::ReadOnly), QSettings::IniFormat);
116 mAgentServerEnabled = settings.value(QStringLiteral("AgentServer/Enabled"), enableAgentServerDefault).toBool();
126 mStorageController = std::unique_ptr<Akonadi::ProcessControl>(new StorageProcessControl(serviceArgs));
154 if (!QDBusConnection::sessionBus().registerService(Akonadi::DBus::serviceName(Akonadi::DBus::Control))) {
251 Q_ASSERT_X(false, "AgentManger::createAgentInstance", "Unhandled AgentType::LaunchMethod case");
270 instance->setIdentifier(QStringLiteral("%1_%2").arg(identifier, QString::number(agentInfo.instanceCounter)));
300 qCWarning(AKONADICONTROL_LOG) << Q_FUNC_INFO << "Agent instance with identifier" << identifier << "does not exist";
314 org::freedesktop::Akonadi::ResourceManager resmanager(Akonadi::DBus::serviceName(Akonadi::DBus::Server),
415void AgentManager::setAgentInstanceActivities(const QString &identifier, const QStringList &activities)
497void AgentManager::agentInstanceSynchronizeCollection(const QString &identifier, qint64 collection)
502void AgentManager::agentInstanceSynchronizeCollection(const QString &identifier, qint64 collection, bool recursive)
504 if (!checkResourceInterface(identifier, QStringLiteral("agentInstanceSynchronizeCollection"))) {
572 qCWarning(AKONADICONTROL_LOG) << "Duplicated agent identifier" << agentInfo.identifier << "from file" << fileName;
589 qCWarning(AKONADICONTROL_LOG) << "Executable" << agentInfo.exec << "for agent" << agentInfo.identifier << "could not be found!";
594 qCDebug(AKONADICONTROL_LOG) << "PLUGINS inserting: " << agentInfo.identifier << agentInfo.instanceCounter << agentInfo.capabilities;
607 org::freedesktop::Akonadi::ResourceManager resmanager(Akonadi::DBus::serviceName(Akonadi::DBus::Server),
613 QSettings file(Akonadi::StandardDirs::agentsConfigFile(Akonadi::StandardDirs::ReadOnly), QSettings::IniFormat);
620 qCWarning(AKONADICONTROL_LOG) << "Duplicated instance identifier" << instanceIdentifier << "found in agentsrc";
630 if (std::find(std::begin(retiredAgentTypes), std::end(retiredAgentTypes), agentType) != std::end(retiredAgentTypes)) {
631 qCInfo(AKONADICONTROL_LOG) << agentType << "has been retired in a previous version, cleaning up " << entries[i];
639 qCWarning(AKONADICONTROL_LOG) << "Reference to unknown agent type" << agentType << "in agentsrc, creating a fake entry.";
656 if (!knownResources.contains(instanceIdentifier) && type.capabilities.contains(AgentType::CapabilityResource)) {
657 qCDebug(AKONADICONTROL_LOG) << "Recovering instance" << instanceIdentifier << "after database loss";
675 QSettings file(Akonadi::StandardDirs::agentsConfigFile(Akonadi::StandardDirs::WriteOnly), QSettings::IniFormat);
692void AgentManager::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
695 // This is called by the D-Bus server when a service comes up, goes down or changes ownership for some reason
705 const auto currentInstance = Akonadi::Instance::hasIdentifier() ? std::optional<QString>(Akonadi::Instance::identifier()) : std::nullopt;
710 qCDebug(AKONADICONTROL_LOG) << "Service" << name << "owner changed from" << oldOwner << "to" << newOwner;
712 if ((name == Akonadi::DBus::serviceName(Akonadi::DBus::Server) || name == Akonadi::DBus::serviceName(Akonadi::DBus::AgentServer)) && !newOwner.isEmpty()) {
713 if (QDBusConnection::sessionBus().interface()->isServiceRegistered(Akonadi::DBus::serviceName(Akonadi::DBus::Server))
714 && (!mAgentServer || QDBusConnection::sessionBus().interface()->isServiceRegistered(Akonadi::DBus::serviceName(Akonadi::DBus::AgentServer)))) {
742 const bool isResource = mAgents.value(instance->agentType()).capabilities.contains(AgentType::CapabilityResource);
786 qCDebug(AKONADICONTROL_LOG) << "Preprocessor " << service->identifier << " is going up or down...";
793 org::freedesktop::Akonadi::PreprocessorManager preProcessorManager(Akonadi::DBus::serviceName(Akonadi::DBus::Server),
799 qCWarning(AKONADICONTROL_LOG) << "Could not connect to PreprocessorManager via D-Bus:" << preProcessorManager.lastError().message();
812 qCWarning(AKONADICONTROL_LOG) << "Couldn't obtain preprocessor interface for instance" << service->identifier;
835 qCWarning(AKONADICONTROL_LOG) << "Agent instance with identifier " << identifier << " does not exist";
842bool AgentManager::checkResourceInterface(const QString &identifier, const QString &method) const
848 if (!mAgents[mAgentInstances[identifier]->agentType()].capabilities.contains(QLatin1StringView("Resource"))) {
853 qCWarning(AKONADICONTROL_LOG) << QLatin1StringView("AgentManager::") + method << " Agent instance " << identifier << " has no resource interface!";
877 qCWarning(AKONADICONTROL_LOG) << "Agent instance (" << method << ") " << identifier << " has no agent interface.";
890 org::freedesktop::Akonadi::AgentServer agentServer(Akonadi::DBus::serviceName(Akonadi::DBus::AgentServer),
895 if (mAgentInstances.contains(info.identifier) || (agentServer.isValid() && agentServer.started(info.identifier))) {
929 new org::freedesktop::Akonadi::ResourceManager(Akonadi::DBus::serviceName(Akonadi::DBus::Server),
937void AgentManager::addSearch(const QString &query, const QString &queryLanguage, qint64 resultCollectionId)
bool agentInstanceOnline(const QString &identifier)
Returns if the agent instance identifier is in online mode.
Definition akonadicontrol/agentmanager.cpp:397
void setAgentInstanceName(const QString &identifier, const QString &name)
Sets the name of the agent instance with the given identifier.
Definition akonadicontrol/agentmanager.cpp:452
QString agentInstanceStatusMessage(const QString &identifier) const
Returns the i18n'ed description of the current status of the agent with the given identifier.
Definition akonadicontrol/agentmanager.cpp:363
void agentInstanceAdded(const QString &agentIdentifier)
This signal is emitted whenever a new agent instance was created.
void agentTypeAdded(const QString &agentType)
This signal is emitted whenever a new agent type was installed on the system.
QStringList agentInstances() const
Returns the list of identifiers of configured instances.
Definition akonadicontrol/agentmanager.cpp:349
QString agentInstanceName(const QString &identifier) const
Returns the name of the agent instance with the given identifier.
Definition akonadicontrol/agentmanager.cpp:461
QStringList agentTypes() const
Returns the list of identifiers of all available agent types.
Definition akonadicontrol/agentmanager.cpp:179
void removeAgentInstance(const QString &identifier)
Removes the agent with the given identifier.
Definition akonadicontrol/agentmanager.cpp:296
void agentInstanceSynchronizeCollectionTree(const QString &identifier)
Trigger a synchronization of the collection tree by the given resource agent.
Definition akonadicontrol/agentmanager.cpp:488
AgentManager(bool verbose, QObject *parent=nullptr)
Creates a new agent manager.
Definition akonadicontrol/agentmanager.cpp:100
QString agentInstanceProgressMessage(const QString &identifier) const
Returns the i18n'ed description of the current progress of the agent with the given identifier.
Definition akonadicontrol/agentmanager.cpp:381
uint agentInstanceProgress(const QString &identifier) const
Returns the current progress of the agent with the given identifier in percentage.
Definition akonadicontrol/agentmanager.cpp:372
void agentInstanceSynchronizeCollection(const QString &identifier, qint64 collection)
Trigger a synchronization of the given collection by its owning resource agent.
Definition akonadicontrol/agentmanager.cpp:497
void removeSearch(quint64 resultCollectionId)
Removes a persistent search for the given result collection.
Definition akonadicontrol/agentmanager.cpp:948
QVariantMap agentCustomProperties(const QString &identifier) const
Returns a list of Custom added properties of the agent type for the given identifier.
Definition akonadicontrol/agentmanager.cpp:233
QStringList agentMimeTypes(const QString &identifier) const
Returns a list of supported mimetypes of the agent type for the given identifier.
Definition akonadicontrol/agentmanager.cpp:216
QString agentInstanceType(const QString &identifier)
Returns the type of the agent instance with the given identifier.
Definition akonadicontrol/agentmanager.cpp:338
void agentInstanceSynchronizeTags(const QString &identifier)
Trigger a synchronization of tags by the given resource agent.
Definition akonadicontrol/agentmanager.cpp:511
void agentInstanceRemoved(const QString &agentIdentifier)
This signal is emitted whenever an agent instance was removed.
QString agentComment(const QString &identifier) const
Returns the i18n'ed comment of the agent type for the given identifier.
Definition akonadicontrol/agentmanager.cpp:193
QStringList agentCapabilities(const QString &identifier) const
Returns a list of supported capabilities of the agent type for the given identifier.
Definition akonadicontrol/agentmanager.cpp:225
QString agentName(const QString &identifier) const
Returns the i18n'ed name of the agent type for the given identifier.
Definition akonadicontrol/agentmanager.cpp:184
void addSearch(const QString &query, const QString &queryLanguage, qint64 resultCollectionId)
Add a persistent search to remote search agents.
Definition akonadicontrol/agentmanager.cpp:937
void setAgentInstanceOnline(const QString &identifier, bool state)
Sets agent instance identifier to online or offline mode.
Definition akonadicontrol/agentmanager.cpp:406
void agentInstanceConfigure(const QString &identifier, qlonglong windowId)
Triggers the agent instance with the given identifier to show its configuration dialog.
Definition akonadicontrol/agentmanager.cpp:388
void restartAgentInstance(const QString &identifier)
Restarts the agent instance identifier.
Definition akonadicontrol/agentmanager.cpp:520
void cleanup()
Called by the crash handler and dtor to terminate the child processes.
Definition akonadicontrol/agentmanager.cpp:168
void agentTypeRemoved(const QString &agentType)
This signal is emitted whenever an agent type was removed from the system.
QString agentIcon(const QString &identifier) const
Returns the icon name of the agent type for the given identifier.
Definition akonadicontrol/agentmanager.cpp:202
int agentInstanceStatus(const QString &identifier) const
Returns the current status code of the agent with the given identifier.
Definition akonadicontrol/agentmanager.cpp:354
QString createAgentInstance(const QString &identifier)
Creates a new agent of the given agent type identifier.
Definition akonadicontrol/agentmanager.cpp:257
void agentInstanceSynchronize(const QString &identifier)
Triggers the agent instance with the given identifier to start synchronization.
Definition akonadicontrol/agentmanager.cpp:479
void start()
Starts the process with the previously set application and arguments.
Definition processcontrol.cpp:158
void unableToStart()
Emitted if the process could not be started since it terminated too often.
void setShutdownTimeout(std::chrono::milliseconds timeout)
Sets the time (in msecs) we wait for the process to shut down before we send terminate/kill signals.
Definition processcontrol.cpp:258
Capabilities capabilities()
QString name(GameStandardAction id)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
void exit(int returnCode)
QCoreApplication * instance()
bool registerObject(const QString &path, QObject *object, RegisterOptions options)
bool send(const QDBusMessage &message) const const
QDBusConnection sessionBus()
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
bool calledFromDBus() const const
QDBusConnection connection() const const
const QDBusMessage & message() const const
QString absoluteFilePath(const QString &fileName) const const
QString canonicalPath() const const
QStringList entryList(Filters filters, SortFlags sort) const const
bool exists() const const
const_iterator cend() const const
void clear()
const_iterator constFind(const Key &key) const const
bool contains(const Key &key) const const
iterator insert(const Key &key, const T &value)
QList< Key > keys() const const
T value(const Key &key) const const
qsizetype count() const const
void remove(qsizetype i, qsizetype n)
bool removeOne(const AT &t)
Q_EMITQ_EMIT
Q_OBJECTQ_OBJECT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
IniFormat
QVariant value(QAnyStringView key) const const
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
bool toBool() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.