diff options
-rw-r--r-- | Kconfig | 85 | ||||
-rw-r--r-- | include/browserinterface.h | 2 | ||||
-rw-r--r-- | lib/bookmarks/xbel.h | 2 | ||||
-rw-r--r-- | lib/downloads/widgets/elidedlabel.h | 1 | ||||
-rw-r--r-- | lib/urlfilter/filterleaf.h | 2 | ||||
-rw-r--r-- | lib/urlfilter/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | src/Kconfig | 82 | ||||
-rw-r--r-- | src/mainwindow/widgets/dockwidget.h | 2 | ||||
-rw-r--r-- | src/meson.build | 2 | ||||
-rw-r--r-- | src/webengine/filter.cpp | 27 |
11 files changed, 95 insertions, 116 deletions
@@ -1,28 +1,73 @@ -mainmenu "smolbote configuration" +menu "Application" + config POI_NAME + string "Application name" + default "smolbote" + config POI_ICON + string "Path to icon" + default ":/icons/poi.svg" +endmenu + +menu "Configuration defaults" + config PATH_CONFIG + string "Configuration location" + default "~/.config/smolbote/smolbote.cfg" + config PATH_FILTER + string "Host filter path" + default "~/.config/smolbote/hosts.d" + config PATH_PLUGINS + string "Plugin load location" + default "~/.config/smolbote/plugins.d" + config PATH_PROFILES + string "Profile load location" + default "~/.config/smolbote/profiles.d" + config PATH_BOOKMARKS + string "Bookmarks location" + default "~/.config/smolbote/bookmarks.xbel" + config PATH_DOWNLOADS + string "Downloads location" + default "~/Downloads" +endmenu + +config USEPLASMA + bool "Enable KDE Frameworks integration" + default n + select SHOW_KDE_INTEGRATION + help + This is a help message -comment "Build system settings" -menu "Install paths" - config INSTALL_BINDIR - string "User executables" - default "bin" +menu "KDE Integration" + depends on USEPLASMA - config INSTALL_LIBDIR - string "Object code libraries" - default "lib64" + config PLASMA_BLUR + bool "Enable translucent background and blur behind window" + default n - config INSTALL_PLUGINDIR - string "Plugins" - default "lib64/plugins" + config WALLET_FOLDER + string "KDE Wallet folder name" + default "smolbote" +endmenu + +config USEBREAKPAD + bool "Enable Breakpad integration" + default n - config INSTALL_APPDIR - string "Application .desktop file" - default "usr/share/applications" +menu "Breakpad Integration" + depends on USEBREAKPAD - config INSTALL_ICONDIR - string "Icons" - default "usr/share/icons" + config PATH_CRASHDUMP + string "Crash dump location" + default "~/.config/smolbote/crash.d" + config PATH_CRASHHANDLER + string "Crash handler location" + default "" endmenu -comment "Application Settings" -rsource src/Kconfig +menu "Workarounds" + config QTBUG_65223 + bool "Manually emit loadFinished" + default y + help + See QTBUG-65223: loadStarted is emitted twice when loading link with anchor + +endmenu diff --git a/include/browserinterface.h b/include/browserinterface.h index 25de65c..ef89456 100644 --- a/include/browserinterface.h +++ b/include/browserinterface.h @@ -12,6 +12,8 @@ class Profile; class BrowserInterface { public: + virtual ~BrowserInterface() = default; + // configuration access virtual const QStringList configurationOptions() const = 0; virtual const QString configuration(const QString &key) const = 0; diff --git a/lib/bookmarks/xbel.h b/lib/bookmarks/xbel.h index c36bc6b..97a6ed4 100644 --- a/lib/bookmarks/xbel.h +++ b/lib/bookmarks/xbel.h @@ -15,6 +15,6 @@ namespace Xbel { void read(QIODevice *device, BookmarkItem *model); void write(QIODevice *device, const BookmarkItem *item); -}; +} #endif // XBEL_H diff --git a/lib/downloads/widgets/elidedlabel.h b/lib/downloads/widgets/elidedlabel.h index b147d1a..3e3ccba 100644 --- a/lib/downloads/widgets/elidedlabel.h +++ b/lib/downloads/widgets/elidedlabel.h @@ -13,6 +13,7 @@ class ElidedLabel : public QLabel { + Q_OBJECT public: explicit ElidedLabel(QWidget *parent = nullptr); diff --git a/lib/urlfilter/filterleaf.h b/lib/urlfilter/filterleaf.h index a565f92..44330aa 100644 --- a/lib/urlfilter/filterleaf.h +++ b/lib/urlfilter/filterleaf.h @@ -36,7 +36,7 @@ public: FilterLeaf(FilterLeaf &&other); FilterLeaf &operator=(FilterLeaf &&other); - ~FilterLeaf() = default; + virtual ~FilterLeaf() = default; virtual bool match(const QUrl &requestUrl) const = 0; virtual Action action() const = 0; diff --git a/lib/urlfilter/meson.build b/lib/urlfilter/meson.build index 732b67f..082320c 100644 --- a/lib/urlfilter/meson.build +++ b/lib/urlfilter/meson.build @@ -1,7 +1,7 @@ urlfilter_inc = include_directories('.') urlfilter_moc = qt5.preprocess( - moc_headers: ['filtertree.h', 'filterleaf.h', 'formats/adblockrule.h', 'formats/hostlistrule.h'], + moc_headers: 'filtertree.h', dependencies: dep_qt5 ) diff --git a/meson.build b/meson.build index 93947bf..20a4844 100644 --- a/meson.build +++ b/meson.build @@ -41,7 +41,7 @@ dep_genheaders = declare_dependency( output: 'version.h' ), custom_target('configheader', - input: ['tools/config.py', 'src/Kconfig', host_machine.system() + '/.config'], + input: ['tools/config.py', 'Kconfig', host_machine.system() + '/.config'], output: 'config.h', command: [python3, '@INPUT0@', '--kconfig=@INPUT1@', '--dotconfig=@INPUT2@', '--generate=@OUTPUT@'], build_by_default: true @@ -49,7 +49,7 @@ dep_genheaders = declare_dependency( ) interfaces_moc = qt5.preprocess( - moc_headers: ['include/browserinterface.h', 'include/plugininterface.h', 'include/profileinterface.h'], + moc_headers: 'include/profileinterface.h', dependencies: dep_qt5 ) diff --git a/src/Kconfig b/src/Kconfig deleted file mode 100644 index fcecdea..0000000 --- a/src/Kconfig +++ /dev/null @@ -1,82 +0,0 @@ -menu "Application" - config POI_NAME - string "Application name" - default "smolbote" - config POI_EXE - string "Executable name" - default "poi" - config POI_ICON - string "Path to icon" - default ":/icons/poi.svg" -endmenu - -menu "Configuration defaults" - config PATH_CONFIG - string "Configuration location" - default "~/.config/smolbote/smolbote.cfg" - config PATH_FILTER - string "Host filter path" - default "~/.config/smolbote/hosts.d" - config PATH_PLUGINS - string "Plugin load location" - default "~/.config/smolbote/plugins.d" - config PATH_PROFILES - string "Profile load location" - default "~/.config/smolbote/profiles.d" - config PATH_BOOKMARKS - string "Bookmarks location" - default "~/.config/smolbote/bookmarks.xbel" - config PATH_DOWNLOADS - string "Downloads location" - default "~/Downloads" -endmenu - -config USEPLASMA - bool "Enable KDE Frameworks integration" - default n - select SHOW_KDE_INTEGRATION - help - This is a help message - -menu "KDE Integration" - depends on USEPLASMA - - config PLASMA_BLUR - bool "Enable translucent background and blur behind window" - default n - - config WALLET_FOLDER - string "KDE Wallet folder name" - default "smolbote" -endmenu - -config USEBREAKPAD - bool "Enable Breakpad integration" - default n - -menu "Breakpad Integration" - depends on USEBREAKPAD - - config PATH_CRASHDUMP - string "Crash dump location" - default "~/.config/smolbote/crash.d" - - config PATH_CRASHHANDLER - string "Crash handler location" - default "" -endmenu - -menu "Workarounds" - config QTBUG_62511 - bool "Use RCC version 1 format" - default y - help - See QTBUG-62511: rcc embeds time in output - - config QTBUG_65223 - bool "Manually emit loadFinished" - default y - help - See QTBUG-65223: loadStarted is emitted twice when loading link with anchor - -endmenu diff --git a/src/mainwindow/widgets/dockwidget.h b/src/mainwindow/widgets/dockwidget.h index 99ae417..ed31ec3 100644 --- a/src/mainwindow/widgets/dockwidget.h +++ b/src/mainwindow/widgets/dockwidget.h @@ -13,6 +13,8 @@ class DockWidget : public QDockWidget { + Q_OBJECT + public: DockWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); ~DockWidget(); diff --git a/src/meson.build b/src/meson.build index a977e8b..f99d0c7 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,6 +1,6 @@ # poi poi_moc = qt5.preprocess( - moc_headers: ['browser.h', 'session.h', + moc_headers: ['browser.h', 'mainwindow/mainwindow.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h', 'subwindow/subwindow.h', 'subwindow/tabwidget.h', 'webengine/filter.h', 'webengine/urlinterceptor.h', 'webengine/webpage.h', 'webengine/webview.h'], diff --git a/src/webengine/filter.cpp b/src/webengine/filter.cpp index 9db61cb..216c84c 100644 --- a/src/webengine/filter.cpp +++ b/src/webengine/filter.cpp @@ -7,13 +7,13 @@ */ #include "filter.h" +#include "configuration.h" #include "urlinterceptor.h" +#include "util.h" #include <QDir> #include <QJsonArray> #include <QJsonDocument> #include <QTextStream> -#include "configuration.h" -#include "util.h" /* inline std::vector<FilterRule> parseAdBlockList(const QString &filename) @@ -36,7 +36,7 @@ inline std::vector<FilterRule> parseAdBlockList(const QString &filename) return rules; }*/ -Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject* parent) +Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject *parent) : QObject(parent) { // parse headers @@ -68,15 +68,26 @@ Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject* pa */ } -void Filter::filterRequest(QWebEngineUrlRequestInfo& info) const +void Filter::filterRequest(QWebEngineUrlRequestInfo &info) const { auto matches = filters.match(info.firstPartyUrl().toString(), info.requestUrl().toString()); for(const auto &rule : matches) { switch(rule->action()) { - case FilterLeaf::Block: - qDebug("block %s", qUtf8Printable(info.requestUrl().toString())); - info.block(true); - break; + case FilterLeaf::NotMatched: +#ifdef QT_DEBUG + qDebug("Paradoxical match: request matched, but not matched."); + qDebug(" - %s", qUtf8Printable(info.requestUrl().toString())); +#endif + break; + case FilterLeaf::Block: + //qDebug("block %s", qUtf8Printable(info.requestUrl().toString())); + info.block(true); + break; + case FilterLeaf::Allow: + info.block(false); + break; + //case FilterLeaf::Redirect: + // break; } } } |