Akonadi

agentpluginloader.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Bertjan Broeksema <[email protected]>
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 
13 AgentPluginLoader::AgentPluginLoader()
14 {
15 }
16 
17 AgentPluginLoader::~AgentPluginLoader()
18 {
19  qDeleteAll(m_pluginLoaders);
20  m_pluginLoaders.clear();
21 }
22 
23 QPluginLoader *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 }
QString errorString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:00:31 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.