mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 01:08:50 -04:00
merging rs_gxs-finale to v0.6 branch
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6953 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
39909b705f
67 changed files with 5686 additions and 488 deletions
|
@ -473,8 +473,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
mStateHelper->setWidgetEnabled(ui.pushButton_Reputation, false);
|
||||
// No Delete Ids yet!
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_Delete, /*true*/ false);
|
||||
// No Editing Ids yet!
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_EditId, /*true*/ false);
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_EditId, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -61,10 +61,19 @@ IdEditDialog::IdEditDialog(QWidget *parent)
|
|||
/* Connect signals */
|
||||
connect(ui.radioButton_GpgId, SIGNAL(toggled(bool)), this, SLOT(idTypeToggled(bool)));
|
||||
connect(ui.radioButton_Pseudo, SIGNAL(toggled(bool)), this, SLOT(idTypeToggled(bool)));
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(updateId()));
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(submit()));
|
||||
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
|
||||
connect(ui.plainTextEdit_Tag, SIGNAL(textChanged()), this, SLOT(checkNewTag()));
|
||||
connect(ui.pushButton_Tag, SIGNAL(clicked(bool)), this, SLOT(addRecognTag()));
|
||||
connect(ui.toolButton_Tag1, SIGNAL(clicked(bool)), this, SLOT(rmTag1()));
|
||||
connect(ui.toolButton_Tag2, SIGNAL(clicked(bool)), this, SLOT(rmTag2()));
|
||||
connect(ui.toolButton_Tag3, SIGNAL(clicked(bool)), this, SLOT(rmTag3()));
|
||||
connect(ui.toolButton_Tag4, SIGNAL(clicked(bool)), this, SLOT(rmTag4()));
|
||||
connect(ui.toolButton_Tag5, SIGNAL(clicked(bool)), this, SLOT(rmTag5()));
|
||||
|
||||
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
||||
ui.pushButton_Tag->setEnabled(false);
|
||||
}
|
||||
|
||||
void IdEditDialog::setupNewId(bool pseudo)
|
||||
|
@ -89,6 +98,10 @@ void IdEditDialog::setupNewId(bool pseudo)
|
|||
|
||||
// force - incase it wasn't triggered.
|
||||
idTypeToggled(true);
|
||||
|
||||
ui.frame_Tags->setHidden(true);
|
||||
ui.radioButton_GpgId->setEnabled(true);
|
||||
ui.radioButton_Pseudo->setEnabled(true);
|
||||
}
|
||||
|
||||
void IdEditDialog::idTypeToggled(bool checked)
|
||||
|
@ -144,7 +157,6 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
|||
mStateHelper->setLoading(IDEDITDIALOG_LOADID, false);
|
||||
|
||||
/* get details from libretroshare */
|
||||
RsGxsIdGroup data;
|
||||
std::vector<RsGxsIdGroup> datavector;
|
||||
if (!rsIdentity->getGroupData(token, datavector))
|
||||
{
|
||||
|
@ -166,9 +178,9 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
|||
return;
|
||||
}
|
||||
|
||||
data = datavector[0];
|
||||
mEditGroup = datavector[0];
|
||||
|
||||
bool realid = (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID);
|
||||
bool realid = (mEditGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID);
|
||||
|
||||
if (realid)
|
||||
{
|
||||
|
@ -178,25 +190,28 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
|||
{
|
||||
ui.radioButton_Pseudo->setChecked(true);
|
||||
}
|
||||
// these are not editable for existing Id.
|
||||
ui.radioButton_GpgId->setEnabled(false);
|
||||
ui.radioButton_Pseudo->setEnabled(false);
|
||||
|
||||
// DOES THIS TRIGGER ALREADY???
|
||||
// force - incase it wasn't triggered.
|
||||
idTypeToggled(true);
|
||||
|
||||
ui.lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()));
|
||||
ui.lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId));
|
||||
ui.lineEdit_Nickname->setText(QString::fromUtf8(mEditGroup.mMeta.mGroupName.c_str()));
|
||||
ui.lineEdit_KeyId->setText(QString::fromStdString(mEditGroup.mMeta.mGroupId));
|
||||
|
||||
if (realid)
|
||||
{
|
||||
ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash));
|
||||
ui.lineEdit_GpgHash->setText(QString::fromStdString(mEditGroup.mPgpIdHash));
|
||||
|
||||
if (data.mPgpKnown)
|
||||
if (mEditGroup.mPgpKnown)
|
||||
{
|
||||
RsPeerDetails details;
|
||||
rsPeers->getGPGDetails(data.mPgpId, details);
|
||||
rsPeers->getGPGDetails(mEditGroup.mPgpId, details);
|
||||
ui.lineEdit_GpgName->setText(QString::fromUtf8(details.name.c_str()));
|
||||
|
||||
ui.lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId));
|
||||
ui.lineEdit_GpgId->setText(QString::fromStdString(mEditGroup.mPgpId));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -210,53 +225,216 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
|||
ui.lineEdit_GpgId->setText(tr("N/A"));
|
||||
ui.lineEdit_GpgName->setText(tr("N/A"));
|
||||
}
|
||||
|
||||
// RecognTags.
|
||||
ui.frame_Tags->setHidden(false);
|
||||
|
||||
loadRecognTags();
|
||||
}
|
||||
|
||||
void IdEditDialog::updateId()
|
||||
#define MAX_RECOGN_TAGS 5
|
||||
|
||||
void IdEditDialog::checkNewTag()
|
||||
{
|
||||
RsGxsIdGroup rid;
|
||||
// Must set, Nickname, KeyId(if existing), mIdType, GpgId.
|
||||
std::string tag = ui.plainTextEdit_Tag->toPlainText().toStdString();
|
||||
std::string id = ui.lineEdit_KeyId->text().toStdString();
|
||||
std::string name = ui.lineEdit_Nickname->text().toUtf8().data();
|
||||
|
||||
rid.mMeta.mGroupName = ui.lineEdit_Nickname->text().toUtf8().constData();
|
||||
QString desc;
|
||||
bool ok = tagDetails(id, name, tag, desc);
|
||||
ui.label_TagCheck->setText(desc);
|
||||
|
||||
if (rid.mMeta.mGroupName.size() < 2)
|
||||
// hack to allow add invalid tags (for testing).
|
||||
if (!tag.empty())
|
||||
{
|
||||
std::cerr << "IdEditDialog::updateId() Nickname too short";
|
||||
ok = true;
|
||||
}
|
||||
|
||||
|
||||
if (mEditGroup.mRecognTags.size() >= MAX_RECOGN_TAGS)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
|
||||
ui.pushButton_Tag->setEnabled(ok);
|
||||
}
|
||||
|
||||
void IdEditDialog::addRecognTag()
|
||||
{
|
||||
std::string tag = ui.plainTextEdit_Tag->toPlainText().toStdString();
|
||||
if (mEditGroup.mRecognTags.size() >= MAX_RECOGN_TAGS)
|
||||
{
|
||||
std::cerr << "IdEditDialog::addRecognTag() Too many Tags, delete one first";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
mEditGroup.mRecognTags.push_back(tag);
|
||||
loadRecognTags();
|
||||
}
|
||||
|
||||
void IdEditDialog::rmTag1()
|
||||
{
|
||||
rmTag(0);
|
||||
}
|
||||
|
||||
void IdEditDialog::rmTag2()
|
||||
{
|
||||
rmTag(1);
|
||||
}
|
||||
|
||||
void IdEditDialog::rmTag3()
|
||||
{
|
||||
rmTag(2);
|
||||
}
|
||||
|
||||
void IdEditDialog::rmTag4()
|
||||
{
|
||||
rmTag(3);
|
||||
}
|
||||
|
||||
void IdEditDialog::rmTag5()
|
||||
{
|
||||
rmTag(4);
|
||||
}
|
||||
|
||||
void IdEditDialog::rmTag(int idx)
|
||||
{
|
||||
std::list<std::string>::iterator it;
|
||||
int i = 0;
|
||||
for(it = mEditGroup.mRecognTags.begin(); it != mEditGroup.mRecognTags.end() && (idx < i); it++, i++) ;
|
||||
|
||||
if (it != mEditGroup.mRecognTags.end())
|
||||
{
|
||||
mEditGroup.mRecognTags.erase(it);
|
||||
}
|
||||
loadRecognTags();
|
||||
}
|
||||
|
||||
bool IdEditDialog::tagDetails(const std::string &id, const std::string &name, const std::string &tag, QString &desc)
|
||||
{
|
||||
if (tag.empty())
|
||||
{
|
||||
desc += "Empty Tag";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* extract details for each tag */
|
||||
RsRecognTagDetails tagDetails;
|
||||
|
||||
bool ok = false;
|
||||
if (rsIdentity->parseRecognTag(id, name, tag, tagDetails))
|
||||
{
|
||||
desc += QString::number(tagDetails.tag_class);
|
||||
desc += ":";
|
||||
desc += QString::number(tagDetails.tag_type);
|
||||
|
||||
if (tagDetails.is_valid)
|
||||
{
|
||||
ok = true;
|
||||
desc += " Valid";
|
||||
}
|
||||
else
|
||||
{
|
||||
desc += " Invalid";
|
||||
}
|
||||
|
||||
if (tagDetails.is_pending)
|
||||
{
|
||||
ok = true;
|
||||
desc += " Pending";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
desc += "Unparseable";
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
void IdEditDialog::loadRecognTags()
|
||||
{
|
||||
std::cerr << "IdEditDialog::loadRecognTags()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// delete existing items.
|
||||
ui.label_Tag1->setHidden(true);
|
||||
ui.label_Tag2->setHidden(true);
|
||||
ui.label_Tag3->setHidden(true);
|
||||
ui.label_Tag4->setHidden(true);
|
||||
ui.label_Tag5->setHidden(true);
|
||||
ui.toolButton_Tag1->setHidden(true);
|
||||
ui.toolButton_Tag2->setHidden(true);
|
||||
ui.toolButton_Tag3->setHidden(true);
|
||||
ui.toolButton_Tag4->setHidden(true);
|
||||
ui.toolButton_Tag5->setHidden(true);
|
||||
ui.plainTextEdit_Tag->setPlainText("");
|
||||
|
||||
int i = 0;
|
||||
std::list<std::string>::const_iterator it;
|
||||
for(it = mEditGroup.mRecognTags.begin(); it != mEditGroup.mRecognTags.end(); it++, i++)
|
||||
{
|
||||
QString recognTag;
|
||||
tagDetails(mEditGroup.mMeta.mGroupId, mEditGroup.mMeta.mGroupName, *it, recognTag);
|
||||
|
||||
switch(i)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
ui.label_Tag1->setText(recognTag);
|
||||
ui.label_Tag1->setHidden(false);
|
||||
ui.toolButton_Tag1->setHidden(false);
|
||||
break;
|
||||
case 1:
|
||||
ui.label_Tag2->setText(recognTag);
|
||||
ui.label_Tag2->setHidden(false);
|
||||
ui.toolButton_Tag2->setHidden(false);
|
||||
break;
|
||||
case 2:
|
||||
ui.label_Tag3->setText(recognTag);
|
||||
ui.label_Tag3->setHidden(false);
|
||||
ui.toolButton_Tag3->setHidden(false);
|
||||
break;
|
||||
case 3:
|
||||
ui.label_Tag4->setText(recognTag);
|
||||
ui.label_Tag4->setHidden(false);
|
||||
ui.toolButton_Tag4->setHidden(false);
|
||||
break;
|
||||
case 4:
|
||||
ui.label_Tag5->setText(recognTag);
|
||||
ui.label_Tag5->setHidden(false);
|
||||
ui.toolButton_Tag5->setHidden(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IdEditDialog::submit()
|
||||
{
|
||||
if (mIsNew)
|
||||
{
|
||||
createId();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IdEditDialog::createId()
|
||||
{
|
||||
std::string groupname = ui.lineEdit_Nickname->text().toUtf8().constData();
|
||||
|
||||
if (groupname.size() < 2)
|
||||
{
|
||||
std::cerr << "IdEditDialog::createId() Nickname too short";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
//rid.mIdType = RSID_RELATION_YOURSELF;
|
||||
if (mIsNew)
|
||||
{
|
||||
rid.mMeta.mGroupId = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
rid.mMeta.mGroupId = ui.lineEdit_KeyId->text().toStdString();
|
||||
}
|
||||
|
||||
if (ui.radioButton_GpgId->isChecked())
|
||||
{
|
||||
//rid.mIdType |= RSID_TYPE_REALID;
|
||||
|
||||
//rid.mGpgId = ui.lineEdit_GpgId->text().toStdString();
|
||||
rid.mPgpIdHash = ui.lineEdit_GpgHash->text().toStdString();
|
||||
//rid.mGpgName = ui.lineEdit_GpgName->text().toUtf8().constData();
|
||||
}
|
||||
else
|
||||
{
|
||||
//rid.mIdType |= RSID_TYPE_PSEUDONYM;
|
||||
|
||||
//rid.mGpgId = "";
|
||||
rid.mPgpIdHash = "";
|
||||
//rid.mGpgName = "";
|
||||
//rid.mGpgEmail = "";
|
||||
}
|
||||
|
||||
// Can only create Identities for the moment!
|
||||
RsIdentityParameters params;
|
||||
params.nickname = rid.mMeta.mGroupName;
|
||||
params.nickname = groupname;
|
||||
params.isPgpLinked = (ui.radioButton_GpgId->isChecked());
|
||||
|
||||
uint32_t dummyToken = 0;
|
||||
|
@ -265,6 +443,30 @@ void IdEditDialog::updateId()
|
|||
close();
|
||||
}
|
||||
|
||||
|
||||
void IdEditDialog::updateId()
|
||||
{
|
||||
/* submit updated details */
|
||||
std::string groupname = ui.lineEdit_Nickname->text().toUtf8().constData();
|
||||
|
||||
if (groupname.size() < 2)
|
||||
{
|
||||
std::cerr << "IdEditDialog::updateId() Nickname too short";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
mEditGroup.mMeta.mGroupName = groupname;
|
||||
|
||||
uint32_t dummyToken = 0;
|
||||
rsIdentity->updateIdentity(dummyToken, mEditGroup);
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void IdEditDialog::loadRequest(const TokenQueue */*queue*/, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "IdDialog::loadRequest() UserType: " << req.mUserType;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
class UIStateHelper;
|
||||
|
||||
|
@ -46,16 +47,33 @@ public:
|
|||
|
||||
private slots:
|
||||
void idTypeToggled(bool checked);
|
||||
void updateId();
|
||||
void submit();
|
||||
|
||||
void addRecognTag();
|
||||
void checkNewTag();
|
||||
void rmTag1();
|
||||
void rmTag2();
|
||||
void rmTag3();
|
||||
void rmTag4();
|
||||
void rmTag5();
|
||||
|
||||
private:
|
||||
void createId();
|
||||
void updateId();
|
||||
void updateIdType(bool pseudo);
|
||||
void loadExistingId(uint32_t token);
|
||||
|
||||
void loadRecognTags();
|
||||
// extract details.
|
||||
bool tagDetails(const std::string &id, const std::string &name, const std::string &tag, QString &desc);
|
||||
void rmTag(int idx);
|
||||
|
||||
protected:
|
||||
Ui::IdEditDialog ui;
|
||||
bool mIsNew;
|
||||
UIStateHelper *mStateHelper;
|
||||
|
||||
RsGxsIdGroup mEditGroup;
|
||||
|
||||
TokenQueue *mIdQueue;
|
||||
};
|
||||
|
|
|
@ -6,147 +6,233 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>557</width>
|
||||
<height>179</height>
|
||||
<width>510</width>
|
||||
<height>595</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Nickname</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Nickname"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Key ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_KeyId">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>PGP Hash</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgHash">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>PGP Id</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgId">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>PGP Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_GpgId">
|
||||
<property name="text">
|
||||
<string>PGP Associated ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Pseudo">
|
||||
<property name="text">
|
||||
<string>Pseudonym</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Nickname</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Nickname"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Key ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_KeyId">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>PGP Hash</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgHash">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>PGP Id</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgId">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>PGP Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_Tags">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_Tag1">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="toolButton_Tag1">
|
||||
<property name="text">
|
||||
<string>RM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_Tag2">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="toolButton_Tag2">
|
||||
<property name="text">
|
||||
<string>RM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_Tag3">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QToolButton" name="toolButton_Tag3">
|
||||
<property name="text">
|
||||
<string>RM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_Tag4">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QToolButton" name="toolButton_Tag4">
|
||||
<property name="text">
|
||||
<string>RM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_Tag5">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QToolButton" name="toolButton_Tag5">
|
||||
<property name="text">
|
||||
<string>RM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_Tag"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_TagCheck">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="pushButton_Tag">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>328</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_GpgId">
|
||||
<property name="text">
|
||||
<string>PGP Associated ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Pseudo">
|
||||
<property name="text">
|
||||
<string>Pseudonym</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEdit_Nickname</tabstop>
|
||||
<tabstop>lineEdit_KeyId</tabstop>
|
||||
<tabstop>lineEdit_GpgHash</tabstop>
|
||||
<tabstop>lineEdit_GpgId</tabstop>
|
||||
<tabstop>lineEdit_GpgName</tabstop>
|
||||
<tabstop>radioButton_GpgId</tabstop>
|
||||
<tabstop>radioButton_Pseudo</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
|
|
|
@ -148,13 +148,13 @@ void GxsGroupDialog::initMode()
|
|||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||
}
|
||||
break;
|
||||
//TODO
|
||||
// case MODE_EDIT:
|
||||
// {
|
||||
// ui.createButton->setText(tr("Submit Changes"));
|
||||
// }
|
||||
// break;
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,14 +320,42 @@ void GxsGroupDialog::submitGroup()
|
|||
break;
|
||||
|
||||
case MODE_EDIT:
|
||||
{
|
||||
/* TEMP: just close if down */
|
||||
cancelDialog();
|
||||
{
|
||||
|
||||
editGroup();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GxsGroupDialog::editGroup()
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::editGroup()" << std::endl;
|
||||
|
||||
QString name = misc::removeNewLine(ui.groupName->text());
|
||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
|
||||
if(name.isEmpty())
|
||||
{
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return; //Don't add a empty name!!
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
RsGxsGroupUpdateMeta updateMeta(mGrpMeta.mGroupId);
|
||||
updateMeta.setMetaUpdate(RsGxsGroupUpdateMeta::NAME, std::string(name.toUtf8()));
|
||||
|
||||
if (service_EditGroup(token, updateMeta))
|
||||
{
|
||||
// get the Queue to handle response.
|
||||
if(mTokenQueue != NULL)
|
||||
mTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void GxsGroupDialog::createGroup()
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::createGroup()";
|
||||
|
|
|
@ -163,13 +163,21 @@ protected:
|
|||
void setUiText(UiType uiType, const QString &text);
|
||||
|
||||
/*!
|
||||
* Main purpose is to help tansfer meta data to service
|
||||
*
|
||||
* It is up to the service to do the actual group creation
|
||||
* Service can also modify initial meta going into group
|
||||
* @param token This should be set to the token retrieved
|
||||
* @param meta The deriving GXS service should set their grp meta to this value
|
||||
*/
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) = 0;
|
||||
|
||||
/*!
|
||||
* It is up to the service to do the actual group editing
|
||||
* TODO: make pure virtual
|
||||
* @param token This should be set to the token retrieved
|
||||
* @param meta The deriving GXS service should set their grp meta to this value
|
||||
*/
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) {}
|
||||
|
||||
/*!
|
||||
* This returns a group logo from the ui \n
|
||||
* Should be calleld by deriving service
|
||||
|
@ -202,6 +210,7 @@ private:
|
|||
void setupVisibility();
|
||||
void clearForm();
|
||||
void createGroup();
|
||||
void editGroup();
|
||||
void sendShareList(std::string forumId);
|
||||
void loadNewGroupId(const uint32_t &token);
|
||||
|
||||
|
@ -215,6 +224,8 @@ private:
|
|||
uint32_t mReadonlyFlags;
|
||||
uint32_t mDefaultsFlags;
|
||||
|
||||
protected:
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsGroupDialog ui;
|
||||
};
|
||||
|
|
|
@ -67,6 +67,17 @@ bool GxsIdChooser::MakeIdDesc(const RsGxsId &id, QString &desc)
|
|||
if (found)
|
||||
{
|
||||
desc = QString::fromUtf8(details.mNickname.c_str());
|
||||
|
||||
std::list<RsRecognTag>::iterator it;
|
||||
for(it = details.mRecognTags.begin(); it != details.mRecognTags.end(); it++)
|
||||
{
|
||||
desc += " (";
|
||||
desc += QString::number(it->tag_class);
|
||||
desc += ":";
|
||||
desc += QString::number(it->tag_type);
|
||||
desc += ")";
|
||||
}
|
||||
|
||||
if (details.mPgpLinked)
|
||||
{
|
||||
desc += " (PGP) [";
|
||||
|
|
|
@ -71,6 +71,16 @@ static bool MakeIdDesc(const RsGxsId &id, QString &str)
|
|||
|
||||
str = QString::fromUtf8(details.mNickname.c_str());
|
||||
|
||||
std::list<RsRecognTag>::iterator it;
|
||||
for(it = details.mRecognTags.begin(); it != details.mRecognTags.end(); it++)
|
||||
{
|
||||
str += " (";
|
||||
str += QString::number(it->tag_class);
|
||||
str += ":";
|
||||
str += QString::number(it->tag_type);
|
||||
str += ")";
|
||||
}
|
||||
|
||||
bool addCode = true;
|
||||
if (details.mPgpLinked)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,17 @@ static bool MakeIdDesc(const RsGxsId &id, QString &str)
|
|||
|
||||
str = QString::fromUtf8(details.mNickname.c_str());
|
||||
|
||||
std::list<RsRecognTag>::iterator it;
|
||||
for(it = details.mRecognTags.begin(); it != details.mRecognTags.end(); it++)
|
||||
{
|
||||
str += " (";
|
||||
str += QString::number(it->tag_class);
|
||||
str += ":";
|
||||
str += QString::number(it->tag_type);
|
||||
str += ")";
|
||||
}
|
||||
|
||||
|
||||
bool addCode = true;
|
||||
if (details.mPgpLinked)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,13 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
|
|||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
|
||||
const uint32_t ForumEditEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
0);
|
||||
|
||||
const uint32_t ForumEditDefaultsFlags = 0;
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
|
||||
{
|
||||
|
@ -88,8 +95,17 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
|
|||
// Specific Function.
|
||||
RsGxsForumGroup grp;
|
||||
grp.mMeta = meta;
|
||||
//grp.mDescription = std::string(desc.toUtf8());
|
||||
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
|
||||
|
||||
rsGxsForums->createGroup(token, grp);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta)
|
||||
{
|
||||
RsGxsForumGroup grp;
|
||||
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
|
||||
|
||||
rsGxsForums->updateGroup(token, updateMeta, grp);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ protected:
|
|||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -193,8 +193,10 @@ macx {
|
|||
|
||||
gxs {
|
||||
LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
|
||||
|
||||
LIBS += ../../../lib/libsqlcipher.a
|
||||
#LIBS += -lsqlite3
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue