Merge pull request #454 from csoler/v0.6-ContactList

V0.6 contact list
This commit is contained in:
Cyril Soler 2016-08-04 22:38:59 +02:00 committed by GitHub
commit 96e73b301c
15 changed files with 573 additions and 277 deletions

View file

@ -333,6 +333,7 @@ IdDialog::IdDialog(QWidget *parent) :
//connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint)));
connect(ui->autoBanIdentities_CB, SIGNAL(toggled(bool)), this, SLOT(toggleAutoBanIdentities(bool)));
/* Setup TokenQueue */
@ -349,6 +350,17 @@ IdDialog::IdDialog(QWidget *parent) :
tmer->start(10000) ; // update every 10 secs.
}
void IdDialog::toggleAutoBanIdentities(bool b)
{
RsPgpId id(ui->lineEdit_GpgId->text().left(16).toStdString());
if(!id.isNull())
{
rsReputations->banNode(id,b) ;
requestIdList();
}
}
void IdDialog::updateCirclesDisplay()
{
if(RsAutoUpdatePage::eventsLocked())
@ -1676,6 +1688,8 @@ void IdDialog::insertIdDetails(uint32_t token)
else
ui->lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId.toStdString()) + tr(" [unverified]"));
ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ;
time_t now = time(NULL) ;
ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;
ui->headerTextLabel_Person->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
@ -1769,6 +1783,8 @@ void IdDialog::insertIdDetails(uint32_t token)
ui->inviteButton->setEnabled(true);
}
ui->autoBanIdentities_CB->setChecked(rsReputations->isNodeBanned(data.mPgpId));
/* now fill in the reputation information */
#ifdef SUSPENDED

View file

@ -77,6 +77,7 @@ private slots:
void createExternalCircle();
void showEditExistingCircle();
void updateCirclesDisplay();
void toggleAutoBanIdentities(bool b);
void acceptCircleSubscription() ;
void cancelCircleSubscription() ;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<height>872</height>
</rect>
</property>
<property name="sizePolicy">
@ -117,7 +117,7 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
@ -278,7 +278,7 @@
<string>Reputation</string>
</property>
<property name="textAlignment">
<set>AlignLeading|AlignVCenter</set>
<set>AlignLeft|AlignVCenter</set>
</property>
</column>
</widget>
@ -534,6 +534,13 @@
<string>Reputation</string>
</property>
<layout class="QVBoxLayout" name="reputationGroupBoxVLayout">
<item>
<widget class="QCheckBox" name="autoBanIdentities_CB">
<property name="text">
<string>Auto-Ban all identities from this node</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="reputationGLayout">
<property name="leftMargin">
@ -806,8 +813,8 @@ p, li { white-space: pre-wrap; }
<tabstop>idTreeWidget</tabstop>
</tabstops>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -37,11 +37,6 @@ PeoplePage::~PeoplePage()
/** Saves the changes on this page */
bool PeoplePage::save(QString &/*errmsg*/)
{
if(!ui.identityBan_CB->isChecked())
rsReputations->setNodeAutoBanThreshold(0) ;
else
rsReputations->setNodeAutoBanThreshold(ui.identityBanThreshold_SB->value()) ;
if(ui.autoPositiveOpinion_CB->isChecked())
rsReputations->setNodeAutoPositiveOpinionForContacts(true) ;
else
@ -55,12 +50,9 @@ bool PeoplePage::save(QString &/*errmsg*/)
/** Loads the settings for this page */
void PeoplePage::load()
{
uint32_t ban_limit = rsReputations->nodeAutoBanThreshold() ;
bool auto_positive_contacts = rsReputations->nodeAutoPositiveOpinionForContacts() ;
float node_auto_ban_identities_limit = rsReputations->nodeAutoBanIdentitiesLimit();
ui.identityBan_CB->setChecked(ban_limit > 0) ;
ui.identityBanThreshold_SB->setValue(ban_limit) ;
ui.autoPositiveOpinion_CB->setChecked(auto_positive_contacts);
ui.autoBanIdentitiesLimit_SB->setValue(node_auto_ban_identities_limit);
}

View file

@ -17,50 +17,6 @@
<string>Identities handling</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="identityBan_CB">
<property name="text">
<string>ban all identities of a node when more than</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="identityBanThreshold_SB">
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>2</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string> of them have a negative opinion</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="autoPositiveOpinion_CB">
<property name="toolTip">