* Added new Forums GUI to Unfinished Applications.

* added rsforums.h interface file.
 * at exit() we now call rsGlobalShutDown() to stop Upnp properly.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@494 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-04-09 12:57:26 +00:00
parent 94371600be
commit 9c015a22c2
8 changed files with 1912 additions and 13 deletions

View File

@ -64,6 +64,7 @@ HEADERS += rshare.h \
gui/PhotoDialog.h \
gui/PhotoShow.h \
gui/LinksDialog.h \
gui/ForumsDialog.h \
gui/NetworkView.h \
gui/MessengerWindow.h \
gui/PeersDialog.h \
@ -158,6 +159,7 @@ FORMS += gui/ChatDialog.ui \
gui/PhotoDialog.ui \
gui/PhotoShow.ui \
gui/LinksDialog.ui \
gui/ForumsDialog.ui \
gui/NetworkView.ui \
gui/MessengerWindow.ui \
gui/PeersDialog.ui \
@ -222,6 +224,7 @@ SOURCES += main.cpp \
gui/PhotoDialog.cpp \
gui/PhotoShow.cpp \
gui/LinksDialog.cpp \
gui/ForumsDialog.cpp \
gui/NetworkView.cpp \
gui/MessengerWindow.cpp \
gui/PeersDialog.cpp \

View File

@ -44,6 +44,7 @@
#include "GamesDialog.h"
#include "NetworkView.h"
#include "PhotoDialog.h"
#include "ForumsDialog.h"
#include "channels/channelsDialog.h"
/* for smplayer */
@ -105,9 +106,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
//NetworkView *networkView = NULL;
//ui.stackPages->add(networkView = new NetworkView(ui.stackPages),
// createPageAction(QIcon(IMAGE_NETWORK), tr("Network View"), grp));
ForumsDialog *forumsDialog = NULL;
ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_NETWORK), tr("Forums"), grp));
PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),

View File

