added machinery to allow to set/get sync and store periods for GXS groups

This commit is contained in:
csoler 2016-12-05 22:14:48 +01:00
parent d2ef2248c6
commit 7afb91d1db
13 changed files with 188 additions and 34 deletions

View file

@ -64,8 +64,8 @@ QString PostedDialog::getHelpString() const
<p>Links can be commented by subscribed users. A promotion system also gives the opportunity to \
enlight important links.</p> \
<p>There is no restriction on which links are shared. Be careful when clicking on them.</p>\
<p>Posted links get deleted after %1 months.</p>\
").arg(QString::number(rsPosted->getStoragePeriod()));
<p>Posted links are kept for %1 days, and sync-ed over the last %2 days, unless you change this.</p>\
").arg(QString::number(rsPosted->getDefaultStoragePeriod()/86400)).arg(QString::number(rsPosted->getDefaultSyncPeriod()/86400));
return hlp_str ;
}

View file

@ -576,9 +576,6 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
meta.mGroupFlags = flags;
meta.mSignFlags = getGroupSignFlags();
meta.mGrpDistribution_MaxStorageAge = ui.keepLimit_SB->value() * 86400 ;
meta.mGrpDistribution_MaxRequestAge = ui.syncLimit_SB->value() * 86400 ;
if (!setCircleParameters(meta)){
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << " Invalid Circles";

View file

@ -285,15 +285,29 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Details"), this, SLOT(editGroupDetails()));
action->setEnabled (!mGroupId.isNull() && isAdmin);
QMenu *ctxMenu2 = contextMnu.addMenu(tr("Store posts for at most...")) ;
ctxMenu2->addAction(tr("5 days" ),this,SLOT(setStorePostDelay()))->setData(QVariant( 5 * 86400)) ;
ctxMenu2->addAction(tr("2 weeks" ),this,SLOT(setStorePostDelay()))->setData(QVariant( 15 * 86400)) ;
ctxMenu2->addAction(tr("1 month" ),this,SLOT(setStorePostDelay()))->setData(QVariant( 30 * 86400)) ;
ctxMenu2->addAction(tr("3 months"),this,SLOT(setStorePostDelay()))->setData(QVariant( 90 * 86400)) ;
ctxMenu2->addAction(tr("6 months"),this,SLOT(setStorePostDelay()))->setData(QVariant(180 * 86400)) ;
ctxMenu2->addAction(tr("1 year" ),this,SLOT(setStorePostDelay()))->setData(QVariant( 0 * 86400)) ;
ctxMenu2->addAction(tr("Indefinitely")) ;
ctxMenu2 = contextMnu.addMenu(tr("Synchronise posts of last...")) ;
ctxMenu2->addAction(tr("5 days" ),this,SLOT(setSyncPostDelay()))->setData(QVariant( 5 * 86400)) ;
ctxMenu2->addAction(tr("2 weeks" ),this,SLOT(setSyncPostDelay()))->setData(QVariant( 15 * 86400)) ;
ctxMenu2->addAction(tr("1 month" ),this,SLOT(setSyncPostDelay()))->setData(QVariant( 30 * 86400)) ;
ctxMenu2->addAction(tr("3 months"),this,SLOT(setSyncPostDelay()))->setData(QVariant( 90 * 86400)) ;
ctxMenu2->addAction(tr("6 months"),this,SLOT(setSyncPostDelay()))->setData(QVariant(180 * 86400)) ;
ctxMenu2->addAction(tr("1 year" ),this,SLOT(setSyncPostDelay()))->setData(QVariant( 0 * 86400)) ;
ctxMenu2->addAction(tr("Indefinitely")) ;
if (shareKeyType()) {
action = contextMnu.addAction(QIcon(IMAGE_SHARE), tr("Share publish permissions"), this, SLOT(sharePublishKey()));
action->setEnabled(!mGroupId.isNull() && isPublisher);
}
//if (!mGroupId.isNull() && isPublisher && !isAdmin) {
// contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights" ), this, SLOT(restoreGroupKeys()));
//}
if (getLinkType() != RetroShareLink::TYPE_UNKNOWN) {
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyGroupLink()));
action->setEnabled(!mGroupId.isNull());
@ -318,6 +332,41 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
contextMnu.exec(QCursor::pos());
}
void GxsGroupFrameDialog::setStorePostsDelay()
{
QAction *action = dynamic_cast<QAction*>(sender()) ;
if(!action || mGroupId.isNull())
{
std::cerr << "(EE) Cannot find action/group that called me! Group is " << mGroupId << ", action is " << (void*)action << " " << __PRETTY_FUNCTION__ << std::endl;
return;
}
uint32_t duration = action->data().toUInt() ;
std::cerr << "Data is " << duration << std::endl;
mInterface->setStoragePeriod(mGroupId,duration) ;
}
void GxsGroupFrameDialog::setSyncPostsDelay()
{
QAction *action = dynamic_cast<QAction*>(sender()) ;
if(!action || mGroupId.isNull())
{
std::cerr << "(EE) Cannot find action/group that called me! Group is " << mGroupId << ", action is " << (void*)action << " " << __PRETTY_FUNCTION__ << std::endl;
return;
}
uint32_t duration = action->data().toUInt() ;
std::cerr << "Data is " << duration << std::endl;
mInterface->setSyncPeriod(mGroupId,duration) ;
}
void GxsGroupFrameDialog::restoreGroupKeys(void)
{
QMessageBox::warning(this, "RetroShare", "ToDo");

View file

@ -99,6 +99,8 @@ private slots:
/** Create the context popup menu and it's submenus */
void groupTreeCustomPopupMenu(QPoint point);
void settingsChanged();
void setSyncPostsDelay();
void setStorePostsDelay();
void restoreGroupKeys();
void newGroup();

View file

@ -65,8 +65,8 @@ QString GxsChannelDialog::getHelpString() const
the posting rights or the reading rights with friend Retroshare nodes.</p>\
<p>Channels can be made anonymous, or attached to a Retroshare identity so that readers can contact you if needed.\
Enable \"Allow Comments\" if you want to let users comment on your posts.</p>\
<p>Channel posts get deleted after %1 months.</p>\
").arg(QString::number(rsGxsChannels->getStoragePeriod()));
<p>Channel posts are kept for %1 days, and sync-ed over the last %2 days, unless you change this.</p>\
").arg(QString::number(rsGxsChannels->getDefaultStoragePeriod()/86400)).arg(QString::number(rsGxsChannels->getDefaultSyncPeriod()/86400));
return hlp_str ;
}

View file

@ -54,16 +54,8 @@ QString GxsForumsDialog::getHelpString() const
<p>Retroshare Forums look like internet forums, but they work in a decentralized way</p> \
<p>You see forums your friends are subscribed to, and you forward subscribed forums to \
your friends. This automatically promotes interesting forums in the network.</p> \
<p>Forum messages get deleted after %1 months.</p>\
").arg(QString::number(rsGxsForums->getStoragePeriod()));
// not true anymore in v0.6
/*
<p>Forums are either Authenticated (<img src=\":/images/konv_message2.png\" width=\"12\"/>) \
or anonymous (<img src=\":/images/konversation.png\" width=\"12\"/>). The former \
class is more resistant to spamming because posts are \
cryptographically signed using a Retroshare pseudo-identity.</p>") ;
*/
<p>Forum messages are kept for %1 days and sync-ed over the last %2 days, unless you configure it otherwise.</p>\
").arg(QString::number(rsGxsForums->getDefaultStoragePeriod()/86400)).arg(QString::number(rsGxsForums->getDefaultSyncPeriod()/86400));
return hlp_str ;
}