diff --git a/src/lib/adblock/adblockplugin.cpp b/src/lib/adblock/adblockplugin.cpp index 02ea97334..b6df92c82 100644 --- a/src/lib/adblock/adblockplugin.cpp +++ b/src/lib/adblock/adblockplugin.cpp @@ -27,15 +27,16 @@ #include "navigationbar.h" #include "mainapplication.h" #include "statusbar.h" +#include "desktopfile.h" AdBlockPlugin::AdBlockPlugin() : QObject() { } -PluginSpec AdBlockPlugin::pluginSpec() +DesktopFile AdBlockPlugin::metaData() const { - return PluginSpec(); + return DesktopFile(); } void AdBlockPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/lib/adblock/adblockplugin.h b/src/lib/adblock/adblockplugin.h index 78cd29a86..e502db50f 100644 --- a/src/lib/adblock/adblockplugin.h +++ b/src/lib/adblock/adblockplugin.h @@ -30,7 +30,7 @@ class AdBlockPlugin : public QObject, public PluginInterface public: explicit AdBlockPlugin(); - PluginSpec pluginSpec() override; + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath) override; void unload() override; bool testPlugin() override; diff --git a/src/lib/plugins/plugininterface.h b/src/lib/plugins/plugininterface.h index b72a0a83b..335bee3e3 100644 --- a/src/lib/plugins/plugininterface.h +++ b/src/lib/plugins/plugininterface.h @@ -25,28 +25,6 @@ #include "qzcommon.h" #include "webhittestresult.h" -struct PluginSpec { - QString name; - QString info; - QString description; - QString author; - QString version; - QPixmap icon; - bool hasSettings; - - PluginSpec() { - hasSettings = false; - } - - bool operator==(const PluginSpec &other) const { - return (this->name == other.name && - this->info == other.info && - this->description == other.description && - this->author == other.author && - this->version == other.version); - } -}; - class QTranslator; class QMenu; class QMouseEvent; @@ -55,13 +33,14 @@ class QWheelEvent; class WebView; class WebPage; +class DesktopFile; class PluginInterface { public: enum InitState { StartupInitState, LateInitState }; - virtual PluginSpec pluginSpec() = 0; + virtual DesktopFile metaData() const = 0; virtual void init(InitState state, const QString &settingsPath) = 0; virtual void unload() = 0; virtual bool testPlugin() = 0; @@ -86,6 +65,6 @@ public: virtual bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) { Q_UNUSED(page); Q_UNUSED(url); Q_UNUSED(type); Q_UNUSED(isMainFrame); return true; } }; -Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.0") +Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.1") #endif // PLUGININTERFACE_H diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 1eb8a61cb..6d8027018 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -23,6 +23,7 @@ #include "datapaths.h" #include "adblock/adblockplugin.h" #include "../config.h" +#include "desktopfile.h" #include #include @@ -126,8 +127,10 @@ void Plugins::loadPlugins() plugin.instance = initPlugin(PluginInterface::StartupInitState, iPlugin, loader); if (plugin.isLoaded()) { - plugin.pluginSpec = iPlugin->pluginSpec(); - m_availablePlugins.append(plugin); + plugin.pluginSpec = createSpec(iPlugin->metaData()); + if (!plugin.pluginSpec.name.isEmpty()) { + m_availablePlugins.append(plugin); + } } } @@ -172,13 +175,13 @@ void Plugins::loadAvailablePlugins() Plugin plugin; plugin.fileName = fileName; plugin.fullPath = absolutePath; - plugin.pluginSpec = iPlugin->pluginSpec(); + plugin.pluginSpec = createSpec(iPlugin->metaData()); plugin.pluginLoader = loader; plugin.instance = 0; loader->unload(); - if (!alreadySpecInAvailable(plugin.pluginSpec)) { + if (!plugin.pluginSpec.name.isEmpty() && !alreadySpecInAvailable(plugin.pluginSpec)) { m_availablePlugins.append(plugin); } } @@ -230,3 +233,24 @@ bool Plugins::alreadySpecInAvailable(const PluginSpec &spec) return false; } + +PluginSpec Plugins::createSpec(const DesktopFile &metaData) const +{ + PluginSpec spec; + spec.name = metaData.name(mApp->currentLanguage()); + spec.description = metaData.comment(mApp->currentLanguage()); + spec.version = metaData.value(QSL("X-Falkon-Version")).toString(); + spec.author = QSL("%1 <%2>").arg(metaData.value(QSL("X-Falkon-Author")).toString(), metaData.value(QSL("X-Falkon-Email")).toString()); + spec.hasSettings = metaData.value(QSL("X-Falkon-Settings")).toBool(); + + const QString iconName = metaData.icon(); + if (!iconName.isEmpty()) { + if (QFileInfo::exists(iconName)) { + spec.icon = QIcon(iconName).pixmap(32); + } else { + spec.icon = QIcon::fromTheme(iconName).pixmap(32); + } + } + + return spec; +} diff --git a/src/lib/plugins/plugins.h b/src/lib/plugins/plugins.h index 4e20d6374..e143e80b2 100644 --- a/src/lib/plugins/plugins.h +++ b/src/lib/plugins/plugins.h @@ -29,6 +29,22 @@ class QPluginLoader; class SpeedDial; +struct PluginSpec { + QString name; + QString description; + QString author; + QString version; + QPixmap icon; + bool hasSettings = false; + + bool operator==(const PluginSpec &other) const { + return (this->name == other.name && + this->description == other.description && + this->author == other.author && + this->version == other.version); + } +}; + class FALKON_EXPORT Plugins : public QObject { Q_OBJECT @@ -82,6 +98,7 @@ signals: private: bool alreadySpecInAvailable(const PluginSpec &spec); + PluginSpec createSpec(const DesktopFile &metaData) const; PluginInterface* initPlugin(PluginInterface::InitState state , PluginInterface* pluginInterface, QPluginLoader* loader); void refreshLoadedPlugins(); diff --git a/src/lib/preferences/pluginlistdelegate.cpp b/src/lib/preferences/pluginlistdelegate.cpp index f1b7a6e3f..2e35b79c3 100644 --- a/src/lib/preferences/pluginlistdelegate.cpp +++ b/src/lib/preferences/pluginlistdelegate.cpp @@ -102,17 +102,20 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op painter->setFont(versionFont); style->drawItemText(painter, versionRect, Qt::AlignLeft, textPalette, true, version, colorRole); - // Draw info + // Draw author const int infoYPos = nameRect.bottom() + opt.fontMetrics.leading(); QRect infoRect(nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height()); const QString info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width()); - painter->setFont(opt.font); + QFont font = opt.font; + font.setPointSize(font.pointSize() - 1); + painter->setFont(font); style->drawItemText(painter, infoRect, Qt::TextSingleLine | Qt::AlignLeft, textPalette, true, info, colorRole); // Draw description const int descriptionYPos = infoRect.bottom() + opt.fontMetrics.leading(); QRect descriptionRect(infoRect.x(), descriptionYPos, infoRect.width(), opt.fontMetrics.height()); const QString description = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 2).toString(), Qt::ElideRight, descriptionRect.width()); + painter->setFont(opt.font); style->drawItemText(painter, descriptionRect, Qt::TextSingleLine | Qt::AlignLeft, textPalette, true, description, colorRole); } diff --git a/src/lib/preferences/pluginsmanager.cpp b/src/lib/preferences/pluginsmanager.cpp index cb633483a..00cc482fa 100644 --- a/src/lib/preferences/pluginsmanager.cpp +++ b/src/lib/preferences/pluginsmanager.cpp @@ -111,12 +111,12 @@ void PluginsManager::refresh() } item->setIcon(icon); - QString pluginInfo = QString("%1 %2
%3
%4").arg(spec.name, spec.version, spec.author.toHtmlEscaped(), spec.info); + QString pluginInfo = QString("%1 %2
%3
").arg(spec.name, spec.version, spec.author.toHtmlEscaped()); item->setToolTip(pluginInfo); item->setText(spec.name); item->setData(Qt::UserRole, spec.version); - item->setData(Qt::UserRole + 1, spec.info); + item->setData(Qt::UserRole + 1, spec.author); item->setData(Qt::UserRole + 2, spec.description); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); diff --git a/src/lib/tools/desktopfile.cpp b/src/lib/tools/desktopfile.cpp index 75577180a..86ca01588 100644 --- a/src/lib/tools/desktopfile.cpp +++ b/src/lib/tools/desktopfile.cpp @@ -17,10 +17,16 @@ * ============================================================ */ #include "desktopfile.h" -DesktopFile::DesktopFile(const QString &filePath) - : m_settings(filePath, QSettings::IniFormat) +#include + +DesktopFile::DesktopFile() { - m_settings.beginGroup(QSL("Desktop Entry")); +} + +DesktopFile::DesktopFile(const QString &filePath) +{ + m_settings.reset(new QSettings(filePath, QSettings::IniFormat)); + m_settings->beginGroup(QSL("Desktop Entry")); } QString DesktopFile::name(const QString &locale) const @@ -45,11 +51,14 @@ QString DesktopFile::icon() const QVariant DesktopFile::value(const QString &key, const QString &locale) const { + if (!m_settings) { + return QVariant(); + } if (!locale.isEmpty()) { const QString localeKey = QSL("%1[%2]").arg(key, locale); - if (m_settings.contains(localeKey)) { - return m_settings.value(localeKey); + if (m_settings->contains(localeKey)) { + return m_settings->value(localeKey); } } - return m_settings.value(key); + return m_settings->value(key); } diff --git a/src/lib/tools/desktopfile.h b/src/lib/tools/desktopfile.h index fcff07f28..13e70f2bc 100644 --- a/src/lib/tools/desktopfile.h +++ b/src/lib/tools/desktopfile.h @@ -17,13 +17,16 @@ * ============================================================ */ #pragma once -#include +#include #include "qzcommon.h" +class QSettings; + class FALKON_EXPORT DesktopFile { public: + explicit DesktopFile(); explicit DesktopFile(const QString &filePath); QString name(const QString &locale = QString()) const; @@ -33,5 +36,5 @@ public: QVariant value(const QString &key, const QString &locale = QString()) const; private: - QSettings m_settings; + QSharedPointer m_settings; }; diff --git a/src/plugins/AutoScroll/autoscroll.qrc b/src/plugins/AutoScroll/autoscroll.qrc index cc33d3a5d..076dbfd42 100644 --- a/src/plugins/AutoScroll/autoscroll.qrc +++ b/src/plugins/AutoScroll/autoscroll.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/scroll_all.png data/scroll_all@2x.png data/scroll_horizontal.png diff --git a/src/plugins/AutoScroll/autoscrollplugin.cpp b/src/plugins/AutoScroll/autoscrollplugin.cpp index 49067d632..ba55e7ca1 100644 --- a/src/plugins/AutoScroll/autoscrollplugin.cpp +++ b/src/plugins/AutoScroll/autoscrollplugin.cpp @@ -22,6 +22,7 @@ #include "pluginproxy.h" #include "mainapplication.h" #include "../config.h" +#include "desktopfile.h" #include @@ -31,18 +32,9 @@ AutoScrollPlugin::AutoScrollPlugin() { } -PluginSpec AutoScrollPlugin::pluginSpec() +DesktopFile AutoScrollPlugin::metaData() const { - PluginSpec spec; - spec.name = "AutoScroll"; - spec.info = "AutoScroll plugin"; - spec.description = "Provides support for autoscroll with middle mouse button"; - spec.version = "1.0.1"; - spec.author = "David Rosca "; - spec.icon = QIcon(QSL(":/autoscroll/data/scroll_all.png")).pixmap(32); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":autoscroll/metadata.desktop")); } void AutoScrollPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/AutoScroll/autoscrollplugin.h b/src/plugins/AutoScroll/autoscrollplugin.h index a7eab0e68..5b0805006 100644 --- a/src/plugins/AutoScroll/autoscrollplugin.h +++ b/src/plugins/AutoScroll/autoscrollplugin.h @@ -31,7 +31,8 @@ class AutoScrollPlugin : public QObject, public PluginInterface public: explicit AutoScrollPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/AutoScroll/metadata.desktop b/src/plugins/AutoScroll/metadata.desktop new file mode 100644 index 000000000..41084aea1 --- /dev/null +++ b/src/plugins/AutoScroll/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=AutoScroll +Comment=Provides support for autoscroll with middle mouse button + +Icon=:autoscroll/data/scroll_all.png +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=1.0.1 +X-Falkon-Settings=true diff --git a/src/plugins/FlashCookieManager/fcm_plugin.cpp b/src/plugins/FlashCookieManager/fcm_plugin.cpp index d8495aa75..d564055c3 100644 --- a/src/plugins/FlashCookieManager/fcm_plugin.cpp +++ b/src/plugins/FlashCookieManager/fcm_plugin.cpp @@ -28,6 +28,7 @@ #include "../config.h" #include "statusbar.h" #include "navigationbar.h" +#include "desktopfile.h" #include #include @@ -65,18 +66,9 @@ FCM_Plugin::FCM_Plugin() { } -PluginSpec FCM_Plugin::pluginSpec() +DesktopFile FCM_Plugin::metaData() const { - PluginSpec spec; - spec.name = "Flash Cookie Manager"; - spec.info = "A plugin to manage flash cookies."; - spec.description = "You can easily view/delete flash cookies stored on your computer. This is a solution for having more privacy."; - spec.version = "0.3.0"; - spec.author = "Razi Alavizadeh "; - spec.icon = QPixmap(":/flashcookiemanager/data/flash-cookie-manager.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":flashcookiemanager/metadata.desktop")); } void FCM_Plugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/FlashCookieManager/fcm_plugin.h b/src/plugins/FlashCookieManager/fcm_plugin.h index 600d9ebbd..2664a3b4a 100644 --- a/src/plugins/FlashCookieManager/fcm_plugin.h +++ b/src/plugins/FlashCookieManager/fcm_plugin.h @@ -51,8 +51,7 @@ class FCM_Plugin : public QObject, public PluginInterface public: explicit FCM_Plugin(); - - PluginSpec pluginSpec(); + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/FlashCookieManager/flashcookiemanager.qrc b/src/plugins/FlashCookieManager/flashcookiemanager.qrc index a7a90750a..08f939ad5 100644 --- a/src/plugins/FlashCookieManager/flashcookiemanager.qrc +++ b/src/plugins/FlashCookieManager/flashcookiemanager.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/flash-cookie-manager.png diff --git a/src/plugins/FlashCookieManager/metadata.desktop b/src/plugins/FlashCookieManager/metadata.desktop new file mode 100644 index 000000000..60b6e3edf --- /dev/null +++ b/src/plugins/FlashCookieManager/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Flash Cookie Manager +Comment=You can easily view/delete flash cookies stored on your computer. This is a solution for having more privacy. + +Icon=:flashcookiemanager/data/flash-cookie-manager.png +Type=Service + +X-Falkon-Author=Razi Alavizadeh +X-Falkon-Email=s.r.alavizadeh@gmail.com +X-Falkon-Version=0.3.0 +X-Falkon-Settings=true diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswords.qrc b/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswords.qrc index 9cb03813f..30337978f 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswords.qrc +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswords.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/icon.png diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp index f3830f82a..3a4005387 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp @@ -23,6 +23,7 @@ #include "mainapplication.h" #include "autofill.h" #include "passwordmanager.h" +#include "desktopfile.h" #include @@ -32,18 +33,9 @@ GnomeKeyringPlugin::GnomeKeyringPlugin() { } -PluginSpec GnomeKeyringPlugin::pluginSpec() +DesktopFile GnomeKeyringPlugin::metaData() const { - PluginSpec spec; - spec.name = "Gnome Keyring Passwords"; - spec.info = "Gnome Keyring password backend"; - spec.description = "Provides support for storing passwords in gnome-keyring"; - spec.version = "0.1.0"; - spec.author = "David Rosca "; - spec.icon = QPixmap(":gkp/data/icon.png"); - spec.hasSettings = false; - - return spec; + return DesktopFile(QSL(":gkp/metadata.desktop")); } void GnomeKeyringPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.h b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.h index 90c5a2764..436e83fd4 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.h +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.h @@ -30,7 +30,8 @@ class GnomeKeyringPlugin : public QObject, public PluginInterface public: explicit GnomeKeyringPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/GnomeKeyringPasswords/metadata.desktop b/src/plugins/GnomeKeyringPasswords/metadata.desktop new file mode 100644 index 000000000..05eec73ab --- /dev/null +++ b/src/plugins/GnomeKeyringPasswords/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Gnome Keyring Passwords +Comment=Provides support for storing passwords in gnome-keyring + +Icon=:gkp/data/icon.png +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.1.0 +X-Falkon-Settings=false diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index d29ecd4a9..5c684a3f5 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -25,6 +25,7 @@ #include "tabwidget.h" #include "webtab.h" #include "../config.h" +#include "desktopfile.h" #include @@ -34,18 +35,9 @@ GM_Plugin::GM_Plugin() { } -PluginSpec GM_Plugin::pluginSpec() +DesktopFile GM_Plugin::metaData() const { - PluginSpec spec; - spec.name = "GreaseMonkey"; - spec.info = "Userscripts for Falkon"; - spec.description = "Provides support for userscripts"; - spec.version = "0.9.4"; - spec.author = "David Rosca "; - spec.icon = QIcon(":gm/data/icon.svg").pixmap(32); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":gm/metadata.desktop")); } void GM_Plugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/GreaseMonkey/gm_plugin.h b/src/plugins/GreaseMonkey/gm_plugin.h index a1368ddbc..70c411be7 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.h +++ b/src/plugins/GreaseMonkey/gm_plugin.h @@ -31,7 +31,7 @@ class GM_Plugin : public QObject, public PluginInterface public: explicit GM_Plugin(); - PluginSpec pluginSpec() override; + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath) override; void unload() override; bool testPlugin() override; diff --git a/src/plugins/GreaseMonkey/greasemonkey.qrc b/src/plugins/GreaseMonkey/greasemonkey.qrc index 38ebd4683..5ff8fab5d 100644 --- a/src/plugins/GreaseMonkey/greasemonkey.qrc +++ b/src/plugins/GreaseMonkey/greasemonkey.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/bootstrap.min.js data/values.min.js data/icon.svg diff --git a/src/plugins/GreaseMonkey/metadata.desktop b/src/plugins/GreaseMonkey/metadata.desktop new file mode 100644 index 000000000..5baf7ff68 --- /dev/null +++ b/src/plugins/GreaseMonkey/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=GreaseMonkey +Comment=Provides support for userscripts + +Icon=:gm/data/icon.svg +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.9.4 +X-Falkon-Settings=true diff --git a/src/plugins/ImageFinder/imagefinder.qrc b/src/plugins/ImageFinder/imagefinder.qrc index 3bb118c35..552dc4e33 100644 --- a/src/plugins/ImageFinder/imagefinder.qrc +++ b/src/plugins/ImageFinder/imagefinder.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/icon.png data/google.png data/yandex.png diff --git a/src/plugins/ImageFinder/imagefinderplugin.cpp b/src/plugins/ImageFinder/imagefinderplugin.cpp index 454135c9e..6f143a019 100644 --- a/src/plugins/ImageFinder/imagefinderplugin.cpp +++ b/src/plugins/ImageFinder/imagefinderplugin.cpp @@ -24,6 +24,7 @@ #include "mainapplication.h" #include "enhancedmenu.h" #include "../config.h" +#include "desktopfile.h" #include #include @@ -34,18 +35,9 @@ ImageFinderPlugin::ImageFinderPlugin() { } -PluginSpec ImageFinderPlugin::pluginSpec() +DesktopFile ImageFinderPlugin::metaData() const { - PluginSpec spec; - spec.name = "ImageFinder"; - spec.info = "Image Finder Plugin"; - spec.description = "Provides context menu with reverse image search engine support"; - spec.version = "0.2.0"; - spec.author = "Vladislav Tronko "; - spec.icon = QPixmap(":/imgfinder/data/icon.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":imgfinder/metadata.desktop")); } void ImageFinderPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/ImageFinder/imagefinderplugin.h b/src/plugins/ImageFinder/imagefinderplugin.h index bef903ae1..fa6bd0e26 100644 --- a/src/plugins/ImageFinder/imagefinderplugin.h +++ b/src/plugins/ImageFinder/imagefinderplugin.h @@ -32,7 +32,8 @@ class ImageFinderPlugin : public QObject, public PluginInterface public: explicit ImageFinderPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/ImageFinder/metadata.desktop b/src/plugins/ImageFinder/metadata.desktop new file mode 100644 index 000000000..30638aad9 --- /dev/null +++ b/src/plugins/ImageFinder/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=ImageFinder +Comment=Provides context menu with reverse image search engine support + +Icon=:imgfinder/data/icon.png +Type=Service + +X-Falkon-Author=Vladislav Tronko +X-Falkon-Email=innermous@gmail.com +X-Falkon-Version=0.2.0 +X-Falkon-Settings=true diff --git a/src/plugins/KWalletPasswords/kwalletpasswords.qrc b/src/plugins/KWalletPasswords/kwalletpasswords.qrc index d67aca1ff..6cf9605e1 100644 --- a/src/plugins/KWalletPasswords/kwalletpasswords.qrc +++ b/src/plugins/KWalletPasswords/kwalletpasswords.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/icon.png diff --git a/src/plugins/KWalletPasswords/kwalletplugin.cpp b/src/plugins/KWalletPasswords/kwalletplugin.cpp index 19f493607..61da76cff 100644 --- a/src/plugins/KWalletPasswords/kwalletplugin.cpp +++ b/src/plugins/KWalletPasswords/kwalletplugin.cpp @@ -23,6 +23,7 @@ #include "mainapplication.h" #include "autofill.h" #include "passwordmanager.h" +#include "desktopfile.h" #include @@ -32,18 +33,9 @@ KWalletPlugin::KWalletPlugin() { } -PluginSpec KWalletPlugin::pluginSpec() +DesktopFile KWalletPlugin::metaData() const { - PluginSpec spec; - spec.name = "KWallet Passwords"; - spec.info = "KWallet password backend"; - spec.description = "Provides support for storing passwords in KWallet"; - spec.version = "0.1.2"; - spec.author = "David Rosca "; - spec.icon = QPixmap(":kwp/data/icon.png"); - spec.hasSettings = false; - - return spec; + return DesktopFile(QSL(":kwp/metadata.desktop")); } void KWalletPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/KWalletPasswords/kwalletplugin.h b/src/plugins/KWalletPasswords/kwalletplugin.h index c61b46503..5480b6907 100644 --- a/src/plugins/KWalletPasswords/kwalletplugin.h +++ b/src/plugins/KWalletPasswords/kwalletplugin.h @@ -30,7 +30,8 @@ class KWalletPlugin : public QObject, public PluginInterface public: explicit KWalletPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/KWalletPasswords/metadata.desktop b/src/plugins/KWalletPasswords/metadata.desktop new file mode 100644 index 000000000..9158bb05c --- /dev/null +++ b/src/plugins/KWalletPasswords/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=KWallet Passwords +Comment=Provides support for storing passwords in KWallet + +Icon=:kwp/data/icon.png +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.1.2 +X-Falkon-Settings=false diff --git a/src/plugins/MouseGestures/metadata.desktop b/src/plugins/MouseGestures/metadata.desktop new file mode 100644 index 000000000..8f46a33e8 --- /dev/null +++ b/src/plugins/MouseGestures/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Mouse Gestures +Comment=Provides support for navigating in webpages by mouse gestures + +Icon=:mousegestures/data/icon.png +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.5.0 +X-Falkon-Settings=true diff --git a/src/plugins/MouseGestures/mousegestures.qrc b/src/plugins/MouseGestures/mousegestures.qrc index 12add1abf..9eed5abba 100644 --- a/src/plugins/MouseGestures/mousegestures.qrc +++ b/src/plugins/MouseGestures/mousegestures.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/icon.png data/down.gif data/down-left.gif diff --git a/src/plugins/MouseGestures/mousegesturesplugin.cpp b/src/plugins/MouseGestures/mousegesturesplugin.cpp index 1864dc7ce..4e217c50b 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.cpp +++ b/src/plugins/MouseGestures/mousegesturesplugin.cpp @@ -21,6 +21,7 @@ #include "mainapplication.h" #include "browserwindow.h" #include "../config.h" +#include "desktopfile.h" #include @@ -30,18 +31,9 @@ MouseGesturesPlugin::MouseGesturesPlugin() { } -PluginSpec MouseGesturesPlugin::pluginSpec() +DesktopFile MouseGesturesPlugin::metaData() const { - PluginSpec spec; - spec.name = "Mouse Gestures"; - spec.info = "Mouse gestures for Falkon"; - spec.description = "Provides support for navigating in webpages by mouse gestures"; - spec.version = "0.5.0"; - spec.author = "David Rosca "; - spec.icon = QPixmap(":/mousegestures/data/icon.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":mousegestures/metadata.desktop")); } void MouseGesturesPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/MouseGestures/mousegesturesplugin.h b/src/plugins/MouseGestures/mousegesturesplugin.h index fa29d92ac..a6b0a785b 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.h +++ b/src/plugins/MouseGestures/mousegesturesplugin.h @@ -29,7 +29,8 @@ class MouseGesturesPlugin : public QObject, public PluginInterface public: MouseGesturesPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/PIM/PIM_plugin.cpp b/src/plugins/PIM/PIM_plugin.cpp index 2e4875c67..7be61b72b 100644 --- a/src/plugins/PIM/PIM_plugin.cpp +++ b/src/plugins/PIM/PIM_plugin.cpp @@ -24,6 +24,7 @@ #include "browserwindow.h" #include "webview.h" #include "../config.h" +#include "desktopfile.h" #include @@ -33,18 +34,9 @@ PIM_Plugin::PIM_Plugin() { } -PluginSpec PIM_Plugin::pluginSpec() +DesktopFile PIM_Plugin::metaData() const { - PluginSpec spec; - spec.name = "PIM"; - spec.info = "Personal Information Manager"; - spec.description = "Adds ability for Falkon to store some personal data"; - spec.version = "0.2.0"; - spec.author = QString::fromUtf8("Mladen Pejaković "); - spec.icon = QPixmap(":/PIM/data/PIM.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":PIM/metadata.desktop")); } void PIM_Plugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/PIM/PIM_plugin.h b/src/plugins/PIM/PIM_plugin.h index 5f68b59e1..9c1516d96 100644 --- a/src/plugins/PIM/PIM_plugin.h +++ b/src/plugins/PIM/PIM_plugin.h @@ -33,7 +33,8 @@ class PIM_Plugin : public QObject, public PluginInterface public: PIM_Plugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/PIM/PIM_res.qrc b/src/plugins/PIM/PIM_res.qrc index 7aab324d0..092899255 100644 --- a/src/plugins/PIM/PIM_res.qrc +++ b/src/plugins/PIM/PIM_res.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/PIM.png diff --git a/src/plugins/PIM/metadata.desktop b/src/plugins/PIM/metadata.desktop new file mode 100644 index 000000000..a64f99a88 --- /dev/null +++ b/src/plugins/PIM/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=PIM +Comment=Adds ability for Falkon to store some personal data + +Icon=:PIM/data/PIM.png +Type=Service + +X-Falkon-Author=Mladen Pejaković +X-Falkon-Email=pejakm@autistici.org +X-Falkon-Version=0.2.0 +X-Falkon-Settings=true diff --git a/src/plugins/StatusBarIcons/metadata.desktop b/src/plugins/StatusBarIcons/metadata.desktop new file mode 100644 index 000000000..f4322967e --- /dev/null +++ b/src/plugins/StatusBarIcons/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=StatusBar Icons +Comment=Adds additional icons and zoom widget to statusbar + +Icon=:sbi/data/icon.png +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.2.0 +X-Falkon-Settings=true diff --git a/src/plugins/StatusBarIcons/statusbaricons.qrc b/src/plugins/StatusBarIcons/statusbaricons.qrc index 6053ac73f..8d7dbc5c7 100644 --- a/src/plugins/StatusBarIcons/statusbaricons.qrc +++ b/src/plugins/StatusBarIcons/statusbaricons.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/icon.png data/images.png data/javascript.png diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp index 514de8d30..594641155 100644 --- a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp @@ -22,6 +22,7 @@ #include "browserwindow.h" #include "../config.h" #include "mainapplication.h" +#include "desktopfile.h" #include @@ -31,18 +32,9 @@ StatusBarIconsPlugin::StatusBarIconsPlugin() { } -PluginSpec StatusBarIconsPlugin::pluginSpec() +DesktopFile StatusBarIconsPlugin::metaData() const { - PluginSpec spec; - spec.name = "StatusBar Icons"; - spec.info = "Icons in statusbar providing various actions"; - spec.description = "Adds additional icons and zoom widget to statusbar"; - spec.version = "0.2.0"; - spec.author = "David Rosca "; - spec.icon = QPixmap(":sbi/data/icon.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":sbi/metadata.desktop")); } void StatusBarIconsPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.h b/src/plugins/StatusBarIcons/statusbariconsplugin.h index 4780860b0..4435c6404 100644 --- a/src/plugins/StatusBarIcons/statusbariconsplugin.h +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.h @@ -30,7 +30,8 @@ class StatusBarIconsPlugin : public QObject, public PluginInterface public: explicit StatusBarIconsPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/TabManager/metadata.desktop b/src/plugins/TabManager/metadata.desktop new file mode 100644 index 000000000..f892dac37 --- /dev/null +++ b/src/plugins/TabManager/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Tab Manager +Comment=Adds ability to managing tabs and windows + +Icon=:tabmanager/data/tabmanager.png +Type=Service + +X-Falkon-Author=Razi Alavizadeh +X-Falkon-Email=s.r.alavizadeh@gmail.com +X-Falkon-Version=0.8.0 +X-Falkon-Settings=true diff --git a/src/plugins/TabManager/tabmanagerplugin.cpp b/src/plugins/TabManager/tabmanagerplugin.cpp index 895999ec7..23fda4562 100644 --- a/src/plugins/TabManager/tabmanagerplugin.cpp +++ b/src/plugins/TabManager/tabmanagerplugin.cpp @@ -26,6 +26,7 @@ #include "tabbar.h" #include "tabmanagersettings.h" #include "../config.h" +#include "desktopfile.h" #include #include @@ -46,18 +47,9 @@ TabManagerPlugin::TabManagerPlugin() { } -PluginSpec TabManagerPlugin::pluginSpec() +DesktopFile TabManagerPlugin::metaData() const { - PluginSpec spec; - spec.name = "Tab Manager"; - spec.info = "Simple yet powerful tab manager for Falkon"; - spec.description = "Adds ability to managing tabs and windows"; - spec.version = "0.8.0"; - spec.author = "Razi Alavizadeh "; - spec.icon = QPixmap(":tabmanager/data/tabmanager.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":tabmanager/metadata.desktop")); } void TabManagerPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/TabManager/tabmanagerplugin.h b/src/plugins/TabManager/tabmanagerplugin.h index 08198cd6b..21ec481fb 100644 --- a/src/plugins/TabManager/tabmanagerplugin.h +++ b/src/plugins/TabManager/tabmanagerplugin.h @@ -38,7 +38,8 @@ class TabManagerPlugin : public QObject, public PluginInterface public: explicit TabManagerPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/TabManager/tabmanagerplugin.qrc b/src/plugins/TabManager/tabmanagerplugin.qrc index 97152bfb8..949502d6b 100644 --- a/src/plugins/TabManager/tabmanagerplugin.qrc +++ b/src/plugins/TabManager/tabmanagerplugin.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/tabmanager.png data/tab-close.png data/tab-bookmark.png diff --git a/src/plugins/TestPlugin/CMakeLists.txt b/src/plugins/TestPlugin/CMakeLists.txt index ad7afb1d4..e50ff933c 100644 --- a/src/plugins/TestPlugin/CMakeLists.txt +++ b/src/plugins/TestPlugin/CMakeLists.txt @@ -3,7 +3,12 @@ set( TestPlugin_SRCS testplugin_sidebar.cpp ) + +set( TestPlugin_RSCS + testplugin.qrc +) +qt5_add_resources(RSCS ${TestPlugin_RSCS}) + add_library(TestPlugin MODULE ${TestPlugin_SRCS} ${RSCS}) install(TARGETS TestPlugin DESTINATION ${FALKON_INSTALL_PLUGINDIR}) target_link_libraries(TestPlugin FalkonPrivate) - diff --git a/src/plugins/TestPlugin/metadata.desktop b/src/plugins/TestPlugin/metadata.desktop new file mode 100644 index 000000000..c09ededb5 --- /dev/null +++ b/src/plugins/TestPlugin/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Example Plugin +Comment=Very simple minimal plugin example + +Icon=configure +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.1.7 +X-Falkon-Settings=true diff --git a/src/plugins/TestPlugin/testplugin.cpp b/src/plugins/TestPlugin/testplugin.cpp index 699873ff7..11ab6290c 100644 --- a/src/plugins/TestPlugin/testplugin.cpp +++ b/src/plugins/TestPlugin/testplugin.cpp @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-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 @@ -24,6 +24,7 @@ #include "sidebar.h" #include "webhittestresult.h" #include "../config.h" +#include "desktopfile.h" #include #include @@ -37,18 +38,9 @@ TestPlugin::TestPlugin() // It will be called even if user doesn't have the plugin allowed } -PluginSpec TestPlugin::pluginSpec() +DesktopFile TestPlugin::metaData() const { - PluginSpec spec; - spec.name = "Example Plugin"; - spec.info = "Example minimal plugin"; - spec.description = "Very simple minimal plugin example"; - spec.version = "0.1.7"; - spec.author = "David Rosca "; - spec.icon = QPixmap(":qupzilla.png"); - spec.hasSettings = true; - - return spec; + return DesktopFile(QSL(":testplugin/metadata.desktop")); } void TestPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/TestPlugin/testplugin.h b/src/plugins/TestPlugin/testplugin.h index 68ea75fa3..79d4568c3 100644 --- a/src/plugins/TestPlugin/testplugin.h +++ b/src/plugins/TestPlugin/testplugin.h @@ -34,7 +34,8 @@ class TestPlugin : public QObject, public PluginInterface public: explicit TestPlugin(); - PluginSpec pluginSpec(); + + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath); void unload(); diff --git a/src/plugins/TestPlugin/testplugin.qrc b/src/plugins/TestPlugin/testplugin.qrc new file mode 100644 index 000000000..f2a437ffd --- /dev/null +++ b/src/plugins/TestPlugin/testplugin.qrc @@ -0,0 +1,5 @@ + + + metadata.desktop + + diff --git a/src/plugins/VerticalTabs/metadata.desktop b/src/plugins/VerticalTabs/metadata.desktop new file mode 100644 index 000000000..e629d5eab --- /dev/null +++ b/src/plugins/VerticalTabs/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Vertical Tabs +Comment=Adds ability to show tabs in sidebar + +Icon=:verticaltabs/data/icon.svg +Type=Service + +X-Falkon-Author=David Rosca +X-Falkon-Email=nowrep@gmail.com +X-Falkon-Version=0.1.0 +X-Falkon-Settings=true diff --git a/src/plugins/VerticalTabs/verticaltabs.qrc b/src/plugins/VerticalTabs/verticaltabs.qrc index 42fecc7ed..cff351abb 100644 --- a/src/plugins/VerticalTabs/verticaltabs.qrc +++ b/src/plugins/VerticalTabs/verticaltabs.qrc @@ -1,5 +1,6 @@ + metadata.desktop data/icon.svg data/group.svg data/index.html diff --git a/src/plugins/VerticalTabs/verticaltabsplugin.cpp b/src/plugins/VerticalTabs/verticaltabsplugin.cpp index 468bec21b..4aa2b82b9 100644 --- a/src/plugins/VerticalTabs/verticaltabsplugin.cpp +++ b/src/plugins/VerticalTabs/verticaltabsplugin.cpp @@ -28,6 +28,7 @@ #include "sidebar.h" #include "networkmanager.h" #include "../config.h" +#include "desktopfile.h" #include #include @@ -37,17 +38,9 @@ VerticalTabsPlugin::VerticalTabsPlugin() { } -PluginSpec VerticalTabsPlugin::pluginSpec() +DesktopFile VerticalTabsPlugin::metaData() const { - PluginSpec spec; - spec.name = QSL("Vertical Tabs"); - spec.info = QSL("Vertical tabs for Falkon"); - spec.description = QSL("Adds ability to show tabs in sidebar"); - spec.version = QSL("0.1.0"); - spec.author = QSL("David Rosca "); - spec.icon = QIcon(QSL(":verticaltabs/data/icon.svg")).pixmap(32); - spec.hasSettings = true; - return spec; + return DesktopFile(QSL(":verticaltabs/metadata.desktop")); } void VerticalTabsPlugin::init(InitState state, const QString &settingsPath) diff --git a/src/plugins/VerticalTabs/verticaltabsplugin.h b/src/plugins/VerticalTabs/verticaltabsplugin.h index 5fce365a1..17f1b714d 100644 --- a/src/plugins/VerticalTabs/verticaltabsplugin.h +++ b/src/plugins/VerticalTabs/verticaltabsplugin.h @@ -33,7 +33,7 @@ class VerticalTabsPlugin : public QObject, public PluginInterface public: explicit VerticalTabsPlugin(); - PluginSpec pluginSpec() override; + DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath) override; void unload() override; bool testPlugin() override;