mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 23:15:41 -04:00
add GXS ID creation option for forum/channel/[...] posting. (Patch from Phenom)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7437 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e25a8eda97
commit
24ad4b8880
30 changed files with 808 additions and 341 deletions
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -67,6 +68,8 @@ CreateCircleDialog::CreateCircleDialog()
|
||||||
|
|
||||||
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||||
|
|
||||||
|
connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
/* Add filter actions */
|
/* Add filter actions */
|
||||||
QTreeWidgetItem *headerItem = ui.treeWidget_IdList->headerItem();
|
QTreeWidgetItem *headerItem = ui.treeWidget_IdList->headerItem();
|
||||||
QString headerText = headerItem->text(RSCIRCLEID_COL_NICKNAME);
|
QString headerText = headerItem->text(RSCIRCLEID_COL_NICKNAME);
|
||||||
|
@ -140,6 +143,7 @@ void CreateCircleDialog::setupForPersonalCircle()
|
||||||
ui.frame_Distribution->hide();
|
ui.frame_Distribution->hide();
|
||||||
ui.idChooserLabel->hide();
|
ui.idChooserLabel->hide();
|
||||||
ui.idChooser->hide();
|
ui.idChooser->hide();
|
||||||
|
ui.toolButton_NewId->hide();
|
||||||
|
|
||||||
getPgpIdentities();
|
getPgpIdentities();
|
||||||
}
|
}
|
||||||
|
@ -154,6 +158,7 @@ void CreateCircleDialog::setupForExternalCircle()
|
||||||
ui.frame_Distribution->show();
|
ui.frame_Distribution->show();
|
||||||
ui.idChooserLabel->show();
|
ui.idChooserLabel->show();
|
||||||
ui.idChooser->show();
|
ui.idChooser->show();
|
||||||
|
ui.toolButton_NewId->show();
|
||||||
|
|
||||||
requestGxsIdentities();
|
requestGxsIdentities();
|
||||||
}
|
}
|
||||||
|
@ -229,90 +234,83 @@ void CreateCircleDialog::createCircle()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QString name = ui.circleName->text();
|
QString name = ui.circleName->text();
|
||||||
QString desc;
|
//QString desc;
|
||||||
|
|
||||||
if(name.isEmpty())
|
if(name.isEmpty()) {
|
||||||
{ /* error message */
|
/* error message */
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a name for your Circle"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a name for your Circle"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return; //Don't add a empty Subject!!
|
return; //Don't add a empty Subject!!
|
||||||
}
|
}//if(name.isEmpty())
|
||||||
|
|
||||||
RsGxsCircleGroup circle;
|
RsGxsCircleGroup circle;
|
||||||
|
|
||||||
circle.mMeta.mGroupName = std::string(name.toUtf8());
|
circle.mMeta.mGroupName = std::string(name.toUtf8());
|
||||||
|
|
||||||
RsGxsId authorId;
|
RsGxsId authorId;
|
||||||
if (ui.idChooser->getChosenId(authorId))
|
switch (ui.idChooser->getChosenId(authorId)) {
|
||||||
{
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
circle.mMeta.mAuthorId = authorId;
|
circle.mMeta.mAuthorId = authorId;
|
||||||
std::cerr << "CreateCircleDialog::createCircle() AuthorId: " << authorId;
|
std::cerr << "CreateCircleDialog::createCircle() AuthorId: " << authorId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
|
||||||
else
|
break;
|
||||||
{
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
std::cerr << "CreateCircleDialog::createCircle() No AuthorId Chosen!";
|
std::cerr << "CreateCircleDialog::createCircle() No AuthorId Chosen!";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}//switch (ui.idChooser->getChosenId(authorId))
|
||||||
|
|
||||||
|
|
||||||
/* copy Ids from GUI */
|
/* copy Ids from GUI */
|
||||||
QTreeWidget *tree = ui.treeWidget_membership;
|
QTreeWidget *tree = ui.treeWidget_membership;
|
||||||
int count = tree->topLevelItemCount();
|
int count = tree->topLevelItemCount();
|
||||||
for(int i = 0; i < count; i++)
|
for(int i = 0; i < count; i++) {
|
||||||
{
|
|
||||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||||
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
|
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
|
||||||
|
|
||||||
/* insert into circle */
|
/* insert into circle */
|
||||||
if (mIsExternalCircle)
|
if (mIsExternalCircle) {
|
||||||
{
|
|
||||||
circle.mInvitedMembers.push_back(RsGxsId(keyId.toStdString()));
|
circle.mInvitedMembers.push_back(RsGxsId(keyId.toStdString()));
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Inserting Member: " << keyId.toStdString();
|
std::cerr << "CreateCircleDialog::createCircle() Inserting Member: " << keyId.toStdString();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
} else {//if (mIsExternalCircle)
|
||||||
else
|
|
||||||
{
|
|
||||||
circle.mLocalFriends.push_back(RsPgpId(keyId.toStdString()));
|
circle.mLocalFriends.push_back(RsPgpId(keyId.toStdString()));
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Inserting Friend: " << keyId.toStdString();
|
std::cerr << "CreateCircleDialog::createCircle() Inserting Friend: " << keyId.toStdString();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}//if (mIsExternalCircle)
|
||||||
|
|
||||||
}
|
}//for(int i = 0; i < count; i++)
|
||||||
|
|
||||||
if (mIsExistingCircle)
|
if (mIsExistingCircle) {
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Existing Circle TODO";
|
std::cerr << "CreateCircleDialog::createCircle() Existing Circle TODO";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// cannot edit these yet.
|
// cannot edit these yet.
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Cannot Edit Existing Circles Yet"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Cannot Edit Existing Circles Yet"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}//if (mIsExistingCircle)
|
||||||
|
|
||||||
if (mIsExternalCircle)
|
if (mIsExternalCircle) {
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() External Circle";
|
std::cerr << "CreateCircleDialog::createCircle() External Circle";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// set distribution from GUI.
|
// set distribution from GUI.
|
||||||
circle.mMeta.mCircleId.clear() ;
|
circle.mMeta.mCircleId.clear() ;
|
||||||
if (ui.radioButton_Public->isChecked())
|
if (ui.radioButton_Public->isChecked()) {
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Public Circle";
|
std::cerr << "CreateCircleDialog::createCircle() Public Circle";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
|
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
|
||||||
}
|
|
||||||
else if (ui.radioButton_Self->isChecked())
|
} else if (ui.radioButton_Self->isChecked()) {
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() ExtSelfRef Circle";
|
std::cerr << "CreateCircleDialog::createCircle() ExtSelfRef Circle";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_EXT_SELF;
|
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_EXT_SELF;
|
||||||
}
|
} else if (ui.radioButton_Restricted->isChecked()) {
|
||||||
else if (ui.radioButton_Restricted->isChecked())
|
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() External (Other) Circle";
|
std::cerr << "CreateCircleDialog::createCircle() External (Other) Circle";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
@ -320,37 +318,31 @@ void CreateCircleDialog::createCircle()
|
||||||
|
|
||||||
/* grab circle ID from chooser */
|
/* grab circle ID from chooser */
|
||||||
RsGxsCircleId chosenId;
|
RsGxsCircleId chosenId;
|
||||||
if (ui.circleComboBox->getChosenCircle(chosenId))
|
if (ui.circleComboBox->getChosenCircle(chosenId)) {
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() ChosenId: " << chosenId;
|
std::cerr << "CreateCircleDialog::createCircle() ChosenId: " << chosenId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
circle.mMeta.mCircleId = chosenId;
|
circle.mMeta.mCircleId = chosenId;
|
||||||
}
|
} else {//if (ui.circleComboBox->getChosenCircle(chosenId))
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Error no Id Chosen";
|
std::cerr << "CreateCircleDialog::createCircle() Error no Id Chosen";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("No Restriction Circle Selected"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("No Restriction Circle Selected"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}//if (ui.circleComboBox->getChosenCircle(chosenId))
|
||||||
}
|
} else { //if (ui.radioButton_Public->isChecked())
|
||||||
else
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("No Circle Limitations Selected"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("No Circle Limitations Selected"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}//if (ui.radioButton_Public->isChecked())
|
||||||
}
|
} else {//if (mIsExternalCircle)
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Personal Circle";
|
std::cerr << "CreateCircleDialog::createCircle() Personal Circle";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// set personal distribution
|
// set personal distribution
|
||||||
circle.mMeta.mCircleId.clear() ;
|
circle.mMeta.mCircleId.clear() ;
|
||||||
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL;
|
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL;
|
||||||
}
|
}//if (mIsExternalCircle)
|
||||||
|
|
||||||
std::cerr << "CreateCircleDialog::createCircle() : mCircleType: " << circle.mMeta.mCircleType;
|
std::cerr << "CreateCircleDialog::createCircle() : mCircleType: " << circle.mMeta.mCircleType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "CreateCircleDialog::createCircle() : mCircleId: " << circle.mMeta.mCircleId;
|
std::cerr << "CreateCircleDialog::createCircle() : mCircleId: " << circle.mMeta.mCircleId;
|
||||||
|
@ -674,3 +666,11 @@ void CreateCircleDialog::filterIds()
|
||||||
|
|
||||||
ui.treeWidget_IdList->filterItems(filterColumn, text);
|
ui.treeWidget_IdList->filterItems(filterColumn, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateCircleDialog::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui.idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ private slots:
|
||||||
|
|
||||||
void createCircle();
|
void createCircle();
|
||||||
void filterChanged(const QString &text);
|
void filterChanged(const QString &text);
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -258,6 +258,38 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -337,6 +369,22 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineEditClear</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header location="global">gui/common/LineEditClear.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>RSTreeWidget</class>
|
||||||
|
<extends>QTreeWidget</extends>
|
||||||
|
<header>gui/common/RSTreeWidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>HeaderFrame</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>gui/common/HeaderFrame.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GxsIdChooser</class>
|
<class>GxsIdChooser</class>
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
|
@ -347,22 +395,6 @@
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
<header>gui/gxs/GxsCircleChooser.h</header>
|
<header>gui/gxs/GxsCircleChooser.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>HeaderFrame</class>
|
|
||||||
<extends>QFrame</extends>
|
|
||||||
<header>gui/common/HeaderFrame.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>LineEditClear</class>
|
|
||||||
<extends>QLineEdit</extends>
|
|
||||||
<header>gui/common/LineEditClear.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>RSTreeWidget</class>
|
|
||||||
<extends>QTreeWidget</extends>
|
|
||||||
<header>gui/common/RSTreeWidget.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "gui/chat/ChatDialog.h"
|
#include "gui/chat/ChatDialog.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsidentity.h>
|
//#include <retroshare/rsidentity.h> //On header
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
#include "retroshare/rsmsgs.h"
|
#include "retroshare/rsmsgs.h"
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ IdEditDialog::IdEditDialog(QWidget *parent)
|
||||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||||
{
|
{
|
||||||
mIsNew = true;
|
mIsNew = true;
|
||||||
|
mLastIdName="";
|
||||||
|
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -445,6 +446,7 @@ void IdEditDialog::createId()
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
rsIdentity->createIdentity(dummyToken, params);
|
rsIdentity->createIdentity(dummyToken, params);
|
||||||
|
|
||||||
|
mLastIdName = groupname;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,6 +467,8 @@ void IdEditDialog::updateId()
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
rsIdentity->updateIdentity(dummyToken, mEditGroup);
|
rsIdentity->updateIdentity(dummyToken, mEditGroup);
|
||||||
|
|
||||||
|
|
||||||
|
mLastIdName = groupname;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
#include <retroshare/rsgxsifacetypes.h>
|
#include <retroshare/rsgxsifacetypes.h>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
class UIStateHelper;
|
class UIStateHelper;
|
||||||
|
|
||||||
|
@ -46,6 +47,8 @@ public:
|
||||||
|
|
||||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
|
std::string getLastIdName() {return mLastIdName;}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void idTypeToggled(bool checked);
|
void idTypeToggled(bool checked);
|
||||||
void submit();
|
void submit();
|
||||||
|
@ -77,6 +80,7 @@ protected:
|
||||||
RsGxsIdGroup mEditGroup;
|
RsGxsIdGroup mEditGroup;
|
||||||
|
|
||||||
TokenQueue *mIdQueue;
|
TokenQueue *mIdQueue;
|
||||||
|
std::string mLastIdName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -107,12 +107,20 @@ const RsPhotoPhoto& PhotoItem::getPhotoDetails()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if(ui->idChooser->isVisible())
|
if (ui->idChooser->isVisible()) {
|
||||||
{
|
|
||||||
RsGxsId id;
|
RsGxsId id;
|
||||||
ui->idChooser->getChosenId(id);
|
switch (ui->idChooser->getChosenId(id)) {
|
||||||
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
mPhotoDetails.mMeta.mAuthorId = id;
|
mPhotoDetails.mMeta.mAuthorId = id;
|
||||||
}
|
|
||||||
|
break;
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}//switch (ui->idChooser->getChosenId(id))
|
||||||
|
}//if (ui->idChooser->isVisible())
|
||||||
|
|
||||||
return mPhotoDetails;
|
return mPhotoDetails;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ private:
|
||||||
QPixmap getPixmap() { return mThumbNail; }
|
QPixmap getPixmap() { return mThumbNail; }
|
||||||
|
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
RsPhotoPhoto mPhotoDetails;
|
|
||||||
PhotoShareItemHolder* mHolder;
|
PhotoShareItemHolder* mHolder;
|
||||||
|
RsPhotoPhoto mPhotoDetails;
|
||||||
|
|
||||||
QLabel *mTitleLabel, *mPhotoGrapherLabel;
|
QLabel *mTitleLabel, *mPhotoGrapherLabel;
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "PostedUserTypes.h"
|
#include "PostedUserTypes.h"
|
||||||
|
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos
|
||||||
|
|
||||||
connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost()));
|
connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost()));
|
||||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||||
|
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png"));
|
ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png"));
|
||||||
ui->headerFrame->setHeaderText(tr("Submit a new Post"));
|
ui->headerFrame->setHeaderText(tr("Submit a new Post"));
|
||||||
|
@ -55,15 +57,20 @@ PostedCreatePostDialog::~PostedCreatePostDialog()
|
||||||
void PostedCreatePostDialog::createPost()
|
void PostedCreatePostDialog::createPost()
|
||||||
{
|
{
|
||||||
RsGxsId authorId;
|
RsGxsId authorId;
|
||||||
if (!ui->idChooser->getChosenId(authorId))
|
switch (ui->idChooser->getChosenId(authorId)) {
|
||||||
{
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
|
break;
|
||||||
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed";
|
std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}//switch (ui->idChooser->getChosenId(authorId))
|
||||||
|
|
||||||
RsPostedPost post;
|
RsPostedPost post;
|
||||||
post.mMeta.mGroupId = mGrpId;
|
post.mMeta.mGroupId = mGrpId;
|
||||||
|
@ -76,7 +83,7 @@ void PostedCreatePostDialog::createPost()
|
||||||
/* error message */
|
/* error message */
|
||||||
QMessageBox::warning(this, "RetroShare", tr("Please add a Title"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, "RetroShare", tr("Please add a Title"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return; //Don't add a empty title!!
|
return; //Don't add a empty title!!
|
||||||
}
|
}//if(ui->titleEdit->text().isEmpty())
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPosted->createPost(token, post);
|
mPosted->createPost(token, post);
|
||||||
|
@ -84,3 +91,11 @@ void PostedCreatePostDialog::createPost()
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostedCreatePostDialog::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui->idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void createPost();
|
void createPost();
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mLink;
|
QString mLink;
|
||||||
|
|
|
@ -185,6 +185,38 @@ p, li { white-space: pre-wrap; }
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="3">
|
<item row="3" column="0" colspan="3">
|
||||||
|
@ -243,17 +275,17 @@ p, li { white-space: pre-wrap; }
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
|
||||||
<class>GxsIdChooser</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>gui/gxs/GxsIdChooser.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>HeaderFrame</class>
|
<class>HeaderFrame</class>
|
||||||
<extends>QFrame</extends>
|
<extends>QFrame</extends>
|
||||||
<header>gui/common/HeaderFrame.h</header>
|
<header>gui/common/HeaderFrame.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>GxsIdChooser</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>gui/gxs/GxsIdChooser.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "PostedDialog.h"
|
#include "PostedDialog.h"
|
||||||
#include "PostedItem.h"
|
#include "PostedItem.h"
|
||||||
#include "PostedUserTypes.h"
|
#include "PostedUserTypes.h"
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -76,6 +77,8 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||||
|
|
||||||
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
||||||
|
|
||||||
|
connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
// default sort method.
|
// default sort method.
|
||||||
mSortMethod = RsPosted::HotRankType;
|
mSortMethod = RsPosted::HotRankType;
|
||||||
mLastSortMethod = RsPosted::TopRankType; // to be different.
|
mLastSortMethod = RsPosted::TopRankType; // to be different.
|
||||||
|
@ -97,6 +100,9 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||||
|
|
||||||
ui.hotSortButton->setChecked(true);
|
ui.hotSortButton->setChecked(true);
|
||||||
|
|
||||||
|
/* fill in the available OwnIds for signing */
|
||||||
|
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||||
|
|
||||||
connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
|
connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,15 +250,20 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
|
||||||
{
|
{
|
||||||
/* must grab AuthorId from Layout */
|
/* must grab AuthorId from Layout */
|
||||||
RsGxsId authorId;
|
RsGxsId authorId;
|
||||||
if (!ui.idChooser->getChosenId(authorId))
|
switch (ui.idChooser->getChosenId(authorId)) {
|
||||||
{
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
|
break;
|
||||||
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
std::cerr << "PostedListDialog::createPost() ERROR GETTING AuthorId!, Vote Failed";
|
std::cerr << "PostedListDialog::createPost() ERROR GETTING AuthorId!, Vote Failed";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}//switch (ui.idChooser->getChosenId(authorId))
|
||||||
|
|
||||||
RsGxsVote vote;
|
RsGxsVote vote;
|
||||||
|
|
||||||
|
@ -261,14 +272,11 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
|
||||||
vote.mMeta.mParentId = msgId.second;
|
vote.mMeta.mParentId = msgId.second;
|
||||||
vote.mMeta.mAuthorId = authorId;
|
vote.mMeta.mAuthorId = authorId;
|
||||||
|
|
||||||
if (up)
|
if (up) {
|
||||||
{
|
|
||||||
vote.mVoteType = GXS_VOTE_UP;
|
vote.mVoteType = GXS_VOTE_UP;
|
||||||
}
|
} else { //if (up)
|
||||||
else
|
|
||||||
{
|
|
||||||
vote.mVoteType = GXS_VOTE_DOWN;
|
vote.mVoteType = GXS_VOTE_DOWN;
|
||||||
}
|
}//if (up)
|
||||||
|
|
||||||
std::cerr << "PostedListDialog::submitVote()";
|
std::cerr << "PostedListDialog::submitVote()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -396,6 +404,14 @@ void PostedListDialog::editTopic()
|
||||||
cf.exec ();
|
cf.exec ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui.idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
||||||
void PostedListDialog::showGroupDetails()
|
void PostedListDialog::showGroupDetails()
|
||||||
{
|
{
|
||||||
if (mCurrTopicId.isNull())
|
if (mCurrTopicId.isNull())
|
||||||
|
@ -422,10 +438,10 @@ void PostedListDialog::requestGroupSummary()
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
|
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
|
||||||
|
|
||||||
/* refresh Id Chooser Too */
|
// /* refresh Id Chooser Too */
|
||||||
RsGxsId currentId ;
|
//RsGxsId currentId ;
|
||||||
ui.idChooser->getChosenId(currentId);
|
//ui.idChooser->getChosenId(currentId);
|
||||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId);
|
//ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostedListDialog::acknowledgeGroup(const uint32_t &token)
|
void PostedListDialog::acknowledgeGroup(const uint32_t &token)
|
||||||
|
|
|
@ -76,6 +76,8 @@ private slots:
|
||||||
void showTopic();
|
void showTopic();
|
||||||
void editTopic();
|
void editTopic();
|
||||||
|
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
void showGroupDetails();
|
void showGroupDetails();
|
||||||
void newPost();
|
void newPost();
|
||||||
|
|
||||||
|
|
|
@ -251,6 +251,38 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
|
@ -263,7 +295,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>711</width>
|
<width>714</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -291,21 +323,21 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GxsIdChooser</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>gui/gxs/GxsIdChooser.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GroupTreeWidget</class>
|
<class>GroupTreeWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>gui/common/GroupTreeWidget.h</header>
|
<header>gui/common/GroupTreeWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>GxsIdChooser</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>gui/gxs/GxsIdChooser.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="Posted_images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
<include location="Posted_images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#define WET_ROLE_ORIGPAGEID Qt::UserRole
|
#define WET_ROLE_ORIGPAGEID Qt::UserRole
|
||||||
#define WET_ROLE_PAGEID Qt::UserRole + 1
|
#define WET_ROLE_PAGEID Qt::UserRole + 1
|
||||||
#define WET_ROLE_PARENTID Qt::UserRole + 2
|
#define WET_ROLE_PARENTID Qt::UserRole + 2
|
||||||
|
|
||||||
#define WET_ROLE_SORT Qt::UserRole + 3
|
#define WET_ROLE_SORT Qt::UserRole + 3
|
||||||
|
|
||||||
|
|
||||||
|
@ -421,7 +420,7 @@ void WikiEditDialog::setNewPage()
|
||||||
ui.headerFrame->setHeaderText(tr("Create New Wiki Page"));
|
ui.headerFrame->setHeaderText(tr("Create New Wiki Page"));
|
||||||
setWindowTitle(tr("Create New Wiki Page"));
|
setWindowTitle(tr("Create New Wiki Page"));
|
||||||
|
|
||||||
/* no need for for REQUIRED ID */
|
/* No need for for REQUIRED ID */
|
||||||
ui.comboBox_IdChooser->loadIds(0, RsGxsId());
|
ui.comboBox_IdChooser->loadIds(0, RsGxsId());
|
||||||
|
|
||||||
textReset();
|
textReset();
|
||||||
|
@ -433,7 +432,7 @@ void WikiEditDialog::setRepublishMode(RsGxsMessageId &origMsgId)
|
||||||
mRepublishMode = true;
|
mRepublishMode = true;
|
||||||
mRepublishOrigId = origMsgId;
|
mRepublishOrigId = origMsgId;
|
||||||
ui.pushButton_Submit->setText(tr("Republish"));
|
ui.pushButton_Submit->setText(tr("Republish"));
|
||||||
/* no need for for REQUIRED ID */
|
/* No need for for REQUIRED ID */
|
||||||
ui.comboBox_IdChooser->loadIds(0, RsGxsId());
|
ui.comboBox_IdChooser->loadIds(0, RsGxsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,15 +446,12 @@ void WikiEditDialog::cancelEdit()
|
||||||
|
|
||||||
void WikiEditDialog::revertEdit()
|
void WikiEditDialog::revertEdit()
|
||||||
{
|
{
|
||||||
if (mNewPage)
|
if (mNewPage) {
|
||||||
{
|
|
||||||
mCurrentText = "";
|
mCurrentText = "";
|
||||||
}
|
} else {//if (mNewPage
|
||||||
else
|
|
||||||
{
|
|
||||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiSnapshot.mPage));
|
ui.textEdit->setPlainText(QString::fromStdString(mWikiSnapshot.mPage));
|
||||||
mCurrentText = QString::fromUtf8(mWikiSnapshot.mPage.c_str());
|
mCurrentText = QString::fromUtf8(mWikiSnapshot.mPage.c_str());
|
||||||
}
|
}//if (mNewPage
|
||||||
redrawPage();
|
redrawPage();
|
||||||
textReset();
|
textReset();
|
||||||
}
|
}
|
||||||
|
@ -466,8 +462,23 @@ void WikiEditDialog::submitEdit()
|
||||||
std::cerr << "WikiEditDialog::submitEdit()";
|
std::cerr << "WikiEditDialog::submitEdit()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
if (mNewPage)
|
RsGxsId authorId;
|
||||||
{
|
switch (ui.comboBox_IdChooser->getChosenId(authorId)) {
|
||||||
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
|
mWikiSnapshot.mMeta.mAuthorId = authorId;
|
||||||
|
std::cerr << "WikiEditDialog::submitEdit() AuthorId: " << authorId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
|
std::cerr << "WikiEditDialog::submitEdit() ERROR GETTING AuthorId!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}//switch (ui.comboBox_IdChooser->getChosenId(authorId))
|
||||||
|
|
||||||
|
if (mNewPage) {
|
||||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||||
mWikiSnapshot.mMeta.mOrigMsgId.clear() ;
|
mWikiSnapshot.mMeta.mOrigMsgId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
||||||
|
@ -476,9 +487,7 @@ void WikiEditDialog::submitEdit()
|
||||||
|
|
||||||
std::cerr << "WikiEditDialog::submitEdit() Is New Page";
|
std::cerr << "WikiEditDialog::submitEdit() Is New Page";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
} else if (mRepublishMode) {
|
||||||
else if (mRepublishMode)
|
|
||||||
{
|
|
||||||
std::cerr << "WikiEditDialog::submitEdit() In Republish Mode";
|
std::cerr << "WikiEditDialog::submitEdit() In Republish Mode";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
// A New Version of the ThreadHead.
|
// A New Version of the ThreadHead.
|
||||||
|
@ -487,65 +496,44 @@ void WikiEditDialog::submitEdit()
|
||||||
mWikiSnapshot.mMeta.mParentId.clear() ;
|
mWikiSnapshot.mMeta.mParentId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mThreadId.clear() ;
|
mWikiSnapshot.mMeta.mThreadId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "WikiEditDialog::submitEdit() In Child Edit Mode";
|
std::cerr << "WikiEditDialog::submitEdit() In Child Edit Mode";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// A Child of the current message.
|
// A Child of the current message.
|
||||||
bool isFirstChild = false;
|
bool isFirstChild = false;
|
||||||
if (mWikiSnapshot.mMeta.mParentId.isNull())
|
if (mWikiSnapshot.mMeta.mParentId.isNull()) {
|
||||||
{
|
|
||||||
isFirstChild = true;
|
isFirstChild = true;
|
||||||
}
|
}//if (mWikiSnapshot.mMeta.mParentId.isNull())
|
||||||
|
|
||||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||||
|
|
||||||
if (isFirstChild)
|
if (isFirstChild){
|
||||||
{
|
|
||||||
mWikiSnapshot.mMeta.mThreadId = mWikiSnapshot.mMeta.mOrigMsgId;
|
mWikiSnapshot.mMeta.mThreadId = mWikiSnapshot.mMeta.mOrigMsgId;
|
||||||
// Special HACK here... parentId points to specific Msg, rather than OrigMsgId.
|
// Special HACK here... parentId points to specific Msg, rather than OrigMsgId.
|
||||||
// This allows versioning to work well.
|
// This allows versioning to work well.
|
||||||
mWikiSnapshot.mMeta.mParentId = mWikiSnapshot.mMeta.mMsgId;
|
mWikiSnapshot.mMeta.mParentId = mWikiSnapshot.mMeta.mMsgId;
|
||||||
}
|
} else {//if (isFirstChild)
|
||||||
else
|
|
||||||
{
|
|
||||||
// ThreadId is the same.
|
// ThreadId is the same.
|
||||||
mWikiSnapshot.mMeta.mParentId = mWikiSnapshot.mMeta.mOrigMsgId;
|
mWikiSnapshot.mMeta.mParentId = mWikiSnapshot.mMeta.mOrigMsgId;
|
||||||
}
|
}//if (isFirstChild)
|
||||||
|
|
||||||
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mOrigMsgId.clear() ;
|
mWikiSnapshot.mMeta.mOrigMsgId.clear() ;
|
||||||
}
|
}//if (mNewPage)
|
||||||
|
|
||||||
|
|
||||||
mWikiSnapshot.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
mWikiSnapshot.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
||||||
|
|
||||||
if (!mPreviewMode)
|
if (!mPreviewMode) {
|
||||||
{
|
|
||||||
/* can just use the current text */
|
/* can just use the current text */
|
||||||
mCurrentText = ui.textEdit->toPlainText();
|
mCurrentText = ui.textEdit->toPlainText();
|
||||||
}
|
}//if (!mPreviewMode)
|
||||||
|
|
||||||
{
|
{// complicated way of preserving Utf8 text */
|
||||||
// complicated way of preserving Utf8 text */
|
|
||||||
QByteArray byte_array = mCurrentText.toUtf8();
|
QByteArray byte_array = mCurrentText.toUtf8();
|
||||||
mWikiSnapshot.mPage = std::string(byte_array.data());
|
mWikiSnapshot.mPage = std::string(byte_array.data());
|
||||||
}
|
}// complicated way of preserving Utf8 text */
|
||||||
|
|
||||||
RsGxsId authorId;
|
|
||||||
if (ui.comboBox_IdChooser->getChosenId(authorId))
|
|
||||||
{
|
|
||||||
mWikiSnapshot.mMeta.mAuthorId = authorId;
|
|
||||||
std::cerr << "CreateGxsForumMsg::createMsg() AuthorId: " << authorId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "CreateGxsForumMsg::createMsg() ERROR GETTING AuthorId!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cerr << "WikiEditDialog::submitEdit() PageTitle: " << mWikiSnapshot.mMeta.mMsgName;
|
std::cerr << "WikiEditDialog::submitEdit() PageTitle: " << mWikiSnapshot.mMeta.mMsgName;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "gui/gxs/GxsCommentDialog.h"
|
#include "gui/gxs/GxsCommentDialog.h"
|
||||||
#include "ui_GxsCommentDialog.h"
|
#include "ui_GxsCommentDialog.h"
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -47,6 +48,7 @@ GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_servic
|
||||||
|
|
||||||
connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
||||||
connect(ui->idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int )));
|
connect(ui->idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int )));
|
||||||
|
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
/* force voterId through - first time */
|
/* force voterId through - first time */
|
||||||
voterSelectionChanged( 0 );
|
voterSelectionChanged( 0 );
|
||||||
|
@ -87,17 +89,20 @@ void GxsCommentDialog::voterSelectionChanged( int index )
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsGxsId voterId;
|
RsGxsId voterId;
|
||||||
if (ui->idChooser->getChosenId(voterId))
|
switch (ui->idChooser->getChosenId(voterId)) {
|
||||||
{
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
std::cerr << "GxsCommentDialog::voterSelectionChanged() => " << voterId;
|
std::cerr << "GxsCommentDialog::voterSelectionChanged() => " << voterId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
ui->treeWidget->setVoteId(voterId);
|
ui->treeWidget->setVoteId(voterId);
|
||||||
}
|
|
||||||
else
|
break;
|
||||||
{
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
std::cerr << "GxsCommentDialog::voterSelectionChanged() ERROR nothing selected";
|
std::cerr << "GxsCommentDialog::voterSelectionChanged() ERROR nothing selected";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}//switch (ui->idChooser->getChosenId(voterId))
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentDialog::setCommentHeader(QWidget *header)
|
void GxsCommentDialog::setCommentHeader(QWidget *header)
|
||||||
|
@ -138,3 +143,11 @@ void GxsCommentDialog::setCommentHeader(QWidget *header)
|
||||||
ui->notesBrowser->setPlainText(QString::fromStdString(mCurrentPost.mNotes));
|
ui->notesBrowser->setPlainText(QString::fromStdString(mCurrentPost.mNotes));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsCommentDialog::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui->idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
void voterSelectionChanged( int index );
|
void voterSelectionChanged( int index );
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RsGxsGroupId mGrpId;
|
RsGxsGroupId mGrpId;
|
||||||
|
|
|
@ -117,6 +117,38 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="refreshButton">
|
<widget class="QPushButton" name="refreshButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "GxsCreateCommentDialog.h"
|
#include "GxsCreateCommentDialog.h"
|
||||||
#include "ui_GxsCreateCommentDialog.h"
|
#include "ui_GxsCreateCommentDialog.h"
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -35,6 +36,7 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentSer
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
|
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
|
||||||
|
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
/* fill in the available OwnIds for signing */
|
/* fill in the available OwnIds for signing */
|
||||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||||
|
@ -58,14 +60,17 @@ void GxsCreateCommentDialog::createComment()
|
||||||
|
|
||||||
|
|
||||||
RsGxsId authorId;
|
RsGxsId authorId;
|
||||||
if (ui->idChooser->getChosenId(authorId))
|
switch (ui->idChooser->getChosenId(authorId)) {
|
||||||
{
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
comment.mMeta.mAuthorId = authorId;
|
comment.mMeta.mAuthorId = authorId;
|
||||||
std::cerr << "AuthorId : " << comment.mMeta.mAuthorId << std::endl;
|
std::cerr << "AuthorId : " << comment.mMeta.mAuthorId << std::endl;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
|
||||||
else
|
break;
|
||||||
{
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
std::cerr << "GxsCreateCommentDialog::createComment() ERROR GETTING AuthorId!";
|
std::cerr << "GxsCreateCommentDialog::createComment() ERROR GETTING AuthorId!";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
@ -73,8 +78,9 @@ void GxsCreateCommentDialog::createComment()
|
||||||
tr("You need to create an Identity\n"
|
tr("You need to create an Identity\n"
|
||||||
"before you can comment"),
|
"before you can comment"),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
Q_UNUSED(ret)
|
||||||
return;
|
return;
|
||||||
}
|
}//switch (ui->idChooser->getChosenId(authorId))
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mCommentService->createComment(token, comment);
|
mCommentService->createComment(token, comment);
|
||||||
|
@ -82,6 +88,14 @@ void GxsCreateCommentDialog::createComment()
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsCreateCommentDialog::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui->idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
||||||
GxsCreateCommentDialog::~GxsCreateCommentDialog()
|
GxsCreateCommentDialog::~GxsCreateCommentDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void createComment();
|
void createComment();
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GxsCreateCommentDialog *ui;
|
Ui::GxsCreateCommentDialog *ui;
|
||||||
|
|
|
@ -27,10 +27,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="3">
|
<item row="1" column="0" colspan="6">
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="4">
|
|
||||||
<widget class="QTextEdit" name="commentTextEdit"/>
|
<widget class="QTextEdit" name="commentTextEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
|
@ -53,6 +50,41 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "GxsGroupDialog.h"
|
#include "GxsGroupDialog.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -85,6 +86,8 @@ void GxsGroupDialog::init()
|
||||||
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(cancelDialog()));
|
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(cancelDialog()));
|
||||||
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
||||||
|
|
||||||
|
connect( ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
connect( ui.groupLogo, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
connect( ui.groupLogo, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
||||||
connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
||||||
|
|
||||||
|
@ -173,6 +176,14 @@ void GxsGroupDialog::initMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsGroupDialog::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui.idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
||||||
void GxsGroupDialog::clearForm()
|
void GxsGroupDialog::clearForm()
|
||||||
{
|
{
|
||||||
ui.groupName->clear();
|
ui.groupName->clear();
|
||||||
|
@ -445,36 +456,44 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
|
||||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
switch (ui.idChooser->getChosenId(meta.mAuthorId)) {
|
||||||
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
|
break;
|
||||||
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}//switch (ui.idChooser->getChosenId(meta.mAuthorId))
|
||||||
|
|
||||||
QString name = misc::removeNewLine(ui.groupName->text());
|
QString name = misc::removeNewLine(ui.groupName->text());
|
||||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||||
|
|
||||||
if(name.isEmpty())
|
if(name.isEmpty()) {
|
||||||
{
|
|
||||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||||
std::cerr << " Invalid GroupName";
|
std::cerr << " Invalid GroupName";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}//if(name.isEmpty())
|
||||||
|
|
||||||
// Fill in the MetaData as best we can.
|
// Fill in the MetaData as best we can.
|
||||||
meta.mGroupName = std::string(name.toUtf8());
|
meta.mGroupName = std::string(name.toUtf8());
|
||||||
|
|
||||||
meta.mGroupFlags = flags;
|
meta.mGroupFlags = flags;
|
||||||
meta.mSignFlags = getGroupSignFlags();
|
meta.mSignFlags = getGroupSignFlags();
|
||||||
|
|
||||||
if (!setCircleParameters(meta))
|
if (!setCircleParameters(meta)){
|
||||||
{
|
|
||||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||||
std::cerr << " Invalid Circles";
|
std::cerr << " Invalid Circles";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}//if (!setCircleParameters(meta))
|
||||||
|
|
||||||
std::cerr << "void GxsGroupDialog::prepareGroupMetaData() meta.mCircleType: ";
|
std::cerr << "void GxsGroupDialog::prepareGroupMetaData() meta.mCircleType: ";
|
||||||
std::cerr << meta.mCircleType << " Internal: " << meta.mInternalCircle;
|
std::cerr << meta.mCircleType << " Internal: " << meta.mInternalCircle;
|
||||||
std::cerr << " External: " << meta.mCircleId;
|
std::cerr << " External: " << meta.mCircleId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
ui.idChooser->getChosenId(meta.mAuthorId);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ private:
|
||||||
void newGroup();
|
void newGroup();
|
||||||
void init();
|
void init();
|
||||||
void initMode();
|
void initMode();
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
// Functions that can be overloaded for specific stuff.
|
// Functions that can be overloaded for specific stuff.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>695</width>
|
<width>695</width>
|
||||||
<height>524</height>
|
<height>577</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -18,16 +18,7 @@
|
||||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -54,16 +45,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -127,16 +109,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -165,6 +138,38 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="pubKeyShare_cb">
|
<widget class="QCheckBox" name="pubKeyShare_cb">
|
||||||
|
@ -226,16 +231,7 @@
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<layout class="QGridLayout" name="_2">
|
<layout class="QGridLayout" name="_2">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -302,16 +298,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -354,16 +341,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -399,16 +377,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "GxsIdChooser.h"
|
#include "GxsIdChooser.h"
|
||||||
#include "GxsIdDetails.h"
|
#include "GxsIdDetails.h"
|
||||||
|
#include "RsGxsUpdateBroadcastBase.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
@ -35,12 +36,26 @@
|
||||||
#define MAX_TRY 10 // 5 seconds
|
#define MAX_TRY 10 // 5 seconds
|
||||||
|
|
||||||
#define ROLE_SORT Qt::UserRole + 1 // Qt::UserRole is reserved for data
|
#define ROLE_SORT Qt::UserRole + 1 // Qt::UserRole is reserved for data
|
||||||
|
#define ROLE_TYPE Qt::UserRole + 2 //
|
||||||
|
|
||||||
|
#define TYPE_NO_ID 1
|
||||||
|
#define TYPE_FOUND_ID 2
|
||||||
|
#define TYPE_UNKNOWN_ID 3
|
||||||
|
|
||||||
|
#define IDCHOOSER_REFRESH 1
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsIdChooser::GxsIdChooser(QWidget *parent)
|
GxsIdChooser::GxsIdChooser(QWidget *parent)
|
||||||
: QComboBox(parent), mFlags(IDCHOOSER_ANON_DEFAULT)
|
: QComboBox(parent), mFlags(IDCHOOSER_ANON_DEFAULT)
|
||||||
{
|
{
|
||||||
|
mBase = new RsGxsUpdateBroadcastBase(rsIdentity, this);
|
||||||
|
connect(mBase, SIGNAL(fillDisplay(bool)), this, SLOT(fillDisplay(bool)));
|
||||||
|
|
||||||
|
mIdQueue = NULL;
|
||||||
|
mFirstLoad=true;
|
||||||
|
|
||||||
mDefaultId.clear() ;
|
mDefaultId.clear() ;
|
||||||
|
mDefaultIdName.clear();
|
||||||
mTimer = NULL;
|
mTimer = NULL;
|
||||||
mTimerCount = 0;
|
mTimerCount = 0;
|
||||||
|
|
||||||
|
@ -51,47 +66,77 @@ GxsIdChooser::GxsIdChooser(QWidget *parent)
|
||||||
setModel(proxy);
|
setModel(proxy);
|
||||||
|
|
||||||
proxy->setSortRole(ROLE_SORT);
|
proxy->setSortRole(ROLE_SORT);
|
||||||
|
connect(this, SIGNAL(currentIndexChanged(int)),this,SLOT(myCurrentIndexChanged(int)));
|
||||||
|
|
||||||
|
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GxsIdChooser::~GxsIdChooser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::setUpdateWhenInvisible(bool update)
|
||||||
|
{
|
||||||
|
mBase->setUpdateWhenInvisible(update);
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::list<RsGxsGroupId> &GxsIdChooser::getGrpIds()
|
||||||
|
{
|
||||||
|
return mBase->getGrpIds();
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &GxsIdChooser::getMsgIds()
|
||||||
|
{
|
||||||
|
return mBase->getMsgIds();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::fillDisplay(bool complete)
|
||||||
|
{
|
||||||
|
updateDisplay(complete);
|
||||||
|
update(); // Qt flush
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
mBase->showEvent(event);
|
||||||
|
QComboBox::showEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GxsIdChooser::loadIds(uint32_t chooserFlags, RsGxsId defId)
|
void GxsIdChooser::loadIds(uint32_t chooserFlags, RsGxsId defId)
|
||||||
{
|
{
|
||||||
mFlags = chooserFlags;
|
mFlags = chooserFlags;
|
||||||
mDefaultId = defId;
|
mDefaultId = defId;
|
||||||
clear();
|
clear();
|
||||||
loadPrivateIds();
|
mFirstLoad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GxsIdChooser::MakeIdDesc(const RsGxsId &id, QString &desc)
|
bool GxsIdChooser::makeIdDesc(const RsGxsId &gxsId, QString &desc)
|
||||||
{
|
{
|
||||||
RsIdentityDetails details;
|
|
||||||
|
|
||||||
std::list<QIcon> icons;
|
std::list<QIcon> icons;
|
||||||
if (!GxsIdDetails::MakeIdDesc(id, false, desc, icons))
|
if (!GxsIdDetails::MakeIdDesc(gxsId, false, desc, icons)) {
|
||||||
{
|
if (mTimerCount > MAX_TRY) {
|
||||||
if (mTimerCount > MAX_TRY)
|
|
||||||
{
|
|
||||||
desc = QString("%1 ... [").arg(tr("Not found"));
|
desc = QString("%1 ... [").arg(tr("Not found"));
|
||||||
desc += QString::fromStdString(id.toStdString().substr(0,5));
|
desc += QString::fromStdString(gxsId.toStdString().substr(0,5));
|
||||||
desc += "...]";
|
desc += "...]";
|
||||||
}
|
}//if (mTimerCount > MAX_TRY)
|
||||||
return false;
|
return false;
|
||||||
}
|
}//if (!GxsIdDetails::MakeIdDesc(gxsId, false, desc, icons))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdChooser::addPrivateId(const RsGxsId &gxsId, bool replace)
|
void GxsIdChooser::addPrivateId(const RsGxsId &gxsId, bool replace)
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
bool found = MakeIdDesc(gxsId, str);
|
bool found = makeIdDesc(gxsId, str);
|
||||||
if (!found)
|
if (!found) {
|
||||||
{
|
|
||||||
/* Add to pending id's */
|
/* Add to pending id's */
|
||||||
mPendingId.push_back(gxsId);
|
mPendingId.push_back(gxsId);
|
||||||
if (replace && mTimerCount <= MAX_TRY) {
|
if (replace && mTimerCount <= MAX_TRY) {
|
||||||
/* Retry */
|
/* Retry */
|
||||||
return;
|
return;
|
||||||
}
|
}//if (replace && mTimerCount <= MAX_TRY)
|
||||||
}
|
}//if (!found)
|
||||||
|
|
||||||
QString id = QString::fromStdString(gxsId.toStdString());
|
QString id = QString::fromStdString(gxsId.toStdString());
|
||||||
|
|
||||||
|
@ -101,71 +146,97 @@ void GxsIdChooser::addPrivateId(const RsGxsId &gxsId, bool replace)
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
setItemText(index, str);
|
setItemText(index, str);
|
||||||
setItemData(index, QString("%1_%2").arg(found ? "1" : "2").arg(str), ROLE_SORT);
|
setItemData(index, QString("%1_%2").arg(found ? "1" : "2").arg(str), ROLE_SORT);
|
||||||
|
setItemData(index, found ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE);
|
||||||
model()->sort(0);
|
model()->sort(0);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}//if (index >= 0)
|
||||||
|
//If not found create a new item.
|
||||||
|
}//if (replace)
|
||||||
|
|
||||||
/* Add new item */
|
/* Add new item */
|
||||||
addItem(str, id);
|
addItem(str, id);
|
||||||
setItemData(count() - 1, QString("%1_%2").arg(found ? "1" : "2").arg(str), ROLE_SORT);
|
setItemData(count() - 1, QString("%1_%2").arg(found ? "1" : "2").arg(str), ROLE_SORT);
|
||||||
|
setItemData(count() - 1, found ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE);
|
||||||
model()->sort(0);
|
model()->sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdChooser::loadPrivateIds()
|
void GxsIdChooser::loadPrivateIds(uint32_t token)
|
||||||
{
|
{
|
||||||
mPendingId.clear();
|
mPendingId.clear();
|
||||||
|
if (mFirstLoad) { clear();}
|
||||||
mTimerCount = 0;
|
mTimerCount = 0;
|
||||||
if (mTimer) {
|
if (mTimer) {
|
||||||
delete(mTimer);
|
delete(mTimer);
|
||||||
}
|
}//if (mTimer)
|
||||||
|
|
||||||
std::list<RsGxsId> ids;
|
std::list<RsGxsId> ids;
|
||||||
rsIdentity->getOwnIds(ids);
|
//rsIdentity->getOwnIds(ids);
|
||||||
|
std::vector<RsGxsIdGroup> datavector;
|
||||||
if (ids.empty())
|
if (!rsIdentity->getGroupData(token, datavector)) {
|
||||||
{
|
std::cerr << "GxsIdChooser::loadPrivateIds() Error getting GroupData";
|
||||||
std::cerr << "GxsIdChooser::loadPrivateIds() ERROR no ids";
|
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}//if (!rsIdentity->getGroupData(token, datavector))
|
||||||
|
|
||||||
|
for (std::vector<RsGxsIdGroup>::iterator vit = datavector.begin();
|
||||||
|
vit != datavector.end(); ++vit) {
|
||||||
|
RsGxsIdGroup data = (*vit);
|
||||||
|
if (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) {
|
||||||
|
ids.push_back((RsGxsId) data.mMeta.mGroupId);
|
||||||
|
}//if (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||||
|
|
||||||
|
if (mDefaultIdName == data.mMeta.mGroupName) {
|
||||||
|
mDefaultId=(RsGxsId) data.mMeta.mGroupId;
|
||||||
|
}//if (mDefaultIdName == data.mMeta.mGroupName)
|
||||||
|
}//for (std::vector<RsGxsIdGroup>::iterator vit
|
||||||
|
|
||||||
//rsIdentity->getDefaultId(defId);
|
//rsIdentity->getDefaultId(defId);
|
||||||
// Prefer to use an application specific default???
|
// Prefer to use an application specific default???
|
||||||
int def = -1;
|
|
||||||
|
|
||||||
if (!(mFlags & IDCHOOSER_ID_REQUIRED))
|
if (mFirstLoad) {
|
||||||
{
|
if (!(mFlags & IDCHOOSER_ID_REQUIRED)) {
|
||||||
/* add No Signature option */
|
/* add No Signature option */
|
||||||
QString str = tr("No Signature");
|
QString str = tr("No Signature");
|
||||||
QString id = "";
|
QString id = "";
|
||||||
|
|
||||||
addItem(str, id);
|
addItem(str, id);
|
||||||
setItemData(count() - 1, QString("0_%2").arg(str), ROLE_SORT);
|
setItemData(count() - 1, QString("0_%2").arg(str), ROLE_SORT);
|
||||||
if (mFlags & IDCHOOSER_ANON_DEFAULT)
|
setItemData(count() - 1, TYPE_NO_ID, ROLE_TYPE);
|
||||||
{
|
}//if (!(mFlags & IDCHOOSER_ID_REQUIRED)
|
||||||
def = 0;
|
}//if (mFirstLoad)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int i = 1;
|
if (!mFirstLoad) {
|
||||||
std::list<RsGxsId>::iterator it;
|
for (int idx=0; idx < count(); idx++) {
|
||||||
for(it = ids.begin(); it != ids.end(); it++, i++)
|
QVariant type = itemData(idx,ROLE_TYPE);
|
||||||
{
|
switch (type.toInt()) {
|
||||||
|
case TYPE_NO_ID:
|
||||||
|
break;
|
||||||
|
case TYPE_FOUND_ID:
|
||||||
|
case TYPE_UNKNOWN_ID:
|
||||||
|
default: {
|
||||||
|
QVariant var = itemData(idx);
|
||||||
|
RsGxsId gxsId = RsGxsId(var.toString().toStdString());
|
||||||
|
std::list<RsGxsId>::iterator lit = std::find( ids.begin(), ids.end(), gxsId);
|
||||||
|
if (lit == ids.end()) {
|
||||||
|
removeItem(idx);
|
||||||
|
idx--;
|
||||||
|
}//if (lit == ids.end())
|
||||||
|
}//default:
|
||||||
|
}//switch (type.toInt())
|
||||||
|
}//for (int idx=0; idx < count(); idx++)
|
||||||
|
}//if (!mFirstLoad)
|
||||||
|
|
||||||
|
if (ids.empty()) {
|
||||||
|
std::cerr << "GxsIdChooser::loadPrivateIds() ERROR no ids";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
mFirstLoad = false;
|
||||||
|
return;
|
||||||
|
}//if (ids.empty())
|
||||||
|
|
||||||
|
for(std::list<RsGxsId>::iterator it = ids.begin(); it != ids.end(); it++) {
|
||||||
/* add to Chooser */
|
/* add to Chooser */
|
||||||
addPrivateId(*it, false);
|
addPrivateId(*it, !mFirstLoad);
|
||||||
|
}//for(std::list<RsGxsId>::iterator it
|
||||||
if (mDefaultId == *it)
|
|
||||||
{
|
|
||||||
def = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (def >= 0)
|
|
||||||
{
|
|
||||||
setCurrentIndex(def);
|
|
||||||
//ui.comboBox->setCurrentIndex(def);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mPendingId.empty()) {
|
if (!mPendingId.empty()) {
|
||||||
/* Create and start timer to load pending id's */
|
/* Create and start timer to load pending id's */
|
||||||
|
@ -175,22 +246,76 @@ void GxsIdChooser::loadPrivateIds()
|
||||||
mTimer->setInterval(500);
|
mTimer->setInterval(500);
|
||||||
connect(mTimer, SIGNAL(timeout()), this, SLOT(timer()));
|
connect(mTimer, SIGNAL(timeout()), this, SLOT(timer()));
|
||||||
mTimer->start();
|
mTimer->start();
|
||||||
}
|
}//if (!mPendingId.empty())
|
||||||
|
|
||||||
|
setDefaultItem();
|
||||||
|
|
||||||
|
mFirstLoad=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GxsIdChooser::getChosenId(RsGxsId &id)
|
void GxsIdChooser::setDefaultItem()
|
||||||
{
|
{
|
||||||
if (count() < 1)
|
int def = -1;
|
||||||
|
|
||||||
|
if ((mFlags & IDCHOOSER_ANON_DEFAULT) && !(mFlags & IDCHOOSER_ID_REQUIRED)) {
|
||||||
|
def = findData(TYPE_NO_ID, ROLE_TYPE);
|
||||||
|
} else {
|
||||||
|
QString id = QString::fromStdString(mDefaultId.toStdString());
|
||||||
|
def = findData(id);
|
||||||
|
}//if ((mFlags & IDCHOOSER_ANON_DEFAULT)
|
||||||
|
|
||||||
|
if (def >= 0) {
|
||||||
|
setCurrentIndex(def);
|
||||||
|
}//if (def >= 0)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GxsIdChooser::setChosenId(RsGxsId &gxsId)
|
||||||
{
|
{
|
||||||
|
QString id = QString::fromStdString(gxsId.toStdString());
|
||||||
|
|
||||||
|
/* Find text of exisiting item */
|
||||||
|
int index = findData(id);
|
||||||
|
if (index >= 0) {
|
||||||
|
setCurrentIndex(index);
|
||||||
|
return true;
|
||||||
|
}//if (index >= 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GxsIdChooser::ChosenId_Ret GxsIdChooser::getChosenId(RsGxsId &gxsId)
|
||||||
|
{
|
||||||
|
if (count() < 1) {
|
||||||
|
return None;
|
||||||
|
}//if (count() < 1)
|
||||||
|
|
||||||
int idx = currentIndex();
|
int idx = currentIndex();
|
||||||
|
|
||||||
QVariant var = itemData(idx);
|
QVariant var = itemData(idx);
|
||||||
id = RsGxsId(var.toString().toStdString());
|
gxsId = RsGxsId(var.toString().toStdString());
|
||||||
|
QVariant type = itemData(idx,ROLE_TYPE);
|
||||||
|
switch (type.toInt()) {
|
||||||
|
case TYPE_NO_ID:
|
||||||
|
return NoId;
|
||||||
|
case TYPE_FOUND_ID:
|
||||||
|
return KnowId;
|
||||||
|
case TYPE_UNKNOWN_ID:
|
||||||
|
return UnKnowId;
|
||||||
|
}//switch (type.toInt())
|
||||||
|
|
||||||
return true;
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::myCurrentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
Q_UNUSED(index)
|
||||||
|
QFontMetrics fm = QFontMetrics(font());
|
||||||
|
QString text = currentText();
|
||||||
|
if (width()<fm.boundingRect(text).width()) {
|
||||||
|
setToolTip(text);
|
||||||
|
} else {
|
||||||
|
setToolTip("");
|
||||||
|
}//if (width()<fm.boundingRect(text).width())
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdChooser::timer()
|
void GxsIdChooser::timer()
|
||||||
|
@ -206,22 +331,67 @@ void GxsIdChooser::timer()
|
||||||
pendingId.pop_front();
|
pendingId.pop_front();
|
||||||
|
|
||||||
addPrivateId(id, true);
|
addPrivateId(id, true);
|
||||||
}
|
}//while (!pendingId.empty())
|
||||||
|
|
||||||
|
setDefaultItem();
|
||||||
|
|
||||||
if (mPendingId.empty()) {
|
if (mPendingId.empty()) {
|
||||||
/* All pending id's processed */
|
/* All pending id's processed */
|
||||||
delete(mTimer);
|
delete(mTimer);
|
||||||
mTimer = NULL;
|
mTimer = NULL;
|
||||||
mTimerCount = 0;
|
mTimerCount = 0;
|
||||||
} else {
|
} else {//if (mPendingId.empty())
|
||||||
if (mTimerCount <= MAX_TRY) {
|
if (mTimerCount <= MAX_TRY) {
|
||||||
/* Restart timer */
|
/* Restart timer */
|
||||||
mTimer->start();
|
mTimer->start();
|
||||||
} else {
|
} else {//if (mTimerCount <= MAX_TRY)
|
||||||
delete(mTimer);
|
delete(mTimer);
|
||||||
mTimer = NULL;
|
mTimer = NULL;
|
||||||
mTimerCount = 0;
|
mTimerCount = 0;
|
||||||
mPendingId.clear();
|
mPendingId.clear();
|
||||||
|
}//if (mTimerCount <= MAX_TRY)
|
||||||
|
}//if (mPendingId.empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::updateDisplay(bool complete)
|
||||||
|
{
|
||||||
|
Q_UNUSED(complete)
|
||||||
|
/* Update identity list */
|
||||||
|
requestIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::requestIdList()
|
||||||
|
{
|
||||||
|
if (!mIdQueue) return;
|
||||||
|
|
||||||
|
mIdQueue->cancelActiveRequestTokens(IDCHOOSER_REFRESH);
|
||||||
|
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
|
|
||||||
|
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, IDCHOOSER_REFRESH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
|
{
|
||||||
|
Q_UNUSED(queue)
|
||||||
|
std::cerr << "IdDialog::loadRequest() UserType: " << req.mUserType;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
switch(req.mUserType) {
|
||||||
|
case IDCHOOSER_REFRESH:
|
||||||
|
insertIdList(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "IdDialog::loadRequest() ERROR";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}//switch(req.mUserType)
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::insertIdList(uint32_t token)
|
||||||
|
{
|
||||||
|
loadPrivateIds(token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,36 +26,73 @@
|
||||||
#define _GXS_ID_CHOOSER_H
|
#define _GXS_ID_CHOOSER_H
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include "util/TokenQueue.h"
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
|
#include <retroshare/rsgxsifacetypes.h>
|
||||||
|
|
||||||
|
// This class implement a basic RS functionality which is that ComboBox displaying Id
|
||||||
|
// should update regularly. They also should update only when visible, to save CPU time.
|
||||||
|
//
|
||||||
|
|
||||||
|
class RsGxsIfaceHelper;
|
||||||
|
class RsGxsUpdateBroadcastBase;
|
||||||
|
|
||||||
#define IDCHOOSER_ID_REQUIRED 0x0001
|
#define IDCHOOSER_ID_REQUIRED 0x0001
|
||||||
#define IDCHOOSER_ANON_DEFAULT 0x0002
|
#define IDCHOOSER_ANON_DEFAULT 0x0002
|
||||||
|
|
||||||
class GxsIdChooser : public QComboBox
|
class GxsIdChooser : public QComboBox, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
GxsIdChooser(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
||||||
GxsIdChooser(QWidget *parent = NULL);
|
GxsIdChooser(QWidget *parent = NULL);
|
||||||
|
virtual ~GxsIdChooser();
|
||||||
|
|
||||||
|
void setUpdateWhenInvisible(bool update);
|
||||||
|
const std::list<RsGxsGroupId> &getGrpIds();
|
||||||
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
||||||
|
|
||||||
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);//TokenResponse
|
||||||
|
|
||||||
|
enum ChosenId_Ret {None, KnowId, UnKnowId, NoId} ;
|
||||||
void loadIds(uint32_t chooserFlags, RsGxsId defId);
|
void loadIds(uint32_t chooserFlags, RsGxsId defId);
|
||||||
bool setChosenId(RsGxsId &id);
|
void setDefaultId(RsGxsId defId) {mDefaultId=defId;}
|
||||||
bool getChosenId(RsGxsId &id);
|
void setDefaultId(std::string defIdName) {mDefaultIdName=defIdName;}
|
||||||
|
|
||||||
|
bool setChosenId(RsGxsId &gxsId);
|
||||||
|
ChosenId_Ret getChosenId(RsGxsId &gxsId);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
virtual void updateDisplay(bool complete);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void fillDisplay(bool complete);
|
||||||
void timer();
|
void timer();
|
||||||
|
void myCurrentIndexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadPrivateIds();
|
void requestIdList() ;
|
||||||
|
void loadPrivateIds(uint32_t token);
|
||||||
void addPrivateId(const RsGxsId &gxsId, bool replace);
|
void addPrivateId(const RsGxsId &gxsId, bool replace);
|
||||||
bool MakeIdDesc(const RsGxsId &id, QString &desc);
|
bool makeIdDesc(const RsGxsId &gxsId, QString &desc);
|
||||||
|
void insertIdList(uint32_t token);
|
||||||
|
void setDefaultItem();
|
||||||
|
|
||||||
uint32_t mFlags;
|
uint32_t mFlags;
|
||||||
RsGxsId mDefaultId;
|
RsGxsId mDefaultId;
|
||||||
|
std::string mDefaultIdName;
|
||||||
|
bool mFirstLoad;
|
||||||
|
QPushButton* addNewCxsId;
|
||||||
|
|
||||||
QList<RsGxsId> mPendingId;
|
QList<RsGxsId> mPendingId;
|
||||||
QTimer *mTimer;
|
QTimer *mTimer;
|
||||||
unsigned int mTimerCount;
|
unsigned int mTimerCount;
|
||||||
|
|
||||||
|
TokenQueue *mIdQueue;
|
||||||
|
RsGxsUpdateBroadcastBase *mBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@ class RsGxsUpdateBroadcastBase : public QObject
|
||||||
{
|
{
|
||||||
friend class RsGxsUpdateBroadcastPage;
|
friend class RsGxsUpdateBroadcastPage;
|
||||||
friend class RsGxsUpdateBroadcastWidget;
|
friend class RsGxsUpdateBroadcastWidget;
|
||||||
|
friend class GxsIdChooser;
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/common/Emoticons.h"
|
#include "gui/common/Emoticons.h"
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
|
#include "gui/Identity/IdDialog.h"
|
||||||
|
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
@ -89,6 +90,7 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
|
||||||
connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
|
connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
|
||||||
connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile()));
|
connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile()));
|
||||||
connect(ui.generateCheckBox, SIGNAL(toggled(bool)), ui.generateSpinBox, SLOT(setEnabled(bool)));
|
connect(ui.generateCheckBox, SIGNAL(toggled(bool)), ui.generateSpinBox, SLOT(setEnabled(bool)));
|
||||||
|
connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
ui.hashBox->setDropWidget(this);
|
ui.hashBox->setDropWidget(this);
|
||||||
|
@ -126,10 +128,9 @@ void CreateGxsForumMsg::newMsg()
|
||||||
mStateHelper->clear(CREATEGXSFORUMMSG_PARENTMSG);
|
mStateHelper->clear(CREATEGXSFORUMMSG_PARENTMSG);
|
||||||
ui.forumName->setText(tr("No Forum"));
|
ui.forumName->setText(tr("No Forum"));
|
||||||
return;
|
return;
|
||||||
}
|
}//if ( mForumId.isNull())
|
||||||
|
|
||||||
/* request Data */
|
{/* request Data */
|
||||||
{
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, true);
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, true);
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
|
@ -143,15 +144,12 @@ void CreateGxsForumMsg::newMsg()
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
|
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
|
||||||
}
|
}/* request Data */
|
||||||
|
|
||||||
if (mParentId.isNull())
|
if (mParentId.isNull()) {
|
||||||
{
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
||||||
mParentMsgLoaded = true;
|
mParentMsgLoaded = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, true);
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, true);
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
|
@ -166,7 +164,7 @@ void CreateGxsForumMsg::newMsg()
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
|
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
|
||||||
}
|
}//if (mParentId.isNull())
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGxsForumMsg::loadFormInformation()
|
void CreateGxsForumMsg::loadFormInformation()
|
||||||
|
@ -261,21 +259,20 @@ void CreateGxsForumMsg::createMsg()
|
||||||
|
|
||||||
RsHtml::optimizeHtml(ui.forumMessage, desc);
|
RsHtml::optimizeHtml(ui.forumMessage, desc);
|
||||||
|
|
||||||
if(name.isEmpty())
|
if(name.isEmpty()) {
|
||||||
{ /* error message */
|
/* error message */
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return; //Don't add a empty Subject!!
|
return; //Don't add a empty Subject!!
|
||||||
}
|
}//if(name.isEmpty())
|
||||||
|
|
||||||
RsGxsForumMsg msg;
|
RsGxsForumMsg msg;
|
||||||
msg.mMeta.mGroupId = mForumId;
|
msg.mMeta.mGroupId = mForumId;
|
||||||
msg.mMeta.mParentId = mParentId;
|
msg.mMeta.mParentId = mParentId;
|
||||||
msg.mMeta.mMsgId.clear() ;
|
msg.mMeta.mMsgId.clear() ;
|
||||||
if (mParentMsgLoaded)
|
if (mParentMsgLoaded) {
|
||||||
{
|
|
||||||
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
||||||
}
|
}//if (mParentMsgLoaded)
|
||||||
|
|
||||||
msg.mMeta.mMsgName = std::string(name.toUtf8());
|
msg.mMeta.mMsgName = std::string(name.toUtf8());
|
||||||
msg.mMsg = std::string(desc.toUtf8());
|
msg.mMsg = std::string(desc.toUtf8());
|
||||||
|
@ -286,31 +283,31 @@ void CreateGxsForumMsg::createMsg()
|
||||||
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
|
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
|
||||||
return; /* do nothing */
|
return; /* do nothing */
|
||||||
|
|
||||||
if (ui.signBox->isChecked())
|
if (ui.signBox->isChecked()) {
|
||||||
{
|
|
||||||
RsGxsId authorId;
|
RsGxsId authorId;
|
||||||
if (ui.idChooser->getChosenId(authorId))
|
switch (ui.idChooser->getChosenId(authorId)) {
|
||||||
{
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId:
|
||||||
msg.mMeta.mAuthorId = authorId;
|
msg.mMeta.mAuthorId = authorId;
|
||||||
std::cerr << "CreateGxsForumMsg::createMsg() AuthorId: " << authorId;
|
std::cerr << "CreateGxsForumMsg::createMsg() AuthorId: " << authorId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
|
||||||
else
|
break;
|
||||||
{
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
default:
|
||||||
std::cerr << "CreateGxsForumMsg::createMsg() ERROR GETTING AuthorId!";
|
std::cerr << "CreateGxsForumMsg::createMsg() ERROR GETTING AuthorId!";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}//switch (ui.idChooser->getChosenId(authorId))
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "CreateGxsForumMsg::createMsg() No Signature (for now :)";
|
std::cerr << "CreateGxsForumMsg::createMsg() No Signature (for now :)";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id, it is required"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id, it is required"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}//if (ui.signBox->isChecked())
|
||||||
|
|
||||||
int generateCount = 0;
|
int generateCount = 0;
|
||||||
|
|
||||||
|
@ -319,8 +316,8 @@ void CreateGxsForumMsg::createMsg()
|
||||||
generateCount = ui.generateSpinBox->value();
|
generateCount = ui.generateSpinBox->value();
|
||||||
if (QMessageBox::question(this, "Generate mass data", QString("Do you really want to generate %1 messages ?").arg(generateCount), QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
|
if (QMessageBox::question(this, "Generate mass data", QString("Do you really want to generate %1 messages ?").arg(generateCount), QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
|
||||||
return;
|
return;
|
||||||
}
|
}//if (QMessageBox::question(this,
|
||||||
}
|
}//if (ui.generateCheckBox->isChecked())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
|
@ -331,15 +328,23 @@ void CreateGxsForumMsg::createMsg()
|
||||||
generateMsg.mMeta.mMsgName = QString("%1 %2").arg(QString::fromUtf8(msg.mMeta.mMsgName.c_str())).arg(count + 1, 3, 10, QChar('0')).toUtf8().constData();
|
generateMsg.mMeta.mMsgName = QString("%1 %2").arg(QString::fromUtf8(msg.mMeta.mMsgName.c_str())).arg(count + 1, 3, 10, QChar('0')).toUtf8().constData();
|
||||||
|
|
||||||
rsGxsForums->createMsg(token, generateMsg);
|
rsGxsForums->createMsg(token, generateMsg);
|
||||||
}
|
}//for (int count = 0
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
rsGxsForums->createMsg(token, msg);
|
rsGxsForums->createMsg(token, msg);
|
||||||
}
|
}//if (generateCount)
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateGxsForumMsg::createNewGxsId()
|
||||||
|
{
|
||||||
|
IdEditDialog dlg(this);
|
||||||
|
dlg.setupNewId(false);
|
||||||
|
dlg.exec();
|
||||||
|
ui.idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
|
}
|
||||||
|
|
||||||
void CreateGxsForumMsg::closeEvent (QCloseEvent * /*event*/)
|
void CreateGxsForumMsg::closeEvent (QCloseEvent * /*event*/)
|
||||||
{
|
{
|
||||||
Settings->saveWidgetInformation(this);
|
Settings->saveWidgetInformation(this);
|
||||||
|
|
|
@ -45,6 +45,7 @@ private slots:
|
||||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||||
/* actions to take.... */
|
/* actions to take.... */
|
||||||
void createMsg();
|
void createMsg();
|
||||||
|
void createNewGxsId();
|
||||||
|
|
||||||
void smileyWidgetForums();
|
void smileyWidgetForums();
|
||||||
void addSmileys();
|
void addSmileys();
|
||||||
|
|
|
@ -95,10 +95,7 @@
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Sunken</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="margin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="attachFileButton">
|
<widget class="QToolButton" name="attachFileButton">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
|
@ -172,7 +169,46 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_NewId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new Identity</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
|
@ -202,8 +238,8 @@
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"><br /></span></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue