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

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>701</width> <width>746</width>
<height>529</height> <height>590</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -44,7 +44,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="createmode"> <widget class="QWidget" name="createmode">
<layout class="QGridLayout" name="createmode_GL"> <layout class="QGridLayout" name="createmode_GL">
@ -575,7 +575,7 @@
<item row="10" column="0"> <item row="10" column="0">
<widget class="QLabel" name="authorLabel"> <widget class="QLabel" name="authorLabel">
<property name="text"> <property name="text">
<string>Author</string> <string>Author:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -739,7 +739,11 @@
</widget> </widget>
</item> </item>
<item row="4" column="2"> <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>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="createdlineLabel"> <widget class="QLabel" name="createdlineLabel">
@ -820,6 +824,16 @@
</layout> </layout>
</widget> </widget>
<customwidgets> <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> <customwidget>
<class>ClickableLabel</class> <class>ClickableLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
@ -846,11 +860,6 @@
<extends>QComboBox</extends> <extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header> <header>gui/gxs/GxsIdChooser.h</header>
</customwidget> </customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>HeaderFrame</class> <class>HeaderFrame</class>
<extends>QFrame</extends> <extends>QFrame</extends>
@ -862,11 +871,6 @@
<extends>QTextEdit</extends> <extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header> <header location="global">gui/common/MimeTextEdit.h</header>
</customwidget> </customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/> <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) QString GxsIdDetails::getName(const RsIdentityDetails &details)
{ {
if( details.mReputation.mOverallReputationLevel == if( details.mReputation.mOverallReputationLevel == RsReputationLevel::LOCALLY_NEGATIVE )
RsReputationLevel::LOCALLY_NEGATIVE )
return tr("[Banned]"); 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; std::list<RsRecognTag>::const_iterator it;
for (it = details.mRecognTags.begin(); it != details.mRecognTags.end(); ++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; mId = id;
GxsIdDetails::process(mId, fillLabelCallback, this); if(id.isNull())
setText(tr("[Nobody]"));
else
GxsIdDetails::process(mId, fillLabelCallback, this);
} }
bool GxsIdLabel::getId(RsGxsId &id) bool GxsIdLabel::getId(RsGxsId &id)