Commit 520558da authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Do not load orphane plugins on Android

Generate a whitelist of plugins part of the current package and only
load those.

REVIEW: 124561
parent 3c60debc
......@@ -51,6 +51,10 @@ class PluginManagerPrivate
QList<const ReverseGeocodingRunnerPlugin *> m_reverseGeocodingRunnerPlugins;
QList<RoutingRunnerPlugin *> m_routingRunnerPlugins;
QList<const ParseRunnerPlugin *> m_parsingRunnerPlugins;
#ifdef ANDROID
QStringList m_pluginPaths;
#endif
};
PluginManagerPrivate::~PluginManagerPrivate()
......@@ -209,6 +213,14 @@ void PluginManagerPrivate::loadPlugins()
foreach( const QString &fileName, pluginFileNameList ) {
// mDebug() << fileName << " - " << MarbleDirs::pluginPath( fileName );
QString const path = MarbleDirs::pluginPath( fileName );
#ifdef ANDROID
QFileInfo targetFile( path );
if ( !m_pluginPaths.contains( targetFile.canonicalFilePath() ) ) {
// @todo Delete the file here?
qDebug() << "Ignoring file " << path << " which is not among the currently installed plugins";
continue;
}
#endif
QPluginLoader* loader = new QPluginLoader( path );
QObject * obj = loader->instance();
......@@ -247,17 +259,21 @@ void PluginManagerPrivate::loadPlugins()
#ifdef ANDROID
void PluginManager::installPluginsFromAssets() const
{
d->m_pluginPaths.clear();
QStringList copyList = MarbleDirs::pluginEntryList(QString());
QDir pluginHome(MarbleDirs::localPath());
pluginHome.mkpath(MarbleDirs::pluginLocalPath());
pluginHome.setCurrent(MarbleDirs::pluginLocalPath());
foreach (const QString & file, copyList) {
QString const target = MarbleDirs::pluginLocalPath() + '/' + file;
if (QFileInfo(MarbleDirs::pluginSystemPath() + '/' + file).isDir()) {
pluginHome.mkpath(MarbleDirs::pluginLocalPath() + '/' + file);
pluginHome.mkpath(target);
}
else{
else {
QFile temporaryFile(MarbleDirs::pluginSystemPath() + '/' + file);
temporaryFile.copy(MarbleDirs::pluginLocalPath() + '/' + file);
temporaryFile.copy(target);
QFileInfo targetFile(target);
d->m_pluginPaths << targetFile.canonicalFilePath();
}
}
}
......
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