mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-04 09:05:34 -05:00
fixed display of info for non admin circles, and added readonly system to not allow editing them
This commit is contained in:
parent
5361c85371
commit
4e4980ba0e
@ -36,6 +36,7 @@
|
||||
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPNAME 0
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPID 1
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS 2
|
||||
|
||||
#define CIRCLEGROUP_FRIEND_COL_NAME 0
|
||||
#define CIRCLEGROUP_FRIEND_COL_ID 1
|
||||
@ -135,8 +136,10 @@ void CirclesDialog::editExistingCircle()
|
||||
QString coltext = item->text(CIRCLEGROUP_CIRCLE_COL_GROUPID);
|
||||
RsGxsGroupId id ( coltext.toStdString());
|
||||
|
||||
uint32_t subscribe_flags = item->data(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole).toUInt();
|
||||
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editExistingId(id);
|
||||
dlg.editExistingId(id,true,!!(subscribe_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)) ;
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
|
@ -105,16 +105,36 @@ CreateCircleDialog::~CreateCircleDialog()
|
||||
delete(mIdQueue);
|
||||
}
|
||||
|
||||
void CreateCircleDialog::editExistingId(const RsGxsGroupId &circleId, const bool &clearList /*= true*/)
|
||||
void CreateCircleDialog::editExistingId(const RsGxsGroupId &circleId, const bool &clearList /*= true*/,bool readonly)
|
||||
{
|
||||
/* load this circle */
|
||||
mIsExistingCircle = true;
|
||||
mReadOnly=readonly;
|
||||
|
||||
mClearList = clearList;
|
||||
requestCircle(circleId);
|
||||
|
||||
ui.headerFrame->setHeaderText(tr("Edit Circle"));
|
||||
|
||||
ui.radioButton_Public->setEnabled(!readonly) ;
|
||||
ui.radioButton_Self->setEnabled(!readonly) ;
|
||||
ui.radioButton_Restricted->setEnabled(!readonly) ;
|
||||
ui.circleName->setReadOnly(readonly) ;
|
||||
|
||||
ui.idChooser->setEnabled(!readonly) ;
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Update"));
|
||||
|
||||
ui.addButton->setEnabled(!readonly) ;
|
||||
ui.removeButton->setEnabled(!readonly) ;
|
||||
|
||||
if(readonly)
|
||||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
ui.peersSelection_GB->hide() ;
|
||||
ui.addButton->hide() ;
|
||||
ui.removeButton->hide() ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +142,7 @@ void CreateCircleDialog::editNewId(bool isExternal)
|
||||
{
|
||||
/* load this circle */
|
||||
mIsExistingCircle = false;
|
||||
mReadOnly = false ;
|
||||
|
||||
/* setup personal or external circle */
|
||||
if (isExternal)
|
||||
@ -183,7 +204,7 @@ void CreateCircleDialog::setupForExternalCircle()
|
||||
|
||||
/* show distribution line */
|
||||
ui.groupBox_title->setTitle(tr("Circle Details"));
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Update"));
|
||||
|
||||
ui.frame_PgpTypes->show();
|
||||
ui.frame_Distribution->show();
|
||||
ui.idChooserLabel->show();
|
||||
@ -303,6 +324,12 @@ void CreateCircleDialog::removeMember()
|
||||
|
||||
void CreateCircleDialog::createCircle()
|
||||
{
|
||||
if(mReadOnly)
|
||||
{
|
||||
close() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
std::cerr << "CreateCircleDialog::createCircle()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
~CreateCircleDialog();
|
||||
|
||||
void editNewId(bool isExternal);
|
||||
void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true);
|
||||
void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true, bool readonly=true);
|
||||
void addMember(const QString &keyId, const QString &idtype, const QString &nickname);
|
||||
void addMember(const RsGxsIdGroup &idGroup);
|
||||
void addCircle(const RsGxsCircleDetails &cirDetails);
|
||||
@ -72,6 +72,7 @@ private:
|
||||
|
||||
bool mIsExistingCircle;
|
||||
bool mIsExternalCircle;
|
||||
bool mReadOnly;
|
||||
|
||||
void loadCircle(uint32_t token);
|
||||
void loadIdentities(uint32_t token);
|
||||
|
@ -44,7 +44,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Circle Membership</string>
|
||||
<string>Circle Members</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
@ -129,7 +129,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<widget class="QGroupBox" name="peersSelection_GB">
|
||||
<property name="title">
|
||||
<string>Known People</string>
|
||||
</property>
|
||||
|
@ -374,12 +374,15 @@ void IdDialog::editExistingCircle()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint32_t subscribe_flags = item->data(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole).toUInt();
|
||||
|
||||
QString coltext = item->text(CIRCLEGROUP_CIRCLE_COL_GROUPID);
|
||||
RsGxsGroupId id ( coltext.toStdString());
|
||||
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editExistingId(id);
|
||||
|
||||
dlg.editExistingId(id,true,!(subscribe_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)) ;
|
||||
dlg.exec();
|
||||
|
||||
requestCircleGroupMeta(); // update GUI
|
||||
@ -483,15 +486,18 @@ void IdDialog::circle_selected()
|
||||
if ((!item) || (!item->parent()))
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui->pushButton_editCircle, false);
|
||||
ui->pushButton_editCircle->setText(tr("Show details")) ;
|
||||
ui->pushButton_editCircle->setEnabled(false) ;
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t subscribe_flags = item->data(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole).toUInt();
|
||||
ui->pushButton_editCircle->setEnabled(true) ;
|
||||
|
||||
if(subscribe_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||
ui->pushButton_editCircle->setEnabled(true) ;
|
||||
ui->pushButton_editCircle->setText(tr("Edit circle")) ;
|
||||
else
|
||||
ui->pushButton_editCircle->setEnabled(false) ;
|
||||
ui->pushButton_editCircle->setText(tr("Show details")) ;
|
||||
|
||||
set_item_background(item, BLUE_BACKGROUND);
|
||||
|
||||
|
@ -516,7 +516,7 @@ void PeopleDialog::addToCircleExt()
|
||||
dlg.addMember(idWidget->groupInfo());
|
||||
}//if((itFound=_gxs_identity_widgets.find(gxs_id)) != _gxs_identity_widgets.end())
|
||||
|
||||
dlg.editExistingId(circle->groupInfo().mGroupId, false);
|
||||
dlg.editExistingId(circle->groupInfo().mGroupId, false,false);
|
||||
dlg.exec();
|
||||
}//if((itFound=_ext_circles_widgets.find(groupId)) != _ext_circles_widgets.end())
|
||||
}//if (action)
|
||||
@ -545,7 +545,7 @@ void PeopleDialog::addToCircleInt()
|
||||
dlg.addMember(idWidget->keyId(), idWidget->idtype(), idWidget->nickname());
|
||||
}//if((itFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end())
|
||||
|
||||
dlg.editExistingId(circle->groupInfo().mGroupId, false);
|
||||
dlg.editExistingId(circle->groupInfo().mGroupId, false,false);
|
||||
dlg.exec();
|
||||
}//if((itFound=_ext_circles_widgets.find(groupId)) != _ext_circles_widgets.end())
|
||||
}//if (action)
|
||||
@ -721,7 +721,7 @@ void PeopleDialog::fl_flowLayoutItemDroppedExt(QList<FlowLayoutItem *>flListItem
|
||||
if (bCreateNewCircle){
|
||||
dlg.editNewId(true);
|
||||
} else {//if (bCreateNewCircle)
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false);
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false,false);
|
||||
}//else (bCreateNewCircle)
|
||||
|
||||
dlg.exec();
|
||||
@ -781,7 +781,7 @@ void PeopleDialog::fl_flowLayoutItemDroppedInt(QList<FlowLayoutItem *>flListItem
|
||||
if (bCreateNewCircle){
|
||||
dlg.editNewId(false);
|
||||
} else {//if (bCreateNewCircle)
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false);
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false,false);
|
||||
}//else (bCreateNewCircle)
|
||||
|
||||
dlg.exec();
|
||||
@ -922,7 +922,7 @@ void PeopleDialog::pf_dropEventOccursExt(QDropEvent *event)
|
||||
if (bCreateNewCircle){
|
||||
dlg.editNewId(true);
|
||||
} else {//if (bCreateNewCircle)
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false);
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false,false);
|
||||
}//else (bCreateNewCircle)
|
||||
|
||||
dlg.exec();
|
||||
@ -1012,7 +1012,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
|
||||
if (bCreateNewCircle){
|
||||
dlg.editNewId(false);
|
||||
} else {//if (bCreateNewCircle)
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false);
|
||||
dlg.editExistingId(cirDest->groupInfo().mGroupId, false,false);
|
||||
}//else (bCreateNewCircle)
|
||||
|
||||
dlg.exec();
|
||||
|
Loading…
x
Reference in New Issue
Block a user