mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 01:31:30 -05:00
Improvements to Wiki.
- Enabled Selection of Snapshots in WikiEditDialog - Added CheckBoxes for Merge selection. (TODO). - Fixed up bugs related to text reload. - Removed Edits from main Wiki Page. - Added a Search Bar (TODO). git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5937 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bcf9f443b4
commit
c1702fc13a
@ -78,7 +78,6 @@ WikiDialog::WikiDialog(QWidget *parent)
|
||||
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()));
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
@ -123,17 +122,6 @@ void WikiDialog::OpenOrShowAddPageDialog()
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() GroupId: " << groupId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
#if 0
|
||||
RsWikiCollection group;
|
||||
if (!rsWiki->getGroup(groupId, group))
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() Failed to Get Group";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
mEditDialog->setGroup(group);
|
||||
#endif
|
||||
|
||||
mEditDialog->setupData(groupId, "");
|
||||
mEditDialog->setNewPage();
|
||||
|
||||
@ -144,18 +132,6 @@ void WikiDialog::OpenOrShowAddPageDialog()
|
||||
|
||||
void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
{
|
||||
#if 0
|
||||
if (mAddGroupDialog)
|
||||
{
|
||||
mAddGroupDialog->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mAddGroupDialog = new WikiAddDialog(NULL);
|
||||
mAddGroupDialog->show();
|
||||
}
|
||||
#endif
|
||||
|
||||
newGroup();
|
||||
}
|
||||
|
||||
@ -166,7 +142,6 @@ void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
void WikiDialog::newGroup()
|
||||
{
|
||||
WikiGroupDialog cf(mWikiQueue, this);
|
||||
//cf.newGroup();
|
||||
cf.wikitype();
|
||||
|
||||
cf.exec ();
|
||||
@ -181,11 +156,6 @@ void WikiDialog::showGroupDetails()
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//RsWikiCollection collection;
|
||||
//WikiGroupDialog cf (collection, this);
|
||||
//cf.exec ();
|
||||
}
|
||||
|
||||
void WikiDialog::editGroupDetails()
|
||||
@ -223,25 +193,12 @@ void WikiDialog::OpenOrShowEditDialog()
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::string modId = getSelectedMod();
|
||||
std::string realPageId;
|
||||
|
||||
if (modId == "")
|
||||
{
|
||||
realPageId = pageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
realPageId = modId;
|
||||
}
|
||||
|
||||
|
||||
if (!mEditDialog)
|
||||
{
|
||||
mEditDialog = new WikiEditDialog(NULL);
|
||||
}
|
||||
|
||||
mEditDialog->setupData(groupId, realPageId);
|
||||
mEditDialog->setupData(groupId, pageId);
|
||||
mEditDialog->show();
|
||||
}
|
||||
|
||||
@ -285,43 +242,14 @@ void WikiDialog::groupTreeChanged()
|
||||
{
|
||||
/* clear Mods */
|
||||
clearGroupTree();
|
||||
clearModsTree();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
clearModsTree();
|
||||
|
||||
|
||||
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 == "") || (groupId == ""))
|
||||
{
|
||||
clearWikiPage();
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
|
||||
requestWikiPage(pagepair);
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::updateWikiPage(const RsWikiSnapshot &page)
|
||||
{
|
||||
#ifdef USE_PEGMMD_RENDERER
|
||||
@ -354,12 +282,6 @@ void WikiDialog::clearGroupTree()
|
||||
ui.treeWidget_Pages->clear();
|
||||
}
|
||||
|
||||
void WikiDialog::clearModsTree()
|
||||
{
|
||||
ui.treeWidget_Mods->clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define WIKI_GROUP_COL_GROUPNAME 0
|
||||
#define WIKI_GROUP_COL_GROUPID 1
|
||||
@ -448,37 +370,6 @@ std::string WikiDialog::getSelectedGroup()
|
||||
return groupId;
|
||||
}
|
||||
|
||||
#define WIKI_MODS_COL_ORIGPAGEID 0
|
||||
#define WIKI_MODS_COL_PAGEID 1
|
||||
#define WIKI_MODS_COL_PARENTID 2
|
||||
|
||||
|
||||
std::string WikiDialog::getSelectedMod()
|
||||
{
|
||||
std::string pageId;
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedMod()" << std::endl;
|
||||
#endif
|
||||
|
||||
/* get current item */
|
||||
QTreeWidgetItem *item = ui.treeWidget_Mods->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
/* leave current list */
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedMod() Nothing selected" << std::endl;
|
||||
#endif
|
||||
return pageId;
|
||||
}
|
||||
|
||||
pageId = item->text(WIKI_MODS_COL_PAGEID).toStdString();
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedMod() PageId: " << pageId << std::endl;
|
||||
#endif
|
||||
return pageId;
|
||||
}
|
||||
|
||||
/************************** Request / Response *************************/
|
||||
/*** Loading Main Index ***/
|
||||
|
||||
@ -615,223 +506,8 @@ void WikiDialog::loadPages(const uint32_t &token)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***** Mods *****/
|
||||
|
||||
void WikiDialog::insertModsForPage(const RsGxsGrpMsgIdPair &origPageId)
|
||||
{
|
||||
requestModPages(origPageId);
|
||||
}
|
||||
|
||||
void WikiDialog::requestModPages(const RsGxsGrpMsgIdPair &origMsgId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_VERSIONS;
|
||||
std::vector<RsGxsGrpMsgIdPair> msgIds;
|
||||
msgIds.push_back(origMsgId);
|
||||
uint32_t token;
|
||||
mWikiQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_MOD_PAGES);
|
||||
}
|
||||
|
||||
void WikiDialog::loadModPages(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WikiDialog::loadModPages()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::vector<RsWikiSnapshot> snapshots;
|
||||
std::vector<RsWikiSnapshot>::iterator vit;
|
||||
if (!rsWiki->getRelatedSnapshots(token, snapshots))
|
||||
{
|
||||
// ERROR
|
||||
std::cerr << "WikiDialog::loadModPages() ERROR";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for(vit = snapshots.begin(); vit != snapshots.end(); vit++)
|
||||
{
|
||||
RsWikiSnapshot &page = *vit;
|
||||
|
||||
std::cerr << "WikiDialog::loadModPages() TopLevel Result: PageTitle: " << page.mMeta.mMsgName;
|
||||
std::cerr << " GroupId: " << page.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tOrigMsgId: " << page.mMeta.mOrigMsgId;
|
||||
std::cerr << " MsgId: " << page.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tThreadId: " << page.mMeta.mThreadId;
|
||||
std::cerr << " ParentId: " << page.mMeta.mParentId;
|
||||
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));
|
||||
modItem->setText(WIKI_MODS_COL_PARENTID, QString::fromStdString(page.mMeta.mParentId));
|
||||
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::string groupId;
|
||||
std::string pageId;
|
||||
std::string origPageId;
|
||||
if (!getSelectedPage(groupId, pageId, origPageId))
|
||||
{
|
||||
// ERROR
|
||||
std::cerr << "WikiDialog::loadEditTreeData() ERROR 2";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "WikiDialog::loadEditTreeData() Loaded " << snapshots.size();
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "WikiDialog::loadEditTreeData() Using ThreadId: " << origPageId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::map<RsGxsMessageId, QTreeWidgetItem *> items;
|
||||
std::map<RsGxsMessageId, QTreeWidgetItem *>::iterator iit;
|
||||
std::list<QTreeWidgetItem *> unparented;
|
||||
std::list<QTreeWidgetItem *>::iterator uit;
|
||||
|
||||
// Grab the existing TopLevelItems, and insert into map.
|
||||
int itemCount = ui.treeWidget_Mods->topLevelItemCount();
|
||||
for (int nIndex = 0; nIndex < itemCount; nIndex++)
|
||||
{
|
||||
QTreeWidgetItem *item = ui.treeWidget_Mods->topLevelItem(nIndex);
|
||||
|
||||
/* index by MsgId --> ONLY For Wiki Thread Head Items... SPECIAL HACK FOR HERE! */
|
||||
std::string msgId = item->text(WIKI_MODS_COL_PAGEID).toStdString();
|
||||
items[msgId] = item;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
if (snapshot.mMeta.mParentId == "")
|
||||
{
|
||||
/* Ignore! */
|
||||
std::cerr << "Ignoring ThreadHead Item";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (snapshot.mMeta.mThreadId != origPageId)
|
||||
{
|
||||
/* Ignore! */
|
||||
std::cerr << "Ignoring Different Thread Item";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 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 0
|
||||
/* 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;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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 RsGxsGrpMsgIdPair &msgId)
|
||||
{
|
||||
std::cerr << "WikiDialog::requestWikiPage(" << msgId.first << "," << msgId.second << ")";
|
||||
@ -907,17 +583,10 @@ void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
loadPages(req.mToken);
|
||||
break;
|
||||
|
||||
case WIKIDIALOG_MOD_PAGES:
|
||||
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();
|
||||
|
@ -54,7 +54,6 @@ private slots:
|
||||
void OpenOrShowRepublishDialog();
|
||||
|
||||
void groupTreeChanged();
|
||||
void modTreeChanged();
|
||||
|
||||
void newGroup();
|
||||
void showGroupDetails();
|
||||
@ -66,20 +65,12 @@ private:
|
||||
|
||||
void clearWikiPage();
|
||||
void clearGroupTree();
|
||||
void clearModsTree();
|
||||
|
||||
void insertModsForPage(const std::string &origPageId);
|
||||
|
||||
void insertModsForPage(const RsGxsGrpMsgIdPair &origPageId);
|
||||
|
||||
void updateWikiPage(const RsWikiSnapshot &page);
|
||||
|
||||
bool getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId);
|
||||
std::string getSelectedPage();
|
||||
std::string getSelectedGroup();
|
||||
std::string getSelectedMod();
|
||||
|
||||
|
||||
|
||||
void requestGroupList();
|
||||
void loadGroupData(const uint32_t &token);
|
||||
@ -87,12 +78,6 @@ void loadGroupData(const uint32_t &token);
|
||||
void requestPages(const std::list<RsGxsGroupId> &groupIds);
|
||||
void loadPages(const uint32_t &token);
|
||||
|
||||
void requestModPages(const RsGxsGrpMsgIdPair &origMsgId);
|
||||
void loadModPages(const uint32_t &token);
|
||||
|
||||
void requestEditTreeData();
|
||||
void loadEditTreeData(const uint32_t &token);
|
||||
|
||||
void requestWikiPage(const RsGxsGrpMsgIdPair &msgId);
|
||||
void loadWikiPage(const uint32_t &token);
|
||||
|
||||
|
@ -6,24 +6,21 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>918</width>
|
||||
<height>669</height>
|
||||
<width>764</width>
|
||||
<height>514</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QFrame" name="titleBarFrame">
|
||||
<property name="frameShape">
|
||||
@ -96,10 +93,6 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="scrollArea_2">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
@ -110,19 +103,10 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>241</width>
|
||||
<height>307</height>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_Pages">
|
||||
<column>
|
||||
@ -145,41 +129,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QScrollArea" name="scrollArea_3">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>241</width>
|
||||
<height>294</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_Mods">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Page Modification</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>By</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -253,32 +202,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_PrevMod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mod</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Wiki_images.qrc">
|
||||
<normaloff>:/images/arrow-left.png</normaloff>:/images/arrow-left.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_Republish">
|
||||
<property name="text">
|
||||
@ -325,32 +248,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NextMod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mod</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Wiki_images.qrc">
|
||||
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
@ -436,27 +333,37 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>645</width>
|
||||
<height>609</height>
|
||||
<width>491</width>
|
||||
<height>454</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -69,6 +69,8 @@ WikiEditDialog::WikiEditDialog(QWidget *parent)
|
||||
connect(ui.toolButton_Hide, SIGNAL( clicked( void ) ), this, SLOT( detailsToggle( void ) ) );
|
||||
connect(ui.textEdit, SIGNAL( textChanged( void ) ), this, SLOT( textChanged( void ) ) );
|
||||
connect(ui.checkBox_OldHistory, SIGNAL( clicked( void ) ), this, SLOT( oldHistoryChanged( void ) ) );
|
||||
connect(ui.checkBox_Merge, SIGNAL( clicked( void ) ), this, SLOT( mergeModeToggle( void ) ) );
|
||||
connect(ui.pushButton_Merge, SIGNAL( clicked( void ) ), this, SLOT( generateMerge( void ) ) );
|
||||
connect(ui.treeWidget_History, SIGNAL( itemSelectionChanged( void ) ), this, SLOT( historySelected( void ) ) );
|
||||
|
||||
mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);
|
||||
@ -79,9 +81,14 @@ WikiEditDialog::WikiEditDialog(QWidget *parent)
|
||||
mRepublishMode = false;
|
||||
mPreviewMode = false;
|
||||
mPageLoading = false;
|
||||
|
||||
mIgnoreTextChange = false;
|
||||
mTextChanged = false;
|
||||
mCurrentText = "";
|
||||
|
||||
mHistoryLoaded = false;
|
||||
mHistoryMergeMode = false;
|
||||
|
||||
ui.checkBox_OldHistory->setChecked(false);
|
||||
mOldHistoryEnabled = false;
|
||||
ui.groupBox_History->hide();
|
||||
@ -93,8 +100,25 @@ WikiEditDialog::~WikiEditDialog()
|
||||
delete (mThreadCompareRole);
|
||||
}
|
||||
|
||||
void WikiEditDialog::mergeModeToggle()
|
||||
{
|
||||
mHistoryMergeMode = ui.checkBox_Merge->isChecked();
|
||||
updateHistoryStatus();
|
||||
}
|
||||
|
||||
void WikiEditDialog::generateMerge()
|
||||
{
|
||||
std::cerr << "WikiEditDialog::generateMerge() TODO" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void WikiEditDialog::textChanged()
|
||||
{
|
||||
if (mIgnoreTextChange)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::textChanged() Ignored" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::cerr << "WikiEditDialog::textChanged()" << std::endl;
|
||||
|
||||
mTextChanged = true;
|
||||
@ -127,6 +151,23 @@ void WikiEditDialog::textReset()
|
||||
void WikiEditDialog::historySelected()
|
||||
{
|
||||
std::cerr << "WikiEditDialog::historySelected()" << std::endl;
|
||||
|
||||
QList<QTreeWidgetItem *> selected = ui.treeWidget_History->selectedItems();
|
||||
if (selected.empty())
|
||||
{
|
||||
std::cerr << "WikiEditDialog::historySelected() ERROR Nothing selected" << std::endl;
|
||||
return;
|
||||
}
|
||||
QTreeWidgetItem *item = *(selected.begin());
|
||||
|
||||
RsGxsGrpMsgIdPair newSnapshot = mThreadMsgIdPair;
|
||||
std::string pageId = item->data(WET_DATA_COLUMN, WET_ROLE_PAGEID).toString().toStdString();
|
||||
newSnapshot.second = pageId;
|
||||
|
||||
std::cerr << "WikiEditDialog::historySelected() New PageId: " << pageId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
requestPage(newSnapshot);
|
||||
}
|
||||
|
||||
|
||||
@ -139,6 +180,9 @@ void WikiEditDialog::oldHistoryChanged()
|
||||
|
||||
void WikiEditDialog::updateHistoryStatus()
|
||||
{
|
||||
std::cerr << "WikiEditDialog::updateHistoryStatus()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* iterate through every History Item */
|
||||
int count = ui.treeWidget_History->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
@ -180,12 +224,35 @@ void WikiEditDialog::updateHistoryItem(QTreeWidgetItem *item, bool isLatest)
|
||||
|
||||
if (isSelectable)
|
||||
{
|
||||
std::cerr << "WikiEditDialog::updateHistoryItem() isSelectable";
|
||||
std::cerr << std::endl;
|
||||
|
||||
item->setFlags(Qt::ItemIsSelectable |
|
||||
Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
|
||||
if (mHistoryMergeMode)
|
||||
{
|
||||
QVariant qvar = item->data(WET_COL_PAGEID, Qt::CheckStateRole);
|
||||
std::cerr << "WikiEditDialog::CheckStateRole:: VariantType: " << (int) qvar.type();
|
||||
std::cerr << std::endl;
|
||||
if (!qvar.isValid())
|
||||
{
|
||||
item->setData(WET_COL_PAGEID, Qt::CheckStateRole, Qt::Unchecked);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setFlags(0);
|
||||
item->setData(WET_COL_PAGEID, Qt::CheckStateRole, QVariant());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WikiEditDialog::updateHistoryItem() NOT isSelectable";
|
||||
std::cerr << std::endl;
|
||||
|
||||
item->setData(WET_COL_PAGEID, Qt::CheckStateRole, QVariant());
|
||||
item->setFlags(Qt::ItemIsUserCheckable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,8 +308,6 @@ void WikiEditDialog::previewToggle()
|
||||
std::cerr << "WikiEditDialog::previewToggle()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool prevTextChanged = mTextChanged;
|
||||
|
||||
if (mPreviewMode)
|
||||
{
|
||||
mPreviewMode = false;
|
||||
@ -255,16 +320,11 @@ void WikiEditDialog::previewToggle()
|
||||
mPreviewMode = true;
|
||||
ui.pushButton_Preview->setText(tr("Edit Page"));
|
||||
}
|
||||
if (!mPageLoading)
|
||||
{
|
||||
redrawPage();
|
||||
}
|
||||
|
||||
/* fix textChanged signal - if we have caused it to change */
|
||||
if (!prevTextChanged)
|
||||
{
|
||||
textReset();
|
||||
}
|
||||
|
||||
mIgnoreTextChange = true;
|
||||
redrawPage();
|
||||
mIgnoreTextChange = false;
|
||||
|
||||
std::cerr << "WikiEditDialog::previewToggle() END";
|
||||
std::cerr << std::endl;
|
||||
@ -334,7 +394,11 @@ void WikiEditDialog::setPreviousPage(RsWikiSnapshot &page)
|
||||
ui.lineEdit_Page->setText(QString::fromStdString(mWikiSnapshot.mMeta.mMsgName));
|
||||
ui.lineEdit_PrevVersion->setText(QString::fromStdString(mWikiSnapshot.mMeta.mMsgId));
|
||||
mCurrentText = QString::fromUtf8(mWikiSnapshot.mPage.c_str());
|
||||
|
||||
mIgnoreTextChange = true;
|
||||
redrawPage();
|
||||
mIgnoreTextChange = false;
|
||||
|
||||
textReset();
|
||||
}
|
||||
|
||||
@ -343,6 +407,7 @@ void WikiEditDialog::setNewPage()
|
||||
{
|
||||
mNewPage = true;
|
||||
mRepublishMode = false;
|
||||
mHistoryLoaded = false;
|
||||
ui.lineEdit_Page->setText("");
|
||||
ui.lineEdit_PrevVersion->setText("");
|
||||
|
||||
@ -364,6 +429,7 @@ void WikiEditDialog::setRepublishMode(RsGxsMessageId &origMsgId)
|
||||
{
|
||||
mRepublishMode = true;
|
||||
mRepublishOrigId = origMsgId;
|
||||
ui.pushButton_Submit->setText(tr("Republish"));
|
||||
}
|
||||
|
||||
|
||||
@ -486,6 +552,7 @@ void WikiEditDialog::submitEdit()
|
||||
void WikiEditDialog::setupData(const std::string &groupId, const std::string &pageId)
|
||||
{
|
||||
mRepublishMode = false;
|
||||
mHistoryLoaded = false;
|
||||
if (groupId != "")
|
||||
{
|
||||
requestGroup(groupId);
|
||||
@ -497,7 +564,6 @@ void WikiEditDialog::setupData(const std::string &groupId, const std::string &pa
|
||||
requestPage(msgId);
|
||||
}
|
||||
|
||||
|
||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/story-editor_48.png"));
|
||||
ui.headerFrame->setHeaderText(tr("Edit Wiki Page"));
|
||||
setWindowTitle(tr("Edit Wiki Page"));
|
||||
@ -584,8 +650,11 @@ void WikiEditDialog::loadPage(const uint32_t &token)
|
||||
{
|
||||
mThreadMsgIdPair.second = page.mMeta.mThreadId;
|
||||
}
|
||||
if (!mHistoryLoaded)
|
||||
{
|
||||
requestBaseHistory(mThreadMsgIdPair);
|
||||
}
|
||||
}
|
||||
mPageLoading = false;
|
||||
}
|
||||
|
||||
@ -801,6 +870,7 @@ void WikiEditDialog::loadEditTreeData(const uint32_t &token)
|
||||
}
|
||||
|
||||
// Enable / Disable Items.
|
||||
mHistoryLoaded = true;
|
||||
updateHistoryStatus();
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,8 @@ void textReset();
|
||||
|
||||
void historySelected();
|
||||
void oldHistoryChanged();
|
||||
void mergeModeToggle();
|
||||
void generateMerge();
|
||||
|
||||
private:
|
||||
|
||||
@ -87,9 +89,12 @@ void loadEditTreeData(const uint32_t &token);
|
||||
|
||||
bool mPreviewMode;
|
||||
bool mPageLoading;
|
||||
bool mHistoryLoaded;
|
||||
bool mHistoryMergeMode;
|
||||
bool mOldHistoryEnabled;
|
||||
|
||||
bool mRepublishMode;
|
||||
bool mIgnoreTextChange; // when we do it programmatically.
|
||||
bool mTextChanged;
|
||||
|
||||
QString mCurrentText;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>731</width>
|
||||
<height>701</height>
|
||||
<width>946</width>
|
||||
<height>568</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -28,6 +28,7 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<zorder>splitter_History</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -54,7 +55,7 @@
|
||||
<property name="title">
|
||||
<string>Page Edit History</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_OldHistory">
|
||||
<property name="text">
|
||||
@ -62,6 +63,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_Merge">
|
||||
<property name="text">
|
||||
<string>Chose for Merge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Merge">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Merge for Republish (TODO)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_History">
|
||||
<column>
|
||||
|
Loading…
x
Reference in New Issue
Block a user