mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
Merge pull request #6859 from Chocobo1/cookie_select
Manage Cookies dialog improvements
This commit is contained in:
commit
6f6a17341f
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "cookiesdialog.h"
|
#include "cookiesdialog.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "base/settingsstorage.h"
|
#include "base/settingsstorage.h"
|
||||||
#include "base/net/downloadmanager.h"
|
#include "base/net/downloadmanager.h"
|
||||||
#include "guiiconprovider.h"
|
#include "guiiconprovider.h"
|
||||||
@ -85,5 +87,16 @@ void CookiesDialog::onButtonAddClicked()
|
|||||||
|
|
||||||
void CookiesDialog::onButtonDeleteClicked()
|
void CookiesDialog::onButtonDeleteClicked()
|
||||||
{
|
{
|
||||||
m_cookiesModel->removeRow(m_ui->treeView->selectionModel()->currentIndex().row());
|
QModelIndexList idxs = m_ui->treeView->selectionModel()->selectedRows();
|
||||||
|
|
||||||
|
// sort in descending order
|
||||||
|
std::sort(idxs.begin(), idxs.end(),
|
||||||
|
[](const QModelIndex &l, const QModelIndex &r)
|
||||||
|
{
|
||||||
|
return (l.row() > r.row());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const QModelIndex &idx : idxs)
|
||||||
|
m_cookiesModel->removeRow(idx.row());
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,17 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="treeView"/>
|
<widget class="QTreeView" name="treeView">
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::AllEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
@ -145,7 +145,7 @@ bool CookiesModel::insertRows(int row, int count, const QModelIndex &parent)
|
|||||||
if ((row < 0) || (row > m_cookies.size())) return false;
|
if ((row < 0) || (row > m_cookies.size())) return false;
|
||||||
|
|
||||||
QNetworkCookie newCookie;
|
QNetworkCookie newCookie;
|
||||||
newCookie.setExpirationDate(QDateTime::currentDateTime().addYears(99));
|
newCookie.setExpirationDate(QDateTime::currentDateTime().addYears(2));
|
||||||
|
|
||||||
beginInsertRows(parent, row, row + count - 1);
|
beginInsertRows(parent, row, row + count - 1);
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user