diff --git a/src/core/pluginmanager.cpp b/src/core/pluginmanager.cpp index 57379dde54..068975bf9d 100644 --- a/src/core/pluginmanager.cpp +++ b/src/core/pluginmanager.cpp @@ -73,17 +73,6 @@ void PluginManager::unloadPlugin( const QString &pluginPath ) } } -const QString PluginManager::findProjectPlugin( const QString &projectPath ) const -{ - QFileInfo fi( projectPath ); - const QString pluginPath = QStringLiteral( "%1/%2.qml" ).arg( fi.absolutePath(), fi.completeBaseName() ); - if ( QFileInfo::exists( pluginPath ) ) - { - return pluginPath; - } - return QString(); -} - void PluginManager::grantRequestedPluginPermission( bool permanent ) { if ( permanent ) @@ -110,3 +99,14 @@ void PluginManager::denyRequestedPluginPermission( bool permanent ) mPermissionRequestPluginPath.clear(); } + +QString PluginManager::findProjectPlugin( const QString &projectPath ) +{ + const QFileInfo fi( projectPath ); + const QString pluginPath = QStringLiteral( "%1/%2.qml" ).arg( fi.absolutePath(), fi.completeBaseName() ); + if ( QFileInfo::exists( pluginPath ) ) + { + return pluginPath; + } + return QString(); +} diff --git a/src/core/pluginmanager.h b/src/core/pluginmanager.h index f92983063d..f07fa5df91 100644 --- a/src/core/pluginmanager.h +++ b/src/core/pluginmanager.h @@ -25,17 +25,17 @@ class PluginManager : public QObject Q_OBJECT public: - PluginManager( QQmlEngine *engine ); - ~PluginManager() = default; + explicit PluginManager( QQmlEngine *engine ); + ~PluginManager() override = default; void loadPlugin( const QString &pluginPath, const QString &pluginName, bool skipPermissionCheck = false ); void unloadPlugin( const QString &pluginPath ); - const QString findProjectPlugin( const QString &projectPath ) const; - Q_INVOKABLE void grantRequestedPluginPermission( bool permanent = false ); Q_INVOKABLE void denyRequestedPluginPermission( bool permanent = false ); + static QString findProjectPlugin( const QString &projectPath ); + signals: void pluginPermissionRequested( const QString &pluginName ); diff --git a/src/core/qgismobileapp.cpp b/src/core/qgismobileapp.cpp index 8a96a95ae0..6e3c0ef76b 100644 --- a/src/core/qgismobileapp.cpp +++ b/src/core/qgismobileapp.cpp @@ -700,7 +700,7 @@ bool QgisMobileapp::loadProjectFile( const QString &path, const QString &name ) if ( !mProjectFilePath.isEmpty() ) { - mPluginManager->unloadPlugin( mPluginManager->findProjectPlugin( mProjectFilePath ) ); + mPluginManager->unloadPlugin( PluginManager::findProjectPlugin( mProjectFilePath ) ); } mAuthRequestHandler->clearStoredRealms(); @@ -1166,7 +1166,7 @@ void QgisMobileapp::readProjectFile() connect( mMapCanvas, &QgsQuickMapCanvasMap::mapCanvasRefreshed, this, &QgisMobileapp::onMapCanvasRefreshed ); - const QString projectPluginPath = mPluginManager->findProjectPlugin( mProjectFilePath ); + const QString projectPluginPath = PluginManager::findProjectPlugin( mProjectFilePath ); if ( !projectPluginPath.isEmpty() ) { mPluginManager->loadPlugin( projectPluginPath, tr( "Project Plugin" ) ); @@ -1393,7 +1393,7 @@ void QgisMobileapp::clearProject() { if ( !mProjectFilePath.isEmpty() ) { - mPluginManager->unloadPlugin( mPluginManager->findProjectPlugin( mProjectFilePath ) ); + mPluginManager->unloadPlugin( PluginManager::findProjectPlugin( mProjectFilePath ) ); } mAuthRequestHandler->clearStoredRealms();