Add Remove Only Selected in Network Keyring.

This commit is contained in:
Phenom 2020-11-24 15:48:56 +01:00
parent bcafd06748
commit 457206272c
3 changed files with 37 additions and 13 deletions

View File

@ -133,6 +133,7 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails()));
contextMnu->addSeparator() ;
contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys()));
contextMnu->addAction(QIcon(), tr("Remove this key"), this, SLOT(removeSelectedKeys()));
contextMnu->exec(QCursor::pos());
}
@ -168,6 +169,23 @@ void NetworkDialog::removeUnusedKeys()
tr("The selected keys below haven't been used in the last 3 months. \nDo you want to delete them permanently ? \n\nNotes: Your old keyring will be backed up.\n The removal may fail when running multiple Retroshare instances on the same machine."),FriendSelectionWidget::MODUS_CHECK,FriendSelectionWidget::SHOW_GPG | FriendSelectionWidget::SHOW_NON_FRIEND_GPG,
pre_selected) ;
removeKeys(selected);
}
void NetworkDialog::removeSelectedKeys()
{
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
if(l.empty())
return;
std::set<RsPgpId> selected;
selected.insert(RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString()));
removeKeys(selected);
}
void NetworkDialog::removeKeys(std::set<RsPgpId> selected)
{
std::cerr << "Removing these keys from the keyring: " << std::endl;
for(std::set<RsPgpId>::const_iterator it(selected.begin());it!=selected.end();++it)
std::cerr << " " << *it << std::endl;

View File

@ -68,6 +68,7 @@ protected:
private slots:
void removeUnusedKeys() ;
void removeSelectedKeys() ;
void makeFriend() ;
void denyFriend() ;
void peerdetails();
@ -86,6 +87,8 @@ private slots:
private:
void removeKeys(std::set<RsPgpId> selected) ;
/* Color definitions (for standard see qss.default) */
QColor mBackgroundColorSelf;
QColor mBackgroundColorOwnSign;

View File

@ -185,7 +185,7 @@ int FriendSelectionWidget::addColumn(const QString &title)
return column;
}
void FriendSelectionWidget::showEvent(QShowEvent *e)
void FriendSelectionWidget::showEvent(QShowEvent */*e*/)
{
if(gxsIds.empty())
loadIdentities();
@ -838,6 +838,9 @@ void FriendSelectionWidget::contextMenuRequested(const QPoint &/*pos*/)
contextMenu->addAction(QIcon(), tr("Mark all"), this, SLOT(selectAll()));
contextMenu->addAction(QIcon(), tr("Mark none"), this, SLOT(deselectAll()));
}
if (mListModus == MODUS_CHECK) {
contextMenu->addAction(QIcon(), tr("Mark none"), this, SLOT(deselectAll()));
}
if (!mContextMenuActions.isEmpty()) {
bool addSeparator = false;