1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 18:26:34 +01:00

Portable: Fix auto-loading saved plugins on startup

This commit is contained in:
David Rosca 2014-10-16 12:24:48 +02:00
parent 15bb39689c
commit bcc9f3f431
2 changed files with 12 additions and 10 deletions

View File

@ -87,6 +87,13 @@ void Plugins::loadSettings()
m_allowedPlugins = settings.value("AllowedPlugins", QStringList()).toStringList();
settings.endGroup();
// Plugins are saved with relative path in portable mode
if (mApp->isPortable()) {
QDir dir(DataPaths::path(DataPaths::Plugins));
for (int i = 0; i < m_allowedPlugins.count(); ++i)
m_allowedPlugins[i] = dir.absoluteFilePath(m_allowedPlugins[i]);
}
c2f_loadSettings();
}
@ -166,12 +173,8 @@ void Plugins::loadAvailablePlugins()
QStringList dirs = DataPaths::allPaths(DataPaths::Plugins);
// Portable build: Load only plugins from DATADIR/plugins/ directory.
// Loaded plugins are saved with relative path, instead of absolute for
// normal build.
if (mApp->isPortable()) {
if (mApp->isPortable())
dirs = QStringList(DataPaths::path(DataPaths::Plugins));
}
foreach (const QString &dir, dirs) {
QDir pluginsDir = QDir(dir);

View File

@ -115,12 +115,11 @@ void PluginsManager::save()
if (item->checkState() == Qt::Checked) {
const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value<Plugins::Plugin>();
if (!mApp->isPortable()) {
allowedPlugins.append(plugin.fullPath);
}
else {
// Save plugins with relative path in portable mode
if (mApp->isPortable())
allowedPlugins.append(plugin.fileName);
}
else
allowedPlugins.append(plugin.fullPath);
}
}