@ -0,0 +1,834 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumsDialog.h"
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsforums.h"
#include <sstream>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QPixmap>
#include <QPrintDialog>
#include <QPrinter>
#include <QDateTime>
#include <QHeaderView>
/* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
#define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png"
/** Constructor */
ForumsDialog::ForumsDialog(QWidget *parent)
: MainPage(parent)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect( ui.forumTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
connect(ui.newForumButton, SIGNAL(clicked()), this, SLOT(newforum()));
#if 0
connect( ui.msgWidget, SIGNAL( itemClicked ( QTreeWidgetItem *, int) ), this, SLOT( updateMessages ( QTreeWidgetItem *, int) ) );
connect( ui.listWidget, SIGNAL( currentRowChanged ( int) ), this, SLOT( changeBox ( int) ) );
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
connect(ui.removemessageButton, SIGNAL(clicked()), this, SLOT(removemessage()));
//connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
//connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
//connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
mCurrCertId = "";
mCurrMsgId = "";
/* hide the Tree +/- */
ui.msgList->setRootIsDecorated( false );
ui.msgWidget->setRootIsDecorated( false );
/* Set header resize modes and initial section sizes */
QHeaderView * msgwheader = ui.msgWidget->header () ;
msgwheader->setResizeMode (0, QHeaderView::Custom);
msgwheader->setResizeMode (3, QHeaderView::Interactive);
msgwheader->resizeSection ( 0, 24 );
msgwheader->resizeSection ( 2, 250 );
msgwheader->resizeSection ( 3, 140 );
/* Set header resize modes and initial section sizes */
QHeaderView * msglheader = ui.msgList->header () ;
msglheader->setResizeMode (0, QHeaderView::Interactive);
msglheader->setResizeMode (1, QHeaderView::Interactive);
msglheader->setResizeMode (2, QHeaderView::Interactive);
msglheader->setResizeMode (3, QHeaderView::Interactive);
msglheader->resizeSection ( 0, 200 );
msglheader->resizeSection ( 1, 100 );
msglheader->resizeSection ( 2, 100 );
msglheader->resizeSection ( 3, 200 );
ui.newmessageButton->setIcon(QIcon(QString(":/images/folder-draft24-pressed.png")));
ui.replymessageButton->setIcon(QIcon(QString(":/images/replymail-pressed.png")));
ui.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png")));
ui.printbutton->setIcon(QIcon(QString(":/images/print24.png")));
/*Disabled Reply Button */
ui.replymessageButton->setEnabled(false);
QMenu * printmenu = new QMenu();
printmenu->addAction(ui.actionPrint);
printmenu->addAction(ui.actionPrintPreview);
ui.printbutton->setMenu(printmenu);
#endif
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void ForumsDialog::forumListCustomPopupMenu( QPoint point )
{
QMenu contextMnu( this );
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() ) );
QAction *unsubForumAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Unsubscribe to Forum" ), this );
connect( unsubForumAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
QAction *newForumAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "New Forum" ), this );
connect( newForumAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
QAction *delForumAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Delete Forum" ), this );
connect( delForumAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
contextMnu.clear();
contextMnu.addAction( subForumAct );
contextMnu.addAction( unsubForumAct );
contextMnu.addAction( newForumAct );
contextMnu.addAction( delForumAct );
contextMnu.exec( mevent->globalPos() );
}
void ForumsDialog::threadListCustomPopupMenu( QPoint point )
{
QMenu contextMnu( this );
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
QAction *replyAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Reply" ), this );
connect( replyAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
QAction *viewAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "View Post" ), this );
connect( viewAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
contextMnu.clear();
contextMnu.addAction( replyAct);
contextMnu.addAction( viewAct);
contextMnu.exec( mevent->globalPos() );
}
void ForumsDialog::newmessage()
{
#if 0
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
/* fill it in */
//std::cerr << "ForumsDialog::newmessage()" << std::endl;
nMsgDialog->newMsg();
nMsgDialog->show();
nMsgDialog->activateWindow();
#endif
/* window will destroy itself! */
}
void ForumsDialog::replytomessage()
{
/* put msg on msgBoard, and switch to it. */
}
void ForumsDialog::togglefileview()
{
#if 0
/* if msg header visible -> hide by changing splitter
* three widgets...
*/
QList<int> sizeList = ui.msgSplitter->sizes();
QList<int>::iterator it;
int listSize = 0;
int msgSize = 0;
int recommendSize = 0;
int i = 0;
for(it = sizeList.begin(); it != sizeList.end(); it++, i++)
{
if (i == 0)
{
listSize = (*it);
}
else if (i == 1)
{
msgSize = (*it);
}
else if (i == 2)
{
recommendSize = (*it);
}
}
int totalSize = listSize + msgSize + recommendSize;
bool toShrink = true;
if (recommendSize < (int) totalSize / 10)
{
toShrink = false;
}
QList<int> newSizeList;
if (toShrink)
{
newSizeList.push_back(listSize + recommendSize / 3);
newSizeList.push_back(msgSize + recommendSize * 2 / 3);
newSizeList.push_back(0);
}
else
{
/* no change */
int nlistSize = (totalSize * 2 / 3) * listSize / (listSize + msgSize);
int nMsgSize = (totalSize * 2 / 3) - listSize;
newSizeList.push_back(nlistSize);
newSizeList.push_back(nMsgSize);
newSizeList.push_back(totalSize * 1 / 3);
}
ui.msgSplitter->setSizes(newSizeList);
#endif
}
void ForumsDialog::changeBox( int newrow )
{
#if 0
//std::cerr << "ForumsDialog::changeBox()" << std::endl;
insertMessages();
insertMsgTxtAndFiles();
#endif
}
void ForumsDialog::insertForums()
{
std::list<ForumInfo> forumList;
std::list<ForumInfo>::iterator it;
if (!rsForums)
{
return;
}
rsForums->getForumList(forumList);
QList<QTreeWidgetItem *> AdminList;
QList<QTreeWidgetItem *> SubList;
QList<QTreeWidgetItem *> PopList;
QList<QTreeWidgetItem *> OtherList;
std::multimap<uint32_t, std::string> popMap;
for(it = forumList.begin(); it != forumList.end(); it++)
{
/* sort it into Publish (Own), Subscribed, Popular and Other */
uint32_t flags = it->forumFlags;
if (flags & RS_FORUM_ADMIN)
{
/* own */
/* Name,
* Type,
* Rank,
* LastPost
* ForumId,
*/
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, QString::fromStdWString(it->forumName));
/* (1) Popularity */
{
std::ostringstream out;
out << it->pop;
item -> setText(1, QString::fromStdString(out.str()));
}
item -> setText(2, QString::fromStdWString(it->forumName));
// Date
{
QDateTime qtime;
qtime.setTime_t(it->lastPost);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
item -> setText(3, timestamp);
}
// Id.
item -> setText(4, QString::fromStdString(it->forumId));
AdminList.append(item);
}
else if (flags & RS_FORUM_SUBSCRIBED)
{
/* subscribed forum */
/* Name,
* Type,
* Rank,
* LastPost
* ForumId,
*/
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, QString::fromStdWString(it->forumName));
/* (1) Popularity */
{
std::ostringstream out;
out << it->pop;
item -> setText(1, QString::fromStdString(out.str()));
}
item -> setText(2, QString::fromStdWString(it->forumName));
// Date
{
QDateTime qtime;
qtime.setTime_t(it->lastPost);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
item -> setText(3, timestamp);
}
// Id.
item -> setText(4, QString::fromStdString(it->forumId));
SubList.append(item);
}
else
{
/* rate the others by popularity */
popMap.insert(std::make_pair(it->pop, it->forumId));
}
}
/* iterate backwards through popMap - take the top 5 or 10% of list */
uint32_t popCount = 5;
if (popCount < popMap.size() / 10)
{
popCount = popMap.size() / 10;
}
uint32_t i = 0;
uint32_t popLimit = 0;
std::multimap<uint32_t, std::string>::reverse_iterator rit;
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++);
if (rit != popMap.rend())
{
popLimit = rit->first;
}
for(it = forumList.begin(); it != forumList.end(); it++)
{
/* ignore the ones we've done already */
uint32_t flags = it->forumFlags;
if (flags & RS_FORUM_ADMIN)
{
continue;
}
else if (flags & RS_FORUM_SUBSCRIBED)
{
continue;
}
else
{
/* Name,
* Type,
* Rank,
* LastPost
* ForumId,
*/
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, QString::fromStdWString(it->forumName));
/* (1) Popularity */
{
std::ostringstream out;
out << it->pop;
item -> setText(1, QString::fromStdString(out.str()));
}
item -> setText(2, QString::fromStdWString(it->forumName));
// Date
{
QDateTime qtime;
qtime.setTime_t(it->lastPost);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
item -> setText(3, timestamp);
}
// Id.
item -> setText(4, QString::fromStdString(it->forumId));
if (it->pop < popLimit)
{
OtherList.append(item);
}
else
{
PopList.append(item);
}
}
}
/* now we can add them in as a tree! */
QList<QTreeWidgetItem *> TopList;
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, tr("Your Forums"));
item -> addChildren(AdminList);
TopList.append(item);
item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, tr("Subscribed Forums"));
item -> addChildren(SubList);
TopList.append(item);
item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, tr("Popular Forums"));
item -> addChildren(PopList);
TopList.append(item);
item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, tr("Other Forums"));
item -> addChildren(OtherList);
TopList.append(item);
/* add the items in! */
ui.forumTreeWidget->clear();
ui.forumTreeWidget->insertTopLevelItems(0, TopList);
return;
}
void ForumsDialog::insertThreads()
{
#if 0
virtual bool getForumList(std::list<ForumInfo> &forumList) = 0;
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0;
std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
rsMsgs -> getMessageSummaries(msgList);
/* get a link to the table */
QTreeWidget *msgWidget = ui.msgWidget;
/* get the MsgId of the current one ... */
std::string cid;
std::string mid;
bool oldSelected = getCurrentMsg(cid, mid);
QTreeWidgetItem *newSelected = NULL;
/* remove old items ??? */
int listrow = ui.listWidget -> currentRow();
//std::cerr << "ForumsDialog::insertMessages()" << std::endl;
//std::cerr << "Current Row: " << listrow << std::endl;
/* check the mode we are in */
unsigned int msgbox = 0;
switch(listrow)
{
case 3:
msgbox = RS_MSG_SENTBOX;
break;
case 2:
msgbox = RS_MSG_DRAFTBOX;
break;
case 1:
msgbox = RS_MSG_OUTBOX;
break;
case 0:
default:
msgbox = RS_MSG_INBOX;
break;
}
QList<QTreeWidgetItem *> items;
for(it = msgList.begin(); it != msgList.end(); it++)
{
/* check the message flags, to decide which
* group it should go in...
*
* InBox
* OutBox
* Drafts
* Sent
*
* FLAGS = OUTGOING.
* -> Outbox/Drafts/Sent
* + SENT -> Sent
* + IN_PROGRESS -> Draft.
* + nuffing -> Outbox.
* FLAGS = INCOMING = (!OUTGOING)
* -> + NEW -> Bold.
*
*/
if ((it -> msgflags & RS_MSG_BOXMASK) != msgbox)
{
//std::cerr << "Msg from other box: " << it->msgflags;
//std::cerr << std::endl;
continue;
}
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
/* So Text should be:
* (1) Msg / Broadcast
* (1b) Person / Channel Name
* (2) Rank
* (3) Date
* (4) Title
* (5) Msg
* (6) File Count
* (7) File Total
*/
// Date First.... (for sorting)
{
QDateTime qtime;
qtime.setTime_t(it->ts);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
item -> setText(3, timestamp);
}
// From ....
{
item -> setText(1, QString::fromStdString(rsPeers->getPeerName(it->srcId)));
}
// Subject
item -> setText(2, QString::fromStdWString(it->title));
item -> setIcon(2, (QIcon(":/images/message-mail-read.png")));
// No of Files.
{
std::ostringstream out;
out << it -> count;
item -> setText(0, QString::fromStdString(out.str()));
}
item -> setText(4, QString::fromStdString(it->srcId));
item -> setText(5, QString::fromStdString(it->msgId));
if ((oldSelected) && (mid == it->msgId))
{
newSelected = item;
}
if (it -> msgflags & RS_MSG_NEW)
{
for(int i = 0; i < 10; i++)
{
QFont qf = item->font(i);
qf.setBold(true);
item->setFont(i, qf);
item -> setIcon(2, (QIcon(":/images/message-mail.png")));
//std::cerr << "Setting Item BOLD!" << std::endl;
}
}
/* add to the list */
items.append(item);
}
/* add the items in! */
msgWidget->clear();
msgWidget->insertTopLevelItems(0, items);
if (newSelected)
{
msgWidget->setCurrentItem(newSelected);
}
#endif
}
void ForumsDialog::updateMessages( QTreeWidgetItem * item, int column )
{
#if 0
//std::cerr << "ForumsDialog::insertMsgTxtAndFiles()" << std::endl;
insertMsgTxtAndFiles();
#endif
}
void ForumsDialog::insertPost()
{
#if 0
/* Locate the current Message */
QTreeWidget *msglist = ui.msgWidget;
std::cerr << "ForumsDialog::insertMsgTxtAndFiles()" << std::endl;
/* get its Ids */
std::string cid;
std::string mid;
QTreeWidgetItem *qtwi = msglist -> currentItem();
if (!qtwi)
{
/* blank it */
ui.dateText-> setText("");
ui.toText->setText("");
ui.fromText->setText("");
ui.filesText->setText("");
ui.subjectText->setText("");
//ui.msgText->setText("");
ui.msgList->clear();
return;
}
else
{
cid = qtwi -> text(4).toStdString();
mid = qtwi -> text(5).toStdString();
}
std::cerr << "ForumsDialog::insertMsgTxtAndFiles() mid:" << mid << std::endl;
/* Save the Data.... for later */
mCurrCertId = cid;
mCurrMsgId = mid;
MessageInfo msgInfo;
if (!rsMsgs -> getMessage(mid, msgInfo))
{
std::cerr << "ForumsDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
return;
}
const std::list<FileInfo> &recList = msgInfo.files;
std::list<FileInfo>::const_iterator it;
/* get a link to the table */
QTreeWidget *tree = ui.msgList;
/* get the MessageInfo */
tree->clear();
tree->setColumnCount(5);
QList<QTreeWidgetItem *> items;
for(it = recList.begin(); it != recList.end(); it++)
{
/* make a widget per person */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
/* (0) Filename */
item -> setText(0, QString::fromStdString(it->fname));
//std::cerr << "Msg FileItem(" << it->fname.length() << ") :" << it->fname << std::endl;
/* (1) Size */
{
std::ostringstream out;
out << it->size;
item -> setText(1, QString::fromStdString(out.str()));
}
/* (2) Rank */
{
std::ostringstream out;
out << it->rank;
item -> setText(2, QString::fromStdString(out.str()));
}
item -> setText(3, QString::fromStdString(it->hash));
/* add to the list */
items.append(item);
}
/* add the items in! */
tree->insertTopLevelItems(0, items);
/* iterate through the sources */
std::list<std::string>::const_iterator pit;
QString msgTxt;
for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++)
{
msgTxt += QString::fromStdString(*pit);
msgTxt += " <";
msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit));
msgTxt += ">, ";
}
if (msgInfo.msgcc.size() > 0)
msgTxt += "\nCc: ";
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
{
msgTxt += QString::fromStdString(*pit);
msgTxt += " <";
msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit));
msgTxt += ">, ";
}
if (msgInfo.msgbcc.size() > 0)
msgTxt += "\nBcc: ";
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
{
msgTxt += QString::fromStdString(*pit);
msgTxt += " <";
msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit));
msgTxt += ">, ";
}
{
QDateTime qtime;
qtime.setTime_t(msgInfo.ts);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
ui.dateText-> setText(timestamp);
}
ui.toText->setText(msgTxt);
ui.fromText->setText(QString::fromStdString(rsPeers->getPeerName(msgInfo.srcId)));
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
ui.msgText->setText(QString::fromStdWString(msgInfo.msg));
{
std::ostringstream out;
out << "(" << msgInfo.count << " Files)";
ui.filesText->setText(QString::fromStdString(out.str()));
}
std::cerr << "ForumsDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl;
/* finally mark message as read! */
rsMsgs -> MessageRead(mid);
#endif
}
bool ForumsDialog::getCurrentMsg(std::string &cid, std::string &mid)
{
#if 0
/* Locate the current Message */
QTreeWidget *msglist = ui.msgWidget;
//std::cerr << "ForumsDialog::getCurrentMsg()" << std::endl;
/* get its Ids */
QTreeWidgetItem *qtwi = msglist -> currentItem();
if (qtwi)
{
cid = qtwi -> text(4).toStdString();
mid = qtwi -> text(5).toStdString();
return true;
}
#endif
return false;
}
void ForumsDialog::removemessage()
{
#if 0
//std::cerr << "ForumsDialog::removemessage()" << std::endl;
std::string cid, mid;
if (!getCurrentMsg(cid, mid))
{
//std::cerr << "ForumsDialog::removemessage()";
//std::cerr << " No Message selected" << std::endl;
return;
}
rsMsgs -> MessageDelete(mid);
#endif
return;
}
void ForumsDialog::markMsgAsRead()
{
#if 0
//std::cerr << "ForumsDialog::markMsgAsRead()" << std::endl;
std::string cid, mid;
if (!getCurrentMsg(cid, mid))
{
//std::cerr << "ForumsDialog::markMsgAsRead()";
//std::cerr << " No Message selected" << std::endl;
return;
}
rsMsgs -> MessageRead(mid);
#endif
return;
}
void ForumsDialog::newforum()
{
insertForums();
}

View File

@ -0,0 +1,75 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _FORUMSDIALOG_H
#define _FORUMSDIALOG_H
#include "mainpage.h"
#include "ui_ForumsDialog.h"
class ForumsDialog : public MainPage
{
Q_OBJECT
public:
ForumsDialog(QWidget *parent = 0);
void insertForums();
void insertThreads();
void insertPost();
private slots:
/** Create the context popup menu and it's submenus */
void forumListCustomPopupMenu( QPoint point );
void threadListCustomPopupMenu( QPoint point );
void newforum();
void changeBox( int newrow );
void updateMessages ( QTreeWidgetItem * item, int column );
void newmessage();
void replytomessage();
//void print();
//void printpreview();
void removemessage();
void markMsgAsRead();
/* handle splitter */
void togglefileview();
private:
bool getCurrentMsg(std::string &cid, std::string &mid);
std::string mCurrForumId;
std::string mCurrThreadId;
std::string mCurrPostId;
/** Qt Designer generated object */
Ui::ForumsDialog ui;
};
#endif

View File

@ -0,0 +1,874 @@
<ui version="4.0" >
<class>ForumsDialog</class>
<widget class="QWidget" name="ForumsDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>673</width>
<height>430</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font" >
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::DefaultContextMenu</enum>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QSplitter" name="splitter_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="" >
<layout class="QVBoxLayout" >
<item>
<widget class="QTreeWidget" name="forumTreeWidget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
<column>
<property name="text" >
<string>Forum Name</string>
</property>
</column>
<column>
<property name="text" >
<string>Popularity</string>
</property>
</column>
<column>
<property name="text" >
<string>Posts</string>
</property>
</column>
<item>
<property name="text" >
<string>Subscribed Forums</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<item>
<property name="text" >
<string>RS Forums</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
</item>
</item>
<item>
<property name="text" >
<string>Popular Forums</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<item>
<property name="text" >
<string>Rs Forums</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
</item>
</item>
<item>
<property name="text" >
<string>Other Forums</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="newForumButton" >
<property name="text" >
<string>New Forum</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="" >
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_17" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Forum Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectText_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="threadTreeWidget" >
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
<column>
<property name="text" >
<string>Title</string>
</property>
</column>
<column>
<property name="text" >
<string>Date</string>
</property>
</column>
<column>
<property name="text" >
<string>Author</string>
</property>
</column>
<column>
<property name="text" >
<string>Signed</string>
</property>
</column>
<item>
<property name="text" >
<string>Thread 1</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<item>
<property name="text" >
<string>Thread 1 Post 2</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
</item>
<item>
<property name="text" >
<string>Thread 1 Post 3</string>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<property name="text" >
<string/>
</property>
</item>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:10pt; font-weight:600;">Forum Post&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="filesText_2" >
<property name="font" >
<font>
<pointsize>10</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="expandFilesButton_2" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2" >
<property name="text" >
<string>Prev</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/up.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton" >
<property name="text" >
<string>Next</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/start.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QTextBrowser" name="postText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
<action name="actionPrint" >
<property name="text" >
<string>Print</string>
</property>
</action>
<action name="actionPrintPreview" >
<property name="text" >
<string>PrintPreview</string>
</property>
</action>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -91,7 +91,6 @@
* #define RS_RELEASE_VERSION 1
****/
#define RS_RELEASE_VERSION 1
/** Constructor */
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
@ -510,14 +509,14 @@ void MainWindow::doQuit()
if (confirm->result() == QDialog::Accepted)
{
rsicontrol->ConfigFinalSave();
rsicontrol->rsGlobalShutDown();
qApp->quit();
} else {
delete confirm;
}
} else {
rsicontrol->ConfigFinalSave();
rsicontrol->rsGlobalShutDown();
qApp->quit();
}
}

