[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim-addons] plugins/messageviewerwebengineurlinterceptor/adblock: Show action when
From: Montel Laurent <montel () kde ! org>
Date: 2016-03-31 19:23:11
Message-ID: E1aliBT-00089w-LM () scm ! kde ! org
[Download RAW message or body]
Git commit d877aeb2ce79ad034aef09411188b8b771fb93d6 by Montel Laurent.
Committed on 31/03/2016 at 19:23.
Pushed by mlaurent into branch 'master'.
Show action when necessary
M +14 -10 plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.cpp
M +2 -1 plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.h
http://commits.kde.org/kdepim-addons/d877aeb2ce79ad034aef09411188b8b771fb93d6
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.cpp \
b/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.cpp
index 959c4bd..667fd73 100644
--- a/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.cpp
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.cpp
@@ -27,6 +27,7 @@
AdblockInterceptorInterface::AdblockInterceptorInterface(QObject *parent)
: MessageViewer::NetworkPluginUrlInterceptorInterface(parent),
+ mShowBlockableItems(Q_NULLPTR),
mWebEngineView(Q_NULLPTR)
{
mAdblockManager = new AdBlock::AdblockManager(this);
@@ -50,23 +51,26 @@ bool \
AdblockInterceptorInterface::interceptRequest(QWebEngineUrlRequestInfo &inf
QList<QAction *> AdblockInterceptorInterface::actions() const
{
- return mActionsList;
+ QList<QAction *> lstAction;
+ if (mAdblockManager->isEnabled()) {
+ lstAction.append(mShowBlockableItems);
+ lstAction.append(mBlockImage);
+ }
+ return lstAction;
}
void AdblockInterceptorInterface::createActions(KActionCollection *ac)
{
if (ac) {
- QAction *showBlockableItems = new QAction(i18n("Open Blockable Items..."), \
this);
- ac->addAction(QStringLiteral("adblock_blockable_items"), \
showBlockableItems);
- connect(showBlockableItems, &QAction::triggered, this, \
&AdblockInterceptorInterface::slotShowBlockableElement);
- mActionsList.append(showBlockableItems);
+ mShowBlockableItems = new QAction(i18n("Open Blockable Items..."), this);
+ ac->addAction(QStringLiteral("adblock_blockable_items"), \
mShowBlockableItems); + connect(mShowBlockableItems, &QAction::triggered, \
this, &AdblockInterceptorInterface::slotShowBlockableElement);
- QAction *blockImage = new QAction(i18n("Block image"), this);
- ac->addAction(QStringLiteral("adblock_image"), blockImage);
- ac->setShortcutsConfigurable(blockImage, false);
- connect(blockImage, &QAction::triggered, this, \
&AdblockInterceptorInterface::slotBlockImage); + mBlockImage = new \
QAction(i18n("Block Image"), this); + \
ac->addAction(QStringLiteral("adblock_image"), mBlockImage); + \
ac->setShortcutsConfigurable(mBlockImage, false); + connect(mBlockImage, \
&QAction::triggered, this, &AdblockInterceptorInterface::slotBlockImage); }
- //TODO more actions
}
QWebEngineView *AdblockInterceptorInterface::webEngineView() const
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.h \
b/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.h \
index 440b241..a8ff172 100644
--- a/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.h
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/adblockinterceptorinterface.h
@@ -43,7 +43,8 @@ private Q_SLOTS:
void slotShowBlockableElement();
private:
- QList<QAction *> mActionsList;
+ QAction *mShowBlockableItems;
+ QAction *mBlockImage;
AdBlock::AdblockManager *mAdblockManager;
QWebEngineView *mWebEngineView;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic