From 464f05962eaa06702d1cc2b3e0c4f0e0c483c7f4 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 16 Sep 2014 15:20:09 +0200 Subject: [PATCH] Plugins: Use settings path without trailing slash --- src/lib/plugins/plugins.cpp | 2 +- src/plugins/AccessKeysNavigation/akn_handler.cpp | 2 +- src/plugins/AutoScroll/autoscrollplugin.cpp | 2 +- src/plugins/GreaseMonkey/gm_downloader.cpp | 2 +- src/plugins/GreaseMonkey/gm_manager.cpp | 6 +++--- src/plugins/GreaseMonkey/gm_plugin.cpp | 1 - src/plugins/GreaseMonkey/gm_plugin.h | 1 - src/plugins/PIM/PIM_handler.cpp | 2 +- src/plugins/StatusBarIcons/sbi_icon.cpp | 2 +- src/plugins/StatusBarIcons/sbi_iconsmanager.cpp | 10 +++++----- src/plugins/StatusBarIcons/sbi_networkmanager.cpp | 2 +- src/plugins/TestPlugin/testplugin.cpp | 7 ++++--- 12 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 0f7e181f7..d40301146 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -212,7 +212,7 @@ PluginInterface* Plugins::initPlugin(PluginInterface::InitState state, PluginInt return 0; } - pluginInterface->init(state, DataPaths::currentProfilePath() + QL1S("/extensions/")); + pluginInterface->init(state, DataPaths::currentProfilePath() + QL1S("/extensions")); if (!pluginInterface->testPlugin()) { pluginInterface->unload(); diff --git a/src/plugins/AccessKeysNavigation/akn_handler.cpp b/src/plugins/AccessKeysNavigation/akn_handler.cpp index 80305a8bd..0960c25f3 100644 --- a/src/plugins/AccessKeysNavigation/akn_handler.cpp +++ b/src/plugins/AccessKeysNavigation/akn_handler.cpp @@ -67,7 +67,7 @@ Qt::Key keyFromCode(int code) AKN_Handler::AKN_Handler(const QString &sPath, QObject* parent) : QObject(parent) , m_accessKeysVisible(false) - , m_settingsFile(sPath + "extensions.ini") + , m_settingsFile(sPath + "/extensions.ini") { loadSettings(); } diff --git a/src/plugins/AutoScroll/autoscrollplugin.cpp b/src/plugins/AutoScroll/autoscrollplugin.cpp index f832cb236..993931550 100644 --- a/src/plugins/AutoScroll/autoscrollplugin.cpp +++ b/src/plugins/AutoScroll/autoscrollplugin.cpp @@ -48,7 +48,7 @@ void AutoScrollPlugin::init(InitState state, const QString &settingsPath) { Q_UNUSED(state) - m_scroller = new AutoScroller(settingsPath + QLatin1String("extensions.ini"), this); + m_scroller = new AutoScroller(settingsPath + QL1S("/extensions.ini"), this); QZ_REGISTER_EVENT_HANDLER(PluginProxy::MouseMoveHandler); QZ_REGISTER_EVENT_HANDLER(PluginProxy::MousePressHandler); diff --git a/src/plugins/GreaseMonkey/gm_downloader.cpp b/src/plugins/GreaseMonkey/gm_downloader.cpp index 7e62f7e84..616e31968 100644 --- a/src/plugins/GreaseMonkey/gm_downloader.cpp +++ b/src/plugins/GreaseMonkey/gm_downloader.cpp @@ -74,7 +74,7 @@ void GM_Downloader::scriptDownloaded() file.write(response); file.close(); - QSettings settings(m_manager->settinsPath() + QL1S("greasemonkey/requires/requires.ini"), QSettings::IniFormat); + QSettings settings(m_manager->settinsPath() + QL1S("/greasemonkey/requires/requires.ini"), QSettings::IniFormat); settings.beginGroup("Files"); QzRegExp rx("@require(.*)\\n"); diff --git a/src/plugins/GreaseMonkey/gm_manager.cpp b/src/plugins/GreaseMonkey/gm_manager.cpp index 500d8c5e3..2153e72aa 100644 --- a/src/plugins/GreaseMonkey/gm_manager.cpp +++ b/src/plugins/GreaseMonkey/gm_manager.cpp @@ -92,7 +92,7 @@ QString GM_Manager::requireScripts(const QStringList &urlList) const void GM_Manager::unloadPlugin() { // Save settings - QSettings settings(m_settingsPath + "extensions.ini", QSettings::IniFormat); + QSettings settings(m_settingsPath + "/extensions.ini", QSettings::IniFormat); settings.beginGroup("GreaseMonkey"); settings.setValue("disabledScripts", m_disabledScripts); settings.endGroup(); @@ -236,9 +236,9 @@ void GM_Manager::pageLoadStart() void GM_Manager::load() { - QDir gmDir(m_settingsPath + "greasemonkey"); + QDir gmDir(m_settingsPath + QL1S("/greasemonkey")); if (!gmDir.exists()) { - gmDir.mkdir(m_settingsPath + "greasemonkey"); + gmDir.mkdir(m_settingsPath + QL1S("/greasemonkey")); } if (!gmDir.exists("requires")) { diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index c03341478..9ee6160c9 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -52,7 +52,6 @@ PluginSpec GM_Plugin::pluginSpec() void GM_Plugin::init(InitState state, const QString &settingsPath) { m_manager = new GM_Manager(settingsPath, this); - m_settingsPath = settingsPath; connect(mApp->plugins(), SIGNAL(webPageCreated(WebPage*)), this, SLOT(webPageCreated(WebPage*))); connect(mApp->plugins(), SIGNAL(mainWindowCreated(BrowserWindow*)), m_manager, SLOT(mainWindowCreated(BrowserWindow*))); diff --git a/src/plugins/GreaseMonkey/gm_plugin.h b/src/plugins/GreaseMonkey/gm_plugin.h index 7f6b52fd7..e7d80a57b 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.h +++ b/src/plugins/GreaseMonkey/gm_plugin.h @@ -50,7 +50,6 @@ private slots: private: GM_Manager* m_manager; - QString m_settingsPath; }; #endif // GM_PLUGIN_H diff --git a/src/plugins/PIM/PIM_handler.cpp b/src/plugins/PIM/PIM_handler.cpp index b35192b26..dee231877 100644 --- a/src/plugins/PIM/PIM_handler.cpp +++ b/src/plugins/PIM/PIM_handler.cpp @@ -31,7 +31,7 @@ PIM_Handler::PIM_Handler(const QString &sPath, QObject* parent) : QObject(parent) - , m_settingsFile(sPath + "extensions.ini") + , m_settingsFile(sPath + QL1S("/extensions.ini")) , m_loaded(false) { } diff --git a/src/plugins/StatusBarIcons/sbi_icon.cpp b/src/plugins/StatusBarIcons/sbi_icon.cpp index f65bbad7a..cc5e541fd 100644 --- a/src/plugins/StatusBarIcons/sbi_icon.cpp +++ b/src/plugins/StatusBarIcons/sbi_icon.cpp @@ -23,7 +23,7 @@ SBI_Icon::SBI_Icon(BrowserWindow* window, const QString &settingsPath) : ClickableLabel(window) , m_window(window) - , m_settingsFile(settingsPath + QLatin1String("extensions.ini")) + , m_settingsFile(settingsPath + QL1S("/extensions.ini")) { } diff --git a/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp b/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp index 6eaeabdb8..84c34038b 100644 --- a/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp +++ b/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp @@ -40,7 +40,7 @@ SBI_IconsManager::SBI_IconsManager(const QString &settingsPath, QObject* parent) void SBI_IconsManager::loadSettings() { - QSettings settings(m_settingsPath + "extensions.ini", QSettings::IniFormat); + QSettings settings(m_settingsPath + QL1S("/extensions.ini"), QSettings::IniFormat); settings.beginGroup("StatusBarIcons"); m_showImagesIcon = settings.value("showImagesIcon", true).toBool(); m_showJavaScriptIcon = settings.value("showJavaScriptIcon", true).toBool(); @@ -56,7 +56,7 @@ bool SBI_IconsManager::showImagesIcon() const void SBI_IconsManager::setShowImagesIcon(bool show) { - QSettings settings(m_settingsPath + QL1S("extensions.ini"), QSettings::IniFormat); + QSettings settings(m_settingsPath + QL1S("/extensions.ini"), QSettings::IniFormat); settings.setValue("StatusBarIcons/showImagesIcon", show); m_showImagesIcon = show; @@ -69,7 +69,7 @@ bool SBI_IconsManager::showJavaScriptIcon() const void SBI_IconsManager::setShowJavaScriptIcon(bool show) { - QSettings settings(m_settingsPath + QL1S("extensions.ini"), QSettings::IniFormat); + QSettings settings(m_settingsPath + QL1S("/extensions.ini"), QSettings::IniFormat); settings.setValue("StatusBarIcons/showJavaScriptIcon", show); m_showJavaScriptIcon = show; @@ -82,7 +82,7 @@ bool SBI_IconsManager::showNetworkIcon() const void SBI_IconsManager::setShowNetworkIcon(bool show) { - QSettings settings(m_settingsPath + QL1S("extensions.ini"), QSettings::IniFormat); + QSettings settings(m_settingsPath + QL1S("/extensions.ini"), QSettings::IniFormat); settings.setValue("StatusBarIcons/showNetworkIcon", show); m_showNetworkIcon = show; @@ -95,7 +95,7 @@ bool SBI_IconsManager::showZoomWidget() const void SBI_IconsManager::setShowZoomWidget(bool show) { - QSettings settings(m_settingsPath + QL1S("extensions.ini"), QSettings::IniFormat); + QSettings settings(m_settingsPath + QL1S("/extensions.ini"), QSettings::IniFormat); settings.setValue("StatusBarIcons/showZoomWidget", show); m_showZoomWidget = show; diff --git a/src/plugins/StatusBarIcons/sbi_networkmanager.cpp b/src/plugins/StatusBarIcons/sbi_networkmanager.cpp index 9b6c624cf..5d01607b1 100644 --- a/src/plugins/StatusBarIcons/sbi_networkmanager.cpp +++ b/src/plugins/StatusBarIcons/sbi_networkmanager.cpp @@ -27,7 +27,7 @@ SBI_NetworkManager* SBI_NetworkManager::s_instance = 0; SBI_NetworkManager::SBI_NetworkManager(const QString &settingsPath, QObject* parent) : QObject(parent) - , m_settingsFile(settingsPath + "networkicon.ini") + , m_settingsFile(settingsPath + QL1S("/networkicon.ini")) , m_currentProxy(0) { s_instance = this; diff --git a/src/plugins/TestPlugin/testplugin.cpp b/src/plugins/TestPlugin/testplugin.cpp index 4f9552149..3ca79144d 100644 --- a/src/plugins/TestPlugin/testplugin.cpp +++ b/src/plugins/TestPlugin/testplugin.cpp @@ -59,9 +59,10 @@ void TestPlugin::init(InitState state, const QString &settingsPath) // it will be called even if we return false from testPlugin() // so it is recommended not to call any QupZilla function here - // Settings path is PROFILE/extensions/, in this directory - // you can use global .ini file for QSettings named "extensions.ini" - // or create new folder for your plugin and save in it anything you want + // Settings path is PROFILE/extensions (without trailign slash), + // in this directory you can use global .ini file for QSettings + // named "extensions.ini" or create new folder for your plugin + // and save in it anything you want m_settingsPath = settingsPath; // State can be either StartupInitState or LateInitState, and it