2012-02-04 08:47:36 -05:00
|
|
|
/*
|
|
|
|
* 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>
|
2012-06-08 18:06:23 -04:00
|
|
|
#include "util/TokenQueue.h"
|
2012-02-04 08:47:36 -05:00
|
|
|
|
2012-12-02 14:06:43 -05:00
|
|
|
class RSTreeWidgetItemCompareRole;
|
|
|
|
|
2012-06-08 18:06:23 -04:00
|
|
|
class WikiEditDialog : public QWidget, public TokenResponse
|
2012-02-04 08:47:36 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
WikiEditDialog(QWidget *parent = 0);
|
2012-12-02 14:06:43 -05:00
|
|
|
~WikiEditDialog();
|
2012-02-04 08:47:36 -05:00
|
|
|
|
|
|
|
void setNewPage();
|
|
|
|
|
2012-06-08 18:06:23 -04:00
|
|
|
void setupData(const std::string &groupId, const std::string &pageId);
|
|
|
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
|
|
|
2012-11-12 15:47:55 -05:00
|
|
|
void setRepublishMode(RsGxsMessageId &origMsgId);
|
|
|
|
|
2012-02-04 08:47:36 -05:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void cancelEdit();
|
|
|
|
void revertEdit();
|
|
|
|
void submitEdit();
|
2012-12-01 12:23:25 -05:00
|
|
|
void previewToggle();
|
|
|
|
void historyToggle();
|
2012-12-01 17:53:50 -05:00
|
|
|
void detailsToggle();
|
|
|
|
void textChanged();
|
|
|
|
void textReset();
|
2012-02-04 08:47:36 -05:00
|
|
|
|
2012-12-02 14:06:43 -05:00
|
|
|
void historySelected();
|
|
|
|
void oldHistoryChanged();
|
2012-12-03 19:47:34 -05:00
|
|
|
void mergeModeToggle();
|
|
|
|
void generateMerge();
|
2012-12-02 14:06:43 -05:00
|
|
|
|
2012-02-04 08:47:36 -05:00
|
|
|
private:
|
|
|
|
|
2012-12-02 14:06:43 -05:00
|
|
|
void updateHistoryStatus();
|
|
|
|
void updateHistoryChildren(QTreeWidgetItem *item, bool isLatest);
|
|
|
|
void updateHistoryItem(QTreeWidgetItem *item, bool isLatest);
|
|
|
|
|
2012-12-01 12:23:25 -05:00
|
|
|
void redrawPage();
|
|
|
|
|
2012-10-31 19:32:56 -04:00
|
|
|
void setGroup(RsWikiCollection &group);
|
|
|
|
void setPreviousPage(RsWikiSnapshot &page);
|
2012-06-08 18:06:23 -04:00
|
|
|
|
2012-11-12 15:47:55 -05:00
|
|
|
void requestPage(const RsGxsGrpMsgIdPair &msgId);
|
2012-06-08 18:06:23 -04:00
|
|
|
void loadPage(const uint32_t &token);
|
|
|
|
void requestGroup(const std::string &groupId);
|
|
|
|
void loadGroup(const uint32_t &token);
|
|
|
|
|
2012-12-01 12:23:25 -05:00
|
|
|
void requestBaseHistory(const RsGxsGrpMsgIdPair &origMsgId);
|
|
|
|
void loadBaseHistory(const uint32_t &token);
|
|
|
|
void requestEditTreeData();
|
|
|
|
void loadEditTreeData(const uint32_t &token);
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-04 08:47:36 -05:00
|
|
|
bool mNewPage;
|
2012-11-12 15:47:55 -05:00
|
|
|
|
2012-12-01 12:23:25 -05:00
|
|
|
bool mPreviewMode;
|
|
|
|
bool mPageLoading;
|
2012-12-03 19:47:34 -05:00
|
|
|
bool mHistoryLoaded;
|
|
|
|
bool mHistoryMergeMode;
|
2012-12-02 14:06:43 -05:00
|
|
|
bool mOldHistoryEnabled;
|
2012-12-01 12:23:25 -05:00
|
|
|
|
2012-11-12 15:47:55 -05:00
|
|
|
bool mRepublishMode;
|
2012-12-03 19:47:34 -05:00
|
|
|
bool mIgnoreTextChange; // when we do it programmatically.
|
2012-12-01 17:53:50 -05:00
|
|
|
bool mTextChanged;
|
2012-12-01 12:23:25 -05:00
|
|
|
|
|
|
|
QString mCurrentText;
|
|
|
|
|
|
|
|
RsGxsGrpMsgIdPair mThreadMsgIdPair;
|
2012-11-12 15:47:55 -05:00
|
|
|
RsGxsMessageId mRepublishOrigId;
|
|
|
|
|
2012-10-31 19:32:56 -04:00
|
|
|
RsWikiCollection mWikiCollection;
|
|
|
|
RsWikiSnapshot mWikiSnapshot;
|
2012-02-04 08:47:36 -05:00
|
|
|
|
|
|
|
Ui::WikiEditDialog ui;
|
|
|
|
|
2012-12-02 14:06:43 -05:00
|
|
|
RSTreeWidgetItemCompareRole *mThreadCompareRole;
|
|
|
|
|
2012-06-08 18:06:23 -04:00
|
|
|
TokenQueue *mWikiQueue;
|
2012-02-04 08:47:36 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|