mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 09:41:29 -05:00
Big Chunk of GUI work.
- Ported Forums to GxsForums. Not functioning yet, waiting on some GXS core functions. - Fixed up plumbing in Wiki. - Minor fixes to TokenQueue git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5812 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d8dc2a0420
commit
8d556955c5
@ -2,10 +2,10 @@ CONFIG += qt gui uic qrc resources uitools idle bitdht
|
||||
|
||||
# Below is for GXS services.
|
||||
CONFIG += photoshare
|
||||
#CONFIG += wikipoos
|
||||
CONFIG += wikipoos
|
||||
#CONFIG += thewire
|
||||
CONFIG += identities
|
||||
#CONFIG += forumsv2
|
||||
CONFIG += gxsforums
|
||||
CONFIG += posted
|
||||
CONFIG += unfinished
|
||||
CONFIG += gxsgui
|
||||
@ -194,11 +194,11 @@ freebsd-* {
|
||||
# ###########################################
|
||||
|
||||
bitdht {
|
||||
#LIBS += ../../libbitdht/src/lib/libbitdht.a
|
||||
#PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
||||
LIBS += ../../libbitdht/src/lib/libbitdht.a
|
||||
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
||||
|
||||
LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
#LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
#PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
|
||||
# Chris version.
|
||||
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
@ -959,25 +959,25 @@ identities {
|
||||
}
|
||||
|
||||
|
||||
forumsv2 {
|
||||
gxsforums {
|
||||
|
||||
HEADERS += gui/ForumsV2Dialog.h \
|
||||
gui/forumsv2/ForumV2Details.h \
|
||||
gui/forumsv2/EditForumV2Details.h \
|
||||
gui/forumsv2/CreateForumV2.h \
|
||||
gui/forumsv2/CreateForumV2Msg.h \
|
||||
HEADERS += gui/GxsForumsDialog.h \
|
||||
gui/gxsforums/GxsForumDetails.h \
|
||||
gui/gxsforums/EditGxsForumDetails.h \
|
||||
gui/gxsforums/CreateGxsForum.h \
|
||||
gui/gxsforums/CreateGxsForumMsg.h \
|
||||
|
||||
FORMS += gui/ForumsV2Dialog.ui \
|
||||
gui/forumsv2/ForumV2Details.ui \
|
||||
gui/forumsv2/EditForumV2Details.ui \
|
||||
gui/forumsv2/CreateForumV2.ui \
|
||||
gui/forumsv2/CreateForumV2Msg.ui \
|
||||
FORMS += gui/GxsForumsDialog.ui \
|
||||
gui/gxsforums/GxsForumDetails.ui \
|
||||
gui/gxsforums/EditGxsForumDetails.ui \
|
||||
gui/gxsforums/CreateGxsForum.ui \
|
||||
gui/gxsforums/CreateGxsForumMsg.ui \
|
||||
|
||||
SOURCES += gui/ForumsV2Dialog.cpp \
|
||||
gui/forumsv2/ForumV2Details.cpp \
|
||||
gui/forumsv2/EditForumV2Details.cpp \
|
||||
gui/forumsv2/CreateForumV2.cpp \
|
||||
gui/forumsv2/CreateForumV2Msg.cpp \
|
||||
SOURCES += gui/GxsForumsDialog.cpp \
|
||||
gui/gxsforums/GxsForumDetails.cpp \
|
||||
gui/gxsforums/EditGxsForumDetails.cpp \
|
||||
gui/gxsforums/CreateGxsForum.cpp \
|
||||
gui/gxsforums/CreateGxsForumMsg.cpp \
|
||||
|
||||
}
|
||||
|
||||
@ -1014,10 +1014,10 @@ posted {
|
||||
gxsgui {
|
||||
|
||||
HEADERS += gui/gxs/GxsGroupDialog.h \
|
||||
gui/gxs/GxsCommentTreeWidget.h \
|
||||
# gui/gxs/WikiGroupDialog.h \
|
||||
gui/gxs/GxsCommentTreeWidget.h \
|
||||
gui/gxs/WikiGroupDialog.h \
|
||||
gui/gxs/GxsForumGroupDialog.h \
|
||||
|
||||
# gui/gxs/ForumV2GroupDialog.h \
|
||||
# gui/gxs/GxsMsgDialog.h \
|
||||
|
||||
FORMS += gui/gxs/GxsGroupDialog.ui \
|
||||
@ -1025,10 +1025,10 @@ gxsgui {
|
||||
# gui/gxs/GxsCommentTreeWidget.ui \
|
||||
|
||||
SOURCES += gui/gxs/GxsGroupDialog.cpp \
|
||||
gui/gxs/GxsCommentTreeWidget.cpp \
|
||||
# gui/gxs/WikiGroupDialog.cpp \
|
||||
gui/gxs/GxsCommentTreeWidget.cpp \
|
||||
gui/gxs/WikiGroupDialog.cpp \
|
||||
gui/gxs/GxsForumGroupDialog.cpp \
|
||||
|
||||
#gui/gxs/ForumV2GroupDialog.cpp \
|
||||
# gui/gxs/GxsMsgDialog.cpp \
|
||||
|
||||
|
||||
|
2422
retroshare-gui/src/gui/GxsForumsDialog.cpp
Normal file
2422
retroshare-gui/src/gui/GxsForumsDialog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
272
retroshare-gui/src/gui/GxsForumsDialog.h
Normal file
272
retroshare-gui/src/gui/GxsForumsDialog.h
Normal file
@ -0,0 +1,272 @@
|
||||
/****************************************************************
|
||||
* 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 _GXSFORUMSDIALOG_H
|
||||
#define _GXSFORUMSDIALOG_H
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include "mainpage.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_GxsForumsDialog.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
|
||||
class ForumInfo;
|
||||
|
||||
|
||||
/* These are all the parameters that are required for thread loading.
|
||||
* They are kept static for the load duration.
|
||||
*/
|
||||
|
||||
class GxsForumsThreadLoadParameters
|
||||
{
|
||||
public:
|
||||
|
||||
std::string ForumId;
|
||||
std::string FocusMsgId;
|
||||
|
||||
uint32_t SubscribeFlags;
|
||||
int ViewType;
|
||||
uint32_t FilterColumn;
|
||||
|
||||
std::map<uint32_t, QTreeWidgetItem *> MsgTokens;
|
||||
QList<QTreeWidgetItem*> Items;
|
||||
QList<QTreeWidgetItem*> ItemToExpand;
|
||||
|
||||
bool FillComplete;
|
||||
bool FlatView;
|
||||
bool UseChildTS;
|
||||
bool ExpandNewMessages;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class GxsForumsDialog : public RsAutoUpdatePage, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsForumsDialog(QWidget *parent = 0);
|
||||
~GxsForumsDialog();
|
||||
|
||||
bool navigate(const std::string& forumId, const std::string& msgId);
|
||||
|
||||
/* overloaded from RsAuthUpdatePage */
|
||||
virtual void updateDisplay();
|
||||
|
||||
// Callback for all Loads.
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void forumListCustomPopupMenu( QPoint point );
|
||||
void threadListCustomPopupMenu( QPoint point );
|
||||
void restoreForumKeys();
|
||||
void newforum();
|
||||
|
||||
void changedForum(const QString &id);
|
||||
void changedThread();
|
||||
void clickedThread (QTreeWidgetItem *item, int column);
|
||||
|
||||
void replytomessage();
|
||||
void replyMessageData(const RsGxsForumMsg &msg);
|
||||
|
||||
//void print();
|
||||
//void printpreview();
|
||||
|
||||
//void removemessage();
|
||||
void markMsgAsRead();
|
||||
void markMsgAsReadChildren();
|
||||
void markMsgAsReadAll();
|
||||
void markMsgAsUnread();
|
||||
void markMsgAsUnreadAll();
|
||||
void markMsgAsUnreadChildren();
|
||||
void copyForumLink();
|
||||
void copyMessageLink();
|
||||
|
||||
/* handle splitter */
|
||||
void togglethreadview();
|
||||
|
||||
void createthread();
|
||||
void createmessage();
|
||||
|
||||
void subscribeToForum();
|
||||
void unsubscribeToForum();
|
||||
|
||||
void showForumDetails();
|
||||
void editForumDetails();
|
||||
|
||||
void previousMessage ();
|
||||
void nextMessage ();
|
||||
void nextUnreadMessage();
|
||||
void downloadAllFiles();
|
||||
|
||||
void changedViewBox();
|
||||
|
||||
void filterColumnChanged();
|
||||
//void filterRegExpChanged();
|
||||
///void clearFilter();
|
||||
|
||||
void generateMassData();
|
||||
|
||||
void fillThreadFinished();
|
||||
void fillThreadProgress(int current, int count);
|
||||
|
||||
void shareKey();
|
||||
|
||||
private:
|
||||
void insertForums();
|
||||
void insertThreads();
|
||||
void insertPost();
|
||||
void insertPostData(const RsGxsForumMsg &msg); // Second Half.
|
||||
|
||||
// Utility Fns.
|
||||
QString titleFromInfo(const RsMsgMetaData &meta);
|
||||
QString messageFromInfo(const RsGxsForumMsg &msg);
|
||||
|
||||
void forumMsgReadStatusChanged(const QString &forumId, const QString &msgId, int status);
|
||||
|
||||
void updateMessageSummaryList(std::string forumId);
|
||||
//void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
||||
void forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo);
|
||||
|
||||
void forumSubscribe(bool subscribe);
|
||||
void FillThreads(QList<QTreeWidgetItem *> &ThreadList, bool bExpandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
||||
void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool bExpandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
||||
|
||||
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
|
||||
|
||||
void setMsgReadStatus(QList<QTreeWidgetItem*> &Rows, bool bRead);
|
||||
void markMsgAsReadUnread(bool bRead, bool bChildren, bool bForum);
|
||||
void CalculateIconsAndFonts(QTreeWidgetItem *pItem = NULL);
|
||||
void CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren);
|
||||
|
||||
void processSettings(bool bLoad);
|
||||
void togglethreadview_internal();
|
||||
|
||||
void filterItems(const QString& text);
|
||||
bool filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn);
|
||||
|
||||
// New Request/Response Loading Functions.
|
||||
void insertForumsData(const std::list<RsGroupMetaData> &forumList);
|
||||
void insertForumThreads(const RsGroupMetaData &fi);
|
||||
|
||||
void requestGroupSummary();
|
||||
void loadGroupSummary(const uint32_t &token);
|
||||
|
||||
void requestGroupSummary_CurrentForum(const std::string &forumId);
|
||||
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
||||
|
||||
void loadCurrentForumThreads(const std::string &forumId);
|
||||
void requestGroupThreadData_InsertThreads(const std::string &forumId);
|
||||
void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
||||
void loadForumBaseThread(const RsGxsForumMsg &msg);
|
||||
|
||||
void requestChildData_InsertThreads(uint32_t &token, const RsGxsGrpMsgIdPair &parentId);
|
||||
void loadChildData_InsertThreads(const uint32_t &token);
|
||||
void loadForumChildMsg(const RsGxsForumMsg &msg, QTreeWidgetItem *parent);
|
||||
|
||||
void requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId);
|
||||
void loadMsgData_InsertPost(const uint32_t &token);
|
||||
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
||||
void loadMsgData_ReplyMessage(const uint32_t &token);
|
||||
|
||||
bool convertMsgToThreadWidget(const RsGxsForumMsg &msgInfo, std::string authorName,
|
||||
bool useChildTS, uint32_t filterColumn, QTreeWidgetItem *item);
|
||||
|
||||
TokenQueue *mForumQueue;
|
||||
|
||||
|
||||
bool m_bProcessSettings;
|
||||
|
||||
QTreeWidgetItem *yourForums;
|
||||
QTreeWidgetItem *subscribedForums;
|
||||
QTreeWidgetItem *popularForums;
|
||||
QTreeWidgetItem *otherForums;
|
||||
|
||||
std::string mCurrForumId;
|
||||
std::string mCurrThreadId;
|
||||
int subscribeFlags;
|
||||
|
||||
QFont m_ForumNameFont;
|
||||
int lastViewType;
|
||||
std::string lastForumID;
|
||||
|
||||
bool inMsgAsReadUnread;
|
||||
//GxsForumsFillThread *fillThread;
|
||||
|
||||
// New Datatypes to replace the FillThread.
|
||||
bool mThreadLoading;
|
||||
GxsForumsThreadLoadParameters mThreadLoad;
|
||||
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsForumsDialog ui;
|
||||
};
|
||||
|
||||
#if 0
|
||||
class GxsForumsFillThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsForumsFillThread(GxsForumsDialog *parent);
|
||||
~GxsForumsFillThread();
|
||||
|
||||
void run();
|
||||
void stop();
|
||||
bool wasStopped() { return stopped; }
|
||||
|
||||
signals:
|
||||
void progress(int current, int count);
|
||||
|
||||
public:
|
||||
std::string forumId;
|
||||
int filterColumn;
|
||||
int subscribeFlags;
|
||||
bool fillComplete;
|
||||
int viewType;
|
||||
bool expandNewMessages;
|
||||
std::string focusMsgId;
|
||||
|
||||
QList<QTreeWidgetItem*> Items;
|
||||
QList<QTreeWidgetItem*> ItemToExpand;
|
||||
|
||||
private:
|
||||
volatile bool stopped;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
1251
retroshare-gui/src/gui/GxsForumsDialog.ui
Normal file
1251
retroshare-gui/src/gui/GxsForumsDialog.ui
Normal file
File diff suppressed because it is too large
Load Diff
@ -93,7 +93,8 @@ void PhotoDialog::requestComments()
|
||||
uint32_t token;
|
||||
msgId.first = mPhotoDetails.mMeta.mGroupId;
|
||||
msgId.second = mPhotoDetails.mMeta.mMsgId;
|
||||
mPhotoQueue->requestMsgRelatedInfo(token, opts, msgId, 0);
|
||||
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST;
|
||||
mPhotoQueue->requestMsgRelatedInfo(token, anstype, opts, msgId, 0);
|
||||
}
|
||||
|
||||
void PhotoDialog::createComment()
|
||||
|
@ -43,15 +43,14 @@
|
||||
|
||||
#define WIKI_DEBUG 1
|
||||
|
||||
#define WIKIDIALOG_LISTING_GROUPLIST 1
|
||||
#define WIKIDIALOG_LISTING_GROUPDATA 2
|
||||
#define WIKIDIALOG_LISTING_ORIGINALPAGES 3
|
||||
#define WIKIDIALOG_LISTING_LATESTPAGES 4
|
||||
#define WIKIDIALOG_LISTING_PAGES 5
|
||||
#define WIKIDIALOG_MOD_LIST 6
|
||||
#define WIKIDIALOG_MOD_PAGES 7
|
||||
#define WIKIDIALOG_WIKI_PAGE 8
|
||||
|
||||
#define WIKIDIALOG_EDITTREE_DATA 9
|
||||
|
||||
|
||||
/** Constructor */
|
||||
WikiDialog::WikiDialog(QWidget *parent)
|
||||
@ -67,6 +66,10 @@ WikiDialog::WikiDialog(QWidget *parent)
|
||||
connect( ui.toolButton_NewGroup, SIGNAL(clicked()), this, SLOT(OpenOrShowAddGroupDialog()));
|
||||
connect( ui.toolButton_NewPage, SIGNAL(clicked()), this, SLOT(OpenOrShowAddPageDialog()));
|
||||
connect( ui.toolButton_Edit, SIGNAL(clicked()), this, SLOT(OpenOrShowEditDialog()));
|
||||
connect( ui.toolButton_Republish, SIGNAL(clicked()), this, SLOT(OpenOrShowRepublishDialog()));
|
||||
|
||||
// Usurped until Refresh works normally
|
||||
connect( ui.toolButton_Delete, SIGNAL(clicked()), this, SLOT(insertWikiGroups()));
|
||||
|
||||
connect( ui.treeWidget_Pages, SIGNAL(itemSelectionChanged()), this, SLOT(groupTreeChanged()));
|
||||
connect( ui.treeWidget_Mods, SIGNAL(itemSelectionChanged()), this, SLOT(modTreeChanged()));
|
||||
@ -76,9 +79,8 @@ WikiDialog::WikiDialog(QWidget *parent)
|
||||
timer->start(1000);
|
||||
|
||||
/* setup TokenQueue */
|
||||
#if 0
|
||||
mWikiQueue = new TokenQueue(rsWiki, this);
|
||||
#endif
|
||||
rsWiki->generateDummyData();
|
||||
mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);
|
||||
|
||||
}
|
||||
|
||||
@ -133,6 +135,7 @@ void WikiDialog::OpenOrShowAddPageDialog()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
{
|
||||
#if 0
|
||||
@ -199,27 +202,23 @@ void WikiDialog::editGroupDetails()
|
||||
|
||||
void WikiDialog::OpenOrShowEditDialog()
|
||||
{
|
||||
std::string groupId = getSelectedGroup();
|
||||
if (groupId == "")
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No Group selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string modId = getSelectedMod();
|
||||
std::string realPageId;
|
||||
|
||||
std::string groupId;
|
||||
std::string pageId;
|
||||
std::string origPageId;
|
||||
|
||||
if (!getSelectedPage(pageId, origPageId))
|
||||
if (!getSelectedPage(groupId, pageId, origPageId))
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No PageId selected";
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No Group or PageId selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::string modId = getSelectedMod();
|
||||
std::string realPageId;
|
||||
|
||||
if (modId == "")
|
||||
{
|
||||
realPageId = pageId;
|
||||
@ -235,29 +234,41 @@ void WikiDialog::OpenOrShowEditDialog()
|
||||
mEditDialog = new WikiEditDialog(NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
RsWikiCollection group;
|
||||
rsWiki->getGroup(groupId, group);
|
||||
mEditDialog->setGroup(group);
|
||||
|
||||
RsWikiSnapshot page;
|
||||
rsWiki->getPage(realPageId, page);
|
||||
mEditDialog->setPreviousPage(page);
|
||||
#endif
|
||||
mEditDialog->setupData(groupId, realPageId);
|
||||
|
||||
mEditDialog->show();
|
||||
}
|
||||
|
||||
void WikiDialog::OpenOrShowRepublishDialog()
|
||||
{
|
||||
OpenOrShowEditDialog();
|
||||
|
||||
std::string groupId;
|
||||
std::string pageId;
|
||||
std::string origPageId;
|
||||
|
||||
if (!getSelectedPage(groupId, pageId, origPageId))
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddRepublishDialog() No Group or PageId selected";
|
||||
std::cerr << std::endl;
|
||||
if (mEditDialog)
|
||||
{
|
||||
mEditDialog->hide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mEditDialog->setRepublishMode(origPageId);
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::groupTreeChanged()
|
||||
{
|
||||
/* */
|
||||
std::string groupId;
|
||||
std::string pageId;
|
||||
std::string origPageId;
|
||||
|
||||
getSelectedPage(pageId, origPageId);
|
||||
getSelectedPage(groupId, pageId, origPageId);
|
||||
if (pageId == mPageSelected)
|
||||
{
|
||||
return; /* nothing changed */
|
||||
@ -275,26 +286,32 @@ void WikiDialog::groupTreeChanged()
|
||||
|
||||
clearModsTree();
|
||||
|
||||
insertModsForPage(origPageId);
|
||||
requestWikiPage(pageId);
|
||||
|
||||
RsGxsGrpMsgIdPair origPagePair = std::make_pair(groupId, origPageId);
|
||||
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
|
||||
|
||||
insertModsForPage(origPagePair);
|
||||
requestWikiPage(pagepair);
|
||||
}
|
||||
|
||||
void WikiDialog::modTreeChanged()
|
||||
{
|
||||
/* */
|
||||
std::string groupId = getSelectedGroup();
|
||||
std::string pageId = getSelectedMod();
|
||||
if (pageId == mModSelected)
|
||||
{
|
||||
return; /* nothing changed */
|
||||
}
|
||||
|
||||
if (pageId == "")
|
||||
if ((pageId == "") || (groupId == ""))
|
||||
{
|
||||
clearWikiPage();
|
||||
return;
|
||||
}
|
||||
|
||||
requestWikiPage(pageId);
|
||||
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
|
||||
requestWikiPage(pagepair);
|
||||
}
|
||||
|
||||
|
||||
@ -330,86 +347,7 @@ void WikiDialog::clearModsTree()
|
||||
#define WIKI_GROUP_COL_ORIGPAGEID 2
|
||||
|
||||
|
||||
// THIS WAS ALREADY COMMENTED OUT!!!
|
||||
#if 0
|
||||
#########################################################
|
||||
void WikiDialog::insertWikiGroups()
|
||||
{
|
||||
|
||||
std::cerr << "WikiDialog::insertWikiGroups()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* clear it all */
|
||||
clearGroupTree();
|
||||
|
||||
std::list<std::string> groupIds;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsWiki->getGroupList(groupIds);
|
||||
|
||||
for(it = groupIds.begin(); it != groupIds.end(); it++)
|
||||
{
|
||||
/* add a group Item */
|
||||
RsWikiCollection group;
|
||||
rsWiki->getGroup(*it, group);
|
||||
|
||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem(NULL);
|
||||
groupItem->setText(WIKI_GROUP_COL_GROUPNAME, QString::fromStdString(group.mName));
|
||||
groupItem->setText(WIKI_GROUP_COL_GROUPID, QString::fromStdString(group.mGroupId));
|
||||
ui.treeWidget_Pages->addTopLevelItem(groupItem);
|
||||
|
||||
std::cerr << "Group: " << group.mName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> pageIds;
|
||||
std::list<std::string>::iterator pit;
|
||||
|
||||
rsWiki->getOrigPageList(*it, pageIds);
|
||||
|
||||
for(pit = pageIds.begin(); pit != pageIds.end(); pit++)
|
||||
{
|
||||
std::cerr << "\tOrigPageId: " << *pit;
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* get newest page */
|
||||
RsWikiSnapshot page;
|
||||
std::string latestPageId;
|
||||
if (!rsWiki->getLatestPage(*pit, latestPageId))
|
||||
{
|
||||
std::cerr << "\tgetLatestPage() Failed";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (!rsWiki->getPage(latestPageId, page))
|
||||
{
|
||||
std::cerr << "\tgetPage() Failed";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << "\tLatestPageId: " << latestPageId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tExtracted OrigPageId: " << page.mOrigPageId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tExtracted PageId: " << page.mPageId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *pageItem = new QTreeWidgetItem(NULL);
|
||||
pageItem->setText(WIKI_GROUP_COL_PAGENAME, QString::fromStdString(page.mName));
|
||||
pageItem->setText(WIKI_GROUP_COL_PAGEID, QString::fromStdString(page.mPageId));
|
||||
pageItem->setText(WIKI_GROUP_COL_ORIGPAGEID, QString::fromStdString(page.mOrigPageId));
|
||||
|
||||
groupItem->addChild(pageItem);
|
||||
|
||||
std::cerr << "\tPage: " << page.mName;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
#########################################################
|
||||
#endif
|
||||
|
||||
|
||||
bool WikiDialog::getSelectedPage(std::string &pageId, std::string &origPageId)
|
||||
bool WikiDialog::getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId)
|
||||
{
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedPage()" << std::endl;
|
||||
@ -439,6 +377,7 @@ bool WikiDialog::getSelectedPage(std::string &pageId, std::string &origPageId)
|
||||
|
||||
|
||||
/* check if it has changed */
|
||||
groupId = parent->text(WIKI_GROUP_COL_GROUPID).toStdString();
|
||||
pageId = item->text(WIKI_GROUP_COL_PAGEID).toStdString();
|
||||
origPageId = item->text(WIKI_GROUP_COL_ORIGPAGEID).toStdString();
|
||||
|
||||
@ -489,37 +428,7 @@ std::string WikiDialog::getSelectedGroup()
|
||||
|
||||
#define WIKI_MODS_COL_ORIGPAGEID 0
|
||||
#define WIKI_MODS_COL_PAGEID 1
|
||||
|
||||
#if 0
|
||||
#########################################################
|
||||
void WikiDialog::insertModsForPage(std::string &origPageId)
|
||||
{
|
||||
/* clear it all */
|
||||
//clearPhotos();
|
||||
//ui.photoLayout->clear();
|
||||
|
||||
/* create a list of albums */
|
||||
|
||||
std::list<std::string> pageIds;
|
||||
std::list<std::string>::const_iterator it;
|
||||
|
||||
rsWiki->getPageVersions(origPageId, pageIds);
|
||||
|
||||
|
||||
for(it = pageIds.begin(); it != pageIds.end(); it++)
|
||||
{
|
||||
RsWikiSnapshot page;
|
||||
rsWiki->getPage(*it, page);
|
||||
|
||||
QTreeWidgetItem *modItem = new QTreeWidgetItem(NULL);
|
||||
modItem->setText(WIKI_MODS_COL_ORIGPAGEID, QString::fromStdString(page.mOrigPageId));
|
||||
modItem->setText(WIKI_MODS_COL_PAGEID, QString::fromStdString(page.mPageId));
|
||||
ui.treeWidget_Mods->addTopLevelItem(modItem);
|
||||
}
|
||||
}
|
||||
#########################################################
|
||||
#endif
|
||||
|
||||
#define WIKI_MODS_COL_PARENTID 2
|
||||
|
||||
|
||||
std::string WikiDialog::getSelectedMod()
|
||||
@ -562,39 +471,13 @@ void WikiDialog::requestGroupList()
|
||||
std::cerr << "WikiDialog::requestGroupList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> ids;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
uint32_t token;
|
||||
mWikiQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, WIKIDIALOG_LISTING_GROUPLIST);
|
||||
mWikiQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, WIKIDIALOG_LISTING_GROUPDATA);
|
||||
}
|
||||
|
||||
void WikiDialog::loadGroupList(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadGroupList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> groupIds;
|
||||
rsWiki->getGroupList(token, groupIds);
|
||||
|
||||
if (groupIds.size() > 0)
|
||||
{
|
||||
requestGroupData(groupIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WikiDialog::loadGroupList() ERROR No Groups...";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void WikiDialog::requestGroupData(const std::list<std::string> &groupIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, WIKIDIALOG_LISTING_GROUPDATA);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WikiDialog::loadGroupData(const uint32_t &token)
|
||||
{
|
||||
@ -603,139 +486,57 @@ void WikiDialog::loadGroupData(const uint32_t &token)
|
||||
|
||||
clearGroupTree();
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
std::vector<RsWikiCollection> datavector;
|
||||
std::vector<RsWikiCollection>::iterator vit;
|
||||
|
||||
if (!rsWiki->getCollections(token, datavector))
|
||||
{
|
||||
RsWikiCollection group;
|
||||
#if 0
|
||||
if (rsWiki->getGroupData(token, group))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
/* Add Widget, and request Pages */
|
||||
|
||||
std::cerr << "WikiDialog::addGroup() GroupId: " << group.mMeta.mGroupId;
|
||||
std::cerr << " Group: " << group.mMeta.mGroupName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem();
|
||||
groupItem->setText(WIKI_GROUP_COL_GROUPNAME, QString::fromStdString(group.mMeta.mGroupName));
|
||||
groupItem->setText(WIKI_GROUP_COL_GROUPID, QString::fromStdString(group.mMeta.mGroupId));
|
||||
ui.treeWidget_Pages->addTopLevelItem(groupItem);
|
||||
|
||||
/* request pages */
|
||||
std::list<std::string> groupIds;
|
||||
groupIds.push_back(group.mMeta.mGroupId);
|
||||
|
||||
requestOriginalPages(groupIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
std::cerr << "WikiDialog::loadGroupData() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for(vit = datavector.begin(); vit != datavector.end(); vit++)
|
||||
{
|
||||
RsWikiCollection &group = *vit;
|
||||
|
||||
/* Add Widget, and request Pages */
|
||||
|
||||
std::cerr << "WikiDialog::addGroup() GroupId: " << group.mMeta.mGroupId;
|
||||
std::cerr << " Group: " << group.mMeta.mGroupName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem();
|
||||
groupItem->setText(WIKI_GROUP_COL_GROUPNAME, QString::fromStdString(group.mMeta.mGroupName));
|
||||
groupItem->setText(WIKI_GROUP_COL_GROUPID, QString::fromStdString(group.mMeta.mGroupId));
|
||||
ui.treeWidget_Pages->addTopLevelItem(groupItem);
|
||||
|
||||
/* request pages */
|
||||
std::list<std::string> groupIds;
|
||||
groupIds.push_back(group.mMeta.mGroupId);
|
||||
|
||||
requestPages(groupIds);
|
||||
//requestOriginalPages(groupIds);
|
||||
}
|
||||
//return true;
|
||||
}
|
||||
|
||||
void WikiDialog::requestOriginalPages(const std::list<std::string> &groupIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_ORIGMSG;
|
||||
uint32_t token;
|
||||
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, groupIds, WIKIDIALOG_LISTING_ORIGINALPAGES);
|
||||
}
|
||||
|
||||
void WikiDialog::loadOriginalPages(const uint32_t &token)
|
||||
void WikiDialog::requestPages(const std::list<RsGxsGroupId> &groupIds)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadOriginalPages()";
|
||||
std::cerr << "WikiDialog::requestPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* translate into latest pages */
|
||||
std::list<std::string> msgIds;
|
||||
#if 0
|
||||
if (rsWiki->getMsgList(token, msgIds))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
std::cerr << "WikiDialog::loadOriginalPages() Loaded " << msgIds.size();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WikiDialog::loadOriginalPages() ERROR No Data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
requestLatestPages(msgIds);
|
||||
|
||||
}
|
||||
|
||||
void WikiDialog::requestLatestPages(const std::list<std::string> &msgIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
opts.mOptions = (RS_TOKREQOPT_MSG_LATEST | RS_TOKREQOPT_MSG_THREAD); // We want latest version of Thread Heads.
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, msgIds, WIKIDIALOG_LISTING_LATESTPAGES);
|
||||
#endif
|
||||
|
||||
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, WIKIDIALOG_LISTING_PAGES);
|
||||
}
|
||||
|
||||
void convert_result_to_list(const GxsMsgIdResult &result, std::list<RsGxsMessageId> &list)
|
||||
{
|
||||
GxsMsgIdResult::const_iterator it;
|
||||
for(it = result.begin(); it != result.end(); it++)
|
||||
{
|
||||
std::vector<RsGxsMessageId>::const_iterator vit;
|
||||
for (vit = it->second.begin(); vit != it->second.end(); vit++)
|
||||
{
|
||||
list.push_back(*vit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WikiDialog::loadLatestPages(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadLatestPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
//std::list<std::string> msgIds;
|
||||
GxsMsgIdResult msgIds;
|
||||
if (rsWiki->getMsgList(token, msgIds))
|
||||
{
|
||||
std::cerr << "WikiDialog::loadLatestPages() Loaded " << msgIds.size();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WikiDialog::loadLatestPages() ERROR No Data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsMessageId> list;
|
||||
convert_result_to_list(msgIds, list);
|
||||
|
||||
/* request actual data */
|
||||
//requestPages(list);
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
void WikiDialog::requestPages(std::list<RsGxsMessageId> &msgids)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_LISTING_PAGES);
|
||||
}
|
||||
#endif
|
||||
|
||||
void WikiDialog::loadPages(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadLatestPages()";
|
||||
std::cerr << "WikiDialog::loadPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* find parent in GUI Tree - stick children */
|
||||
@ -757,7 +558,7 @@ void WikiDialog::loadPages(const uint32_t &token)
|
||||
{
|
||||
/* find the entry */
|
||||
int itemCount = ui.treeWidget_Pages->topLevelItemCount();
|
||||
for (int nIndex = 0; nIndex < itemCount;)
|
||||
for (int nIndex = 0; nIndex < itemCount; nIndex++)
|
||||
{
|
||||
QTreeWidgetItem *tmpItem = ui.treeWidget_Pages->topLevelItem(nIndex);
|
||||
std::string tmpid = tmpItem->data(WIKI_GROUP_COL_GROUPID,
|
||||
@ -790,35 +591,30 @@ void WikiDialog::loadPages(const uint32_t &token)
|
||||
|
||||
groupItem->addChild(pageItem);
|
||||
}
|
||||
//return true;
|
||||
}
|
||||
|
||||
|
||||
/***** Mods *****/
|
||||
|
||||
void WikiDialog::insertModsForPage(const std::string &origPageId)
|
||||
void WikiDialog::insertModsForPage(const RsGxsGrpMsgIdPair &origPageId)
|
||||
{
|
||||
requestModPageList(origPageId);
|
||||
}
|
||||
|
||||
void WikiDialog::requestModPageList(const std::string &origMsgId)
|
||||
void WikiDialog::requestModPageList(const RsGxsGrpMsgIdPair &origMsgId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_VERSIONS;
|
||||
|
||||
std::list<std::string> msgIds;
|
||||
msgIds.push_back(origMsgId);
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, msgIds, WIKIDIALOG_MOD_LIST);
|
||||
#endif
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, origMsgId, WIKIDIALOG_MOD_LIST);
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::loadModPageList(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPages()";
|
||||
std::cerr << "WikiDialog::loadModPageList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* translate into latest pages */
|
||||
@ -827,8 +623,18 @@ void WikiDialog::loadModPageList(const uint32_t &token)
|
||||
|
||||
if (rsWiki->getMsgList(token, msgIds))
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPageList() Loaded " << msgIds.size();
|
||||
std::cerr << std::endl;
|
||||
GxsMsgIdResult::iterator git;
|
||||
for(git = msgIds.begin(); git != msgIds.end(); git++)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPageList() Loaded GroupId: " << git->first;
|
||||
std::cerr << std::endl;
|
||||
std::vector<RsGxsMessageId>::iterator vit;
|
||||
for(vit = git->second.begin(); vit != git->second.end(); vit++)
|
||||
{
|
||||
std::cerr << "\tMsgId: " << *vit;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -837,20 +643,21 @@ void WikiDialog::loadModPageList(const uint32_t &token)
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsMessageId> list;
|
||||
convert_result_to_list(msgIds, list);
|
||||
requestModPages(list);
|
||||
|
||||
requestModPages(msgIds);
|
||||
}
|
||||
|
||||
void WikiDialog::requestModPages(const std::list<RsGxsMessageId> &msgIds)
|
||||
void WikiDialog::requestModPages(const GxsMsgIdResult &msgIds)
|
||||
{
|
||||
std::cerr << "WikiDialog::requestModPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_MOD_PAGES);
|
||||
#endif
|
||||
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_MOD_PAGES);
|
||||
|
||||
//mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_MOD_PAGES);
|
||||
}
|
||||
|
||||
|
||||
@ -859,80 +666,195 @@ void WikiDialog::loadModPages(const uint32_t &token)
|
||||
std::cerr << "WikiDialog::loadModPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsWikiSnapshot page;
|
||||
#if 0
|
||||
if (rsWiki->getMsgData(token, page))
|
||||
#endif
|
||||
if (0)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *modItem = new QTreeWidgetItem();
|
||||
modItem->setText(WIKI_MODS_COL_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId));
|
||||
modItem->setText(WIKI_MODS_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId));
|
||||
ui.treeWidget_Mods->addTopLevelItem(modItem);
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
std::vector<RsWikiSnapshot>::iterator vit;
|
||||
if (!rsWiki->getSnapshots(token, snapshots))
|
||||
{
|
||||
// ERROR
|
||||
std::cerr << "WikiDialog::loadModPages() ERROR";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
for(vit = snapshots.begin(); vit != snapshots.end(); vit++)
|
||||
{
|
||||
RsWikiSnapshot &page = *vit;
|
||||
|
||||
std::cerr << "WikiDialog::loadModPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
//QTreeWidgetItem *modItem = new QTreeWidgetItem();
|
||||
//modItem->setText(WIKI_MODS_COL_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId));
|
||||
//modItem->setText(WIKI_MODS_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId));
|
||||
//ui.treeWidget_Mods->addTopLevelItem(modItem);
|
||||
}
|
||||
|
||||
|
||||
/* then we need to request all pages from this thread */
|
||||
requestEditTreeData();
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::requestEditTreeData() //const RsGxsGroupId &groupId)
|
||||
{
|
||||
std::string groupId = getSelectedGroup();
|
||||
|
||||
// SWITCH THIS TO A THREAD REQUEST - WHEN WE CAN!
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(groupId);
|
||||
|
||||
uint32_t token;
|
||||
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, WIKIDIALOG_EDITTREE_DATA);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WikiDialog::loadEditTreeData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadEditTreeData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
std::vector<RsWikiSnapshot>::iterator vit;
|
||||
if (!rsWiki->getSnapshots(token, snapshots))
|
||||
{
|
||||
// ERROR
|
||||
std::cerr << "WikiDialog::loadEditTreeData() ERROR";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "WikiDialog::loadEditTreeData() Loaded " << snapshots.size();
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::map<RsGxsMessageId, QTreeWidgetItem *> items;
|
||||
std::map<RsGxsMessageId, QTreeWidgetItem *>::iterator iit;
|
||||
std::list<QTreeWidgetItem *> unparented;
|
||||
std::list<QTreeWidgetItem *>::iterator uit;
|
||||
|
||||
for(vit = snapshots.begin(); vit != snapshots.end(); vit++)
|
||||
{
|
||||
RsWikiSnapshot &snapshot = *vit;
|
||||
|
||||
std::cerr << "Result: PageTitle: " << snapshot.mMeta.mMsgName;
|
||||
std::cerr << " GroupId: " << snapshot.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tOrigMsgId: " << snapshot.mMeta.mOrigMsgId;
|
||||
std::cerr << " MsgId: " << snapshot.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tThreadId: " << snapshot.mMeta.mThreadId;
|
||||
std::cerr << " ParentId: " << snapshot.mMeta.mParentId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* create an Entry */
|
||||
QTreeWidgetItem *modItem = new QTreeWidgetItem();
|
||||
modItem->setText(WIKI_MODS_COL_ORIGPAGEID, QString::fromStdString(snapshot.mMeta.mOrigMsgId));
|
||||
modItem->setText(WIKI_MODS_COL_PAGEID, QString::fromStdString(snapshot.mMeta.mMsgId));
|
||||
modItem->setText(WIKI_MODS_COL_PARENTID, QString::fromStdString(snapshot.mMeta.mParentId));
|
||||
|
||||
/* if no parentId */
|
||||
if (snapshot.mMeta.mParentId == "")
|
||||
{
|
||||
/* we've found one the missing ones */
|
||||
ui.treeWidget_Mods->addTopLevelItem(modItem);
|
||||
|
||||
/* index by MsgId --> SPECIAL HACK FOR HERE! */
|
||||
items[snapshot.mMeta.mMsgId] = modItem;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* find the parent */
|
||||
iit = items.find(snapshot.mMeta.mParentId);
|
||||
if (iit != items.end())
|
||||
{
|
||||
(iit->second)->addChild(modItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
unparented.push_back(modItem);
|
||||
}
|
||||
items[snapshot.mMeta.mOrigMsgId] = modItem;
|
||||
}
|
||||
|
||||
for(uit = unparented.begin(); uit != unparented.end(); uit++)
|
||||
{
|
||||
std::string parentId = (*uit)->text(WIKI_MODS_COL_PARENTID).toStdString();
|
||||
|
||||
iit = items.find(parentId);
|
||||
if (iit != items.end())
|
||||
{
|
||||
(iit->second)->addChild(*uit);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ERROR */
|
||||
std::cerr << "Unparented!!!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***** Wiki *****/
|
||||
|
||||
|
||||
void WikiDialog::requestWikiPage(const std::string &msgId)
|
||||
void WikiDialog::requestWikiPage(const RsGxsGrpMsgIdPair &msgId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
std::cerr << "WikiDialog::requestWikiPage(" << msgId.first << "," << msgId.second << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> msgIds;
|
||||
msgIds.push_back(msgId);
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_WIKI_PAGE);
|
||||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[msgId.first];
|
||||
vect_msgIds.push_back(msgId.second);
|
||||
|
||||
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_WIKI_PAGE);
|
||||
|
||||
//mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_WIKI_PAGE);
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::loadWikiPage(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPages()";
|
||||
std::cerr << "WikiDialog::loadWikiPage()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// Should only have one WikiPage....
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
if (!rsWiki->getSnapshots(token, snapshots))
|
||||
{
|
||||
std::cerr << "WikiDialog::loadWikiPage() ERROR";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
if (snapshots.size() < 1)
|
||||
if (snapshots.size() != 1)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadWikiPage() SIZE ERROR";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (snapshots.size() > 1)
|
||||
{
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
RsWikiSnapshot page = snapshots[0];
|
||||
|
||||
std::cerr << "WikiDialog::loadModPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << "WikiDialog::loadWikiPage() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
@ -951,22 +873,10 @@ void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case WIKIDIALOG_LISTING_GROUPLIST:
|
||||
loadGroupList(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_LISTING_GROUPDATA:
|
||||
loadGroupData(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_LISTING_ORIGINALPAGES:
|
||||
loadOriginalPages(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_LISTING_LATESTPAGES:
|
||||
loadLatestPages(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_LISTING_PAGES:
|
||||
loadPages(req.mToken);
|
||||
break;
|
||||
@ -979,12 +889,19 @@ void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
loadModPages(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_EDITTREE_DATA:
|
||||
loadEditTreeData(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_WIKI_PAGE:
|
||||
loadWikiPage(req.mToken);
|
||||
break;
|
||||
|
||||
#define GXSGROUP_NEWGROUPID 1
|
||||
case GXSGROUP_NEWGROUPID:
|
||||
insertWikiGroups();
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << "WikiDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ private slots:
|
||||
void OpenOrShowAddPageDialog();
|
||||
void OpenOrShowAddGroupDialog();
|
||||
void OpenOrShowEditDialog();
|
||||
void OpenOrShowRepublishDialog();
|
||||
|
||||
void groupTreeChanged();
|
||||
void modTreeChanged();
|
||||
@ -59,18 +60,21 @@ private slots:
|
||||
void showGroupDetails();
|
||||
void editGroupDetails();
|
||||
|
||||
void insertWikiGroups();
|
||||
|
||||
private:
|
||||
|
||||
void clearWikiPage();
|
||||
void clearGroupTree();
|
||||
void clearModsTree();
|
||||
|
||||
void insertWikiGroups();
|
||||
void insertModsForPage(const std::string &origPageId);
|
||||
|
||||
void insertModsForPage(const RsGxsGrpMsgIdPair &origPageId);
|
||||
|
||||
void updateWikiPage(const RsWikiSnapshot &page);
|
||||
|
||||
bool getSelectedPage(std::string &pageId, std::string &origPageId);
|
||||
bool getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId);
|
||||
std::string getSelectedPage();
|
||||
std::string getSelectedGroup();
|
||||
std::string getSelectedMod();
|
||||
@ -78,23 +82,26 @@ std::string getSelectedMod();
|
||||
|
||||
|
||||
void requestGroupList();
|
||||
void loadGroupList(const uint32_t &token);
|
||||
void requestGroupData(const std::list<std::string> &groupIds);
|
||||
void loadGroupData(const uint32_t &token);
|
||||
void requestOriginalPages(const std::list<std::string> &groupIds);
|
||||
void loadOriginalPages(const uint32_t &token);
|
||||
void requestLatestPages(const std::list<std::string> &msgIds);
|
||||
void loadLatestPages(const uint32_t &token);
|
||||
void requestPages(const std::list<std::string> &msgIds);
|
||||
|
||||
//void requestOriginalPages(const std::list<std::string> &groupIds);
|
||||
//void loadOriginalPages(const uint32_t &token);
|
||||
//void requestLatestPages(const std::list<std::string> &msgIds);
|
||||
//void loadLatestPages(const uint32_t &token);
|
||||
void requestPages(const std::list<RsGxsGroupId> &groupIds);
|
||||
//void requestPages(const std::list<std::string> &msgIds);
|
||||
void loadPages(const uint32_t &token);
|
||||
|
||||
|
||||
void requestModPageList(const std::string &origMsgId);
|
||||
void requestModPageList(const RsGxsGrpMsgIdPair &origMsgId);
|
||||
void loadModPageList(const uint32_t &token);
|
||||
void requestModPages(const std::list<std::string> &msgIds);
|
||||
void requestModPages(const GxsMsgIdResult &msgIds);
|
||||
void loadModPages(const uint32_t &token);
|
||||
|
||||
void requestWikiPage(const std::string &msgId);
|
||||
void requestEditTreeData();
|
||||
void loadEditTreeData(const uint32_t &token);
|
||||
|
||||
void requestWikiPage(const RsGxsGrpMsgIdPair &msgId);
|
||||
void loadWikiPage(const uint32_t &token);
|
||||
|
||||
|
||||
|
@ -139,6 +139,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_Republish">
|
||||
<property name="text">
|
||||
<string>Republish</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_Edit">
|
||||
<property name="text">
|
||||
@ -180,10 +187,10 @@
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_Delete">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -36,13 +36,15 @@ WikiEditDialog::WikiEditDialog(QWidget *parent)
|
||||
connect(ui.pushButton_Revert, SIGNAL( clicked( void ) ), this, SLOT( revertEdit( void ) ) );
|
||||
connect(ui.pushButton_Submit, SIGNAL( clicked( void ) ), this, SLOT( submitEdit( void ) ) );
|
||||
|
||||
#if 0
|
||||
mWikiQueue = new TokenQueue(rsWiki, this);
|
||||
#endif
|
||||
mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);
|
||||
mRepublishMode = false;
|
||||
}
|
||||
|
||||
void WikiEditDialog::setGroup(RsWikiCollection &group)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::setGroup(): " << group;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mWikiCollection = group;
|
||||
|
||||
ui.lineEdit_Group->setText(QString::fromStdString(mWikiCollection.mMeta.mGroupName));
|
||||
@ -51,6 +53,9 @@ void WikiEditDialog::setGroup(RsWikiCollection &group)
|
||||
|
||||
void WikiEditDialog::setPreviousPage(RsWikiSnapshot &page)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::setPreviousPage(): " << page;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mNewPage = false;
|
||||
mWikiSnapshot = page;
|
||||
|
||||
@ -63,12 +68,21 @@ void WikiEditDialog::setPreviousPage(RsWikiSnapshot &page)
|
||||
void WikiEditDialog::setNewPage()
|
||||
{
|
||||
mNewPage = true;
|
||||
mRepublishMode = false;
|
||||
ui.lineEdit_Page->setText("");
|
||||
ui.lineEdit_PrevVersion->setText("");
|
||||
ui.textEdit->setPlainText("");
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::setRepublishMode(RsGxsMessageId &origMsgId)
|
||||
{
|
||||
mRepublishMode = true;
|
||||
mRepublishOrigId = origMsgId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WikiEditDialog::cancelEdit()
|
||||
{
|
||||
hide();
|
||||
@ -90,6 +104,9 @@ void WikiEditDialog::revertEdit()
|
||||
|
||||
void WikiEditDialog::submitEdit()
|
||||
{
|
||||
std::cerr << "WikiEditDialog::submitEdit()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mNewPage)
|
||||
{
|
||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||
@ -98,28 +115,78 @@ void WikiEditDialog::submitEdit()
|
||||
#if 0
|
||||
mWikiSnapshot.mPrevId = "";
|
||||
#endif
|
||||
std::cerr << "WikiEditDialog::submitEdit() Is New Page";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mRepublishMode)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::submitEdit() In Republish Mode";
|
||||
std::cerr << std::endl;
|
||||
// A New Version of the ThreadHead.
|
||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||
mWikiSnapshot.mMeta.mOrigMsgId = mRepublishOrigId;
|
||||
mWikiSnapshot.mMeta.mParentId = "";
|
||||
mWikiSnapshot.mMeta.mThreadId = "";
|
||||
mWikiSnapshot.mMeta.mMsgId = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
mWikiSnapshot.mPrevId = mWikiSnapshot.mMeta.mMsgId;
|
||||
#endif
|
||||
std::cerr << "WikiEditDialog::submitEdit() In Child Edit Mode";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// A Child of the current message.
|
||||
bool isFirstChild = false;
|
||||
if (mWikiSnapshot.mMeta.mParentId == "")
|
||||
{
|
||||
isFirstChild = true;
|
||||
}
|
||||
|
||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||
|
||||
if (isFirstChild)
|
||||
{
|
||||
mWikiSnapshot.mMeta.mThreadId = mWikiSnapshot.mMeta.mOrigMsgId;
|
||||
// Special HACK here... parentId points to specific Msg, rather than OrigMsgId.
|
||||
// This allows versioning to work well.
|
||||
mWikiSnapshot.mMeta.mParentId = mWikiSnapshot.mMeta.mMsgId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ThreadId is the same.
|
||||
mWikiSnapshot.mMeta.mParentId = mWikiSnapshot.mMeta.mOrigMsgId;
|
||||
}
|
||||
|
||||
mWikiSnapshot.mMeta.mMsgId = "";
|
||||
mWikiSnapshot.mMeta.mOrigMsgId = "";
|
||||
}
|
||||
|
||||
|
||||
mWikiSnapshot.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
||||
mWikiSnapshot.mPage = ui.textEdit->toPlainText().toStdString();
|
||||
|
||||
std::cerr << "WikiEditDialog::submitEdit() PageTitle: " << mWikiSnapshot.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "WikiEditDialog::submitEdit() GroupId: " << mWikiSnapshot.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "WikiEditDialog::submitEdit() OrigMsgId: " << mWikiSnapshot.mMeta.mOrigMsgId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "WikiEditDialog::submitEdit() MsgId: " << mWikiSnapshot.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "WikiEditDialog::submitEdit() ThreadId: " << mWikiSnapshot.mMeta.mThreadId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "WikiEditDialog::submitEdit() ParentId: " << mWikiSnapshot.mMeta.mParentId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
bool isNew = mNewPage;
|
||||
#if 0
|
||||
rsWiki->createPage(token, mWikiSnapshot, isNew);
|
||||
#endif
|
||||
//bool isNew = mNewPage;
|
||||
//rsWiki->createPage(token, mWikiSnapshot, isNew);
|
||||
rsWiki->submitSnapshot(token, mWikiSnapshot);
|
||||
hide();
|
||||
}
|
||||
|
||||
void WikiEditDialog::setupData(const std::string &groupId, const std::string &pageId)
|
||||
{
|
||||
mRepublishMode = false;
|
||||
if (groupId != "")
|
||||
{
|
||||
requestGroup(groupId);
|
||||
@ -127,7 +194,8 @@ void WikiEditDialog::setupData(const std::string &groupId, const std::string &pa
|
||||
|
||||
if (pageId != "")
|
||||
{
|
||||
requestPage(pageId);
|
||||
RsGxsGrpMsgIdPair msgId = std::make_pair(groupId, pageId);
|
||||
requestPage(msgId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,6 +211,7 @@ void WikiEditDialog::requestGroup(const std::string &groupId)
|
||||
ids.push_back(groupId);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
uint32_t token;
|
||||
mWikiQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
}
|
||||
@ -152,30 +221,33 @@ void WikiEditDialog::loadGroup(const uint32_t &token)
|
||||
std::cerr << "WikiEditDialog::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWikiCollection group;
|
||||
#if 0
|
||||
if (rsWiki->getGroupData(token, group))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
std::vector<RsWikiCollection> groups;
|
||||
if (rsWiki->getCollections(token, groups))
|
||||
{
|
||||
setGroup(group);
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::loadGroup() ERROR No group data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
setGroup(groups[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void WikiEditDialog::requestPage(const std::string &msgId)
|
||||
void WikiEditDialog::requestPage(const RsGxsGrpMsgIdPair &msgId)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::requestGroup()";
|
||||
std::cerr << "WikiEditDialog::requestPage()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> ids;
|
||||
ids.push_back(msgId);
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[msgId.first];
|
||||
vect_msgIds.push_back(msgId.second);
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
#endif
|
||||
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, 0);
|
||||
}
|
||||
|
||||
void WikiEditDialog::loadPage(const uint32_t &token)
|
||||
@ -183,14 +255,17 @@ void WikiEditDialog::loadPage(const uint32_t &token)
|
||||
std::cerr << "WikiEditDialog::loadPage()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWikiSnapshot page;
|
||||
#if 0
|
||||
if (rsWiki->getMsgData(token, page))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
|
||||
if (rsWiki->getSnapshots(token, snapshots))
|
||||
{
|
||||
setPreviousPage(page);
|
||||
if (snapshots.size() != 1)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::loadGroup() ERROR No group data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
setPreviousPage(snapshots[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +282,7 @@ void WikiEditDialog::loadRequest(const TokenQueue *queue, const TokenRequest &re
|
||||
case TOKENREQ_GROUPINFO:
|
||||
loadGroup(req.mToken);
|
||||
break;
|
||||
case TOKENREQ_MSGRELATEDINFO:
|
||||
case TOKENREQ_MSGINFO:
|
||||
loadPage(req.mToken);
|
||||
break;
|
||||
default:
|
||||
|
@ -41,6 +41,8 @@ void setNewPage();
|
||||
void setupData(const std::string &groupId, const std::string &pageId);
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
void setRepublishMode(RsGxsMessageId &origMsgId);
|
||||
|
||||
private slots:
|
||||
|
||||
void cancelEdit();
|
||||
@ -52,12 +54,16 @@ private:
|
||||
void setGroup(RsWikiCollection &group);
|
||||
void setPreviousPage(RsWikiSnapshot &page);
|
||||
|
||||
void requestPage(const std::string &msgId);
|
||||
void requestPage(const RsGxsGrpMsgIdPair &msgId);
|
||||
void loadPage(const uint32_t &token);
|
||||
void requestGroup(const std::string &groupId);
|
||||
void loadGroup(const uint32_t &token);
|
||||
|
||||
bool mNewPage;
|
||||
|
||||
bool mRepublishMode;
|
||||
RsGxsMessageId mRepublishOrigId;
|
||||
|
||||
RsWikiCollection mWikiCollection;
|
||||
RsWikiSnapshot mWikiSnapshot;
|
||||
|
||||
|
83
retroshare-gui/src/gui/gxs/GxsForumGroupDialog.cpp
Normal file
83
retroshare-gui/src/gui/gxs/GxsForumGroupDialog.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/****************************************************************
|
||||
* 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 "GxsForumGroupDialog.h"
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
#include <iostream>
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
const uint32_t ForumCreateEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
GXS_GROUP_FLAGS_SHAREKEYS |
|
||||
// GXS_GROUP_FLAGS_PERSONALSIGN |
|
||||
// GXS_GROUP_FLAGS_COMMENTS |
|
||||
0);
|
||||
|
||||
const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_GROUP |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_LOCAL |
|
||||
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_GPG |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_COMMENTS_YES |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(const RsGxsForumGroup &group, QWidget *parent)
|
||||
:GxsGroupDialog(group.mMeta, GXS_GROUP_DIALOG_SHOW_MODE, parent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
{
|
||||
// Specific Function.
|
||||
RsGxsForumGroup grp;
|
||||
grp.mMeta = meta;
|
||||
//grp.mDescription = std::string(desc.toUtf8());
|
||||
|
||||
rsGxsForums->createGroup(token, grp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
42
retroshare-gui/src/gui/gxs/GxsForumGroupDialog.h
Normal file
42
retroshare-gui/src/gui/gxs/GxsForumGroupDialog.h
Normal file
@ -0,0 +1,42 @@
|
||||
/****************************************************************
|
||||
* 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 _GXSFORUM_GROUP_DIALOG_H
|
||||
#define _GXSFORUM_GROUP_DIALOG_H
|
||||
|
||||
#include "GxsGroupDialog.h"
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
|
||||
class GxsForumGroupDialog : public GxsGroupDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
GxsForumGroupDialog(const RsGxsForumGroup &group, QWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -285,6 +285,9 @@ void GxsGroupDialog::submitGroup()
|
||||
|
||||
void GxsGroupDialog::createGroup()
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::createGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QString name = misc::removeNewLine(ui.groupName->text());
|
||||
uint32_t flags = 0;
|
||||
|
||||
|
@ -24,12 +24,39 @@
|
||||
#include <retroshare/rswiki.h>
|
||||
#include <iostream>
|
||||
|
||||
const uint32_t WikiCreateEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
GXS_GROUP_FLAGS_SHAREKEYS |
|
||||
// GXS_GROUP_FLAGS_PERSONALSIGN |
|
||||
// GXS_GROUP_FLAGS_COMMENTS |
|
||||
0);
|
||||
|
||||
uint32_t WikiCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_GROUP |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_LOCAL |
|
||||
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_GPG |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_COMMENTS_YES |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
|
||||
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, parent, GXS_GROUP_DIALOG_CREATE_MODE)
|
||||
:GxsGroupDialog(tokenQueue, WikiCreateEnabledFlags, WikiCreateDefaultsFlags, parent)
|
||||
{
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
#if 0
|
||||
uint32_t enabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
@ -60,12 +87,15 @@ WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
|
||||
//setFlags(enabledFlags, readonlyFlags, defaultsFlags);
|
||||
setFlags(enabledFlags, defaultsFlags);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent)
|
||||
:GxsGroupDialog(NULL, parent, GXS_GROUP_DIALOG_SHOW_MODE)
|
||||
:GxsGroupDialog(collection.mMeta, GXS_GROUP_DIALOG_SHOW_MODE, parent)
|
||||
|
||||
{
|
||||
#if 0
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
@ -84,6 +114,7 @@ WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *pa
|
||||
0);
|
||||
|
||||
setFlags(enabledFlags, defaultsFlags);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -94,48 +125,12 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
|
||||
RsWikiCollection grp;
|
||||
grp.mMeta = meta;
|
||||
//grp.mDescription = std::string(desc.toUtf8());
|
||||
std::cerr << "WikiGroupDialog::service_CreateGroup() storing to Queue";
|
||||
std::cerr << std::endl;
|
||||
|
||||
rsWiki->submitCollection(token, grp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QPixmap WikiGroupDialog::service_getLogo()
|
||||
{
|
||||
return QPixmap(); // null pixmap
|
||||
}
|
||||
|
||||
QString WikiGroupDialog::service_getDescription()
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
RsGroupMetaData WikiGroupDialog::service_getMeta()
|
||||
{
|
||||
return mGrp.mMeta;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void WikiGroupDialog::service_loadExistingGroup(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiGroupDialog::service_loadExistingGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWikiCollection group;
|
||||
if (!rsWiki->getGroupData(token, group))
|
||||
{
|
||||
std::cerr << "WikiGroupDialog::service_loadExistingGroup() ERROR Getting Group";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* must call metadata loader */
|
||||
loadExistingGroupMetaData(group.mMeta);
|
||||
|
||||
/* now load any extra data we feel like */
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -36,11 +36,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
virtual QPixmap service_getLogo();
|
||||
virtual QString service_getDescription();
|
||||
virtual RsGroupMetaData service_getMeta();
|
||||
|
||||
//virtual void service_loadExistingGroup(const uint32_t &token);
|
||||
|
||||
private:
|
||||
|
||||
|
234
retroshare-gui/src/gui/gxsforums/CreateGxsForum.cpp
Normal file
234
retroshare-gui/src/gui/gxsforums/CreateGxsForum.cpp
Normal file
@ -0,0 +1,234 @@
|
||||
/****************************************************************
|
||||
* 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 <QMessageBox>
|
||||
|
||||
#include "util/misc.h"
|
||||
#include "CreateGxsForum.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define CREATEGXSFORUMS_NEWFORUMID 1
|
||||
|
||||
|
||||
/** Constructor */
|
||||
CreateGxsForum::CreateGxsForum(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
|
||||
|
||||
// connect up the buttons.
|
||||
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelForum( ) ) );
|
||||
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createForum( ) ) );
|
||||
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
||||
|
||||
if (!ui.pubKeyShare_cb->isChecked()) {
|
||||
ui.contactsdockWidget->hide();
|
||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||
}
|
||||
|
||||
/* initialize key share list */
|
||||
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
||||
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||
ui.keyShareList->start();
|
||||
|
||||
newForum();
|
||||
}
|
||||
|
||||
void CreateGxsForum::newForum()
|
||||
{
|
||||
/* enforce Public for the moment */
|
||||
ui.typePublic->setChecked(true);
|
||||
|
||||
ui.typePrivate->setEnabled(false);
|
||||
ui.typeEncrypted->setEnabled(true);
|
||||
|
||||
#ifdef RS_RELEASE_VERSION
|
||||
ui.typePrivate->setVisible(false);
|
||||
ui.typeEncrypted->setVisible(true);
|
||||
#endif
|
||||
|
||||
ui.msgAnon->setChecked(true);
|
||||
//ui.msgAuth->setEnabled(false);
|
||||
|
||||
ui.forumName->clear();
|
||||
ui.forumDesc->clear();
|
||||
|
||||
ui.forumName->setFocus();
|
||||
}
|
||||
|
||||
void CreateGxsForum::createForum()
|
||||
{
|
||||
QString name = misc::removeNewLine(ui.forumName->text());
|
||||
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
||||
uint32_t flags = 0;
|
||||
|
||||
if(name.isEmpty()) {
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return; //Don't add a empty name!!
|
||||
}
|
||||
|
||||
#ifdef TOGXS
|
||||
if (ui.typePublic->isChecked()) {
|
||||
flags |= RS_DISTRIB_PUBLIC;
|
||||
} else if (ui.typePrivate->isChecked()) {
|
||||
flags |= RS_DISTRIB_PRIVATE;
|
||||
} else if (ui.typeEncrypted->isChecked()) {
|
||||
flags |= RS_DISTRIB_ENCRYPTED;
|
||||
}
|
||||
|
||||
if (ui.msgAuth->isChecked()) {
|
||||
flags |= RS_DISTRIB_AUTHEN_REQ;
|
||||
} else if (ui.msgAnon->isChecked()) {
|
||||
flags |= RS_DISTRIB_AUTHEN_ANON;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rsGxsForums) {
|
||||
|
||||
|
||||
uint32_t token;
|
||||
RsGxsForumGroup grp;
|
||||
grp.mMeta.mGroupName = std::string(name.toUtf8());
|
||||
grp.mDescription = std::string(desc.toUtf8());
|
||||
grp.mMeta.mGroupFlags = flags;
|
||||
|
||||
rsGxsForums->createGroup(token, grp);
|
||||
|
||||
// get the Queue to handle response.
|
||||
mForumQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_SUMMARY, CREATEGXSFORUMS_NEWFORUMID);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CreateGxsForum::completeCreateNewForum(const RsGroupMetaData &newForumMeta)
|
||||
{
|
||||
sendShareList(newForumMeta.mGroupId);
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsForum::sendShareList(std::string forumId)
|
||||
{
|
||||
if (!rsGxsForums)
|
||||
{
|
||||
std::cerr << "CreateGxsForum::sendShareList() GxsForums not active";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui.pubKeyShare_cb->isChecked())
|
||||
{
|
||||
std::list<std::string> shareList;
|
||||
ui.keyShareList->selectedSslIds(shareList, false);
|
||||
#ifdef TOGXS
|
||||
rsGxsForums->groupShareKeys(forumId, shareList);
|
||||
#endif
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForum::setShareList()
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
void CreateGxsForum::cancelForum()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForum::loadNewForumId(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "CreateGxsForum::loadNewForumId()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
rsGxsForums->getGroupSummary(token, groupInfo);
|
||||
|
||||
if (groupInfo.size() == 1)
|
||||
{
|
||||
RsGroupMetaData fi = groupInfo.front();
|
||||
completeCreateNewForum(fi);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "CreateGxsForum::loadNewForumId() ERROR INVALID Number of Forums Created";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForum::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "CreateGxsForum::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mForumQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
|
||||
case CREATEGXSFORUMS_NEWFORUMID:
|
||||
loadNewForumId(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "CreateGxsForum::loadRequest() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
67
retroshare-gui/src/gui/gxsforums/CreateGxsForum.h
Normal file
67
retroshare-gui/src/gui/gxsforums/CreateGxsForum.h
Normal file
@ -0,0 +1,67 @@
|
||||
/****************************************************************
|
||||
* 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 _CREATE_GXSFORUM_DIALOG_H
|
||||
#define _CREATE_GXSFORUM_DIALOG_H
|
||||
|
||||
#include "ui_CreateGxsForum.h"
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
class CreateGxsForum : public QDialog, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateGxsForum(QWidget *parent = 0);
|
||||
|
||||
void newForum(); /* cleanup */
|
||||
|
||||
// Callback for all Loads.
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private slots:
|
||||
/* actions to take.... */
|
||||
void createForum();
|
||||
void cancelForum();
|
||||
|
||||
// set private forum key share list
|
||||
void setShareList();
|
||||
|
||||
private:
|
||||
void sendShareList(std::string forumId);
|
||||
void completeCreateNewForum(const RsGroupMetaData &newForumMeta);
|
||||
void loadNewForumId(const uint32_t &token);
|
||||
|
||||
|
||||
std::list<std::string> mShareList;
|
||||
|
||||
QPixmap picture;
|
||||
|
||||
TokenQueue *mForumQueue;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateGxsForum ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
374
retroshare-gui/src/gui/gxsforums/CreateGxsForum.ui
Normal file
374
retroshare-gui/src/gui/gxsforums/CreateGxsForum.ui
Normal file
@ -0,0 +1,374 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateGxsForum</class>
|
||||
<widget class="QDialog" name="CreateGxsForum">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>672</width>
|
||||
<height>495</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create new Forum</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame_2{background-image: url(:/images/connect/connectFriendBanner.png);}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelicon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/konversation64.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabelcreatforums">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;">New Forum</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="forumName"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="3" rowspan="6">
|
||||
<widget class="QDockWidget" name="contactsdockWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>524287</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>check peers you would like to share private publish key with</string>
|
||||
</property>
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Share Key With</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>4</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="forumDesc"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="tyoeGroupBox">
|
||||
<property name="title">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="typePublic">
|
||||
<property name="text">
|
||||
<string>Public - Anyone can read and publish (Shared Publish Key)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="typePrivate">
|
||||
<property name="text">
|
||||
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="typeEncrypted">
|
||||
<property name="text">
|
||||
<string>Private - (Private Publish Key required to view Messages)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="msgGroupBox_2">
|
||||
<property name="title">
|
||||
<string>Key Sharing</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pubKeyShare_cb">
|
||||
<property name="toolTip">
|
||||
<string>Key recipients can publish to restricted-type channels, and can view and publish for private-type channels</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share Private Publish Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="msgGroupBox">
|
||||
<property name="title">
|
||||
<string>Allowed Messages</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="msgAuth">
|
||||
<property name="text">
|
||||
<string>Authenticated Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="msgAnon">
|
||||
<property name="text">
|
||||
<string>Anonymous Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>238</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="createButton">
|
||||
<property name="text">
|
||||
<string>Create</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>FriendSelectionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/common/FriendSelectionWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
442
retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp
Normal file
442
retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp
Normal file
@ -0,0 +1,442 @@
|
||||
/****************************************************************
|
||||
* 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 "CreateGxsForumMsg.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDropEvent>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/common/Emoticons.h"
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#define CREATEGXSFORUMMSG_FORUMINFO 1
|
||||
#define CREATEGXSFORUMMSG_PARENTMSG 2
|
||||
|
||||
|
||||
/** Constructor */
|
||||
CreateGxsForumMsg::CreateGxsForumMsg(std::string fId, std::string pId)
|
||||
: QMainWindow(NULL), mForumId(fId), mParentId(pId)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/* Setup Queue */
|
||||
mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
|
||||
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||
|
||||
// connect up the buttons.
|
||||
connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) );
|
||||
connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) );
|
||||
connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
|
||||
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
|
||||
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
|
||||
|
||||
setAcceptDrops(true);
|
||||
ui.hashBox->setDropWidget(this);
|
||||
ui.hashBox->setAutoHide(false);
|
||||
|
||||
mParentMsgLoaded = false;
|
||||
mForumMetaLoaded = false;
|
||||
|
||||
newMsg();
|
||||
}
|
||||
|
||||
/** context menu searchTablewidget2 **/
|
||||
void CreateGxsForumMsg::forumMessageCostumPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu();
|
||||
|
||||
contextMnu->addSeparator();
|
||||
QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
|
||||
QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
|
||||
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste own certificate link"), this, SLOT(pasteOwnCertificateLink()));
|
||||
|
||||
if (RSLinkClipboard::empty()) {
|
||||
pasteLinkAct->setDisabled (true);
|
||||
pasteLinkFullAct->setDisabled (true);
|
||||
}
|
||||
|
||||
contextMnu->exec(QCursor::pos());
|
||||
delete(contextMnu);
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::newMsg()
|
||||
{
|
||||
/* clear all */
|
||||
mParentMsgLoaded = false;
|
||||
mForumMetaLoaded = false;
|
||||
|
||||
/* request Data */
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
|
||||
std::list<std::string> groupIds;
|
||||
groupIds.push_back(mForumId);
|
||||
|
||||
std::cerr << "ForumsV2Dialog::newMsg() Requesting Group Summary(" << mForumId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
|
||||
|
||||
}
|
||||
|
||||
if (mParentId != "")
|
||||
{
|
||||
|
||||
RsTokReqOptions opts;
|
||||
|
||||
std::list<std::string> msgIds;
|
||||
msgIds.push_back(mParentId);
|
||||
|
||||
std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
#ifdef TOGXS
|
||||
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsForumMsg::saveForumInfo(const RsGroupMetaData &meta)
|
||||
{
|
||||
mForumMeta = meta;
|
||||
mForumMetaLoaded = true;
|
||||
|
||||
loadFormInformation();
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::saveParentMsg(const RsGxsForumMsg &msg)
|
||||
{
|
||||
mParentMsg = msg;
|
||||
mParentMsgLoaded = true;
|
||||
|
||||
loadFormInformation();
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::loadFormInformation()
|
||||
{
|
||||
if ((!mParentMsgLoaded) && (mParentId != ""))
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadMsgInformation() ParentMsg not Loaded Yet";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mForumMetaLoaded)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadMsgInformation() ForumMeta not Loaded Yet";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "CreateGxsForumMsg::loadMsgInformation() Data Available!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
|
||||
QString subj;
|
||||
if (mParentId != "")
|
||||
{
|
||||
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
|
||||
name += " " + tr("In Reply to") + ": ";
|
||||
name += title;
|
||||
|
||||
QString text = title;
|
||||
|
||||
if (text.startsWith("Re:", Qt::CaseInsensitive))
|
||||
{
|
||||
subj = title;
|
||||
}
|
||||
else
|
||||
{
|
||||
subj = "Re: " + title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ui.forumName->setText(misc::removeNewLine(name));
|
||||
ui.forumSubject->setText(misc::removeNewLine(subj));
|
||||
|
||||
if (!ui.forumSubject->text().isEmpty())
|
||||
{
|
||||
ui.forumMessage->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.forumSubject->setFocus();
|
||||
}
|
||||
|
||||
#ifdef TOGXS
|
||||
if (mForumMeta.mGroupFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
#else
|
||||
if (1)
|
||||
#endif
|
||||
{
|
||||
ui.signBox->setChecked(true);
|
||||
ui.signBox->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Uncheck sign box by default for anonymous forums */
|
||||
ui.signBox->setChecked(false);
|
||||
ui.signBox->setEnabled(true);
|
||||
}
|
||||
|
||||
ui.forumMessage->setText("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::createMsg()
|
||||
{
|
||||
QString name = misc::removeNewLine(ui.forumSubject->text());
|
||||
QString desc = ui.forumMessage->toHtml();
|
||||
|
||||
if(desc == QTextDocument(ui.forumMessage->toPlainText()).toHtml())
|
||||
desc = ui.forumMessage->toPlainText() ;
|
||||
|
||||
if(name.isEmpty())
|
||||
{ /* error message */
|
||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return; //Don't add a empty Subject!!
|
||||
}
|
||||
|
||||
RsGxsForumMsg msg;
|
||||
msg.mMeta.mGroupId = mForumId;
|
||||
msg.mMeta.mParentId = mParentId;
|
||||
msg.mMeta.mMsgId = "";
|
||||
if (mParentMsgLoaded)
|
||||
{
|
||||
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
||||
}
|
||||
|
||||
msg.mMeta.mMsgName = std::string(name.toUtf8());
|
||||
msg.mMsg = std::string(desc.toUtf8());
|
||||
#ifdef TOGXS
|
||||
msg.mMeta.mMsgFlags = RS_DISTRIB_AUTHEN_REQ;
|
||||
#endif
|
||||
|
||||
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
|
||||
return; /* do nothing */
|
||||
|
||||
uint32_t token;
|
||||
rsGxsForums->createMsg(token, msg);
|
||||
close();
|
||||
|
||||
|
||||
// Previous Info - for reference.
|
||||
|
||||
//ForumMsgInfo msgInfo;
|
||||
|
||||
//msgInfo.forumId = mForumId;
|
||||
//msgInfo.threadId = "";
|
||||
//msgInfo.parentId = mParentId;
|
||||
//msgInfo.msgId = "";
|
||||
|
||||
//msgInfo.title = name.toStdWString();
|
||||
//msgInfo.msg = desc.toStdWString();
|
||||
//msgInfo.msgflags = 0;
|
||||
|
||||
//if (ui.signBox->isChecked())
|
||||
//{
|
||||
// msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
|
||||
//}
|
||||
|
||||
//if ((msgInfo.msg == L"") && (msgInfo.title == L""))
|
||||
// return; /* do nothing */
|
||||
|
||||
//if (rsForumsV2->ForumMessageSend(msgInfo) == true) {
|
||||
// close();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::closeEvent (QCloseEvent * /*event*/)
|
||||
{
|
||||
Settings->saveWidgetInformation(this);
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::cancelMsg()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::smileyWidgetForums()
|
||||
{
|
||||
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::addSmileys()
|
||||
{
|
||||
ui.forumMessage->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::addFile()
|
||||
{
|
||||
QStringList files;
|
||||
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
|
||||
ui.hashBox->addAttachments(files);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::fileHashingFinished() started." << std::endl;
|
||||
|
||||
QString mesgString;
|
||||
|
||||
QList<HashedFile>::iterator it;
|
||||
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
|
||||
HashedFile& hashedFile = *it;
|
||||
RetroShareLink link;
|
||||
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
|
||||
mesgString += link.toHtmlSize() + "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "CreateGxsForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
if (!mesgString.isEmpty()) {
|
||||
ui.forumMessage->textCursor().insertHtml(mesgString);
|
||||
}
|
||||
|
||||
ui.forumMessage->setFocus( Qt::OtherFocusReason );
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::pasteLink()
|
||||
{
|
||||
ui.forumMessage->insertHtml(RSLinkClipboard::toHtml()) ;
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::pasteLinkFull()
|
||||
{
|
||||
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::pasteOwnCertificateLink()
|
||||
{
|
||||
RetroShareLink link ;
|
||||
std::string ownId = rsPeers->getOwnId() ;
|
||||
if( link.createCertificate(ownId) ) {
|
||||
ui.forumMessage->insertHtml(link.toHtml() + " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadForumInfo()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
rsGxsForums->getGroupSummary(token, groupInfo);
|
||||
|
||||
if (groupInfo.size() == 1)
|
||||
{
|
||||
RsGroupMetaData fi = groupInfo.front();
|
||||
saveForumInfo(fi);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadForumInfo() ERROR INVALID Number of Forums";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsForumMsg::loadParentMsg(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadParentMsg()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// Only grab one.... ignore more (shouldn't be any).
|
||||
std::vector<RsGxsForumMsg> msgs;
|
||||
if (rsGxsForums->getMsgData(token, msgs))
|
||||
{
|
||||
if (msgs.size() != 1)
|
||||
{
|
||||
/* error */
|
||||
std::cerr << "CreateGxsForumMsg::loadParentMsg() ERROR wrong number of msgs";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
}
|
||||
saveParentMsg(msgs[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "CreateGxsForum::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mForumQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case CREATEGXSFORUMMSG_FORUMINFO:
|
||||
loadForumInfo(req.mToken);
|
||||
break;
|
||||
|
||||
case CREATEGXSFORUMMSG_PARENTMSG:
|
||||
loadParentMsg(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "CreateGxsForum::loadRequest() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
86
retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h
Normal file
86
retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h
Normal file
@ -0,0 +1,86 @@
|
||||
/****************************************************************
|
||||
* 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 _CREATE_GXSFORUM_MSG_DIALOG_H
|
||||
#define _CREATE_GXSFORUM_MSG_DIALOG_H
|
||||
|
||||
#include "ui_CreateGxsForumMsg.h"
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
|
||||
|
||||
class CreateGxsForumMsg : public QMainWindow, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateGxsForumMsg(std::string fId, std::string pId);
|
||||
|
||||
void newMsg(); /* cleanup */
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void forumMessageCostumPopupMenu( QPoint point );
|
||||
|
||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||
/* actions to take.... */
|
||||
void createMsg();
|
||||
void cancelMsg();
|
||||
void pasteLink();
|
||||
void pasteLinkFull();
|
||||
void pasteOwnCertificateLink();
|
||||
|
||||
void smileyWidgetForums();
|
||||
void addSmileys();
|
||||
void addFile();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private:
|
||||
|
||||
void saveForumInfo(const RsGroupMetaData &meta);
|
||||
void saveParentMsg(const RsGxsForumMsg &msg);
|
||||
void loadFormInformation();
|
||||
|
||||
void loadForumInfo(const uint32_t &token);
|
||||
void loadParentMsg(const uint32_t &token);
|
||||
|
||||
std::string mForumId;
|
||||
std::string mParentId;
|
||||
|
||||
bool mParentMsgLoaded;
|
||||
bool mForumMetaLoaded;
|
||||
RsGxsForumMsg mParentMsg;
|
||||
RsGroupMetaData mForumMeta;
|
||||
|
||||
TokenQueue *mForumQueue;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateGxsForumMsg ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
333
retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.ui
Normal file
333
retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.ui
Normal file
@ -0,0 +1,333 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateGxsForumMsg</class>
|
||||
<widget class="QMainWindow" name="CreateGxsForumMsg">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>482</width>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Post Forum Message</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png)}</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame_4">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="forumName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Subject</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="forumSubject"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>38</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame_2{
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
|
||||
border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="attachFileButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Attach File</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="emoticonButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="signBox">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sign Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/pgp.png</normaloff>:/images/pgp.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pastersButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Paste RetroShare Link</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Forum Post</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="forumMessage">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Attach files via drag and drop</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="HashBox" name="hashBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>You can attach files via drag and drop here in this window</string>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string notr="true">toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="postmessage_action"/>
|
||||
<addaction name="close_action"/>
|
||||
</widget>
|
||||
<action name="postmessage_action">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_send24.png</normaloff>:/images/mail_send24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Post Forum Msg</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="close_action">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/button_cancel.png</normaloff>:/images/button_cancel.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>HashBox</class>
|
||||
<extends>QScrollArea</extends>
|
||||
<header location="global">gui/common/HashBox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
89
retroshare-gui/src/gui/gxsforums/EditGxsForumDetails.cpp
Normal file
89
retroshare-gui/src/gui/gxsforums/EditGxsForumDetails.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2010 RetroShare Team
|
||||
*
|
||||
* 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 "EditGxsForumDetails.h"
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
/** Default constructor */
|
||||
EditGxsForumDetails::EditGxsForumDetails(std::string forumId, QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags), m_forumId(forumId)
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
|
||||
|
||||
loadForum();
|
||||
}
|
||||
|
||||
void EditGxsForumDetails::loadForum()
|
||||
{
|
||||
if (!rsGxsForums) {
|
||||
return;
|
||||
}
|
||||
|
||||
#warning "EditGxsForumDetails incomplete"
|
||||
#if 0
|
||||
ForumInfo info;
|
||||
rsGxsForums->getForumInfo(m_forumId, info);
|
||||
|
||||
// set name
|
||||
ui.nameline->setText(QString::fromStdWString(info.forumName));
|
||||
|
||||
// set description
|
||||
ui.DescriptiontextEdit->setText(QString::fromStdWString(info.forumDesc));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void EditGxsForumDetails::applyDialog()
|
||||
{
|
||||
if (!rsGxsForums) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if text boxes have not been edited leave alone
|
||||
if (!ui.nameline->isModified() && !ui.DescriptiontextEdit->document()->isModified()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#warning "EditGxsForumDetails incomplete"
|
||||
#if 0
|
||||
|
||||
ForumInfo info;
|
||||
|
||||
info.forumName = misc::removeNewLine(ui.nameline->text()).toStdWString();
|
||||
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
||||
|
||||
rsGxsForums->setForumInfo(m_forumId, info);
|
||||
#endif
|
||||
|
||||
/* close the Dialog after the Changes applied */
|
||||
close();
|
||||
}
|
53
retroshare-gui/src/gui/gxsforums/EditGxsForumDetails.h
Normal file
53
retroshare-gui/src/gui/gxsforums/EditGxsForumDetails.h
Normal file
@ -0,0 +1,53 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2010 RetroShare Team
|
||||
*
|
||||
* 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 _EDITGXSFORUMDETAILS_H
|
||||
#define _EDITGXSFORUMDETAILS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_EditGxsForumDetails.h"
|
||||
|
||||
class EditGxsForumDetails : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default constructor */
|
||||
EditGxsForumDetails(std::string forumId = "", QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
|
||||
signals:
|
||||
void configChanged();
|
||||
|
||||
private slots:
|
||||
void applyDialog();
|
||||
|
||||
private:
|
||||
void loadForum();
|
||||
|
||||
std::string m_forumId;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::EditGxsForumDetails ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
130
retroshare-gui/src/gui/gxsforums/EditGxsForumDetails.ui
Normal file
130
retroshare-gui/src/gui/gxsforums/EditGxsForumDetails.ui
Normal file
@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditGxsForumDetails</class>
|
||||
<widget class="QDialog" name="EditGxsForumDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>355</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Forum Details</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="stabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Edit Forum Details</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Forum Info</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Forum Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="nameline"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Forum Description</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="DescriptiontextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>EditForumDetails</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>307</x>
|
||||
<y>333</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>217</x>
|
||||
<y>177</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
146
retroshare-gui/src/gui/gxsforums/GxsForumDetails.cpp
Normal file
146
retroshare-gui/src/gui/gxsforums/GxsForumDetails.cpp
Normal file
@ -0,0 +1,146 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009 RetroShare Team
|
||||
*
|
||||
* 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 "GxsForumDetails.h"
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsdisc.h>
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
/** Default constructor */
|
||||
GxsForumDetails::GxsForumDetails(QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
|
||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg()));
|
||||
|
||||
ui.applyButton->setToolTip(tr("Apply and Close"));
|
||||
|
||||
ui.nameline ->setReadOnly(true);
|
||||
ui.popline ->setReadOnly(true);
|
||||
ui.postline ->setReadOnly(true);
|
||||
ui.IDline ->setReadOnly(true);
|
||||
ui.DescriptiontextEdit ->setReadOnly(true);
|
||||
|
||||
ui.radioButton_authd->setEnabled(false);
|
||||
ui.radioButton_anonymous->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Overloads the default show() slot so we can set opacity*/
|
||||
|
||||
void
|
||||
GxsForumDetails::show()
|
||||
{
|
||||
//loadSettings();
|
||||
if(!this->isVisible()) {
|
||||
QDialog::show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumDetails::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void GxsForumDetails::closeinfodlg()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void GxsForumDetails::showDetails(std::string mCurrForumId)
|
||||
{
|
||||
fId = mCurrForumId;
|
||||
loadDialog();
|
||||
}
|
||||
|
||||
void GxsForumDetails::loadDialog()
|
||||
{
|
||||
if (!rsGxsForums)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#warning "GxsForumDetails Incomplete"
|
||||
#if 0
|
||||
ForumInfo fi;
|
||||
rsGxsForums->getForumInfo(fId, fi);
|
||||
|
||||
// Set Forum Name
|
||||
ui.nameline->setText(QString::fromStdWString(fi.forumName));
|
||||
|
||||
// Set Popularity
|
||||
ui.popline->setText(QString::number(fi.pop));
|
||||
|
||||
// Set Last Post Date
|
||||
if (fi.lastPost) {
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(fi.lastPost);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
ui.postline->setText(timestamp);
|
||||
}
|
||||
|
||||
// Set Forum ID
|
||||
ui.IDline->setText(QString::fromStdString(fi.forumId));
|
||||
|
||||
// Set Forum Description
|
||||
ui.DescriptiontextEdit->setText(QString::fromStdWString(fi.forumDesc));
|
||||
|
||||
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
{
|
||||
ui.radioButton_authd->setChecked(true);
|
||||
ui.radioButton_anonymous->setChecked(false);
|
||||
}
|
||||
if (fi.forumFlags & RS_DISTRIB_AUTHEN_ANON)
|
||||
{
|
||||
ui.radioButton_authd->setChecked(false);
|
||||
ui.radioButton_anonymous->setChecked(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GxsForumDetails::applyDialog()
|
||||
{
|
||||
|
||||
/* reload now */
|
||||
loadDialog();
|
||||
|
||||
/* close the Dialog after the Changes applied */
|
||||
closeinfodlg();
|
||||
|
||||
}
|
67
retroshare-gui/src/gui/gxsforums/GxsForumDetails.h
Normal file
67
retroshare-gui/src/gui/gxsforums/GxsForumDetails.h
Normal file
@ -0,0 +1,67 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009 RetroShare Team
|
||||
*
|
||||
* 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 _GXSFORUMDETAILS_H
|
||||
#define _GXSFORUMDETAILS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_GxsForumDetails.h"
|
||||
|
||||
class GxsForumDetails : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/** Default constructor */
|
||||
GxsForumDetails(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default destructor */
|
||||
|
||||
void showDetails(std::string mCurrForumId);
|
||||
|
||||
signals:
|
||||
void configChanged() ;
|
||||
|
||||
public slots:
|
||||
/** Overloaded QWidget.show */
|
||||
void show();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private slots:
|
||||
|
||||
void closeinfodlg();
|
||||
void applyDialog();
|
||||
|
||||
private:
|
||||
|
||||
void loadDialog();
|
||||
|
||||
std::string fId;
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsForumDetails ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
201
retroshare-gui/src/gui/gxsforums/GxsForumDetails.ui
Normal file
201
retroshare-gui/src/gui/gxsforums/GxsForumDetails.ui
Normal file
@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GxsForumDetails</class>
|
||||
<widget class="QDialog" name="GxsForumDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>355</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Forum Details</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="stabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Forum Details</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Forum Info</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Forum Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="nameline"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Popularity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="popline">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Last Post</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="postline">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Forum ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="IDline"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Forum Description</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="DescriptiontextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Seite">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/encrypted22.png</normaloff>:/images/encrypted22.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Security</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Allowed Messages</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_authd">
|
||||
<property name="text">
|
||||
<string>Authenticated Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_anonymous">
|
||||
<property name="text">
|
||||
<string>Anonymous Messages</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>358</width>
|
||||
<height>172</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -30,12 +30,11 @@
|
||||
#include "gui/PhotoShare/PhotoShare.h"
|
||||
#include "gui/WikiPoos/WikiDialog.h"
|
||||
#include "gui/Posted/PostedDialog.h"
|
||||
#include "gui/GxsForumsDialog.h"
|
||||
|
||||
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
||||
#if USE_VEG_SERVICE
|
||||
#include "gui/TheWire/WireDialog.h"
|
||||
#include "gui/ForumsV2Dialog.h"
|
||||
|
||||
#endif
|
||||
|
||||
//#include "GamesDialog.h"
|
||||
@ -54,7 +53,7 @@
|
||||
#define IMAGE_CALENDAR ":/images/calendar.png"
|
||||
#define IMAGE_LIBRARY ":/images/library.png"
|
||||
#define IMAGE_PLUGINS ":/images/extension_32.png"
|
||||
#define IMAGE_FORUMSV2 ":/images/konversation.png"
|
||||
#define IMAGE_GXSFORUMS ":/images/konversation.png"
|
||||
|
||||
/** Constructor */
|
||||
ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
@ -97,9 +96,13 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_LIBRARY), tr("Posted Links"), grp));
|
||||
|
||||
// WikiDialog *wikiDialog = NULL;
|
||||
// ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
||||
// createPageAction(QIcon(IMAGE_LIBRARY), tr("Wiki Pages"), grp));
|
||||
WikiDialog *wikiDialog = NULL;
|
||||
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_LIBRARY), tr("Wiki Pages"), grp));
|
||||
|
||||
GxsForumsDialog *gxsforumsDialog = NULL;
|
||||
ui.stackPages->add(gxsforumsDialog = new GxsForumsDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_GXSFORUMS), tr("GxsForums"), grp));
|
||||
|
||||
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
||||
#if USE_VEG_SERVICE
|
||||
@ -107,11 +110,6 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.stackPages->add(wireDialog = new WireDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_BWGRAPH), tr("The Wire"), grp));
|
||||
|
||||
ForumsV2Dialog *forumsV2Dialog = NULL;
|
||||
ui.stackPages->add(forumsV2Dialog = new ForumsV2Dialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_FORUMSV2), tr("ForumsV2"), grp));
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* Create the toolbar */
|
||||
|
@ -67,10 +67,9 @@ bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokRe
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair &msgId, uint32_t usertype)
|
||||
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair &msgId, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST; // always a list answer
|
||||
mService->requestMsgRelatedInfo(token, anstype, opts, msgId);
|
||||
queueRequest(token, basictype, anstype, usertype);
|
||||
|
||||
@ -125,21 +124,39 @@ void TokenQueue::pollRequests()
|
||||
{
|
||||
double pollPeriod = 1.0; // max poll period.
|
||||
|
||||
TokenRequest req;
|
||||
|
||||
if(mRequests.size() > 0){
|
||||
req = mRequests.front();
|
||||
}else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (mRequests.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TokenRequest req;
|
||||
req = mRequests.front();
|
||||
mRequests.pop_front();
|
||||
|
||||
if (checkForRequest(req.mToken))
|
||||
{
|
||||
/* clean it up and handle */
|
||||
loadRequest(req);
|
||||
mRequests.pop_front();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#define MAX_REQUEST_AGE 30
|
||||
|
||||
/* drop old requests too */
|
||||
if (time(NULL) - req.mRequestTs.tv_sec < MAX_REQUEST_AGE)
|
||||
{
|
||||
mRequests.push_back(req);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "TokenQueue::loadRequest(): ";
|
||||
std::cerr << "Dropping old Token: " << req.mToken << " Type: " << req.mType;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mRequests.size() > 0)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
const GxsMsgReq& grpIds, uint32_t usertype);
|
||||
|
||||
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair& msgId, uint32_t usertype);
|
||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair& msgId, uint32_t usertype);
|
||||
|
||||
bool cancelRequest(const uint32_t token);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user