Commit d6eb6017 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Move plugin in own subdirectory

parent 2c3877ec
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.13.42")
set(PIM_VERSION "5.13.43")
project(pimcommon VERSION ${PIM_VERSION})
......
......@@ -72,9 +72,7 @@ public:
void CustomToolsPluginManagerPrivate::initializePluginList()
{
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("pimcommon"), [](const KPluginMetaData &md) {
return md.serviceTypes().contains(QLatin1String("PimCommonCustomTools/Plugin"));
});
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("pimcommon/customtools"));
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
......
......@@ -38,7 +38,7 @@ void GenericPluginManagerTest::shouldInitialized()
{
PimCommon::GenericPluginManager pluginManager;
QVERIFY(!pluginManager.initializePlugins());
pluginManager.setServiceTypeName(QStringLiteral("foo"));
pluginManager.setPluginDirectory(QStringLiteral("foo"));
QVERIFY(!pluginManager.initializePlugins());
pluginManager.setPluginName(QStringLiteral("foo"));
QVERIFY(pluginManager.initializePlugins());
......
......@@ -59,7 +59,7 @@ public:
void loadPlugin(GenericPluginInfo *item);
QVector<GenericPlugin *> pluginsList() const;
bool initializePlugins();
QString serviceTypeName;
QString pluginDirectory;
QString pluginName;
QVector<GenericPluginInfo> mPluginList;
......@@ -88,12 +88,10 @@ bool GenericPluginManagerPrivate::initializePlugins()
return true;
}
if (serviceTypeName.isEmpty() || pluginName.isEmpty()) {
if (pluginDirectory.isEmpty() || pluginName.isEmpty()) {
return false;
}
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(pluginName, [this](const KPluginMetaData &md) {
return md.serviceTypes().contains(serviceTypeName);
});
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(pluginDirectory);
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
QVectorIterator<KPluginMetaData> i(plugins);
......@@ -185,14 +183,14 @@ bool GenericPluginManager::initializePlugins()
return d->initializePlugins();
}
void GenericPluginManager::setServiceTypeName(const QString &serviceName)
void GenericPluginManager::setPluginDirectory(const QString &directory)
{
d->serviceTypeName = serviceName;
d->pluginDirectory = directory;
}
QString GenericPluginManager::serviceTypeName() const
QString GenericPluginManager::pluginDirectory() const
{
return d->serviceTypeName;
return d->pluginDirectory;
}
void GenericPluginManager::setPluginName(const QString &pluginName)
......
......@@ -54,8 +54,8 @@ public:
Q_REQUIRED_RESULT bool initializePlugins();
void setServiceTypeName(const QString &serviceName);
Q_REQUIRED_RESULT QString serviceTypeName() const;
void setPluginDirectory(const QString &directory);
Q_REQUIRED_RESULT QString pluginDirectory() const;
void setPluginName(const QString &pluginName);
Q_REQUIRED_RESULT QString pluginName() const;
......
......@@ -37,7 +37,7 @@ public:
}
QString mPluginName;
QString mServiceTypeName;
QString mPluginDirectory;
QWidget *mParentWidget = nullptr;
KActionCollection *mActionCollection = nullptr;
QVector<PimCommon::GenericPluginInterface *> mListGenericInterface;
......@@ -64,7 +64,7 @@ void PimCommon::PluginInterface::setActionCollection(KActionCollection *ac)
void PluginInterface::initializePlugins()
{
d->mGenericPluginManager->setPluginName(d->mPluginName);
d->mGenericPluginManager->setServiceTypeName(d->mServiceTypeName);
d->mGenericPluginManager->setPluginDirectory(d->mPluginDirectory);
if (!d->mGenericPluginManager->initializePlugins()) {
qCDebug(PIMCOMMONAKONADI_LOG) << " Impossible to initialize plugins";
}
......@@ -75,9 +75,9 @@ void PluginInterface::setPluginName(const QString &name)
d->mPluginName = name;
}
void PluginInterface::setServiceTypeName(const QString &name)
void PluginInterface::setPluginDirectory(const QString &name)
{
d->mServiceTypeName = name;
d->mPluginDirectory = name;
}
void PluginInterface::createPluginInterface()
......
......@@ -40,11 +40,11 @@ public:
~PluginInterface();
void setParentWidget(QWidget *widget);
QHash<PimCommon::ActionType::Type, QList<QAction *> > actionsType();
Q_REQUIRED_RESULT QHash<PimCommon::ActionType::Type, QList<QAction *> > actionsType();
void createPluginInterface();
void setPluginName(const QString &name);
void setServiceTypeName(const QString &name);
void setPluginDirectory(const QString &name);
void initializePlugins();
virtual void initializeInterfaceRequires(AbstractGenericPluginInterface *interface);
static QString actionXmlExtension(PimCommon::ActionType::Type type);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment