mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
* Added retroshare interface.
* Updated RS_FORUM -> RS_DISTRIB flags * Improvements to Forum (mainly subscribe/unsubscribe). git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@595 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fe284b628a
commit
2c7df4aba1
@ -147,22 +147,22 @@ void ForumsDialog::forumListCustomPopupMenu( QPoint point )
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
QAction *subForumAct = new QAction(QIcon(IMAGE_MESSAGE), tr( "Subscribe to Forum" ), this );
|
||||
connect( subForumAct , SIGNAL( triggered() ), this, SLOT( newmessage() ) );
|
||||
connect( subForumAct , SIGNAL( triggered() ), this, SLOT( subscribeToForum() ) );
|
||||
|
||||
QAction *unsubForumAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Unsubscribe to Forum" ), this );
|
||||
connect( unsubForumAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
|
||||
connect( unsubForumAct , SIGNAL( triggered() ), this, SLOT( unsubscribeToForum() ) );
|
||||
|
||||
QAction *newForumAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "New Forum" ), this );
|
||||
connect( newForumAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
||||
connect( newForumAct , SIGNAL( triggered() ), this, SLOT( newforum() ) );
|
||||
|
||||
QAction *delForumAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Delete Forum" ), this );
|
||||
connect( delForumAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
||||
QAction *detailsForumAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Show Forum Details" ), this );
|
||||
connect( detailsForumAct , SIGNAL( triggered() ), this, SLOT( showForumDetails() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction( subForumAct );
|
||||
contextMnu.addAction( unsubForumAct );
|
||||
contextMnu.addAction( newForumAct );
|
||||
contextMnu.addAction( delForumAct );
|
||||
contextMnu.addAction( detailsForumAct );
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
|
||||
}
|
||||
@ -317,7 +317,7 @@ void ForumsDialog::insertForums()
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->forumFlags;
|
||||
|
||||
if (flags & RS_FORUM_ADMIN)
|
||||
if (flags & RS_DISTRIB_ADMIN)
|
||||
{
|
||||
/* own */
|
||||
|
||||
@ -350,7 +350,7 @@ void ForumsDialog::insertForums()
|
||||
item -> setText(4, QString::fromStdString(it->forumId));
|
||||
AdminList.append(item);
|
||||
}
|
||||
else if (flags & RS_FORUM_SUBSCRIBED)
|
||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
/* subscribed forum */
|
||||
|
||||
@ -411,11 +411,11 @@ void ForumsDialog::insertForums()
|
||||
/* ignore the ones we've done already */
|
||||
uint32_t flags = it->forumFlags;
|
||||
|
||||
if (flags & RS_FORUM_ADMIN)
|
||||
if (flags & RS_DISTRIB_ADMIN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (flags & RS_FORUM_SUBSCRIBED)
|
||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -773,6 +773,51 @@ void ForumsDialog::showthread()
|
||||
cfm->show();
|
||||
}
|
||||
|
||||
void ForumsDialog::subscribeToForum()
|
||||
{
|
||||
forumSubscribe(true);
|
||||
}
|
||||
|
||||
void ForumsDialog::unsubscribeToForum()
|
||||
{
|
||||
forumSubscribe(false);
|
||||
}
|
||||
|
||||
void ForumsDialog::forumSubscribe(bool subscribe)
|
||||
{
|
||||
QTreeWidgetItem *forumItem = ui.forumTreeWidget->currentItem();
|
||||
if ((!forumItem) || (forumItem->parent() == NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* store forumId */
|
||||
std::string fId = (forumItem->text(4)).toStdString();
|
||||
|
||||
rsForums->forumSubscribe(fId, subscribe);
|
||||
}
|
||||
|
||||
void ForumsDialog::showForumDetails()
|
||||
{
|
||||
#if 0
|
||||
static ForumDisplay *fui = new ForumDisplay();
|
||||
|
||||
if (mCurrForumId == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fui->showDetails(mCurrForumId);
|
||||
fui->show();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -68,8 +68,14 @@ void updateMessages ( QTreeWidgetItem * item, int column );
|
||||
void showthread();
|
||||
void createmessage();
|
||||
|
||||
void subscribeToForum();
|
||||
void unsubscribeToForum();
|
||||
|
||||
void showForumDetails();
|
||||
|
||||
private:
|
||||
|
||||
void forumSubscribe(bool subscribe);
|
||||
bool getCurrentMsg(std::string &cid, std::string &mid);
|
||||
|
||||
std::string mCurrForumId;
|
||||
|
@ -55,24 +55,24 @@ void CreateForum::createForum()
|
||||
|
||||
if (ui.forumTypePublic->isChecked())
|
||||
{
|
||||
flags |= RS_FORUM_PUBLIC;
|
||||
flags |= RS_DISTRIB_PUBLIC;
|
||||
}
|
||||
else if (ui.forumTypePrivate->isChecked())
|
||||
{
|
||||
flags |= RS_FORUM_PRIVATE;
|
||||
flags |= RS_DISTRIB_PRIVATE;
|
||||
}
|
||||
else if (ui.forumTypeEncrypted->isChecked())
|
||||
{
|
||||
flags |= RS_FORUM_ENCRYPTED;
|
||||
flags |= RS_DISTRIB_ENCRYPTED;
|
||||
}
|
||||
|
||||
if (ui.forumMsgAuth->isChecked())
|
||||
{
|
||||
flags |= RS_FORUM_MSG_AUTH;
|
||||
flags |= RS_DISTRIB_AUTHEN_REQ;
|
||||
}
|
||||
else if (ui.forumMsgAnon->isChecked())
|
||||
{
|
||||
flags |= RS_FORUM_MSG_ANON;
|
||||
flags |= RS_DISTRIB_AUTHEN_ANON;
|
||||
}
|
||||
|
||||
rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags);
|
||||
|
46
retroshare-gui/src/rsiface/rsdistrib.h
Normal file
46
retroshare-gui/src/rsiface/rsdistrib.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef RS_DISTRIB_GUI_INTERFACE_H
|
||||
#define RS_DISTRIB_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rsdistrib.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* 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 as published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define RS_DISTRIB_PRIVACY_MASK 0x000f /* who can publish & view */
|
||||
#define RS_DISTRIB_AUTHEN_MASK 0x00f0 /* how to publish */
|
||||
#define RS_DISTRIB_LISTEN_MASK 0x0f00 /* distribution flags */
|
||||
|
||||
#define RS_DISTRIB_PUBLIC 0x0001 /* anyone can publish */
|
||||
#define RS_DISTRIB_PRIVATE 0x0002 /* anyone with key can publish */
|
||||
#define RS_DISTRIB_ENCRYPTED 0x0004 /* need publish key to view */
|
||||
|
||||
#define RS_DISTRIB_AUTHEN_REQ 0x0010 /* you must sign messages */
|
||||
#define RS_DISTRIB_AUTHEN_ANON 0x0020 /* you can send anonymous messages */
|
||||
|
||||
#define RS_DISTRIB_ADMIN 0x0100
|
||||
#define RS_DISTRIB_PUBLISH 0x0200
|
||||
#define RS_DISTRIB_SUBSCRIBED 0x0400
|
||||
|
||||
|
||||
#endif
|
@ -32,17 +32,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
|
||||
#define RS_FORUM_PUBLIC 0x0001 /* anyone can publish */
|
||||
#define RS_FORUM_PRIVATE 0x0002 /* anyone with key can publish */
|
||||
#define RS_FORUM_ENCRYPTED 0x0004 /* need admin key */
|
||||
|
||||
#define RS_FORUM_MSG_AUTH 0x0010 /* you must sign messages */
|
||||
#define RS_FORUM_MSG_ANON 0x0020 /* you can send anonymous messages */
|
||||
|
||||
#define RS_FORUM_ADMIN 0x0100 /* anyone can publish */
|
||||
#define RS_FORUM_SUBSCRIBED 0x0200 /* anyone can publish */
|
||||
|
||||
#include "rsiface/rsdistrib.h" /* For FLAGS */
|
||||
|
||||
class ForumInfo
|
||||
{
|
||||
@ -123,6 +113,7 @@ virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg
|
||||
|
||||
virtual bool ForumMessageSend(ForumMsgInfo &info) = 0;
|
||||
|
||||
virtual bool forumSubscribe(std::string fId, bool subscribe) = 0;
|
||||
/****************************************/
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user