enforce AuthorID requirement for Albums

Improve GxsGroupDialog to support required AuthorID.
Remove unused AlbumCreateDialog
Update Defaults for PhotoShare
This commit is contained in:
drbob 2020-03-03 21:56:35 +11:00
parent 5ffa5aacd2
commit 70d1d65cbf
7 changed files with 32 additions and 830 deletions

View File

@ -1,204 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp *
* *
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <QBuffer>
#include "AlbumCreateDialog.h"
#include "ui_AlbumCreateDialog.h"
#include "util/misc.h"
#include "retroshare/rsgxsflags.h"
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhoto *rs_photo, QWidget *parent):
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo), mPhotoSelected(NULL)
{
ui->setupUi(this);
ui->headerFrame->setHeaderImage(QPixmap(":/images/album_create_64.png"));
ui->headerFrame->setHeaderText(tr("Create Album"));
#if QT_VERSION >= 0x040700
ui->lineEdit_Title_2->setPlaceholderText(tr("Untitle Album"));
ui->lineEdit_Caption_2->setPlaceholderText(tr("Say something about this album..."));
//ui->textEdit_Description->setPlaceholderText(tr("Say something about this album...")) ;
ui->lineEdit_Where->setPlaceholderText(tr("Where were these taken?"));
#endif
ui->backButton->hide();
connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum()));
connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail()));
connect(ui->addphotosButton, SIGNAL(clicked()),this, SLOT(changePage()));
connect(ui->backButton, SIGNAL(clicked()),this, SLOT(backPage()));
mPhotoDrop = ui->scrollAreaWidgetContents;
mPhotoDrop->setPhotoItemHolder(this);
}
AlbumCreateDialog::~AlbumCreateDialog()
{
delete ui;
}
#define PUBLIC_INDEX 0
#define RESTRICTED_INDEX 1
#define PRIVATE_INDEX 2
void AlbumCreateDialog::publishAlbum()
{
// get fields for album to publish, publish and then exit dialog
RsPhotoAlbum album;
album.mCaption = ui->lineEdit_Caption_2->text().toStdString();
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
album.mMeta.mGroupName = ui->lineEdit_Title_2->text().toStdString();
album.mDescription = ui->textEdit_Description->toPlainText().toStdString();
album.mWhere = ui->lineEdit_Where->text().toStdString();
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
getAlbumThumbnail(album.mThumbnail);
int currIndex = ui->privacyComboBox->currentIndex();
switch(currIndex)
{
case PUBLIC_INDEX:
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
break;
case RESTRICTED_INDEX:
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_RESTRICTED;
break;
case PRIVATE_INDEX:
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PRIVATE;
break;
}
uint32_t token;
mRsPhoto->submitAlbumDetails(token, album);
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
publishPhotos();
close();
}
void AlbumCreateDialog::publishPhotos()
{
// get fields for album to publish, publish and then exit dialog
RsPhotoAlbum album;
QSet<PhotoItem*> photos;
mPhotoDrop->getPhotos(photos);
QSetIterator<PhotoItem*> sit(photos);
while(sit.hasNext())
{
PhotoItem* item = sit.next();
uint32_t token;
RsPhotoPhoto photo = item->getPhotoDetails();
photo.mMeta.mGroupId = album.mMeta.mGroupId;
mRsPhoto->submitPhoto(token, photo);
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
}
bool AlbumCreateDialog::getAlbumThumbnail(RsGxsImage &image)
{
const QPixmap *tmppix = &mThumbNail;
QByteArray ba;
QBuffer buffer(&ba);
if(!tmppix->isNull())
{
// send chan image
buffer.open(QIODevice::WriteOnly);
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
image.copy((uint8_t *) ba.data(), ba.size());
return true;
}
image.clear();
return false;
}
void AlbumCreateDialog::addAlbumThumbnail()
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Album Thumbnail"), 128, 128);
if (img.isNull())
return;
mThumbNail = img;
// to show the selected
ui->AlbumThumbNail->setIcon(mThumbNail);
}
void AlbumCreateDialog::changePage()
{
int nextPage = ui->stackedWidget->currentIndex() + 1;
if (nextPage >= ui->stackedWidget->count())
nextPage = 0;
ui->stackedWidget->setCurrentIndex(nextPage);
ui->backButton->show();
ui->addphotosButton->hide();
}
void AlbumCreateDialog::backPage()
{
int nextPage = ui->stackedWidget->currentIndex() - 1;
if (nextPage >= ui->stackedWidget->count())
nextPage = 0;
ui->stackedWidget->setCurrentIndex(nextPage);
ui->backButton->hide();
ui->addphotosButton->show();
}
void AlbumCreateDialog::notifySelection(PhotoShareItem *selection)
{
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
if(mPhotoSelected == NULL)
{
return;
}
else
{
mPhotoSelected->setSelected(false);
mPhotoSelected = pItem;
}
mPhotoSelected->setSelected(true);
}

