2008-04-09 08:57:26 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Robert Fernie
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _FORUMSDIALOG_H
|
|
|
|
#define _FORUMSDIALOG_H
|
|
|
|
|
2011-06-07 18:28:07 -04:00
|
|
|
#include <QThread>
|
|
|
|
|
2008-04-09 08:57:26 -04:00
|
|
|
#include "mainpage.h"
|
2010-07-05 15:41:46 -04:00
|
|
|
#include "RsAutoUpdatePage.h"
|
2008-04-09 08:57:26 -04:00
|
|
|
#include "ui_ForumsDialog.h"
|
|
|
|
|
2010-12-26 19:15:25 -05:00
|
|
|
class ForumInfo;
|
2011-06-07 18:28:07 -04:00
|
|
|
class ForumsFillThread;
|
2012-02-13 15:40:36 -05:00
|
|
|
class ForumMsgInfo;
|
2010-12-26 19:15:25 -05:00
|
|
|
|
2010-07-05 15:41:46 -04:00
|
|
|
class ForumsDialog : public RsAutoUpdatePage
|
2008-04-09 08:57:26 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-08-08 18:58:10 -04:00
|
|
|
ForumsDialog(QWidget *parent = 0);
|
|
|
|
~ForumsDialog();
|
|
|
|
|
2012-08-05 16:12:55 -04:00
|
|
|
virtual UserNotify *getUserNotify(QObject *parent);
|
|
|
|
|
2011-04-19 15:42:44 -04:00
|
|
|
bool navigate(const std::string& forumId, const std::string& msgId);
|
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
/* overloaded from RsAuthUpdatePage */
|
|
|
|
virtual void updateDisplay();
|
|
|
|
|
2012-02-13 15:40:36 -05:00
|
|
|
static QString titleFromInfo(ForumMsgInfo &msgInfo);
|
|
|
|
static QString messageFromInfo(ForumMsgInfo &msgInfo);
|
|
|
|
|
2011-05-02 17:50:20 -04:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
|
|
|
|
2008-04-09 08:57:26 -04:00
|
|
|
private slots:
|
2010-08-08 18:58:10 -04:00
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void forumListCustomPopupMenu( QPoint point );
|
|
|
|
void threadListCustomPopupMenu( QPoint point );
|
2011-02-08 17:34:54 -05:00
|
|
|
void restoreForumKeys();
|
2010-08-08 18:58:10 -04:00
|
|
|
void newforum();
|
2008-04-09 08:57:26 -04:00
|
|
|
|
2010-12-26 19:15:25 -05:00
|
|
|
void changedForum(const QString &id);
|
2010-08-08 18:58:10 -04:00
|
|
|
void changedThread();
|
|
|
|
void clickedThread (QTreeWidgetItem *item, int column);
|
2012-03-11 20:27:18 -04:00
|
|
|
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
|
2008-04-09 08:57:26 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void replytomessage();
|
|
|
|
//void print();
|
|
|
|
//void printpreview();
|
2008-04-15 12:40:38 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
//void removemessage();
|
|
|
|
void markMsgAsRead();
|
2010-11-15 18:33:32 -05:00
|
|
|
void markMsgAsReadChildren();
|
2010-08-08 18:58:10 -04:00
|
|
|
void markMsgAsReadAll();
|
|
|
|
void markMsgAsUnread();
|
|
|
|
void markMsgAsUnreadAll();
|
2010-11-15 18:33:32 -05:00
|
|
|
void markMsgAsUnreadChildren();
|
2011-04-19 15:42:44 -04:00
|
|
|
void copyForumLink();
|
|
|
|
void copyMessageLink();
|
2008-04-15 12:40:38 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
/* handle splitter */
|
|
|
|
void togglethreadview();
|
2008-04-09 08:57:26 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void createthread();
|
|
|
|
void createmessage();
|
2008-04-15 12:40:38 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void subscribeToForum();
|
|
|
|
void unsubscribeToForum();
|
2008-06-13 11:46:34 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void showForumDetails();
|
2010-09-14 15:38:47 -04:00
|
|
|
void editForumDetails();
|
2010-05-01 15:03:35 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void previousMessage ();
|
|
|
|
void nextMessage ();
|
2011-09-25 08:15:25 -04:00
|
|
|
void nextUnreadMessage();
|
2011-05-15 16:21:14 -04:00
|
|
|
void downloadAllFiles();
|
2010-05-01 15:03:35 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void changedViewBox();
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void filterColumnChanged();
|
2012-04-05 17:03:03 -04:00
|
|
|
void filterItems(const QString &text);
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2011-06-06 17:44:16 -04:00
|
|
|
void generateMassData();
|
|
|
|
|
2011-06-07 18:28:07 -04:00
|
|
|
void fillThreadFinished();
|
|
|
|
void fillThreadProgress(int current, int count);
|
|
|
|
|
2011-08-29 17:20:48 -04:00
|
|
|
void shareKey();
|
|
|
|
|
2008-04-09 08:57:26 -04:00
|
|
|
private:
|
2010-08-08 18:58:10 -04:00
|
|
|
void insertForums();
|
|
|
|
void insertThreads();
|
|
|
|
void insertPost();
|
2010-08-09 17:20:34 -04:00
|
|
|
void updateMessageSummaryList(std::string forumId);
|
2010-12-26 19:15:25 -05:00
|
|
|
void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
2010-08-08 18:58:10 -04:00
|
|
|
|
|
|
|
void forumSubscribe(bool subscribe);
|
2011-06-07 18:28:07 -04:00
|
|
|
void FillThreads(QList<QTreeWidgetItem *> &ThreadList, bool bExpandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
|
|
|
void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool bExpandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
2010-05-01 15:03:35 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
|
|
|
|
void setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead);
|
2010-11-15 18:33:32 -05:00
|
|
|
void markMsgAsReadUnread(bool bRead, bool bChildren, bool bForum);
|
2010-08-08 18:58:10 -04:00
|
|
|
void CalculateIconsAndFonts(QTreeWidgetItem *pItem = NULL);
|
|
|
|
void CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren);
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
void processSettings(bool bLoad);
|
|
|
|
void togglethreadview_internal();
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2012-04-05 17:03:03 -04:00
|
|
|
bool filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn);
|
2010-05-20 17:53:27 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
bool m_bProcessSettings;
|
2012-03-11 20:27:18 -04:00
|
|
|
bool inMsgAsReadUnread;
|
2008-04-09 08:57:26 -04:00
|
|
|
|
2010-12-26 19:15:25 -05:00
|
|
|
QTreeWidgetItem *yourForums;
|
|
|
|
QTreeWidgetItem *subscribedForums;
|
|
|
|
QTreeWidgetItem *popularForums;
|
|
|
|
QTreeWidgetItem *otherForums;
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
std::string mCurrForumId;
|
|
|
|
std::string mCurrThreadId;
|
2011-06-07 18:28:07 -04:00
|
|
|
int subscribeFlags;
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2011-06-06 17:44:16 -04:00
|
|
|
int lastViewType;
|
|
|
|
std::string lastForumID;
|
2010-05-19 16:17:43 -04:00
|
|
|
|
2011-06-07 18:28:07 -04:00
|
|
|
ForumsFillThread *fillThread;
|
|
|
|
|
2010-08-08 18:58:10 -04:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::ForumsDialog ui;
|
2008-04-09 08:57:26 -04:00
|
|
|
};
|
|
|
|
|
2011-06-07 18:28:07 -04:00
|
|
|
class ForumsFillThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ForumsFillThread(ForumsDialog *parent);
|
|
|
|
~ForumsFillThread();
|
|
|
|
|
|
|
|
void run();
|
|
|
|
void stop();
|
|
|
|
bool wasStopped() { return stopped; }
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void progress(int current, int count);
|
|
|
|
|
|
|
|
public:
|
|
|
|
std::string forumId;
|
|
|
|
int filterColumn;
|
|
|
|
int subscribeFlags;
|
|
|
|
bool fillComplete;
|
|
|
|
int viewType;
|
|
|
|
bool expandNewMessages;
|
2011-09-11 18:07:24 -04:00
|
|
|
std::string focusMsgId;
|
2011-06-07 18:28:07 -04:00
|
|
|
|
|
|
|
QList<QTreeWidgetItem*> items;
|
|
|
|
QList<QTreeWidgetItem*> itemToExpand;
|
|
|
|
|
|
|
|
private:
|
|
|
|
volatile bool stopped;
|
|
|
|
};
|
|
|
|
|
2008-04-09 08:57:26 -04:00
|
|
|
#endif
|
|
|
|
|