1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

AdBlockRule: Disable copy

Closes #1654
This commit is contained in:
David Rosca 2015-05-28 11:10:41 +02:00
parent 878ed65753
commit 458c131170
3 changed files with 10 additions and 8 deletions

View File

@ -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));
}
}

View File

@ -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;

View File

@ -60,6 +60,8 @@ class AdBlockSubscription;
class QUPZILLA_EXPORT AdBlockRule
{
Q_DISABLE_COPY(AdBlockRule)
public:
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
~AdBlockRule();