2018-11-13 22:02:26 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* gui/feeds/GxsForumMsgItem.h *
|
|
|
|
* *
|
|
|
|
* Copyright (c) 2014, Retroshare Team <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2014-11-19 12:40:42 +00:00
|
|
|
|
|
|
|
#ifndef _GXSFORUMMSGITEM_H
|
|
|
|
#define _GXSFORUMMSGITEM_H
|
|
|
|
|
|
|
|
#include <retroshare/rsgxsforums.h>
|
|
|
|
#include "gui/gxs/GxsFeedItem.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class GxsForumMsgItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
class FeedHolder;
|
|
|
|
|
|
|
|
class GxsForumMsgItem : public GxsFeedItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
|
|
|
|
GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, const RsGxsForumMsg &post, bool isHome, bool autoUpdate);
|
|
|
|
GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumMsg &post, bool isHome, bool autoUpdate);
|
|
|
|
virtual ~GxsForumMsgItem();
|
|
|
|
|
|
|
|
bool setGroup(const RsGxsForumGroup &group, bool doFill = true);
|
|
|
|
bool setMessage(const RsGxsForumMsg &msg, bool doFill = true);
|
|
|
|
|
2020-01-16 20:33:34 +01:00
|
|
|
uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumMsgItem " + messageId().toStdString()) ; }
|
2015-06-17 18:59:12 +00:00
|
|
|
protected:
|
2014-11-19 12:40:42 +00:00
|
|
|
/* FeedItem */
|
2020-11-10 20:06:04 +01:00
|
|
|
virtual void doExpand(bool open) override;
|
|
|
|
virtual void expandFill(bool first) override;
|
2014-11-19 12:40:42 +00:00
|
|
|
|
|
|
|
/* load message data */
|
2020-02-16 20:57:36 +01:00
|
|
|
virtual void loadParentMessage(const RsGxsMessageId &parent_msg);
|
2014-11-19 12:40:42 +00:00
|
|
|
|
|
|
|
/* GxsGroupFeedItem */
|
2020-11-10 20:06:04 +01:00
|
|
|
virtual QString groupName() override;
|
2020-02-16 20:57:36 +01:00
|
|
|
virtual void loadGroup() override;
|
2020-11-10 20:06:04 +01:00
|
|
|
virtual RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_FORUM; }
|
2020-02-16 20:57:36 +01:00
|
|
|
//virtual bool isLoading();
|
2014-11-19 12:40:42 +00:00
|
|
|
|
|
|
|
/* GxsFeedItem */
|
2020-11-10 20:06:04 +01:00
|
|
|
virtual QString messageName() override;
|
2020-02-16 20:57:36 +01:00
|
|
|
virtual void loadMessage() override;
|
|
|
|
virtual void loadComment() override { return; }
|
2014-11-19 12:40:42 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
/* default stuff */
|
2020-01-14 21:43:29 +01:00
|
|
|
void toggle() override;
|
2014-11-19 12:40:42 +00:00
|
|
|
void readAndClearItem();
|
|
|
|
|
|
|
|
void unsubscribeForum();
|
|
|
|
|
2020-11-10 20:06:04 +01:00
|
|
|
void on_linkActivated(QString link);
|
|
|
|
|
2014-11-19 12:40:42 +00:00
|
|
|
signals:
|
|
|
|
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setup();
|
|
|
|
void fill();
|
2015-06-17 18:59:12 +00:00
|
|
|
void fillExpandFrame();
|
2014-11-19 12:40:42 +00:00
|
|
|
void setReadStatus(bool isNew, bool isUnread);
|
|
|
|
void setAsRead();
|
|
|
|
bool isTop();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mInFill;
|
|
|
|
bool mCloseOnRead;
|
|
|
|
|
|
|
|
RsGxsForumGroup mGroup;
|
|
|
|
RsGxsForumMsg mMessage;
|
|
|
|
RsGxsForumMsg mParentMessage;
|
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::GxsForumMsgItem *ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|