mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
parent
878ed65753
commit
458c131170
@ -46,6 +46,8 @@ AdBlockIcon::AdBlockIcon(BrowserWindow* window, QWidget* parent)
|
|||||||
|
|
||||||
AdBlockIcon::~AdBlockIcon()
|
AdBlockIcon::~AdBlockIcon()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < m_blockedPopups.count(); ++i)
|
||||||
|
delete m_blockedPopups.at(i).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
|
void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
|
||||||
@ -59,10 +61,8 @@ void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdBlockRule rule(filter, subscription);
|
QPair<AdBlockRule*, QUrl> pair;
|
||||||
|
pair.first = new AdBlockRule(filter, subscription);
|
||||||
QPair<AdBlockRule, QUrl> pair;
|
|
||||||
pair.first = rule;
|
|
||||||
pair.second = url;
|
pair.second = url;
|
||||||
m_blockedPopups.append(pair);
|
m_blockedPopups.append(pair);
|
||||||
|
|
||||||
@ -138,13 +138,13 @@ void AdBlockIcon::createMenu(QMenu* menu)
|
|||||||
if (!m_blockedPopups.isEmpty()) {
|
if (!m_blockedPopups.isEmpty()) {
|
||||||
menu->addAction(tr("Blocked Popup Windows"))->setEnabled(false);
|
menu->addAction(tr("Blocked Popup Windows"))->setEnabled(false);
|
||||||
for (int i = 0; i < m_blockedPopups.count(); i++) {
|
for (int i = 0; i < m_blockedPopups.count(); i++) {
|
||||||
const QPair<AdBlockRule, QUrl> &pair = m_blockedPopups.at(i);
|
const QPair<AdBlockRule*, QUrl> &pair = m_blockedPopups.at(i);
|
||||||
|
|
||||||
QString address = pair.second.toString().right(55);
|
QString address = pair.second.toString().right(55);
|
||||||
QString actionText = tr("%1 with (%2)").arg(address, pair.first.filter()).replace(QLatin1Char('&'), QLatin1String("&&"));
|
QString actionText = tr("%1 with (%2)").arg(address, pair.first->filter()).replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||||
|
|
||||||
QAction* action = menu->addAction(actionText, manager, SLOT(showRule()));
|
QAction* action = menu->addAction(actionText, manager, SLOT(showRule()));
|
||||||
action->setData(QVariant::fromValue((void*)&pair.first));
|
action->setData(QVariant::fromValue((void*)pair.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ private:
|
|||||||
BrowserWindow* m_window;
|
BrowserWindow* m_window;
|
||||||
QAction* m_menuAction;
|
QAction* m_menuAction;
|
||||||
|
|
||||||
QVector<QPair<AdBlockRule, QUrl> > m_blockedPopups;
|
QVector<QPair<AdBlockRule*, QUrl> > m_blockedPopups;
|
||||||
QTimer* m_flashTimer;
|
QTimer* m_flashTimer;
|
||||||
|
|
||||||
int m_timerTicks;
|
int m_timerTicks;
|
||||||
|
@ -60,6 +60,8 @@ class AdBlockSubscription;
|
|||||||
|
|
||||||
class QUPZILLA_EXPORT AdBlockRule
|
class QUPZILLA_EXPORT AdBlockRule
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(AdBlockRule)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
|
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
|
||||||
~AdBlockRule();
|
~AdBlockRule();
|
||||||
|
Loading…
Reference in New Issue
Block a user