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:
drbob 2012-02-04 13:47:36 +00:00
parent efddc9afab
commit 42acb5007e
10 changed files with 1554 additions and 0 deletions

View 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();
}