improved display in GxsGroupDialog

This commit is contained in:
csoler 2022-03-29 22:02:56 +02:00
parent 2b4e571332
commit 065e6946c7
4 changed files with 85 additions and 72 deletions

View File

@ -410,11 +410,8 @@ void GxsGroupDialog::setupReadonly()
{
ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
//ui.distribGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
@ -470,7 +467,9 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
ui.createdline->setText(DateTime::formatLongDateTime(mGrpMeta.mPublishTs));
link = RetroShareLink::createMessage(mGrpMeta.mAuthorId, "");
ui.authorValueLabel->setText(link.toHtml());
if(!mGrpMeta.mAuthorId.isNull())
ui.authorValueLabel->setText(link.toHtml());
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
ui.descriptiontextEdit->setPlainText(description);
@ -721,55 +720,57 @@ uint32_t GxsGroupDialog::getGroupSignFlags()
void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
{
if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED) {
ui.publish_encrypt->setChecked(true);
} else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED) {
ui.publish_required->setChecked(true);
} else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) {
ui.publish_threads->setChecked(true);
} else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_NONEREQ) {
ui.publish_open->setChecked(true);
}
if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED)
ui.publish_encrypt->setChecked(true);
else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED)
ui.publish_required->setChecked(true);
else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD)
ui.publish_threads->setChecked(true);
else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_NONEREQ)
ui.publish_open->setChecked(true);
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED)
ui.personal_required->setChecked(true);
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN)
ui.personal_ifnopub->setChecked(true);
if( (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) && (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG))
ui.antiSpam_perms_CB->setCurrentIndex(2) ;
else if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
ui.antiSpam_perms_CB->setCurrentIndex(1) ;
else
ui.antiSpam_perms_CB->setCurrentIndex(0) ;
QString antispam_string ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) antispam_string += tr("Message tracking") ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature from known ID required") ;
else
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature required") ;
ui.antiSpamValueLabel->setText(antispam_string) ;
//ui.antiSpam_trackMessages_2->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
//ui.antiSpam_signedIds_2 ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
//ui.SignEdIds->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
//ui.trackmessagesradioButton->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
/* guess at comments */
if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) &&
(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN))
{
// (cyril) very weird piece of code. Need to clear this up.
ui.comments_allowed->setChecked(true);
ui.commentsValueLabel->setText("Allowed") ;
}
else
{
ui.comments_no->setChecked(true);
ui.commentsValueLabel->setText("Forbidden") ;
}
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED)
ui.personal_required->setChecked(true);
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN)
ui.personal_ifnopub->setChecked(true);
if( (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) && (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG))
ui.antiSpam_perms_CB->setCurrentIndex(2) ;
else if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
ui.antiSpam_perms_CB->setCurrentIndex(1) ;
else
ui.antiSpam_perms_CB->setCurrentIndex(0) ;
QString antispam_string ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) antispam_string += tr("Message tracking") ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature from known ID required") ;
else if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature required") ;
if(antispam_string.isNull())
antispam_string = tr("[None]");
ui.antiSpamValueLabel->setText(antispam_string) ;
//ui.antiSpam_trackMessages_2->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
//ui.antiSpam_signedIds_2 ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
//ui.SignEdIds->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
//ui.trackmessagesradioButton->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
/* guess at comments */
if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) &&
(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN))
{
// (cyril) very weird piece of code. Need to clear this up.
ui.comments_allowed->setChecked(true);
ui.commentsValueLabel->setText("Allowed") ;
}
else
{
ui.comments_no->setChecked(true);
ui.commentsValueLabel->setText("Forbidden") ;
}
}
/**** Above logic is flawed, and will be removed shortly
@ -915,7 +916,10 @@ void GxsGroupDialog::setSelectedModerators(const std::set<RsGxsId>& ids)
moderatorsListString += link.toHtml() + " ";
}
//ui.moderatorsValueLabel->setId(det.mId);
if(moderatorsListString.isNull())
moderatorsListString = tr("[None]");
ui.moderatorsValueLabel->setText(moderatorsListString);
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>701</width>
<height>529</height>
<width>746</width>
<height>590</height>
</rect>
</property>
<property name="windowTitle">
@ -44,7 +44,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="createmode">
<layout class="QGridLayout" name="createmode_GL">
@ -575,7 +575,7 @@
<item row="10" column="0">
<widget class="QLabel" name="authorLabel">
<property name="text">
<string>Author</string>
<string>Author:</string>
</property>
</widget>
</item>
@ -739,7 +739,11 @@
</widget>
</item>
<item row="4" column="2">
<widget class="QLineEdit" name="createdline"/>
<widget class="QLineEdit" name="createdline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="createdlineLabel">
@ -820,6 +824,16 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
@ -846,11 +860,6 @@
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
@ -862,11 +871,6 @@
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>

View File

@ -1073,11 +1073,13 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, QLi
QString GxsIdDetails::getName(const RsIdentityDetails &details)
{
if( details.mReputation.mOverallReputationLevel ==
RsReputationLevel::LOCALLY_NEGATIVE )
if( details.mReputation.mOverallReputationLevel == RsReputationLevel::LOCALLY_NEGATIVE )
return tr("[Banned]");
QString name = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE);
if( details.mId.isNull() )
return tr("[Nobody]");
QString name = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE);
std::list<RsRecognTag>::const_iterator it;
for (it = details.mRecognTags.begin(); it != details.mRecognTags.end(); ++it)

View File

@ -60,7 +60,10 @@ void GxsIdLabel::setId(const RsGxsId &id)
{
mId = id;
GxsIdDetails::process(mId, fillLabelCallback, this);
if(id.isNull())
setText(tr("[Nobody]"));
else
GxsIdDetails::process(mId, fillLabelCallback, this);
}
bool GxsIdLabel::getId(RsGxsId &id)