2013-03-15 17:02:43 -04:00
/*
* Retroshare Gxs Support
2012-07-30 19:55:21 -04:00
*
2013-03-15 17:02:43 -04:00
* Copyright 2012 - 2013 by Robert Fernie .
2012-07-30 19:55:21 -04:00
*
2013-03-15 17:02:43 -04:00
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation .
2012-07-30 19:55:21 -04:00
*
2013-03-15 17:02:43 -04:00
* This library 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
* Library General Public License for more details .
2012-07-30 19:55:21 -04:00
*
2013-03-15 17:02:43 -04:00
* You should have received a copy of the GNU Library General Public
* License along with this library ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307
* USA .
*
* Please report all bugs and problems to " retroshare@lunamutt.com " .
*
*/
2012-07-30 19:55:21 -04:00
# include <QMessageBox>
# include "util/misc.h"
2014-12-27 18:51:45 -05:00
# include "util/DateTime.h"
2012-07-30 19:55:21 -04:00
# include "GxsGroupDialog.h"
# include "gui/common/PeerDefs.h"
2013-02-28 16:58:38 -05:00
# include "retroshare/rsgxsflags.h"
2012-07-30 19:55:21 -04:00
# include <algorithm>
# include <retroshare/rspeers.h>
2012-12-15 18:11:11 -05:00
# include <retroshare/rsgxscircles.h>
2012-07-30 19:55:21 -04:00
# include <iostream>
2012-10-21 15:45:35 -04:00
// Control of Publish Signatures.
2015-10-23 22:53:00 -04:00
//
// These are now defined in rsgxsflags.h
//
// #define FLAG_GROUP_SIGN_PUBLISH_MASK 0x000000ff
// #define FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED 0x00000001
// #define FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED 0x00000002
// #define FLAG_GROUP_SIGN_PUBLISH_THREADHEAD 0x00000004
// #define FLAG_GROUP_SIGN_PUBLISH_NONEREQ 0x00000008
// // Author Signature.
//
// These are now defined in rsgxsflags.h
//
// #define FLAG_AUTHOR_AUTHENTICATION_MASK 0x0000ff00
// #define FLAG_AUTHOR_AUTHENTICATION_NONE 0x00000000
// #define FLAG_AUTHOR_AUTHENTICATION_GPG 0x00000100
// #define FLAG_AUTHOR_AUTHENTICATION_REQUIRED 0x00000200
// #define FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN 0x00000400
2012-10-21 15:45:35 -04:00
2014-07-24 19:26:04 -04:00
# define GXSGROUP_NEWGROUPID 1
# define GXSGROUP_LOADGROUP 2
# define GXSGROUP_INTERNAL_LOADGROUP 3
2012-07-30 19:55:21 -04:00
/** Constructor */
2014-01-28 02:57:58 -05:00
GxsGroupDialog : : GxsGroupDialog ( TokenQueue * tokenExternalQueue , uint32_t enableFlags , uint32_t defaultFlags , QWidget * parent )
2014-07-24 19:26:04 -04:00
: QDialog ( parent , Qt : : WindowSystemMenuHint | Qt : : WindowTitleHint | Qt : : WindowCloseButtonHint ) , mTokenService ( NULL ) , mExternalTokenQueue ( tokenExternalQueue ) , mInternalTokenQueue ( NULL ) , mGrpMeta ( ) , mMode ( MODE_CREATE ) , mEnabledFlags ( enableFlags ) , mReadonlyFlags ( 0 ) , mDefaultsFlags ( defaultFlags )
2012-07-30 19:55:21 -04:00
{
2012-12-15 18:11:11 -05:00
/* Invoke the Qt Designer generated object setup routine */
ui . setupUi ( this ) ;
2012-07-30 19:55:21 -04:00
2014-01-28 02:57:58 -05:00
mInternalTokenQueue = NULL ;
2012-12-15 18:11:11 -05:00
init ( ) ;
2012-11-28 17:27:19 -05:00
}
2014-01-28 02:57:58 -05:00
GxsGroupDialog : : GxsGroupDialog ( TokenQueue * tokenExternalQueue , RsTokenService * tokenService , Mode mode , RsGxsGroupId groupId , uint32_t enableFlags , uint32_t defaultFlags , QWidget * parent )
2014-07-24 19:26:04 -04:00
: QDialog ( parent , Qt : : WindowSystemMenuHint | Qt : : WindowTitleHint | Qt : : WindowCloseButtonHint ) , mTokenService ( NULL ) , mExternalTokenQueue ( tokenExternalQueue ) , mInternalTokenQueue ( NULL ) , mGrpMeta ( ) , mMode ( mode ) , mEnabledFlags ( enableFlags ) , mReadonlyFlags ( 0 ) , mDefaultsFlags ( defaultFlags )
2012-11-28 17:27:19 -05:00
{
/* Invoke the Qt Designer generated object setup routine */
ui . setupUi ( this ) ;
2014-01-28 02:57:58 -05:00
mTokenService = tokenService ;
mInternalTokenQueue = new TokenQueue ( tokenService , this ) ;
mGrpMeta . mGroupId = groupId ;
2012-11-28 17:27:19 -05:00
init ( ) ;
}
2014-10-12 06:46:09 -04:00
GxsGroupDialog : : ~ GxsGroupDialog ( )
{
if ( mInternalTokenQueue ) {
delete ( mInternalTokenQueue ) ;
}
}
2012-11-28 17:27:19 -05:00
void GxsGroupDialog : : init ( )
{
2012-12-15 18:11:11 -05:00
// connect up the buttons.
2014-07-24 19:26:04 -04:00
connect ( ui . buttonBox , SIGNAL ( accepted ( ) ) , this , SLOT ( submitGroup ( ) ) ) ;
connect ( ui . buttonBox , SIGNAL ( rejected ( ) ) , this , SLOT ( cancelDialog ( ) ) ) ;
connect ( ui . pubKeyShare_cb , SIGNAL ( clicked ( ) ) , this , SLOT ( setShareList ( ) ) ) ;
2012-12-15 18:11:11 -05:00
2014-07-24 19:26:04 -04:00
connect ( ui . groupLogo , SIGNAL ( clicked ( ) ) , this , SLOT ( addGroupLogo ( ) ) ) ;
connect ( ui . addLogoButton , SIGNAL ( clicked ( ) ) , this , SLOT ( addGroupLogo ( ) ) ) ;
2012-07-30 19:55:21 -04:00
2012-12-15 18:11:11 -05:00
ui . typePublic - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . distributionValueLabel - > setText ( tr ( " Public " ) ) ;
2012-12-15 18:11:11 -05:00
updateCircleOptions ( ) ;
2012-11-17 16:43:21 -05:00
2014-07-24 19:26:04 -04:00
connect ( ui . typePublic , SIGNAL ( clicked ( ) ) , this , SLOT ( updateCircleOptions ( ) ) ) ;
connect ( ui . typeGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( updateCircleOptions ( ) ) ) ;
connect ( ui . typeLocal , SIGNAL ( clicked ( ) ) , this , SLOT ( updateCircleOptions ( ) ) ) ;
2012-07-30 19:55:21 -04:00
2012-12-15 18:11:11 -05:00
if ( ! ui . pubKeyShare_cb - > isChecked ( ) )
{
ui . contactsdockWidget - > hide ( ) ;
this - > resize ( this - > size ( ) . width ( ) - ui . contactsdockWidget - > size ( ) . width ( ) , this - > size ( ) . height ( ) ) ;
}
2012-07-30 19:55:21 -04:00
2012-12-15 18:11:11 -05:00
/* initialize key share list */
ui . keyShareList - > setHeaderText ( tr ( " Contacts: " ) ) ;
ui . keyShareList - > setModus ( FriendSelectionWidget : : MODUS_CHECK ) ;
ui . keyShareList - > start ( ) ;
2012-07-30 19:55:21 -04:00
2012-12-15 18:11:11 -05:00
/* Setup Reasonable Defaults */
2012-07-30 19:55:21 -04:00
2014-07-24 19:26:04 -04:00
ui . idChooser - > loadIds ( 0 , RsGxsId ( ) ) ;
ui . circleComboBox - > loadCircles ( GXS_CIRCLE_CHOOSER_EXTERNAL , RsGxsCircleId ( ) ) ;
ui . localComboBox - > loadCircles ( GXS_CIRCLE_CHOOSER_PERSONAL , RsGxsCircleId ( ) ) ;
2014-12-30 16:35:34 -05:00
ui . groupDesc - > setPlaceholderText ( tr ( " Set a descriptive description here " ) ) ;
2012-12-15 18:11:11 -05:00
2015-10-24 00:22:55 -04:00
ui . personal_ifnopub - > hide ( ) ;
ui . personal_required - > hide ( ) ;
ui . personal_required - > setChecked ( true ) ; // this is always true
2012-12-15 18:11:11 -05:00
initMode ( ) ;
2012-07-30 19:55:21 -04:00
}
2014-07-24 19:26:04 -04:00
QIcon GxsGroupDialog : : serviceWindowIcon ( )
{
return qApp - > windowIcon ( ) ;
}
2012-11-21 13:55:52 -05:00
void GxsGroupDialog : : showEvent ( QShowEvent * )
{
2012-12-15 18:11:11 -05:00
ui . headerFrame - > setHeaderImage ( serviceImage ( ) ) ;
2014-07-24 19:26:04 -04:00
setWindowIcon ( serviceWindowIcon ( ) ) ;
2013-01-06 19:00:46 -05:00
2013-01-07 06:40:05 -05:00
initUi ( ) ;
}
2013-01-06 19:00:46 -05:00
2013-01-07 06:40:05 -05:00
void GxsGroupDialog : : setUiText ( UiType uiType , const QString & text )
{
switch ( uiType )
{
case UITYPE_SERVICE_HEADER :
setWindowTitle ( text ) ;
ui . headerFrame - > setHeaderText ( text ) ;
break ;
case UITYPE_KEY_SHARE_CHECKBOX :
ui . pubKeyShare_cb - > setText ( text ) ;
break ;
case UITYPE_CONTACTS_DOCK :
2013-01-06 19:00:46 -05:00
ui . contactsdockWidget - > setWindowTitle ( text ) ;
2013-01-07 06:40:05 -05:00
break ;
2014-04-14 18:36:10 -04:00
case UITYPE_BUTTONBOX_OK :
2014-01-11 17:02:05 -05:00
ui . buttonBox - > button ( QDialogButtonBox : : Ok ) - > setText ( text ) ;
break ;
2013-01-06 19:00:46 -05:00
}
2012-11-21 13:55:52 -05:00
}
2012-11-28 17:27:19 -05:00
void GxsGroupDialog : : initMode ( )
2012-07-30 19:55:21 -04:00
{
2014-01-28 02:57:58 -05:00
setAllReadonly ( ) ;
2012-12-15 18:11:11 -05:00
switch ( mode ( ) )
{
case MODE_CREATE :
{
2015-05-03 12:42:58 -04:00
ui . stackedWidget - > setCurrentIndex ( 0 ) ;
2012-12-15 18:11:11 -05:00
ui . buttonBox - > setStandardButtons ( QDialogButtonBox : : Ok | QDialogButtonBox : : Cancel ) ;
newGroup ( ) ;
}
break ;
case MODE_SHOW :
{
2014-12-27 18:51:45 -05:00
ui . stackedWidget - > setCurrentIndex ( 1 ) ;
2014-01-28 02:57:58 -05:00
mReadonlyFlags = 0xffffffff ; // Force all to readonly.
2012-12-15 18:11:11 -05:00
ui . buttonBox - > setStandardButtons ( QDialogButtonBox : : Close ) ;
2014-01-28 02:57:58 -05:00
requestGroup ( mGrpMeta . mGroupId ) ;
}
break ;
2014-04-14 18:36:10 -04:00
2014-01-28 02:57:58 -05:00
case MODE_EDIT :
{
2015-05-03 12:42:58 -04:00
ui . stackedWidget - > setCurrentIndex ( 0 ) ;
2014-01-28 02:57:58 -05:00
ui . buttonBox - > setStandardButtons ( QDialogButtonBox : : Ok | QDialogButtonBox : : Cancel ) ;
ui . buttonBox - > button ( QDialogButtonBox : : Ok ) - > setText ( tr ( " Submit Group Changes " ) ) ;
requestGroup ( mGrpMeta . mGroupId ) ;
2012-12-15 18:11:11 -05:00
}
break ;
}
2012-07-30 19:55:21 -04:00
}
void GxsGroupDialog : : clearForm ( )
{
ui . groupName - > clear ( ) ;
ui . groupDesc - > clear ( ) ;
ui . groupName - > setFocus ( ) ;
}
void GxsGroupDialog : : setupDefaults ( )
{
/* Enable / Show Parts based on Flags */
2012-12-15 18:11:11 -05:00
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_MASK )
{
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC )
{
ui . typePublic - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . distributionValueLabel - > setText ( tr ( " Public " ) ) ;
ui . distributionCircleComboBox - > setVisible ( false ) ;
2012-12-15 18:11:11 -05:00
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_GROUP )
{
ui . typeGroup - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . distributionValueLabel - > setText ( tr ( " Restricted to circle: " ) ) ;
ui . distributionCircleComboBox - > setVisible ( true ) ;
2012-12-15 18:11:11 -05:00
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_LOCAL )
{
ui . typeLocal - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . distributionValueLabel - > setText ( tr ( " Limited to your friends " ) ) ;
ui . distributionCircleComboBox - > setVisible ( false ) ;
2012-12-15 18:11:11 -05:00
}
else
{
// default
ui . typePublic - > setChecked ( true ) ;
}
}
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_MASK )
{
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED )
{
ui . publish_encrypt - > setChecked ( true ) ;
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED )
{
ui . publish_required - > setChecked ( true ) ;
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_THREADS )
{
ui . publish_threads - > setChecked ( true ) ;
}
else
{
// default
ui . publish_open - > setChecked ( true ) ;
}
}
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_MASK )
{
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_PGP )
{
ui . personal_pgp - > setChecked ( true ) ;
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED )
{
ui . personal_required - > setChecked ( true ) ;
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB )
{
ui . personal_ifnopub - > setChecked ( true ) ;
}
else
{
// default
ui . personal_ifnopub - > setChecked ( true ) ;
}
}
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_MASK )
{
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_YES )
{
ui . comments_allowed - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . commentsValueLabel - > setText ( tr ( " Allowed " ) ) ;
2012-12-15 18:11:11 -05:00
}
else if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_NO )
{
ui . comments_no - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . commentsValueLabel - > setText ( tr ( " Disallowed " ) ) ;
2012-12-15 18:11:11 -05:00
}
else
{
// default
ui . comments_no - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . commentsValueLabel - > setText ( tr ( " Allowed " ) ) ;
2012-12-15 18:11:11 -05:00
}
2015-10-25 19:28:13 -04:00
}
2015-10-29 22:58:21 -04:00
ui . antiSpam_trackMessages - > setChecked ( ( bool ) ( mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK ) ) ;
ui . antiSpam_signedIds - > setChecked ( ( bool ) ( mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP ) ) ;
2016-03-20 22:21:09 -04:00
QString antispam_string ;
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK ) antispam_string + = tr ( " Message tracking " ) ;
if ( mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP ) antispam_string + = ( antispam_string . isNull ( ) ? " " : " and " ) + tr ( " PGP signature required " ) ;
ui . antiSpamValueLabel - > setText ( antispam_string ) ;
2015-10-25 19:28:13 -04:00
2014-09-15 15:14:38 -04:00
# ifndef RS_USE_CIRCLES
ui . typeGroup - > setEnabled ( false ) ;
2014-12-27 18:51:45 -05:00
ui . typeGroup_3 - > setEnabled ( false ) ;
ui . typeLocal_3 - > setEnabled ( false ) ;
2014-09-15 15:14:38 -04:00
# endif
2016-03-24 19:46:08 -04:00
ui . typeLocal - > setEnabled ( false ) ; // for now, since local circles not fully tested.
ui . typeLocal - > setToolTip ( tr ( " This feature is not yet available, but it will be available very soon! " ) ) ; // for now, since local circles not fully tested.
2012-07-30 19:55:21 -04:00
}
void GxsGroupDialog : : setupVisibility ( )
{
2014-04-14 18:36:10 -04:00
ui . groupName - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_NAME ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . groupLogo - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_ICON ) ;
ui . addLogoButton - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_ICON ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . groupDesc - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . distribGroupBox - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION ) ;
2016-03-20 22:21:09 -04:00
ui . distributionLabel - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION ) ;
ui . distributionValueLabel - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION ) ;
2015-10-29 22:58:21 -04:00
ui . spamProtection_GB - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM ) ;
2016-03-20 22:21:09 -04:00
ui . antiSpamLabel - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM ) ;
ui . antiSpamValueLabel - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . publishGroupBox - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . pubKeyShare_cb - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_SHAREKEYS ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . personalGroupBox - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN ) ;
2012-12-15 18:11:11 -05:00
2014-04-14 18:36:10 -04:00
ui . commentGroupBox - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS ) ;
2016-03-20 22:21:09 -04:00
ui . commentsLabel - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS ) ;
ui . commentsValueLabel - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS ) ;
//ui.commentslabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS);
2012-07-30 19:55:21 -04:00
2014-04-14 18:36:10 -04:00
ui . extraFrame - > setVisible ( mEnabledFlags & GXS_GROUP_FLAGS_EXTRA ) ;
}
2012-07-30 19:55:21 -04:00
2014-01-28 02:57:58 -05:00
void GxsGroupDialog : : setAllReadonly ( )
{
uint32_t origReadonlyFlags = mReadonlyFlags ;
mReadonlyFlags = 0xffffffff ;
setupReadonly ( ) ;
mReadonlyFlags = origReadonlyFlags ;
}
void GxsGroupDialog : : setupReadonly ( )
{
2014-04-14 18:36:10 -04:00
ui . addLogoButton - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_ICON ) ) ;
2014-01-28 02:57:58 -05:00
2014-04-14 18:36:10 -04:00
ui . publishGroupBox - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN ) ) ;
2014-01-28 02:57:58 -05:00
2014-04-14 18:36:10 -04:00
ui . pubKeyShare_cb - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS ) ) ;
2014-01-28 02:57:58 -05:00
2014-04-14 18:36:10 -04:00
ui . personalGroupBox - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN ) ) ;
2014-12-27 18:51:45 -05:00
2014-04-14 18:36:10 -04:00
ui . idChooser - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN ) ) ;
2014-01-28 02:57:58 -05:00
2016-03-20 22:21:09 -04:00
//ui.distribGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
//ui.commentGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS));
2015-10-29 22:58:21 -04:00
ui . spamProtection_GB - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_ANTI_SPAM ) ) ;
2016-03-20 22:21:09 -04:00
//ui.spamProtection_GB_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ANTI_SPAM));
2014-01-28 02:57:58 -05:00
2014-04-14 18:36:10 -04:00
ui . extraFrame - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA ) ) ;
2014-09-15 15:14:38 -04:00
# ifndef UNFINISHED
ui . pubKeyShare_cb - > setEnabled ( false ) ;
# endif
2014-04-14 18:36:10 -04:00
}
2014-01-28 02:57:58 -05:00
2012-07-30 19:55:21 -04:00
void GxsGroupDialog : : newGroup ( )
{
2012-12-15 18:11:11 -05:00
setupDefaults ( ) ;
setupVisibility ( ) ;
2014-01-28 02:57:58 -05:00
setupReadonly ( ) ;
2012-12-15 18:11:11 -05:00
clearForm ( ) ;
2012-07-30 19:55:21 -04:00
}
2014-04-14 18:36:10 -04:00
void GxsGroupDialog : : updateFromExistingMeta ( const QString & description )
2014-01-28 02:57:58 -05:00
{
std : : cerr < < " void GxsGroupDialog::updateFromExistingMeta() " ;
std : : cerr < < std : : endl ;
std : : cerr < < " void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: " ;
std : : cerr < < mGrpMeta . mCircleType < < " Internal: " < < mGrpMeta . mInternalCircle ;
std : : cerr < < " External: " < < mGrpMeta . mCircleId ;
std : : cerr < < std : : endl ;
setupDefaults ( ) ;
setupVisibility ( ) ;
setupReadonly ( ) ;
2012-12-15 18:11:11 -05:00
clearForm ( ) ;
2015-10-29 22:58:21 -04:00
setGroupSignFlags ( mGrpMeta . mSignFlags ) ;
2012-07-30 19:55:21 -04:00
2014-01-28 02:57:58 -05:00
/* setup name */
ui . groupName - > setText ( QString : : fromUtf8 ( mGrpMeta . mGroupName . c_str ( ) ) ) ;
2014-12-27 18:51:45 -05:00
/* Show Mode */
ui . nameline - > setText ( QString : : fromUtf8 ( mGrpMeta . mGroupName . c_str ( ) ) ) ;
ui . popline - > setText ( QString : : number ( mGrpMeta . mPop ) ) ;
ui . postsline - > setText ( QString : : number ( mGrpMeta . mVisibleMsgCount ) ) ;
ui . lastpostline - > setText ( DateTime : : formatLongDateTime ( mGrpMeta . mLastPost ) ) ;
2015-05-03 03:58:04 -04:00
ui . authorLabel - > setId ( mGrpMeta . mAuthorId ) ;
2014-12-27 18:51:45 -05:00
ui . IDline - > setText ( QString : : fromStdString ( mGrpMeta . mGroupId . toStdString ( ) ) ) ;
ui . descriptiontextEdit - > setPlainText ( description ) ;
switch ( mode ( ) )
{
case MODE_CREATE : {
}
break ;
case MODE_SHOW : {
ui . headerFrame - > setHeaderText ( QString : : fromUtf8 ( mGrpMeta . mGroupName . c_str ( ) ) ) ;
2016-03-20 22:21:09 -04:00
if ( ! mPicture . isNull ( ) )
ui . headerFrame - > setHeaderImage ( mPicture ) ;
2014-12-27 18:51:45 -05:00
}
break ;
case MODE_EDIT : {
}
break ;
}
2014-04-14 18:36:10 -04:00
/* set description */
ui . groupDesc - > setPlainText ( description ) ;
2016-03-20 22:21:09 -04:00
QString distribution_string = " [Unknown] " ;
2014-04-14 18:36:10 -04:00
2014-01-28 02:57:58 -05:00
switch ( mGrpMeta . mCircleType )
{
case GXS_CIRCLE_TYPE_YOUREYESONLY :
ui . typeLocal - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
distribution_string = tr ( " Your friends only " ) ;
2014-01-28 02:57:58 -05:00
ui . localComboBox - > loadCircles ( GXS_CIRCLE_CHOOSER_PERSONAL , mGrpMeta . mInternalCircle ) ;
2016-03-20 22:21:09 -04:00
ui . distributionCircleComboBox - > setVisible ( true ) ;
ui . distributionCircleComboBox - > loadCircles ( GXS_CIRCLE_CHOOSER_PERSONAL , mGrpMeta . mInternalCircle ) ;
2014-01-28 02:57:58 -05:00
break ;
case GXS_CIRCLE_TYPE_PUBLIC :
ui . typePublic - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
distribution_string = tr ( " Public " ) ;
ui . distributionCircleComboBox - > setVisible ( false ) ;
2014-01-28 02:57:58 -05:00
break ;
case GXS_CIRCLE_TYPE_EXTERNAL :
ui . typeGroup - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
distribution_string = tr ( " Restricted to circle: " ) ;
ui . distributionCircleComboBox - > setVisible ( true ) ;
ui . distributionCircleComboBox - > loadCircles ( GXS_CIRCLE_CHOOSER_EXTERNAL , mGrpMeta . mCircleId ) ;
2014-01-28 02:57:58 -05:00
ui . circleComboBox - > loadCircles ( GXS_CIRCLE_CHOOSER_EXTERNAL , mGrpMeta . mCircleId ) ;
break ;
default :
std : : cerr < < " CreateCircleDialog::updateCircleGUI() INVALID mCircleType " ;
std : : cerr < < std : : endl ;
break ;
}
2016-03-20 22:21:09 -04:00
ui . distributionValueLabel - > setText ( distribution_string ) ;
2014-04-14 18:36:10 -04:00
ui . idChooser - > loadIds ( 0 , mGrpMeta . mAuthorId ) ;
2016-04-03 17:11:13 -04:00
if ( ! mGrpMeta . mAuthorId . isNull ( ) )
ui . idChooser - > setChosenId ( mGrpMeta . mAuthorId ) ;
2014-01-28 02:57:58 -05:00
updateCircleOptions ( ) ;
2012-07-30 19:55:21 -04:00
}
void GxsGroupDialog : : submitGroup ( )
{
2012-12-15 18:11:11 -05:00
std : : cerr < < " GxsGroupDialog::submitGroup() " ;
std : : cerr < < std : : endl ;
/* switch depending on mode */
switch ( mode ( ) )
{
case MODE_CREATE :
{
/* just close if down */
createGroup ( ) ;
}
break ;
case MODE_SHOW :
{
/* just close if down */
cancelDialog ( ) ;
}
break ;
case MODE_EDIT :
{
2014-01-28 02:57:58 -05:00
editGroup ( ) ;
2012-12-15 18:11:11 -05:00
}
break ;
}
2012-07-30 19:55:21 -04:00
}
2014-01-20 02:29:54 -05:00
void GxsGroupDialog : : editGroup ( )
{
2014-02-09 05:43:59 -05:00
std : : cerr < < " GxsGroupDialog::editGroup() " < < std : : endl ;
2014-01-20 02:29:54 -05:00
2014-02-09 05:43:59 -05:00
RsGroupMetaData newMeta ;
newMeta . mGroupId = mGrpMeta . mGroupId ;
2014-01-20 02:29:54 -05:00
2014-02-09 05:43:59 -05:00
if ( ! prepareGroupMetaData ( newMeta ) )
{
/* error message */
QMessageBox : : warning ( this , " RetroShare " , tr ( " Failed to Prepare Group MetaData - please Review " ) , QMessageBox : : Ok , QMessageBox : : Ok ) ;
return ; //Don't add a empty name!!
}
std : : cerr < < " GxsGroupDialog::editGroup() calling service_EditGroup " ;
std : : cerr < < std : : endl ;
2014-01-20 02:29:54 -05:00
2014-02-09 05:43:59 -05:00
uint32_t token ;
2014-02-19 06:11:06 -05:00
if ( service_EditGroup ( token , newMeta ) )
2014-02-09 05:43:59 -05:00
{
// get the Queue to handle response.
if ( mExternalTokenQueue ! = NULL )
mExternalTokenQueue - > queueRequest ( token , TOKENREQ_GROUPINFO , RS_TOKREQ_ANSTYPE_ACK , GXSGROUP_NEWGROUPID ) ;
}
else
{
std : : cerr < < " GxsGroupDialog::editGroup() ERROR " ;
std : : cerr < < std : : endl ;
}
2014-01-20 02:29:54 -05:00
2014-02-09 05:43:59 -05:00
close ( ) ;
2013-10-05 07:36:31 -04:00
}
2014-02-09 05:43:59 -05:00
bool GxsGroupDialog : : prepareGroupMetaData ( RsGroupMetaData & meta )
{
std : : cerr < < " GxsGroupDialog::prepareGroupMetaData() " ;
2012-12-15 18:11:11 -05:00
std : : cerr < < std : : endl ;
2015-03-18 09:36:38 -04:00
// 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 ) ;
2014-07-06 07:19:58 -04:00
2014-07-26 18:29:53 -04:00
QString name = getName ( ) ;
2013-02-28 16:58:38 -05:00
uint32_t flags = GXS_SERV : : FLAG_PRIVACY_PUBLIC ;
2012-12-15 18:11:11 -05:00
2014-07-06 07:19:58 -04:00
if ( name . isEmpty ( ) ) {
2014-02-09 05:43:59 -05:00
std : : cerr < < " GxsGroupDialog::prepareGroupMetaData() " ;
std : : cerr < < " Invalid GroupName " ;
std : : cerr < < std : : endl ;
return false ;
2016-04-03 17:11:13 -04:00
}
2014-07-06 07:19:58 -04:00
2012-12-15 18:11:11 -05:00
// Fill in the MetaData as best we can.
meta . mGroupName = std : : string ( name . toUtf8 ( ) ) ;
meta . mGroupFlags = flags ;
meta . mSignFlags = getGroupSignFlags ( ) ;
2014-07-06 07:19:58 -04:00
if ( ! setCircleParameters ( meta ) ) {
2014-02-09 05:43:59 -05:00
std : : cerr < < " GxsGroupDialog::prepareGroupMetaData() " ;
std : : cerr < < " Invalid Circles " ;
std : : cerr < < std : : endl ;
return false ;
2016-04-03 17:11:13 -04:00
}
2013-06-04 17:00:43 -04:00
2014-02-09 05:43:59 -05:00
std : : cerr < < " void GxsGroupDialog::prepareGroupMetaData() meta.mCircleType: " ;
2014-01-28 02:57:58 -05:00
std : : cerr < < meta . mCircleType < < " Internal: " < < meta . mInternalCircle ;
std : : cerr < < " External: " < < meta . mCircleId ;
std : : cerr < < std : : endl ;
2013-06-04 17:00:43 -04:00
2014-02-09 05:43:59 -05:00
return true ;
}
2014-07-24 19:26:04 -04:00
2014-02-09 05:43:59 -05:00
void GxsGroupDialog : : createGroup ( )
{
std : : cerr < < " GxsGroupDialog::createGroup() " ;
std : : cerr < < std : : endl ;
2014-07-26 18:29:53 -04:00
/* Check name */
QString name = getName ( ) ;
2014-02-09 05:43:59 -05:00
if ( name . isEmpty ( ) )
{
2014-04-14 18:36:10 -04:00
/* error message */
QMessageBox : : warning ( this , " RetroShare " , tr ( " Please add a Name " ) , QMessageBox : : Ok , QMessageBox : : Ok ) ;
return ; //Don't add a empty name!!
2014-02-09 05:43:59 -05:00
}
uint32_t token ;
RsGroupMetaData meta ;
if ( ! prepareGroupMetaData ( meta ) )
{
/* error message */
QMessageBox : : warning ( this , " RetroShare " , tr ( " Failed to Prepare Group MetaData - please Review " ) , QMessageBox : : Ok , QMessageBox : : Ok ) ;
return ; //Don't add with invalid circle.
}
2012-12-15 18:11:11 -05:00
if ( service_CreateGroup ( token , meta ) )
{
// get the Queue to handle response.
2014-01-28 02:57:58 -05:00
if ( mExternalTokenQueue ! = NULL )
mExternalTokenQueue - > queueRequest ( token , TOKENREQ_GROUPINFO , RS_TOKREQ_ANSTYPE_ACK , GXSGROUP_NEWGROUPID ) ;
2012-12-15 18:11:11 -05:00
}
2013-03-08 14:55:59 -05:00
2012-12-15 18:11:11 -05:00
close ( ) ;
2012-07-30 19:55:21 -04:00
}
uint32_t GxsGroupDialog : : getGroupSignFlags ( )
{
2012-12-15 18:11:11 -05:00
/* grab from the ui options -> */
uint32_t signFlags = 0 ;
if ( ui . publish_encrypt - > isChecked ( ) ) {
2015-10-23 22:53:00 -04:00
signFlags | = GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED ;
2012-12-15 18:11:11 -05:00
} else if ( ui . publish_required - > isChecked ( ) ) {
2015-10-23 22:53:00 -04:00
signFlags | = GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED ;
2012-12-15 18:11:11 -05:00
} else if ( ui . publish_threads - > isChecked ( ) ) {
2015-10-23 22:53:00 -04:00
signFlags | = GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_THREADHEAD ;
2012-12-15 18:11:11 -05:00
} else { // publish_open (default).
2015-10-23 22:53:00 -04:00
signFlags | = GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_NONEREQ ;
2012-12-15 18:11:11 -05:00
}
2012-07-30 19:55:21 -04:00
2015-10-24 00:22:55 -04:00
if ( ui . personal_required - > isChecked ( ) )
2015-10-23 22:53:00 -04:00
signFlags | = GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_REQUIRED ;
2015-10-24 00:22:55 -04:00
if ( ui . personal_ifnopub - > isChecked ( ) )
2015-10-23 22:53:00 -04:00
signFlags | = GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN ;
2015-10-24 00:22:55 -04:00
2015-10-25 19:28:13 -04:00
// Author Signature.
2015-10-29 22:58:21 -04:00
if ( ui . antiSpam_signedIds - > isChecked ( ) )
2015-10-25 19:28:13 -04:00
signFlags | = GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_GPG ;
2015-10-29 22:58:21 -04:00
if ( ui . antiSpam_trackMessages - > isChecked ( ) )
2015-10-25 19:28:13 -04:00
signFlags | = GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES ;
2012-12-15 18:11:11 -05:00
return signFlags ;
2012-07-30 19:55:21 -04:00
}
void GxsGroupDialog : : setGroupSignFlags ( uint32_t signFlags )
{
2015-10-23 22:53:00 -04:00
if ( signFlags & GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED ) {
2012-12-15 18:11:11 -05:00
ui . publish_encrypt - > setChecked ( true ) ;
2015-10-23 22:53:00 -04:00
} else if ( signFlags & GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED ) {
2012-12-15 18:11:11 -05:00
ui . publish_required - > setChecked ( true ) ;
2015-10-23 22:53:00 -04:00
} else if ( signFlags & GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_THREADHEAD ) {
2012-12-15 18:11:11 -05:00
ui . publish_threads - > setChecked ( true ) ;
2015-10-23 22:53:00 -04:00
} else if ( signFlags & GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_NONEREQ ) {
2012-12-15 18:11:11 -05:00
ui . publish_open - > setChecked ( true ) ;
}
2015-10-24 00:22:55 -04:00
if ( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_REQUIRED )
2012-12-15 18:11:11 -05:00
ui . personal_required - > setChecked ( true ) ;
2015-10-24 00:22:55 -04:00
if ( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN )
2012-12-15 18:11:11 -05:00
ui . personal_ifnopub - > setChecked ( true ) ;
2015-10-24 00:22:55 -04:00
2015-10-29 22:58:21 -04:00
ui . antiSpam_trackMessages - > setChecked ( ( bool ) ( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES ) ) ;
ui . antiSpam_signedIds - > setChecked ( ( bool ) ( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_GPG ) ) ;
2016-03-20 22:21:09 -04:00
QString antispam_string ;
if ( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES ) antispam_string + = tr ( " Message tracking " ) ;
if ( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_GPG ) antispam_string + = ( antispam_string . isNull ( ) ? " " : " and " ) + tr ( " PGP signature required " ) ;
ui . antiSpamValueLabel - > setText ( antispam_string ) ;
//ui.antiSpam_trackMessages_2->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
//ui.antiSpam_signedIds_2 ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
2015-10-29 22:58:21 -04:00
//ui.SignEdIds->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
//ui.trackmessagesradioButton->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
2015-10-25 19:28:13 -04:00
2012-12-15 18:11:11 -05:00
/* guess at comments */
2015-10-23 22:53:00 -04:00
if ( ( signFlags & GXS_SERV : : FLAG_GROUP_SIGN_PUBLISH_THREADHEAD ) & &
( signFlags & GXS_SERV : : FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN ) )
2012-12-15 18:11:11 -05:00
{
2016-03-20 22:21:09 -04:00
// (cyril) very weird piece of code. Need to clear this up.
2012-12-15 18:11:11 -05:00
ui . comments_allowed - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . commentsValueLabel - > setText ( " Allowed " ) ;
2012-12-15 18:11:11 -05:00
}
else
{
ui . comments_no - > setChecked ( true ) ;
2016-03-20 22:21:09 -04:00
ui . commentsValueLabel - > setText ( " Allowed " ) ;
2012-12-15 18:11:11 -05:00
}
2012-07-30 19:55:21 -04:00
}
2012-12-15 18:11:11 -05:00
/**** Above logic is flawed, and will be removed shortly
*
*
* * * */
void GxsGroupDialog : : updateCircleOptions ( )
{
if ( ui . typeGroup - > isChecked ( ) )
{
2014-01-28 02:57:58 -05:00
ui . circleComboBox - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION ) ) ;
2012-12-15 18:11:11 -05:00
ui . circleComboBox - > setVisible ( true ) ;
}
else
{
ui . circleComboBox - > setEnabled ( false ) ;
ui . circleComboBox - > setVisible ( false ) ;
}
if ( ui . typeLocal - > isChecked ( ) )
{
2014-02-05 02:08:29 -05:00
ui . localComboBox - > setEnabled ( ! ( mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION ) ) ;
2012-12-15 18:11:11 -05:00
ui . localComboBox - > setVisible ( true ) ;
}
else
{
ui . localComboBox - > setEnabled ( false ) ;
ui . localComboBox - > setVisible ( false ) ;
}
}
2013-06-04 17:00:43 -04:00
bool GxsGroupDialog : : setCircleParameters ( RsGroupMetaData & meta )
2012-12-15 18:11:11 -05:00
{
2013-06-04 17:00:43 -04:00
meta . mCircleType = GXS_CIRCLE_TYPE_PUBLIC ;
meta . mCircleId . clear ( ) ;
meta . mOriginator . clear ( ) ;
meta . mInternalCircle . clear ( ) ;
2012-12-15 18:11:11 -05:00
if ( ui . typePublic - > isChecked ( ) )
{
meta . mCircleType = GXS_CIRCLE_TYPE_PUBLIC ;
meta . mCircleId . clear ( ) ;
}
else if ( ui . typeGroup - > isChecked ( ) )
{
meta . mCircleType = GXS_CIRCLE_TYPE_EXTERNAL ;
if ( ! ui . circleComboBox - > getChosenCircle ( meta . mCircleId ) )
{
2013-06-04 17:00:43 -04:00
return false ;
2012-12-15 18:11:11 -05:00
}
}
2013-06-04 17:00:43 -04:00
else if ( ui . typeLocal - > isChecked ( ) )
2012-12-15 18:11:11 -05:00
{
meta . mCircleType = GXS_CIRCLE_TYPE_YOUREYESONLY ;
meta . mCircleId . clear ( ) ;
meta . mOriginator . clear ( ) ;
2014-04-20 12:34:26 -04:00
meta . mInternalCircle . clear ( ) ;
2012-12-15 18:11:11 -05:00
2013-06-04 17:00:43 -04:00
if ( ! ui . localComboBox - > getChosenCircle ( meta . mInternalCircle ) )
{
return false ;
}
2012-12-15 18:11:11 -05:00
}
else
{
2013-06-04 17:00:43 -04:00
return false ;
2012-12-15 18:11:11 -05:00
}
2013-06-04 17:00:43 -04:00
return true ;
2012-12-15 18:11:11 -05:00
}
2012-07-30 19:55:21 -04:00
void GxsGroupDialog : : cancelDialog ( )
{
std : : cerr < < " GxsGroupDialog::cancelDialog() Should Close! " ;
std : : cerr < < std : : endl ;
close ( ) ;
}
void GxsGroupDialog : : addGroupLogo ( )
{
QPixmap img = misc : : getOpenThumbnailedPicture ( this , tr ( " Load Group Logo " ) , 64 , 64 ) ;
if ( img . isNull ( ) )
return ;
2014-07-26 18:29:53 -04:00
setLogo ( img ) ;
2012-07-30 19:55:21 -04:00
}
2012-11-11 18:45:22 -05:00
QPixmap GxsGroupDialog : : getLogo ( )
{
2014-07-26 18:29:53 -04:00
return mPicture ;
}
void GxsGroupDialog : : setLogo ( const QPixmap & pixmap )
{
mPicture = pixmap ;
// to show the selected
ui . groupLogo - > setPixmap ( mPicture ) ;
}
QString GxsGroupDialog : : getName ( )
{
return misc : : removeNewLine ( ui . groupName - > text ( ) ) ;
2012-11-11 18:45:22 -05:00
}
2012-07-30 19:55:21 -04:00
2012-11-11 18:45:22 -05:00
QString GxsGroupDialog : : getDescription ( )
{
2014-07-26 18:29:53 -04:00
return ui . groupDesc - > toPlainText ( ) ;
2012-11-11 18:45:22 -05:00
}
2012-07-30 19:55:21 -04:00
/***********************************************************************************
Share Lists .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2014-04-14 18:36:10 -04:00
void GxsGroupDialog : : sendShareList ( std : : string /*groupId*/ )
2012-07-30 19:55:21 -04:00
{
close ( ) ;
}
void GxsGroupDialog : : setShareList ( )
{
2014-07-26 18:29:53 -04:00
if ( ui . pubKeyShare_cb - > isChecked ( ) ) {
QMessageBox : : warning ( this , " " , " ToDo " ) ;
ui . pubKeyShare_cb - > setChecked ( false ) ;
2012-12-15 18:11:11 -05:00
}
2014-07-26 18:29:53 -04:00
// if (ui.pubKeyShare_cb->isChecked()){
// this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
// ui.contactsdockWidget->show();
// } else { // hide share widget
// ui.contactsdockWidget->hide();
// this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
// }
2012-07-30 19:55:21 -04:00
}
2014-01-28 02:57:58 -05:00
/***********************************************************************************
Loading Group .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void GxsGroupDialog : : requestGroup ( const RsGxsGroupId & groupId )
{
RsTokReqOptions opts ;
opts . mReqType = GXS_REQUEST_TYPE_GROUP_DATA ;
std : : list < RsGxsGroupId > groupIds ;
groupIds . push_back ( groupId ) ;
std : : cerr < < " GxsGroupDialog::requestGroup() Requesting Group Summary( " < < groupId < < " ) " ;
std : : cerr < < std : : endl ;
uint32_t token ;
mInternalTokenQueue - > requestGroupInfo ( token , RS_TOKREQ_ANSTYPE_DATA , opts , groupIds , GXSGROUP_INTERNAL_LOADGROUP ) ;
}
void GxsGroupDialog : : loadGroup ( uint32_t token )
{
std : : cerr < < " GxsGroupDialog::loadGroup( " < < token < < " ) " ;
std : : cerr < < std : : endl ;
2014-04-14 18:36:10 -04:00
QString description ;
if ( service_loadGroup ( token , mMode , mGrpMeta , description ) )
2014-01-28 02:57:58 -05:00
{
2014-04-14 18:36:10 -04:00
updateFromExistingMeta ( description ) ;
2014-01-28 02:57:58 -05:00
}
}
void GxsGroupDialog : : loadRequest ( const TokenQueue * queue , const TokenRequest & req )
{
std : : cerr < < " GxsGroupDialog::loadRequest() UserType: " < < req . mUserType ;
std : : cerr < < std : : endl ;
if ( queue = = mInternalTokenQueue )
{
/* now switch on req */
switch ( req . mUserType )
{
case GXSGROUP_INTERNAL_LOADGROUP :
loadGroup ( req . mToken ) ;
break ;
default :
std : : cerr < < " GxsGroupDialog::loadGroup() UNKNOWN UserType " ;
std : : cerr < < std : : endl ;
break ;
}
}
}