mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added Wiki GUI Elements.
- This is a new Plugin, for development with the new cache system. - We want to get the GUI right before finalising the back-end. - This will start life here, then be moved to the Plugin section. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4887 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
efddc9afab
commit
42acb5007e
78
retroshare-gui/src/gui/WikiPoos/WikiAddDialog.cpp
Normal file
78
retroshare-gui/src/gui/WikiPoos/WikiAddDialog.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Retroshare Wiki Plugin.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gui/WikiPoos/WikiAddDialog.h"
|
||||
#include <retroshare/rswiki.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
WikiAddDialog::WikiAddDialog(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelGroup( void ) ) );
|
||||
connect(ui.pushButton_Create, SIGNAL( clicked( void ) ), this, SLOT( createGroup( void ) ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void WikiAddDialog::cancelGroup()
|
||||
{
|
||||
clearDialog();
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WikiAddDialog::createGroup()
|
||||
{
|
||||
std::cerr << "WikiAddDialog::createGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
RsWikiGroup group;
|
||||
|
||||
group.mShareOptions.mShareType = 0;
|
||||
group.mShareOptions.mShareGroupId = "unknown";
|
||||
group.mShareOptions.mPublishKey = "unknown";
|
||||
group.mShareOptions.mCommentMode = 0;
|
||||
group.mShareOptions.mResizeMode = 0;
|
||||
|
||||
group.mName = ui.lineEdit_Name->text().toStdString();
|
||||
group.mCategory = "Unknown";
|
||||
|
||||
rsWiki->createGroup(group);
|
||||
clearDialog();
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void WikiAddDialog::clearDialog()
|
||||
{
|
||||
ui.lineEdit_Name->setText(QString("title"));
|
||||
}
|
||||
|
||||
|
48
retroshare-gui/src/gui/WikiPoos/WikiAddDialog.h
Normal file
48
retroshare-gui/src/gui/WikiPoos/WikiAddDialog.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Retroshare Wiki Plugin.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MRK_WIKI_ADD_DIALOG_H
|
||||
#define MRK_WIKI_ADD_DIALOG_H
|
||||
|
||||
#include "ui_WikiAddDialog.h"
|
||||
|
||||
class WikiAddDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WikiAddDialog(QWidget *parent = 0);
|
||||
|
||||
private slots:
|
||||
void clearDialog();
|
||||
void cancelGroup();
|
||||
void createGroup();
|
||||
|
||||
private:
|
||||
|
||||
Ui::WikiAddDialog ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
273
retroshare-gui/src/gui/WikiPoos/WikiAddDialog.ui
Normal file
273
retroshare-gui/src/gui/WikiPoos/WikiAddDialog.ui
Normal file
@ -0,0 +1,273 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WikiAddDialog</class>
|
||||
<widget class="QWidget" name="WikiAddDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>832</width>
|
||||
<height>452</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>10</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Basic Details</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Group Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Category:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Category">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Travel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Holiday</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Family</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Work</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Share Options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Public</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Restricted</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>N/A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>University Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Family</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>This List Contains</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All your Groups</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="comboBox_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No Comments Allowed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Authenticated Comments</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any Comments Allowed</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Publish with XXX Key</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>183</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QFrame" name="">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Cancel">
|
||||
<property name="text">
|
||||
<string>Cancel </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>68</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Create">
|
||||
<property name="text">
|
||||
<string>Create Group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Wiki_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
471
retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp
Normal file
471
retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp
Normal file
@ -0,0 +1,471 @@
|
||||
/*
|
||||
* Retroshare Wiki Plugin.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "WikiDialog.h"
|
||||
#include "gui/WikiPoos/WikiAddDialog.h"
|
||||
#include "gui/WikiPoos/WikiEditDialog.h"
|
||||
|
||||
#include <retroshare/rswiki.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
/******
|
||||
* #define WIKI_DEBUG 1
|
||||
*****/
|
||||
|
||||
#define WIKI_DEBUG 1
|
||||
|
||||
|
||||
/** Constructor */
|
||||
WikiDialog::WikiDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mAddPageDialog = NULL;
|
||||
mAddGroupDialog = NULL;
|
||||
mEditDialog = NULL;
|
||||
|
||||
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.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()));
|
||||
timer->start(1000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void WikiDialog::checkUpdate()
|
||||
{
|
||||
/* update */
|
||||
if (!rsWiki)
|
||||
return;
|
||||
|
||||
if (rsWiki->updated())
|
||||
{
|
||||
insertWikiGroups();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::OpenOrShowAddPageDialog()
|
||||
{
|
||||
std::string groupId = getSelectedGroup();
|
||||
if (groupId == "")
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No Group selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mEditDialog)
|
||||
{
|
||||
mEditDialog = new WikiEditDialog(NULL);
|
||||
}
|
||||
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() GroupId: " << groupId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWikiGroup group;
|
||||
if (!rsWiki->getGroup(groupId, group))
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() Failed to Get Group";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
|
||||
mEditDialog->setGroup(group);
|
||||
mEditDialog->setNewPage();
|
||||
|
||||
mEditDialog->show();
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
{
|
||||
if (mAddGroupDialog)
|
||||
{
|
||||
mAddGroupDialog->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mAddGroupDialog = new WikiAddDialog(NULL);
|
||||
mAddGroupDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::OpenOrShowEditDialog()
|
||||
{
|
||||
std::string groupId = getSelectedGroup();
|
||||
if (groupId == "")
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No Group selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string pageId = getSelectedPage();
|
||||
std::string modId = getSelectedMod();
|
||||
std::string realPageId;
|
||||
if (pageId == "")
|
||||
{
|
||||
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No PageId selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (modId == "")
|
||||
{
|
||||
realPageId = pageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
realPageId = modId;
|
||||
}
|
||||
|
||||
|
||||
if (!mEditDialog)
|
||||
{
|
||||
mEditDialog = new WikiEditDialog(NULL);
|
||||
}
|
||||
|
||||
RsWikiGroup group;
|
||||
rsWiki->getGroup(groupId, group);
|
||||
mEditDialog->setGroup(group);
|
||||
|
||||
RsWikiPage page;
|
||||
rsWiki->getPage(realPageId, page);
|
||||
mEditDialog->setPreviousPage(page);
|
||||
|
||||
mEditDialog->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WikiDialog::groupTreeChanged()
|
||||
{
|
||||
/* */
|
||||
std::string pageId = getSelectedPage();
|
||||
if (pageId == mPageSelected)
|
||||
{
|
||||
return; /* nothing changed */
|
||||
}
|
||||
|
||||
if (pageId == "")
|
||||
{
|
||||
/* clear Mods */
|
||||
clearGroupTree();
|
||||
clearModsTree();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
clearModsTree();
|
||||
RsWikiPage page;
|
||||
|
||||
if (rsWiki->getPage(pageId, page))
|
||||
{
|
||||
insertModsForPage(page.mOrigPageId);
|
||||
updateWikiPage(page);
|
||||
}
|
||||
}
|
||||
|
||||
void WikiDialog::modTreeChanged()
|
||||
{
|
||||
/* */
|
||||
std::string pageId = getSelectedMod();
|
||||
if (pageId == mModSelected)
|
||||
{
|
||||
return; /* nothing changed */
|
||||
}
|
||||
|
||||
if (pageId == "")
|
||||
{
|
||||
clearWikiPage();
|
||||
return;
|
||||
}
|
||||
|
||||
RsWikiPage page;
|
||||
if (rsWiki->getPage(pageId, page))
|
||||
{
|
||||
updateWikiPage(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::updateWikiPage(const RsWikiPage &page)
|
||||
{
|
||||
ui.textBrowser->setPlainText(QString::fromStdString(page.mPage));
|
||||
}
|
||||
|
||||
|
||||
void WikiDialog::clearWikiPage()
|
||||
{
|
||||
ui.textBrowser->setPlainText("");
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
#define WIKI_GROUP_COL_PAGENAME 0
|
||||
#define WIKI_GROUP_COL_PAGEID 1
|
||||
#define WIKI_GROUP_COL_ORIGPAGEID 2
|
||||
|
||||
|
||||
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 */
|
||||
RsWikiGroup 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 */
|
||||
RsWikiPage 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string WikiDialog::getSelectedPage()
|
||||
{
|
||||
std::string pageId;
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedPage()" << std::endl;
|
||||
#endif
|
||||
|
||||
/* get current item */
|
||||
QTreeWidgetItem *item = ui.treeWidget_Pages->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
/* leave current list */
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedPage() Nothing selected" << std::endl;
|
||||
#endif
|
||||
return pageId;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *parent = item->parent();
|
||||
|
||||
if (!parent)
|
||||
{
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedPage() No Parent -> Group Selected" << std::endl;
|
||||
#endif
|
||||
return pageId;
|
||||
}
|
||||
|
||||
|
||||
/* check if it has changed */
|
||||
pageId = item->text(WIKI_GROUP_COL_PAGEID).toStdString();
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedPage() PageId: " << pageId << std::endl;
|
||||
#endif
|
||||
return pageId;
|
||||
}
|
||||
|
||||
|
||||
std::string WikiDialog::getSelectedGroup()
|
||||
{
|
||||
std::string groupId;
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedGroup()" << std::endl;
|
||||
#endif
|
||||
|
||||
/* get current item */
|
||||
QTreeWidgetItem *item = ui.treeWidget_Pages->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
/* leave current list */
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedGroup() Nothing selected" << std::endl;
|
||||
#endif
|
||||
return groupId;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *parent = item->parent();
|
||||
|
||||
if (parent)
|
||||
{
|
||||
groupId = parent->text(WIKI_GROUP_COL_GROUPID).toStdString();
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedGroup() Page -> GroupId: " << groupId << std::endl;
|
||||
#endif
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/* otherwise, we are on the group already */
|
||||
groupId = item->text(WIKI_GROUP_COL_GROUPID).toStdString();
|
||||
#ifdef WIKI_DEBUG
|
||||
std::cerr << "WikiDialog::getSelectedGroup() GroupId: " << groupId << std::endl;
|
||||
#endif
|
||||
return groupId;
|
||||
}
|
||||
|
||||
#define WIKI_MODS_COL_ORIGPAGEID 0
|
||||
#define WIKI_MODS_COL_PAGEID 1
|
||||
|
||||
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++)
|
||||
{
|
||||
RsWikiPage 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
83
retroshare-gui/src/gui/WikiPoos/WikiDialog.h
Normal file
83
retroshare-gui/src/gui/WikiPoos/WikiDialog.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Retroshare Wiki Plugin.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MRK_WIKI_DIALOG_H
|
||||
#define MRK_WIKI_DIALOG_H
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_WikiDialog.h"
|
||||
|
||||
#include <retroshare/rswiki.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
class WikiAddDialog;
|
||||
class WikiEditDialog;
|
||||
|
||||
class WikiDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WikiDialog(QWidget *parent = 0);
|
||||
|
||||
private slots:
|
||||
|
||||
void checkUpdate();
|
||||
void OpenOrShowAddPageDialog();
|
||||
void OpenOrShowAddGroupDialog();
|
||||
void OpenOrShowEditDialog();
|
||||
|
||||
void groupTreeChanged();
|
||||
void modTreeChanged();
|
||||
|
||||
private:
|
||||
|
||||
void clearWikiPage();
|
||||
void clearGroupTree();
|
||||
void clearModsTree();
|
||||
|
||||
void insertWikiGroups();
|
||||
void insertModsForPage(std::string &origPageId);
|
||||
|
||||
void updateWikiPage(const RsWikiPage &page);
|
||||
|
||||
std::string getSelectedPage();
|
||||
std::string getSelectedGroup();
|
||||
std::string getSelectedMod();
|
||||
|
||||
WikiAddDialog *mAddPageDialog;
|
||||
WikiAddDialog *mAddGroupDialog;
|
||||
WikiEditDialog *mEditDialog;
|
||||
|
||||
std::string mGroupSelected;
|
||||
std::string mPageSelected;
|
||||
std::string mModSelected;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::WikiDialog ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
257
retroshare-gui/src/gui/WikiPoos/WikiDialog.ui
Normal file
257
retroshare-gui/src/gui/WikiPoos/WikiDialog.ui
Normal file
@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WikiDialog</class>
|
||||
<widget class="QWidget" name="WikiDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>774</width>
|
||||
<height>608</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<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>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>205</width>
|
||||
<height>285</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_Pages">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Wiki Group</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Page</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Id</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</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>205</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<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>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_PrevPage">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><<</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NextPage">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>>></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_PrevMod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><< Mod</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_Edit">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NextMod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mod >></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NewGroup">
|
||||
<property name="text">
|
||||
<string>New Group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NewPage">
|
||||
<property name="text">
|
||||
<string>New Page</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_Delete">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>528</width>
|
||||
<height>511</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>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Wiki_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
110
retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp
Normal file
110
retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Retroshare Wiki Plugin.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "gui/WikiPoos/WikiEditDialog.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
WikiEditDialog::WikiEditDialog(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelEdit( void ) ) );
|
||||
connect(ui.pushButton_Revert, SIGNAL( clicked( void ) ), this, SLOT( revertEdit( void ) ) );
|
||||
connect(ui.pushButton_Submit, SIGNAL( clicked( void ) ), this, SLOT( submitEdit( void ) ) );
|
||||
|
||||
}
|
||||
|
||||
void WikiEditDialog::setGroup(RsWikiGroup &group)
|
||||
{
|
||||
mWikiGroup = group;
|
||||
|
||||
ui.lineEdit_Group->setText(QString::fromStdString(mWikiGroup.mName));
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::setPreviousPage(RsWikiPage &page)
|
||||
{
|
||||
mNewPage = false;
|
||||
mWikiPage = page;
|
||||
|
||||
ui.lineEdit_Page->setText(QString::fromStdString(mWikiPage.mName));
|
||||
ui.lineEdit_PrevVersion->setText(QString::fromStdString(mWikiPage.mPageId));
|
||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiPage.mPage));
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::setNewPage()
|
||||
{
|
||||
mNewPage = true;
|
||||
ui.lineEdit_Page->setText("");
|
||||
ui.lineEdit_PrevVersion->setText("");
|
||||
ui.textEdit->setPlainText("");
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::cancelEdit()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::revertEdit()
|
||||
{
|
||||
if (mNewPage)
|
||||
{
|
||||
ui.textEdit->setPlainText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.textEdit->setPlainText(QString::fromStdString(mWikiPage.mPage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WikiEditDialog::submitEdit()
|
||||
{
|
||||
if (mNewPage)
|
||||
{
|
||||
mWikiPage.mGroupId = mWikiGroup.mGroupId;
|
||||
mWikiPage.mOrigPageId = "";
|
||||
mWikiPage.mPageId = "";
|
||||
mWikiPage.mPrevId = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
mWikiPage.mPrevId = mWikiPage.mPageId;
|
||||
mWikiPage.mPageId = "";
|
||||
}
|
||||
|
||||
mWikiPage.mName = ui.lineEdit_Page->text().toStdString();
|
||||
mWikiPage.mPage = ui.textEdit->toPlainText().toStdString();
|
||||
|
||||
rsWiki->createPage(mWikiPage);
|
||||
hide();
|
||||
}
|
||||
|
||||
|
59
retroshare-gui/src/gui/WikiPoos/WikiEditDialog.h
Normal file
59
retroshare-gui/src/gui/WikiPoos/WikiEditDialog.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Retroshare Wiki Plugin.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MRK_WIKI_EDIT_DIALOG_H
|
||||
#define MRK_WIKI_EDIT_DIALOG_H
|
||||
|
||||
#include "ui_WikiEditDialog.h"
|
||||
|
||||
#include <retroshare/rswiki.h>
|
||||
|
||||
class WikiEditDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WikiEditDialog(QWidget *parent = 0);
|
||||
|
||||
void setGroup(RsWikiGroup &group);
|
||||
void setPreviousPage(RsWikiPage &page);
|
||||
void setNewPage();
|
||||
|
||||
private slots:
|
||||
|
||||
void cancelEdit();
|
||||
void revertEdit();
|
||||
void submitEdit();
|
||||
|
||||
private:
|
||||
|
||||
bool mNewPage;
|
||||
RsWikiGroup mWikiGroup;
|
||||
RsWikiPage mWikiPage;
|
||||
|
||||
Ui::WikiEditDialog ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
170
retroshare-gui/src/gui/WikiPoos/WikiEditDialog.ui
Normal file
170
retroshare-gui/src/gui/WikiPoos/WikiEditDialog.ui
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WikiEditDialog</class>
|
||||
<widget class="QWidget" name="WikiEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>647</width>
|
||||
<height>618</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Wiki Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Wiki Group:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>groupBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Group">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>168</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Page Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Page">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>10</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Edit ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QComboBox" name="comboBox_Id"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Previous Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_PrevVersion">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>10</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Prev ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_PrevId">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Revert">
|
||||
<property name="text">
|
||||
<string>Revert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>228</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Submit">
|
||||
<property name="text">
|
||||
<string>Submit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Wiki_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
5
retroshare-gui/src/gui/WikiPoos/Wiki_images.qrc
Normal file
5
retroshare-gui/src/gui/WikiPoos/Wiki_images.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>images/dummy.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue
Block a user