Commit a74b04e5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for open adblock web site url

parent 9a73cfc5
......@@ -46,6 +46,7 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
#include <KMessageBox>
#include <KLocalizedString>
#include <QWhatsThisClickedEvent>
// Qt Includes
#include <QWhatsThis>
......@@ -55,6 +56,7 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
#include <QTextStream>
#include <QStandardPaths>
#include <QRegularExpression>
#include <KRun>
using namespace MessageViewer;
AdBlockSettingWidget::AdBlockSettingWidget(QWidget *parent)
......@@ -141,17 +143,29 @@ void AdBlockSettingWidget::slotInfoLinkActivated(const QString &url)
const QString href = QStringLiteral("");
const QString hintHelpString = i18n("<qt><p>Enter an expression to filter. Filters can be defined as either:"
"<ul><li>a shell-style wildcard, e.g. <tt>*</tt>, "
"the wildcards <tt>*?[]</tt> may be used</li>"
"<li>a full regular expression by surrounding the string with '<tt>/</tt>', "
"e.g. <tt>/\\/(ad|banner)\\./</tt></li></ul>"
"<p>Any filter string can be preceded by '<tt>@@</tt>' to whitelist (allow) any matching URL, "
"which takes priority over any blacklist (blocking) filter.");
"which takes priority over any blacklist (blocking) filter.<br><a href=\'%1\'>%2</a></qt>", href, i18n("More information"));
QWhatsThis::showText(QCursor::pos(), hintHelpString);
QWhatsThis::showText(QCursor::pos(), hintHelpString, this);
bool AdBlockSettingWidget::event(QEvent *event)
if (event->type() == QEvent::WhatsThisClicked) {
QWhatsThisClickedEvent *clicked = static_cast<QWhatsThisClickedEvent *>(event);
new KRun(QUrl(clicked->href()), this);
return true;
return QWidget::event(event);
void AdBlockSettingWidget::insertRule()
const QString rule = mUi->addFilterLineEdit->text();
......@@ -58,6 +58,8 @@ public:
void changed(bool);
bool event(QEvent *event) Q_DECL_OVERRIDE;
private Q_SLOTS:
void hasChanged();
void slotInfoLinkActivated(const QString &);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment