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