mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Add 'Remove and block domain' button to the cookie manager
This commit is contained in:
parent
80dd3a8f85
commit
e81cbb167a
@ -56,6 +56,7 @@ CookieManager::CookieManager(QWidget* parent)
|
|||||||
connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
|
connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
|
||||||
connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll()));
|
connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll()));
|
||||||
connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie()));
|
connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie()));
|
||||||
|
connect(ui->blockDomain, SIGNAL(clicked()), this, SLOT(blockCurrentHostAndRemoveCookie()));
|
||||||
connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
|
connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
|
||||||
connect(ui->close2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
|
connect(ui->close2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
|
||||||
connect(ui->close3, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
|
connect(ui->close3, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
|
||||||
@ -142,6 +143,19 @@ void CookieManager::removeCookie()
|
|||||||
mApp->cookieJar()->setAllCookies(allCookies);
|
mApp->cookieJar()->setAllCookies(allCookies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CookieManager::blockCurrentHostAndRemoveCookie()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem* current = ui->cookieTree->currentItem();
|
||||||
|
if (!current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const QString domain = (current->text(1).isEmpty()) ? current->data(0, Qt::UserRole + 10).toString() :
|
||||||
|
qvariant_cast<QNetworkCookie>(current->data(0, Qt::UserRole + 10)).domain();
|
||||||
|
|
||||||
|
removeCookie();
|
||||||
|
addBlacklist(domain);
|
||||||
|
}
|
||||||
|
|
||||||
void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent)
|
void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent)
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
@ -277,7 +291,11 @@ void CookieManager::removeWhitelist()
|
|||||||
void CookieManager::addBlacklist()
|
void CookieManager::addBlacklist()
|
||||||
{
|
{
|
||||||
const QString server = QInputDialog::getText(this, tr("Add to blacklist"), tr("Server:"));
|
const QString server = QInputDialog::getText(this, tr("Add to blacklist"), tr("Server:"));
|
||||||
|
addBlacklist(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CookieManager::addBlacklist(const QString &server)
|
||||||
|
{
|
||||||
if (server.isEmpty()) {
|
if (server.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ private slots:
|
|||||||
void currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent);
|
void currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent);
|
||||||
void removeCookie();
|
void removeCookie();
|
||||||
void removeAll();
|
void removeAll();
|
||||||
|
void blockCurrentHostAndRemoveCookie();
|
||||||
|
|
||||||
void slotRefreshTable();
|
void slotRefreshTable();
|
||||||
void slotRefreshFilters();
|
void slotRefreshFilters();
|
||||||
@ -62,6 +63,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent* e);
|
void closeEvent(QCloseEvent* e);
|
||||||
void keyPressEvent(QKeyEvent* e);
|
void keyPressEvent(QKeyEvent* e);
|
||||||
|
void addBlacklist(const QString &server);
|
||||||
|
|
||||||
Ui::CookieManager* ui;
|
Ui::CookieManager* ui;
|
||||||
|
|
||||||
|
@ -225,6 +225,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="blockDomain">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove and block domain</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="close">
|
<widget class="QDialogButtonBox" name="close">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
Loading…
Reference in New Issue
Block a user