1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +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(); m_allowedPlugins = settings.value("AllowedPlugins", QStringList()).toStringList();
settings.endGroup(); 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(); c2f_loadSettings();
} }
@ -166,12 +173,8 @@ void Plugins::loadAvailablePlugins()
QStringList dirs = DataPaths::allPaths(DataPaths::Plugins); QStringList dirs = DataPaths::allPaths(DataPaths::Plugins);
// Portable build: Load only plugins from DATADIR/plugins/ directory. // Portable build: Load only plugins from DATADIR/plugins/ directory.
// Loaded plugins are saved with relative path, instead of absolute for if (mApp->isPortable())
// normal build.
if (mApp->isPortable()) {
dirs = QStringList(DataPaths::path(DataPaths::Plugins)); dirs = QStringList(DataPaths::path(DataPaths::Plugins));
}
foreach (const QString &dir, dirs) { foreach (const QString &dir, dirs) {
QDir pluginsDir = QDir(dir); QDir pluginsDir = QDir(dir);

View File

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