Akonadi

agentpluginloader.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#include "agentpluginloader.h"
7#include "akonadiagentserver_debug.h"
8
9#include "shared/akdebug.h"
10
11#include <QPluginLoader>
12
13AgentPluginLoader::AgentPluginLoader()
14{
15}
16
17AgentPluginLoader::~AgentPluginLoader()
18{
19 qDeleteAll(m_pluginLoaders);
20 m_pluginLoaders.clear();
21}
22
23QPluginLoader *AgentPluginLoader::load(const QString &pluginName)
24{
25 QPluginLoader *loader = m_pluginLoaders.value(pluginName);
26 if (loader) {
27 return loader;
28 } else {
29 loader = new QPluginLoader(pluginName);
30 if (!loader->load()) {
31 qCWarning(AKONADIAGENTSERVER_LOG) << "Failed to load agent: " << loader->errorString();
32 delete loader;
33 return nullptr;
34 }
35 m_pluginLoaders.insert(pluginName, loader);
36 return loader;
37 }
38}
void clear()
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
QString errorString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.