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()
|
||||
{
|
||||
for (int i = 0; i < m_blockedPopups.count(); ++i)
|
||||
delete m_blockedPopups.at(i).first;
|
||||
}
|
||||
|
||||
void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
|
||||
@ -59,10 +61,8 @@ void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
|
||||
return;
|
||||
}
|
||||
|
||||
AdBlockRule rule(filter, subscription);
|
||||
|
||||
QPair<AdBlockRule, QUrl> pair;
|
||||
pair.first = rule;
|
||||
QPair<AdBlockRule*, QUrl> pair;
|
||||
pair.first = new AdBlockRule(filter, subscription);
|
||||
pair.second = url;
|
||||
m_blockedPopups.append(pair);
|
||||
|
||||
@ -138,13 +138,13 @@ void AdBlockIcon::createMenu(QMenu* menu)
|
||||
if (!m_blockedPopups.isEmpty()) {
|
||||
menu->addAction(tr("Blocked Popup Windows"))->setEnabled(false);
|
||||
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 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()));
|
||||
action->setData(QVariant::fromValue((void*)&pair.first));
|
||||
action->setData(QVariant::fromValue((void*)pair.first));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ private:
|
||||
BrowserWindow* m_window;
|
||||
QAction* m_menuAction;
|
||||
|
||||
QVector<QPair<AdBlockRule, QUrl> > m_blockedPopups;
|
||||
QVector<QPair<AdBlockRule*, QUrl> > m_blockedPopups;
|
||||
QTimer* m_flashTimer;
|
||||
|
||||
int m_timerTicks;
|
||||
|
@ -60,6 +60,8 @@ class AdBlockSubscription;
|
||||
|
||||
class QUPZILLA_EXPORT AdBlockRule
|
||||
{
|
||||
Q_DISABLE_COPY(AdBlockRule)
|
||||
|
||||
public:
|
||||
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
|
||||
~AdBlockRule();
|
||||
|
Loading…
Reference in New Issue
Block a user