Added Ban/Unban Context menu actions for People list.

This commit is contained in:
defnax 2015-11-19 19:08:47 +01:00
parent 5404cda302
commit 4dacd9a54d
2 changed files with 58 additions and 0 deletions

View File

@ -950,6 +950,29 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
}
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
contextMnu.addSeparator();
RsReputations::ReputationInfo info ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->getReputationInfo(RsGxsId(Id),info) ;
QAction *banaction = contextMnu.addAction(QIcon(":/images/denied16.png"), tr("Ban this person"), this, SLOT(banPerson()));
QAction *unbanaction = contextMnu.addAction(QIcon(), tr("Unban this person"), this, SLOT(unbanPerson()));
if(info.mAssessment == RsReputations::ASSESSMENT_BAD)
{
banaction->setVisible(false);
unbanaction->setVisible(true);
}
else
{
banaction->setVisible(true);
unbanaction->setVisible(false);
}
}
}
@ -1008,3 +1031,35 @@ void IdDialog::sendMsg()
/* window will destroy itself! */
}
void IdDialog::banPerson()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEGATIVE) ;
requestIdDetails();
requestIdList();
}
void IdDialog::unbanPerson()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_POSITIVE) ;
requestIdDetails();
requestIdList();
}

View File

@ -75,6 +75,9 @@ private slots:
/** Create the context popup menu and it's submenus */
void IdListCustomPopupMenu( QPoint point );
void banPerson();
void unbanPerson();
private:
void processSettings(bool load);