From b5b77e79323c640390dcef4118dbc0e2c8a2cdc5 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 29 Jan 2018 21:39:37 +0100 Subject: [PATCH] GM_Script: Add iconUrl property --- src/plugins/GreaseMonkey/gm_script.cpp | 11 +++++++++++ src/plugins/GreaseMonkey/gm_script.h | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/GreaseMonkey/gm_script.cpp b/src/plugins/GreaseMonkey/gm_script.cpp index 801a2d2b9..0f0117a0d 100644 --- a/src/plugins/GreaseMonkey/gm_script.cpp +++ b/src/plugins/GreaseMonkey/gm_script.cpp @@ -76,6 +76,11 @@ QString GM_Script::version() const return m_version; } +QUrl GM_Script::iconUrl() const +{ + return m_iconUrl; +} + QUrl GM_Script::downloadUrl() const { return m_downloadUrl; @@ -178,6 +183,7 @@ void GM_Script::parseScript() m_include.clear(); m_exclude.clear(); m_require.clear(); + m_iconUrl.clear(); m_downloadUrl.clear(); m_updateUrl.clear(); m_startAt = DocumentEnd; @@ -269,6 +275,9 @@ void GM_Script::parseScript() m_startAt = DocumentIdle; } } + else if (key == QL1S("@icon")) { + m_iconUrl = QUrl(value); + } } if (!inMetadata) { @@ -276,6 +285,8 @@ void GM_Script::parseScript() return; } + m_iconUrl = m_downloadUrl.resolved(m_iconUrl); + if (m_include.isEmpty()) { m_include.append(QSL("*")); } diff --git a/src/plugins/GreaseMonkey/gm_script.h b/src/plugins/GreaseMonkey/gm_script.h index 28796209b..f4144a915 100644 --- a/src/plugins/GreaseMonkey/gm_script.h +++ b/src/plugins/GreaseMonkey/gm_script.h @@ -1,6 +1,6 @@ /* ============================================================ * GreaseMonkey plugin for Falkon -* Copyright (C) 2012-2017 David Rosca +* Copyright (C) 2012-2018 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +44,7 @@ public: QString description() const; QString version() const; + QUrl iconUrl() const; QUrl downloadUrl() const; QUrl updateUrl() const; @@ -89,6 +90,7 @@ private: QStringList m_exclude; QStringList m_require; + QUrl m_iconUrl; QUrl m_downloadUrl; QUrl m_updateUrl; StartAt m_startAt;