View File

@ -193,13 +193,6 @@
<file>images/textedit/textcenter.png</file>
<file>images/textedit/textleft.png</file>
<file>images/textedit/textright.png</file>
<file>images/textedit/text_bold.png</file>
<file>images/textedit/text_italic.png</file>
<file>images/textedit/text_under.png</file>
<file>images/textedit/text_block.png</file>
<file>images/textedit/text_center.png</file>
<file>images/textedit/text_left.png</file>
<file>images/textedit/text_right.png</file>
<file>images/textedit/editcopy.png</file>
<file>images/textedit/editcut.png</file>
<file>images/textedit/editpaste.png</file>

View File

@ -0,0 +1,120 @@
#ifndef RS_FORUM_GUI_INTERFACE_H
#define RS_FORUM_GUI_INTERFACE_H
/*
* libretroshare/src/rsiface: rsforums.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".
*
*/
#include <list>
#include <iostream>
#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_ADMIN 0x0100 /* anyone can publish */
#define RS_FORUM_SUBSCRIBED 0x0200 /* anyone can publish */
class ForumInfo
{
public:
ForumInfo() {}
std::string forumId;
std::wstring forumName;
std::wstring forumDesc;
uint32_t forumFlags;
uint32_t pop;
time_t lastPost;
};
class ForumMsgInfo
{
public:
ForumMsgInfo() {}
std::string forumId;
std::string threadId;
std::string msgId;
unsigned int msgflags;
std::wstring title;
std::wstring msg;
time_t ts;
};
class ThreadInfoSummary
{
public:
ThreadInfoSummary() {}
std::string msgId;
std::string srcId;
uint32_t msgflags;
std::wstring title;
int count; /* file count */
time_t ts;
};
std::ostream &operator<<(std::ostream &out, const ForumInfo &info);
std::ostream &operator<<(std::ostream &out, const ThreadInfoSummary &info);
std::ostream &operator<<(std::ostream &out, const ForumMsgInfo &info);
class RsForums;
extern RsForums *rsForums;
class RsForums
{
public:
RsForums() { return; }
virtual ~RsForums() { return; }
/****************************************/
virtual bool forumsChanged(std::list<std::string> &forumIds) = 0;
virtual bool getForumList(std::list<ForumInfo> &forumList) = 0;
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0;
virtual bool ForumMessageSend(ForumMsgInfo &info) = 0;
/****************************************/
};
#endif