1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Plugins: Use settings path without trailing slash

This commit is contained in:
David Rosca 2014-09-16 15:20:09 +02:00
parent 6ae0109115
commit 464f05962e
12 changed files with 19 additions and 20 deletions

View File

@ -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();

View File

@ -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();
}

View File

@ -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);

View File

@ -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");

View File

@ -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")) {

View File

@ -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*)));

View File

@ -50,7 +50,6 @@ private slots:
private:
GM_Manager* m_manager;
QString m_settingsPath;
};
#endif // GM_PLUGIN_H

View File

@ -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)
{
}

View File

@ -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"))
{
}

View File

@ -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;

View File

@ -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;

View File

@ -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