View File

@ -1,71 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h *
* *
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef ALBUMCREATEDIALOG_H
#define ALBUMCREATEDIALOG_H
#include <QDialog>
#include "util/TokenQueue.h"
#include "retroshare/rsphoto.h"
#include "retroshare/rsphoto.h"
#include "PhotoShareItemHolder.h"
#include "PhotoItem.h"
#include "PhotoDrop.h"
namespace Ui {
class AlbumCreateDialog;
}
class AlbumCreateDialog : public QDialog, public PhotoShareItemHolder
{
Q_OBJECT
public:
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhoto* rs_photo, QWidget *parent = 0);
~AlbumCreateDialog();
void notifySelection(PhotoShareItem* selection);
private slots:
void publishAlbum();
void publishPhotos();
void addAlbumThumbnail();
void changePage();
void backPage();
private:
bool getAlbumThumbnail(RsGxsImage &image);
private:
Ui::AlbumCreateDialog *ui;
TokenQueue* mPhotoQueue;
RsPhoto* mRsPhoto;
QPixmap mThumbNail;
PhotoDrop* mPhotoDrop;
PhotoItem* mPhotoSelected;
};
#endif // ALBUMCREATEDIALOG_H

View File

@ -1,539 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AlbumCreateDialog</class>
<widget class="QDialog" name="AlbumCreateDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>643</width>
<height>550</height>
</rect>
</property>
<property name="windowTitle">
<string>Create Album</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Album Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Title_2"/>
</item>
<item row="0" column="2" rowspan="2">
<widget class="QToolButton" name="AlbumThumbNail">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">
border: 2px solid white;
border-radius: 10px;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Photo_images.qrc">
<normaloff>:/images/album_64.png</normaloff>:/images/album_64.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Category:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox_Category_2">
<item>
<property name="text">
<string>Animals</string>
</property>
</item>
<item>
<property name="text">
<string>Family</string>
</property>
</item>
<item>
<property name="text">
<string>Friends</string>
</property>
</item>
<item>
<property name="text">
<string>Flowers</string>
</property>
</item>
<item>
<property name="text">
<string>Holiday</string>
</property>
</item>
<item>
<property name="text">
<string>Landscapes</string>
</property>
</item>
<item>
<property name="text">
<string>Pets</string>
</property>
</item>
<item>
<property name="text">
<string>Portraits</string>
</property>
</item>
<item>
<property name="text">
<string>Travel</string>
</property>
</item>
<item>
<property name="text">
<string>Work</string>
</property>
</item>
<item>
<property name="text">
<string>Random</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="captionLabel">
<property name="text">
<string>Caption:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_Caption_2"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Where:</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_Where"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Photographer:</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_Photographer"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item row="6" column="1" rowspan="2" colspan="2">
<widget class="QTextEdit" name="textEdit_Description"/>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Share Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Policy:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Quality:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Comments:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Identity:</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="privacyComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Public</string>
</property>
</item>
<item>
<property name="text">
<string>Restricted</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Resize Images (&lt; 1Mb)</string>
</property>
</item>
<item>
<property name="text">
<string>Resize Images (&lt; 10Mb)</string>
</property>
</item>
<item>
<property name="text">
<string>Send Original Images</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>No Comments Allowed</string>
</property>
</item>
<item>
<property name="text">
<string>Authenticated Comments</string>
</property>
</item>
<item>
<property name="text">
<string>Any Comments Allowed</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Publish with Identity</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>168</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,10">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt; Drag &amp;amp; Drop to insert pictures. Click on a picture to edit details below.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollAreaPhotos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="PhotoDrop" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>458</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QGridLayout" name="gridLayout_10"/>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="frame">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>9</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>419</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addphotosButton">
<property name="text">
<string>Add Photos</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="publishButton">
<property name="text">
<string>Publish Album</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>PhotoDrop</class>
<extends>QWidget</extends>
<header>gui/PhotoShare/PhotoDrop.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="Photo_images.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AlbumCreateDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>353</x>
<y>529</y>
</hint>
<hint type="destinationlabel">
<x>321</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -37,21 +37,26 @@ const uint32_t AlbumCreateEnabledFlags = (
GXS_GROUP_FLAGS_EXTRA |
0);
// Album Requirements:
// - All Photos require Publish signature (PUBLISH THREADS).
// - Comments are in the threads - so these need Author signatures.
// - Author signature required for all groups.
uint32_t AlbumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
//GXS_GROUP_DEFAULTS_DISTRIB_GROUP |
//GXS_GROUP_DEFAULTS_DISTRIB_LOCAL |
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
//GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
//GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
//GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED |
//GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED |
//GXS_GROUP_DEFAULTS_PERSONAL_GPG |
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
//GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
//GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
GXS_GROUP_DEFAULTS_PERSONAL_GROUP |
//GXS_GROUP_DEFAULTS_COMMENTS_YES |
GXS_GROUP_DEFAULTS_COMMENTS_NO |
GXS_GROUP_DEFAULTS_COMMENTS_YES |
//GXS_GROUP_DEFAULTS_COMMENTS_NO |
0);
uint32_t AlbumEditEnabledFlags = AlbumCreateEnabledFlags;

