File indexing completed on 2025-01-05 04:47:06

0001 /*
0002     SPDX-FileCopyrightText: 2018 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "agentconfigurationfactorybase.h"
0010 #include "agentconfigurationwidget.h"
0011 #include "agentinstance.h"
0012 
0013 #include <QPluginLoader>
0014 #include <QPointer>
0015 
0016 #include <memory>
0017 
0018 namespace Akonadi
0019 {
0020 class AgentConfigurationWidgetPrivate
0021 {
0022 private:
0023     struct PluginLoaderDeleter {
0024         inline void operator()(QPluginLoader *loader)
0025         {
0026             loader->unload();
0027             delete loader;
0028         }
0029     };
0030 
0031 public:
0032     AgentConfigurationWidgetPrivate(const AgentInstance &instance);
0033     ~AgentConfigurationWidgetPrivate();
0034 
0035     void setupErrorWidget(QWidget *parent, const QString &text);
0036     bool loadPlugin(const QString &pluginPath);
0037 
0038     std::unique_ptr<QPluginLoader, PluginLoaderDeleter> loader;
0039     QPointer<AgentConfigurationFactoryBase> factory = nullptr;
0040     QPointer<AgentConfigurationBase> plugin = nullptr;
0041     QWidget *baseWidget = nullptr;
0042     AgentInstance agentInstance;
0043 };
0044 
0045 }