mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Modified Identity & Wiki GXS code so that it compiles.
- Just commented out the issues - still needs to be converted to new system. - Included it in build - Not actually enabled in the GUI yet. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5750 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2fadb6d44d
commit
cfef2cc052
@ -2,9 +2,9 @@ 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 += identities
|
||||
#CONFIG += forumsv2
|
||||
CONFIG += posted
|
||||
CONFIG += unfinished
|
||||
@ -194,15 +194,15 @@ 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
|
||||
|
||||
# Chris version.
|
||||
LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
#PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
}
|
||||
|
||||
win32 {
|
||||
@ -1007,22 +1007,22 @@ posted {
|
||||
gxsgui {
|
||||
|
||||
HEADERS += gui/gxs/GxsGroupDialog.h \
|
||||
gui/gxs/GxsCommentTreeWidget.h
|
||||
# gui/gxs/ForumV2GroupDialog.h \
|
||||
# gui/gxs/WikiGroupDialog.h \
|
||||
gui/gxs/GxsCommentTreeWidget.h \
|
||||
gui/gxs/WikiGroupDialog.h \
|
||||
|
||||
# gui/gxs/ForumV2GroupDialog.h \
|
||||
# gui/gxs/GxsMsgDialog.h \
|
||||
|
||||
FORMS += gui/gxs/GxsGroupDialog.ui \
|
||||
|
||||
# gui/gxs/GxsMsgDialog.ui \
|
||||
# gui/gxs/GxsCommentTreeWidget.ui \
|
||||
|
||||
SOURCES += gui/gxs/GxsGroupDialog.cpp \
|
||||
gui/gxs/GxsCommentTreeWidget.cpp
|
||||
#gui/gxs/ForumV2GroupDialog.cpp \
|
||||
# gui/gxs/WikiGroupDialog.cpp \
|
||||
#
|
||||
gui/gxs/GxsCommentTreeWidget.cpp \
|
||||
gui/gxs/WikiGroupDialog.cpp \
|
||||
|
||||
#gui/gxs/ForumV2GroupDialog.cpp \
|
||||
# gui/gxs/GxsMsgDialog.cpp \
|
||||
|
||||
|
||||
|
@ -79,8 +79,9 @@ IdDialog::IdDialog(QWidget *parent)
|
||||
timer->start(1000);
|
||||
|
||||
rsIdentity->generateDummyData();
|
||||
|
||||
#if 0
|
||||
mIdQueue = new TokenQueue(rsIdentity, this);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -145,8 +146,10 @@ void IdDialog::requestIdDetails(std::string &id)
|
||||
void IdDialog::insertIdDetails(uint32_t token)
|
||||
{
|
||||
/* get details from libretroshare */
|
||||
RsIdGroup data;
|
||||
RsGxsIdGroup data;
|
||||
#if 0
|
||||
if (!rsIdentity->getGroupData(token, data))
|
||||
#endif
|
||||
{
|
||||
ui.lineEdit_KeyId->setText("ERROR GETTING KEY!");
|
||||
return;
|
||||
@ -287,8 +290,12 @@ void IdDialog::insertIdList(uint32_t token)
|
||||
|
||||
//for(it = ids.begin(); it != ids.end(); it++)
|
||||
//{
|
||||
RsIdGroup data;
|
||||
RsGxsIdGroup data;
|
||||
#if 0
|
||||
while(rsIdentity->getGroupData(token, data))
|
||||
#else
|
||||
while(0)
|
||||
#endif
|
||||
{
|
||||
|
||||
/* do filtering */
|
||||
|
@ -41,8 +41,9 @@ IdEditDialog::IdEditDialog(QWidget *parent)
|
||||
connect(ui.radioButton_Pseudo, SIGNAL( toggled( bool ) ), this, SLOT( IdTypeToggled( bool ) ) );
|
||||
connect(ui.pushButton_Update, SIGNAL( clicked( void ) ), this, SLOT( updateId( void ) ) );
|
||||
connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelId( void ) ) );
|
||||
|
||||
#if 0
|
||||
mIdQueue = new TokenQueue(rsIdentity, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void IdEditDialog::setupNewId(bool pseudo)
|
||||
@ -122,8 +123,10 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
||||
ui.radioButton_Pseudo->setEnabled(false);
|
||||
|
||||
/* get details from libretroshare */
|
||||
RsIdGroup data;
|
||||
RsGxsIdGroup data;
|
||||
#if 0
|
||||
if (!rsIdentity->getGroupData(token, data))
|
||||
#endif
|
||||
{
|
||||
ui.lineEdit_KeyId->setText("ERROR KEYID INVALID");
|
||||
ui.lineEdit_Nickname->setText("");
|
||||
@ -184,7 +187,7 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
||||
|
||||
void IdEditDialog::updateId()
|
||||
{
|
||||
RsIdGroup rid;
|
||||
RsGxsIdGroup rid;
|
||||
// Must set, Nickname, KeyId(if existing), mIdType, GpgId.
|
||||
|
||||
rid.mMeta.mGroupName = ui.lineEdit_Nickname->text().toStdString();
|
||||
|
@ -53,21 +53,26 @@ void WikiAddDialog::createGroup()
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
|
||||
#if 0
|
||||
group.mShareOptions.mShareType = 0;
|
||||
group.mShareOptions.mShareGroupId = "unknown";
|
||||
group.mShareOptions.mPublishKey = "unknown";
|
||||
group.mShareOptions.mCommentMode = 0;
|
||||
group.mShareOptions.mResizeMode = 0;
|
||||
#endif
|
||||
|
||||
group.mMeta.mGroupName = ui.lineEdit_Name->text().toStdString();
|
||||
group.mCategory = "Unknown";
|
||||
|
||||
uint32_t token;
|
||||
bool isNew = true;
|
||||
|
||||
#if 0
|
||||
// Don't worry about getting the response?
|
||||
rsWiki->createGroup(token, group, isNew);
|
||||
#endif
|
||||
|
||||
|
||||
clearDialog();
|
||||
|
@ -76,7 +76,9 @@ WikiDialog::WikiDialog(QWidget *parent)
|
||||
timer->start(1000);
|
||||
|
||||
/* setup TokenQueue */
|
||||
#if 0
|
||||
mWikiQueue = new TokenQueue(rsWiki, this);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -114,7 +116,7 @@ void WikiDialog::OpenOrShowAddPageDialog()
|
||||
std::cerr << std::endl;
|
||||
|
||||
#if 0
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
if (!rsWiki->getGroup(groupId, group))
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() Failed to Get Group";
|
||||
@ -154,8 +156,8 @@ void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
|
||||
void WikiDialog::newGroup()
|
||||
{
|
||||
WikiGroupDialog cf (this);
|
||||
cf.newGroup();
|
||||
WikiGroupDialog cf(mWikiQueue, this);
|
||||
//cf.newGroup();
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
@ -171,10 +173,9 @@ void WikiDialog::showGroupDetails()
|
||||
}
|
||||
|
||||
|
||||
WikiGroupDialog cf (this);
|
||||
cf.existingGroup(groupId, GXS_GROUP_DIALOG_SHOW_MODE);
|
||||
|
||||
cf.exec ();
|
||||
//RsWikiCollection collection;
|
||||
//WikiGroupDialog cf (collection, this);
|
||||
//cf.exec ();
|
||||
}
|
||||
|
||||
void WikiDialog::editGroupDetails()
|
||||
@ -188,10 +189,10 @@ void WikiDialog::editGroupDetails()
|
||||
}
|
||||
|
||||
|
||||
WikiGroupDialog cf (this);
|
||||
cf.existingGroup(groupId, GXS_GROUP_DIALOG_EDIT_MODE);
|
||||
//WikiGroupDialog cf (this);
|
||||
//cf.existingGroup(groupId, GXS_GROUP_DIALOG_EDIT_MODE);
|
||||
|
||||
cf.exec ();
|
||||
//cf.exec ();
|
||||
}
|
||||
|
||||
|
||||
@ -235,11 +236,11 @@ void WikiDialog::OpenOrShowEditDialog()
|
||||
}
|
||||
|
||||
#if 0
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
rsWiki->getGroup(groupId, group);
|
||||
mEditDialog->setGroup(group);
|
||||
|
||||
RsWikiPage page;
|
||||
RsWikiSnapshot page;
|
||||
rsWiki->getPage(realPageId, page);
|
||||
mEditDialog->setPreviousPage(page);
|
||||
#endif
|
||||
@ -297,7 +298,7 @@ void WikiDialog::modTreeChanged()
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::updateWikiPage(const RsWikiPage &page)
|
||||
void WikiDialog::updateWikiPage(const RsWikiSnapshot &page)
|
||||
{
|
||||
ui.textBrowser->setPlainText(QString::fromStdString(page.mPage));
|
||||
}
|
||||
@ -329,6 +330,7 @@ void WikiDialog::clearModsTree()
|
||||
#define WIKI_GROUP_COL_ORIGPAGEID 2
|
||||
|
||||
|
||||
// THIS WAS ALREADY COMMENTED OUT!!!
|
||||
#if 0
|
||||
#########################################################
|
||||
void WikiDialog::insertWikiGroups()
|
||||
@ -348,7 +350,7 @@ void WikiDialog::insertWikiGroups()
|
||||
for(it = groupIds.begin(); it != groupIds.end(); it++)
|
||||
{
|
||||
/* add a group Item */
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
rsWiki->getGroup(*it, group);
|
||||
|
||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem(NULL);
|
||||
@ -370,7 +372,7 @@ void WikiDialog::insertWikiGroups()
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* get newest page */
|
||||
RsWikiPage page;
|
||||
RsWikiSnapshot page;
|
||||
std::string latestPageId;
|
||||
if (!rsWiki->getLatestPage(*pit, latestPageId))
|
||||
{
|
||||
@ -506,7 +508,7 @@ void WikiDialog::insertModsForPage(std::string &origPageId)
|
||||
|
||||
for(it = pageIds.begin(); it != pageIds.end(); it++)
|
||||
{
|
||||
RsWikiPage page;
|
||||
RsWikiSnapshot page;
|
||||
rsWiki->getPage(*it, page);
|
||||
|
||||
QTreeWidgetItem *modItem = new QTreeWidgetItem(NULL);
|
||||
@ -589,7 +591,9 @@ 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)
|
||||
@ -602,8 +606,12 @@ void WikiDialog::loadGroupData(const uint32_t &token)
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
#if 0
|
||||
if (rsWiki->getGroupData(token, group))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
/* Add Widget, and request Pages */
|
||||
|
||||
@ -645,7 +653,11 @@ void WikiDialog::loadOriginalPages(const uint32_t &token)
|
||||
|
||||
/* 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;
|
||||
@ -666,7 +678,23 @@ void WikiDialog::requestLatestPages(const std::list<std::string> &msgIds)
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, msgIds, WIKIDIALOG_LISTING_LATESTPAGES);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
@ -674,7 +702,8 @@ void WikiDialog::loadLatestPages(const uint32_t &token)
|
||||
std::cerr << "WikiDialog::loadLatestPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> msgIds;
|
||||
//std::list<std::string> msgIds;
|
||||
GxsMsgIdResult msgIds;
|
||||
if (rsWiki->getMsgList(token, msgIds))
|
||||
{
|
||||
std::cerr << "WikiDialog::loadLatestPages() Loaded " << msgIds.size();
|
||||
@ -687,17 +716,22 @@ void WikiDialog::loadLatestPages(const uint32_t &token)
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsMessageId> list;
|
||||
convert_result_to_list(msgIds, list);
|
||||
|
||||
/* request actual data */
|
||||
requestPages(msgIds);
|
||||
//requestPages(list);
|
||||
|
||||
}
|
||||
|
||||
void WikiDialog::requestPages(const std::list<std::string> &msgIds)
|
||||
#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)
|
||||
{
|
||||
@ -708,56 +742,54 @@ void WikiDialog::loadPages(const uint32_t &token)
|
||||
|
||||
QTreeWidgetItem *groupItem = NULL;
|
||||
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
std::vector<RsWikiSnapshot>::iterator vit;
|
||||
if (!rsWiki->getSnapshots(token, snapshots))
|
||||
{
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsWikiPage page;
|
||||
if (rsWiki->getMsgData(token, page))
|
||||
{
|
||||
if (!groupItem)
|
||||
{
|
||||
/* find the entry */
|
||||
int itemCount = ui.treeWidget_Pages->topLevelItemCount();
|
||||
for (int nIndex = 0; nIndex < itemCount;)
|
||||
{
|
||||
QTreeWidgetItem *tmpItem = ui.treeWidget_Pages->topLevelItem(nIndex);
|
||||
std::string tmpid = tmpItem->data(WIKI_GROUP_COL_GROUPID,
|
||||
Qt::DisplayRole).toString().toStdString();
|
||||
if (tmpid == page.mMeta.mGroupId)
|
||||
{
|
||||
groupItem = tmpItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!groupItem)
|
||||
for(vit = snapshots.begin(); vit != snapshots.end(); vit++)
|
||||
{
|
||||
RsWikiSnapshot page = *vit;
|
||||
if (!groupItem)
|
||||
{
|
||||
/* find the entry */
|
||||
int itemCount = ui.treeWidget_Pages->topLevelItemCount();
|
||||
for (int nIndex = 0; nIndex < itemCount;)
|
||||
{
|
||||
QTreeWidgetItem *tmpItem = ui.treeWidget_Pages->topLevelItem(nIndex);
|
||||
std::string tmpid = tmpItem->data(WIKI_GROUP_COL_GROUPID,
|
||||
Qt::DisplayRole).toString().toStdString();
|
||||
if (tmpid == page.mMeta.mGroupId)
|
||||
{
|
||||
/* error */
|
||||
std::cerr << "WikiDialog::loadPages() ERROR Unable to find group";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
groupItem = tmpItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!groupItem)
|
||||
{
|
||||
/* error */
|
||||
std::cerr << "WikiDialog::loadPages() ERROR Unable to find group";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "WikiDialog::loadPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *pageItem = new QTreeWidgetItem();
|
||||
pageItem->setText(WIKI_GROUP_COL_PAGENAME, QString::fromStdString(page.mMeta.mMsgName));
|
||||
pageItem->setText(WIKI_GROUP_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId));
|
||||
pageItem->setText(WIKI_GROUP_COL_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId));
|
||||
std::cerr << "WikiDialog::loadPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
groupItem->addChild(pageItem);
|
||||
QTreeWidgetItem *pageItem = new QTreeWidgetItem();
|
||||
pageItem->setText(WIKI_GROUP_COL_PAGENAME, QString::fromStdString(page.mMeta.mMsgName));
|
||||
pageItem->setText(WIKI_GROUP_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId));
|
||||
pageItem->setText(WIKI_GROUP_COL_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
groupItem->addChild(pageItem);
|
||||
}
|
||||
//return true;
|
||||
}
|
||||
|
||||
@ -778,7 +810,9 @@ void WikiDialog::requestModPageList(const std::string &origMsgId)
|
||||
msgIds.push_back(origMsgId);
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, msgIds, WIKIDIALOG_MOD_LIST);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -788,7 +822,9 @@ void WikiDialog::loadModPageList(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* translate into latest pages */
|
||||
std::list<std::string> msgIds;
|
||||
//std::list<std::string> msgIds;
|
||||
GxsMsgIdResult msgIds;
|
||||
|
||||
if (rsWiki->getMsgList(token, msgIds))
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPageList() Loaded " << msgIds.size();
|
||||
@ -801,16 +837,20 @@ void WikiDialog::loadModPageList(const uint32_t &token)
|
||||
return;
|
||||
}
|
||||
|
||||
requestModPages(msgIds);
|
||||
std::list<RsGxsMessageId> list;
|
||||
convert_result_to_list(msgIds, list);
|
||||
requestModPages(list);
|
||||
|
||||
}
|
||||
|
||||
void WikiDialog::requestModPages(const std::list<std::string> &msgIds)
|
||||
void WikiDialog::requestModPages(const std::list<RsGxsMessageId> &msgIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_MOD_PAGES);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -822,8 +862,11 @@ void WikiDialog::loadModPages(const uint32_t &token)
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsWikiPage page;
|
||||
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;
|
||||
@ -855,7 +898,9 @@ void WikiDialog::requestWikiPage(const std::string &msgId)
|
||||
msgIds.push_back(msgId);
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_WIKI_PAGE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -865,23 +910,33 @@ void WikiDialog::loadWikiPage(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
// Should only have one WikiPage....
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsWikiPage page;
|
||||
if (rsWiki->getMsgData(token, page))
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
if (!rsWiki->getSnapshots(token, snapshots))
|
||||
{
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
updateWikiPage(page);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
if (snapshots.size() < 1)
|
||||
{
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (snapshots.size() > 1)
|
||||
{
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
RsWikiSnapshot page = snapshots[0];
|
||||
|
||||
std::cerr << "WikiDialog::loadModPages() PageId: " << page.mMeta.mMsgId;
|
||||
std::cerr << " Page: " << page.mMeta.mMsgName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
updateWikiPage(page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ void clearModsTree();
|
||||
void insertWikiGroups();
|
||||
void insertModsForPage(const std::string &origPageId);
|
||||
|
||||
void updateWikiPage(const RsWikiPage &page);
|
||||
void updateWikiPage(const RsWikiSnapshot &page);
|
||||
|
||||
bool getSelectedPage(std::string &pageId, std::string &origPageId);
|
||||
std::string getSelectedPage();
|
||||
|
@ -36,25 +36,27 @@ 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
|
||||
}
|
||||
|
||||
void WikiEditDialog::setGroup(RsWikiGroup &group)
|
||||
void WikiEditDialog::setGroup(RsWikiCollection &group)
|
||||
{
|
||||
mWikiGroup = group;
|
||||
mWikiCollection = group;
|
||||
|
||||
ui.lineEdit_Group->setText(QString::fromStdString(mWikiGroup.mMeta.mGroupName));
|
||||
ui.lineEdit_Group->setText(QString::fromStdString(mWikiCollection.mMeta.mGroupName));
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::setPreviousPage(RsWikiPage &page)
|
||||
void WikiEditDialog::setPreviousPage(RsWikiSnapshot &page)
|
||||
{
|
||||
mNewPage = false;
|
||||
mWikiPage = page;
|
||||
mWikiSnapshot = page;
|
||||
|
||||
ui.lineEdit_Page->setText(QString::fromStdString(mWikiPage.mMeta.mMsgName));
|
||||
ui.lineEdit_PrevVersion->setText(QString::fromStdString(mWikiPage.mMeta.mMsgId));
|
||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiPage.mPage));
|
||||
ui.lineEdit_Page->setText(QString::fromStdString(mWikiSnapshot.mMeta.mMsgName));
|
||||
ui.lineEdit_PrevVersion->setText(QString::fromStdString(mWikiSnapshot.mMeta.mMsgId));
|
||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiSnapshot.mPage));
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +83,7 @@ void WikiEditDialog::revertEdit()
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiPage.mPage));
|
||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiSnapshot.mPage));
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,23 +92,29 @@ void WikiEditDialog::submitEdit()
|
||||
{
|
||||
if (mNewPage)
|
||||
{
|
||||
mWikiPage.mMeta.mGroupId = mWikiGroup.mMeta.mGroupId;
|
||||
mWikiPage.mMeta.mOrigMsgId = "";
|
||||
mWikiPage.mMeta.mMsgId = "";
|
||||
mWikiPage.mPrevId = "";
|
||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||
mWikiSnapshot.mMeta.mOrigMsgId = "";
|
||||
mWikiSnapshot.mMeta.mMsgId = "";
|
||||
#if 0
|
||||
mWikiSnapshot.mPrevId = "";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
mWikiPage.mPrevId = mWikiPage.mMeta.mMsgId;
|
||||
mWikiPage.mMeta.mMsgId = "";
|
||||
#if 0
|
||||
mWikiSnapshot.mPrevId = mWikiSnapshot.mMeta.mMsgId;
|
||||
#endif
|
||||
mWikiSnapshot.mMeta.mMsgId = "";
|
||||
}
|
||||
|
||||
mWikiPage.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
||||
mWikiPage.mPage = ui.textEdit->toPlainText().toStdString();
|
||||
mWikiSnapshot.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
||||
mWikiSnapshot.mPage = ui.textEdit->toPlainText().toStdString();
|
||||
|
||||
uint32_t token;
|
||||
bool isNew = mNewPage;
|
||||
rsWiki->createPage(token, mWikiPage, isNew);
|
||||
#if 0
|
||||
rsWiki->createPage(token, mWikiSnapshot, isNew);
|
||||
#endif
|
||||
hide();
|
||||
}
|
||||
|
||||
@ -144,8 +152,12 @@ void WikiEditDialog::loadGroup(const uint32_t &token)
|
||||
std::cerr << "WikiEditDialog::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
#if 0
|
||||
if (rsWiki->getGroupData(token, group))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
setGroup(group);
|
||||
}
|
||||
@ -161,7 +173,9 @@ void WikiEditDialog::requestPage(const std::string &msgId)
|
||||
RsTokReqOptions opts;
|
||||
|
||||
uint32_t token;
|
||||
#if 0
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WikiEditDialog::loadPage(const uint32_t &token)
|
||||
@ -169,8 +183,12 @@ void WikiEditDialog::loadPage(const uint32_t &token)
|
||||
std::cerr << "WikiEditDialog::loadPage()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWikiPage page;
|
||||
RsWikiSnapshot page;
|
||||
#if 0
|
||||
if (rsWiki->getMsgData(token, page))
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
setPreviousPage(page);
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ void submitEdit();
|
||||
|
||||
private:
|
||||
|
||||
void setGroup(RsWikiGroup &group);
|
||||
void setPreviousPage(RsWikiPage &page);
|
||||
void setGroup(RsWikiCollection &group);
|
||||
void setPreviousPage(RsWikiSnapshot &page);
|
||||
|
||||
void requestPage(const std::string &msgId);
|
||||
void loadPage(const uint32_t &token);
|
||||
@ -58,8 +58,8 @@ void requestGroup(const std::string &groupId);
|
||||
void loadGroup(const uint32_t &token);
|
||||
|
||||
bool mNewPage;
|
||||
RsWikiGroup mWikiGroup;
|
||||
RsWikiPage mWikiPage;
|
||||
RsWikiCollection mWikiCollection;
|
||||
RsWikiSnapshot mWikiSnapshot;
|
||||
|
||||
Ui::WikiEditDialog ui;
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <retroshare/rswiki.h>
|
||||
#include <iostream>
|
||||
|
||||
WikiGroupDialog::WikiGroupDialog(QWidget *parent)
|
||||
:GxsGroupDialog(rsWiki, parent)
|
||||
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, parent, GXS_GROUP_DIALOG_CREATE_MODE)
|
||||
{
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
@ -58,7 +58,32 @@ WikiGroupDialog::WikiGroupDialog(QWidget *parent)
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
setFlags(enabledFlags, readonlyFlags, defaultsFlags);
|
||||
//setFlags(enabledFlags, readonlyFlags, defaultsFlags);
|
||||
setFlags(enabledFlags, defaultsFlags);
|
||||
|
||||
}
|
||||
|
||||
WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent)
|
||||
:GxsGroupDialog(NULL, parent, GXS_GROUP_DIALOG_SHOW_MODE)
|
||||
{
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
uint32_t enabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
GXS_GROUP_FLAGS_SHAREKEYS |
|
||||
0);
|
||||
|
||||
uint32_t readonlyFlags = 0;
|
||||
|
||||
uint32_t defaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
setFlags(enabledFlags, defaultsFlags);
|
||||
|
||||
}
|
||||
|
||||
@ -66,20 +91,37 @@ WikiGroupDialog::WikiGroupDialog(QWidget *parent)
|
||||
bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
{
|
||||
// Specific Function.
|
||||
RsWikiGroup grp;
|
||||
RsWikiCollection grp;
|
||||
grp.mMeta = meta;
|
||||
//grp.mDescription = std::string(desc.toUtf8());
|
||||
|
||||
rsWiki->createGroup(token, grp, true);
|
||||
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;
|
||||
|
||||
RsWikiGroup group;
|
||||
RsWikiCollection group;
|
||||
if (!rsWiki->getGroupData(token, group))
|
||||
{
|
||||
std::cerr << "WikiGroupDialog::service_loadExistingGroup() ERROR Getting Group";
|
||||
@ -94,7 +136,6 @@ void WikiGroupDialog::service_loadExistingGroup(const uint32_t &token)
|
||||
/* now load any extra data we feel like */
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -24,19 +24,27 @@
|
||||
#define _WIKI_GROUP_DIALOG_H
|
||||
|
||||
#include "GxsGroupDialog.h"
|
||||
#include "retroshare/rswiki.h"
|
||||
|
||||
class WikiGroupDialog : public GxsGroupDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WikiGroupDialog(QWidget *parent);
|
||||
WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
// virtual bool service_CompleteCreateGroup(const RsGroupMetaData &meta);
|
||||
virtual QPixmap service_getLogo();
|
||||
virtual QString service_getDescription();
|
||||
virtual RsGroupMetaData service_getMeta();
|
||||
|
||||
virtual void service_loadExistingGroup(const uint32_t &token);
|
||||
//virtual void service_loadExistingGroup(const uint32_t &token);
|
||||
|
||||
private:
|
||||
|
||||
RsWikiCollection mGrp;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user