View File

@ -585,11 +585,11 @@ void GxsGroupDialog::editGroup()
RsGroupMetaData newMeta;
newMeta.mGroupId = mGrpMeta.mGroupId;
if(!prepareGroupMetaData(newMeta))
QString reason;
if(!prepareGroupMetaData(newMeta, reason))
{
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData: ") + reason, QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
@ -612,14 +612,22 @@ void GxsGroupDialog::editGroup()
close();
}
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta, QString &reason)
{
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << std::endl;
// here would be the place to check for empty author id
// but GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN is currently not used by any service
ui.idChooser->getChosenId(meta.mAuthorId);
if ((mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_GROUP) && (meta.mAuthorId.isNull())) {
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << " Group needs a Personal Signature";
std::cerr << std::endl;
reason = "Missing AuthorId";
return false;
}
QString name = getName();
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
@ -628,6 +636,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << " Invalid GroupName";
std::cerr << std::endl;
reason = "Missing GroupName";
return false;
}
@ -641,6 +650,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << " Invalid Circles";
std::cerr << std::endl;
reason = "Invalid Circle Parameters";
return false;
}
@ -668,10 +678,11 @@ void GxsGroupDialog::createGroup()
uint32_t token;
RsGroupMetaData meta;
if (!prepareGroupMetaData(meta))
QString reason;
if (!prepareGroupMetaData(meta, reason))
{
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData: ") + reason, QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add with invalid circle.
}

View File

@ -84,10 +84,13 @@ public:
#define GXS_GROUP_DEFAULTS_PERSONAL_PGP 0x00000100
#define GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED 0x00000200
#define GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB 0x00000400
// independent from other PERSONAL FLAGS. If Group requires a AuthorId.
#define GXS_GROUP_DEFAULTS_PERSONAL_GROUP 0x00000800
#define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000
#define GXS_GROUP_DEFAULTS_COMMENTS_NO 0x00002000
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP 0x00100000
#define GXS_GROUP_DEFAULTS_ANTISPAM_TRACK 0x00200000
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP_KNOWN 0x00400000
@ -271,7 +274,7 @@ private:
void loadGroup(uint32_t token);
void updateFromExistingMeta(const QString &description);
bool prepareGroupMetaData(RsGroupMetaData &meta);
bool prepareGroupMetaData(RsGroupMetaData &meta, QString &reason);
std::list<std::string> mShareList;
QPixmap mPicture;

View File

@ -1159,7 +1159,6 @@ gxsphotoshare {
gui/PhotoShare/PhotoDrop.h \
gui/PhotoShare/AlbumItem.h \
gui/PhotoShare/AlbumDialog.h \
gui/PhotoShare/AlbumCreateDialog.h \
gui/PhotoShare/PhotoItem.h \
gui/PhotoShare/PhotoShareItemHolder.h \
gui/PhotoShare/PhotoShare.h \
@ -1172,7 +1171,6 @@ gxsphotoshare {
gui/PhotoShare/PhotoDialog.ui \
gui/PhotoShare/AlbumItem.ui \
gui/PhotoShare/AlbumDialog.ui \
gui/PhotoShare/AlbumCreateDialog.ui \
gui/PhotoShare/PhotoShare.ui \
gui/PhotoShare/PhotoSlideShow.ui
@ -1184,7 +1182,6 @@ gxsphotoshare {
gui/PhotoShare/PhotoDrop.cpp \
gui/PhotoShare/AlbumItem.cpp \
gui/PhotoShare/AlbumDialog.cpp \
gui/PhotoShare/AlbumCreateDialog.cpp \
gui/PhotoShare/PhotoShareItemHolder.cpp \
gui/PhotoShare/PhotoShare.cpp \
gui/PhotoShare/PhotoSlideShow.cpp