mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added feed item for forum group and forum message
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7692 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
06065ef623
commit
d70bb01b2e
@ -34,8 +34,8 @@
|
||||
|
||||
#include "feeds/GxsChannelGroupItem.h"
|
||||
#include "feeds/GxsChannelPostItem.h"
|
||||
//#include "feeds/ForumNewItem.h"
|
||||
//#include "feeds/ForumMsgItem.h"
|
||||
#include "feeds/GxsForumGroupItem.h"
|
||||
#include "feeds/GxsForumMsgItem.h"
|
||||
#include "settings/rsettingswin.h"
|
||||
|
||||
#ifdef BLOGS
|
||||
@ -833,11 +833,17 @@ void NewsFeed::addFeedItemChannelMsg(const RsFeedItem &fi)
|
||||
|
||||
void NewsFeed::addFeedItemForumNew(const RsFeedItem &fi)
|
||||
{
|
||||
RsGxsGroupId grpId(fi.mId1);
|
||||
|
||||
if (grpId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* make new widget */
|
||||
// ForumNewItem *fni = new ForumNewItem(this, NEWSFEED_FORUMNEWLIST, fi.mId1, false, true);
|
||||
GxsForumGroupItem *item = new GxsForumGroupItem(this, NEWSFEED_FORUMNEWLIST, grpId, false, true);
|
||||
|
||||
/* add to layout */
|
||||
// addFeedItem(fni);
|
||||
addFeedItem(item);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemForumNew()";
|
||||
@ -861,11 +867,18 @@ void NewsFeed::addFeedItemForumNew(const RsFeedItem &fi)
|
||||
|
||||
void NewsFeed::addFeedItemForumMsg(const RsFeedItem &fi)
|
||||
{
|
||||
RsGxsGroupId grpId(fi.mId1);
|
||||
RsGxsMessageId msgId(fi.mId2);
|
||||
|
||||
if (grpId.isNull() || msgId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* make new widget */
|
||||
// ForumMsgItem *fm = new ForumMsgItem(this, NEWSFEED_FORUMMSGLIST, fi.mId1, fi.mId2, false);
|
||||
GxsForumMsgItem *item = new GxsForumMsgItem(this, NEWSFEED_FORUMMSGLIST, grpId, msgId, false, true);
|
||||
|
||||
/* add to layout */
|
||||
// addFeedItem(fm);
|
||||
addFeedItem(item);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemForumMsg()";
|
||||
|
@ -22,11 +22,8 @@
|
||||
#ifndef _GXSCHANNELGROUPITEM_H
|
||||
#define _GXSCHANNELGROUPITEM_H
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
#include "gui/gxs/GxsGroupFeedItem.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Ui {
|
||||
class GxsChannelGroupItem;
|
||||
@ -72,6 +69,4 @@ private:
|
||||
Ui::GxsChannelGroupItem *ui;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(RsGxsChannelGroup)
|
||||
|
||||
#endif
|
||||
|
@ -12,16 +12,16 @@
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
|
@ -95,6 +95,7 @@ void GxsChannelPostItem::setup()
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
mInFill = false;
|
||||
mCloseOnRead = false;
|
||||
|
||||
/* clear ui */
|
||||
ui->titleLabel->setText(tr("Loading"));
|
||||
@ -118,7 +119,6 @@ void GxsChannelPostItem::setup()
|
||||
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyMessageLink()));
|
||||
|
||||
connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
|
||||
//connect(ui-> voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
|
||||
//connect(ui->voteDownButton, SIGNAL(clicked()), this, SLOT(makeDownVote()));
|
||||
@ -176,6 +176,16 @@ bool GxsChannelPostItem::setPost(const RsGxsChannelPost &post, bool doFill)
|
||||
return true;
|
||||
}
|
||||
|
||||
QString GxsChannelPostItem::getTitleLabel()
|
||||
{
|
||||
return QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
|
||||
}
|
||||
|
||||
QString GxsChannelPostItem::getMsgLabel()
|
||||
{
|
||||
return RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
|
||||
}
|
||||
|
||||
QString GxsChannelPostItem::groupName()
|
||||
{
|
||||
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
|
||||
@ -257,6 +267,10 @@ void GxsChannelPostItem::fill()
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||
removeItem();
|
||||
}
|
||||
|
||||
title = tr("Channel Feed") + ": ";
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
|
||||
@ -278,6 +292,10 @@ void GxsChannelPostItem::fill()
|
||||
ui->readButton->hide();
|
||||
ui->newLabel->hide();
|
||||
ui->copyLinkButton->hide();
|
||||
|
||||
if (IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||
mCloseOnRead = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -307,6 +325,8 @@ void GxsChannelPostItem::fill()
|
||||
ui->readButton->setVisible(false);
|
||||
ui->newLabel->setVisible(false);
|
||||
}
|
||||
|
||||
mCloseOnRead = false;
|
||||
}
|
||||
|
||||
// differences between Feed or Top of Comment.
|
||||
@ -601,6 +621,8 @@ void GxsChannelPostItem::readToggled(bool checked)
|
||||
return;
|
||||
}
|
||||
|
||||
mCloseOnRead = false;
|
||||
|
||||
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
|
||||
|
||||
uint32_t token;
|
||||
@ -609,21 +631,6 @@ void GxsChannelPostItem::readToggled(bool checked)
|
||||
setReadStatus(false, checked);
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
||||
{
|
||||
#if 0
|
||||
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
|
||||
if (!mIsHome) {
|
||||
if (status & CHANNEL_MSG_STATUS_READ) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::makeDownVote()
|
||||
{
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
|
@ -28,8 +28,6 @@
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
#include "gui/gxs/GxsFeedItem.h"
|
||||
#include <stdint.h>
|
||||
#include "util/HandleRichText.h"
|
||||
|
||||
namespace Ui {
|
||||
class GxsChannelPostItem;
|
||||
@ -53,8 +51,8 @@ public:
|
||||
|
||||
void setFileCleanUpWarning(uint32_t time_left);
|
||||
|
||||
const QString getTitleLabel() {return QString::fromUtf8(mPost.mMeta.mMsgName.c_str()); }
|
||||
const QString getMsgLabel() {return RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS); }
|
||||
QString getTitleLabel();
|
||||
QString getMsgLabel();
|
||||
const std::list<SubFileItem *> &getFileItems() {return mFileItems; }
|
||||
|
||||
/* FeedItem */
|
||||
@ -79,7 +77,6 @@ private slots:
|
||||
void loadComments();
|
||||
|
||||
void readToggled(bool checked);
|
||||
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||
|
||||
void unsubscribeChannel();
|
||||
void updateItem();
|
||||
@ -97,6 +94,7 @@ private:
|
||||
|
||||
private:
|
||||
bool mInFill;
|
||||
bool mCloseOnRead;
|
||||
|
||||
RsGxsChannelGroup mGroup;
|
||||
RsGxsChannelPost mPost;
|
||||
|
205
retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp
Normal file
205
retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp
Normal file
@ -0,0 +1,205 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2014 RetroShare Team
|
||||
*
|
||||
* 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.
|
||||
****************************************************************/
|
||||
|
||||
#include "GxsForumGroupItem.h"
|
||||
#include "ui_GxsForumGroupItem.h"
|
||||
|
||||
#include "FeedHolder.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate) :
|
||||
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
}
|
||||
|
||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) :
|
||||
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
setGroup(group);
|
||||
}
|
||||
|
||||
GxsForumGroupItem::~GxsForumGroupItem()
|
||||
{
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::setup()
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui = new(Ui::GxsForumGroupItem);
|
||||
ui->setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/* clear ui */
|
||||
ui->nameLabel->setText(tr("Loading"));
|
||||
ui->titleLabel->clear();
|
||||
ui->descLabel->clear();
|
||||
|
||||
/* general ones */
|
||||
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(toggle()));
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
|
||||
|
||||
/* specific */
|
||||
connect(ui->subscribeButton, SIGNAL(clicked()), this, SLOT(subscribeForum()));
|
||||
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyGroupLink()));
|
||||
|
||||
ui->expandFrame->hide();
|
||||
}
|
||||
|
||||
bool GxsForumGroupItem::setGroup(const RsGxsForumGroup &group)
|
||||
{
|
||||
if (groupId() != group.mMeta.mGroupId) {
|
||||
std::cerr << "GxsForumGroupItem::setContent() - Wrong id, cannot set post";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
mGroup = group;
|
||||
fill();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::loadGroup(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
if (!rsGxsForums->getGroupData(token, groups))
|
||||
{
|
||||
std::cerr << "GxsForumGroupItem::loadGroup() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsForumGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
setGroup(groups[0]);
|
||||
}
|
||||
|
||||
QString GxsForumGroupItem::groupName()
|
||||
{
|
||||
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::fill()
|
||||
{
|
||||
/* fill in */
|
||||
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumGroupItem::fill()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, mGroup.mMeta.mGroupId, groupName());
|
||||
ui->nameLabel->setText(link.toHtml());
|
||||
|
||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||
|
||||
if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) {
|
||||
ui->forumlogo_label->setPixmap(QPixmap(":/images/konv_message64.png"));
|
||||
} else {
|
||||
ui->forumlogo_label->setPixmap(QPixmap(":/images/konversation64.png"));
|
||||
}
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) {
|
||||
ui->subscribeButton->setEnabled(false);
|
||||
} else {
|
||||
ui->subscribeButton->setEnabled(true);
|
||||
}
|
||||
|
||||
// if (mIsNew)
|
||||
// {
|
||||
ui->titleLabel->setText(tr("New Forum"));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ui->titleLabel->setText(tr("Updated Forum"));
|
||||
// }
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
ui->clearButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::toggle()
|
||||
{
|
||||
expand(ui->expandFrame->isHidden());
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::expand(bool open)
|
||||
{
|
||||
if (mFeedHolder)
|
||||
{
|
||||
mFeedHolder->lockLayout(this, true);
|
||||
}
|
||||
|
||||
if (open)
|
||||
{
|
||||
ui->expandFrame->show();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
ui->expandButton->setToolTip(tr("Hide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->expandFrame->hide();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
ui->expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
emit sizeChanged(this);
|
||||
|
||||
if (mFeedHolder)
|
||||
{
|
||||
mFeedHolder->lockLayout(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::subscribeForum()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumGroupItem::subscribeForum()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
subscribe();
|
||||
}
|
72
retroshare-gui/src/gui/feeds/GxsForumGroupItem.h
Normal file
72
retroshare-gui/src/gui/feeds/GxsForumGroupItem.h
Normal file
@ -0,0 +1,72 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2014 RetroShare Team
|
||||
*
|
||||
* 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 _GXSFORUMGROUPITEM_H
|
||||
#define _GXSFORUMGROUPITEM_H
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
#include "gui/gxs/GxsGroupFeedItem.h"
|
||||
|
||||
namespace Ui {
|
||||
class GxsForumGroupItem;
|
||||
}
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
class GxsForumGroupItem : public GxsGroupFeedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate);
|
||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate);
|
||||
~GxsForumGroupItem();
|
||||
|
||||
bool setGroup(const RsGxsForumGroup &group);
|
||||
|
||||
/* FeedItem */
|
||||
virtual void expand(bool open);
|
||||
|
||||
protected:
|
||||
/* GxsGroupFeedItem */
|
||||
virtual QString groupName();
|
||||
virtual void loadGroup(const uint32_t &token);
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void toggle();
|
||||
|
||||
void subscribeForum();
|
||||
|
||||
private:
|
||||
void fill();
|
||||
void setup();
|
||||
|
||||
private:
|
||||
RsGxsForumGroup mGroup;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsForumGroupItem *ui;
|
||||
};
|
||||
|
||||
#endif
|
335
retroshare-gui/src/gui/feeds/GxsForumGroupItem.ui
Normal file
335
retroshare-gui/src/gui/feeds/GxsForumGroupItem.ui
Normal file
@ -0,0 +1,335 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GxsForumGroupItem</class>
|
||||
<widget class="QWidget" name="GxsForumGroupItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>618</width>
|
||||
<height>157</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="forumlogo_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/konversation64.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string notr="true">name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>254</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyLinkButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="subscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Subscribe to Forum</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Forum Description</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/contacts24.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="descLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Description
|
||||
of Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
505
retroshare-gui/src/gui/feeds/GxsForumMsgItem.cpp
Normal file
505
retroshare-gui/src/gui/feeds/GxsForumMsgItem.cpp
Normal file
@ -0,0 +1,505 @@
|
||||
/*
|
||||
* Retroshare Gxs Feed Item
|
||||
*
|
||||
* Copyright 2014 RetroShare Team
|
||||
*
|
||||
* 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 <QTimer>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "GxsForumMsgItem.h"
|
||||
#include "ui_GxsForumMsgItem.h"
|
||||
|
||||
#include "FeedHolder.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
#define COLOR_NORMAL QColor(248, 248, 248)
|
||||
#define COLOR_NEW QColor(220, 236, 253)
|
||||
|
||||
GxsForumMsgItem::GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
requestMessage();
|
||||
}
|
||||
|
||||
GxsForumMsgItem::GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, const RsGxsForumMsg &post, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::GxsForumMsgItem() Direct Load";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
setup();
|
||||
|
||||
setGroup(group, false);
|
||||
setMessage(post);
|
||||
}
|
||||
|
||||
GxsForumMsgItem::GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumMsg &post, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::GxsForumMsgItem() Direct Load";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
setMessage(post);
|
||||
}
|
||||
|
||||
GxsForumMsgItem::~GxsForumMsgItem()
|
||||
{
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::setup()
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui = new Ui::GxsForumMsgItem;
|
||||
ui->setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
mInFill = false;
|
||||
mCloseOnRead = false;
|
||||
mTokenTypeParentMessage = nextTokenType();
|
||||
|
||||
/* clear ui */
|
||||
ui->titleLabel->setText(tr("Loading"));
|
||||
ui->subjectLabel->clear();
|
||||
ui->timestamplabel->clear();
|
||||
|
||||
/* general ones */
|
||||
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(toggle()));
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
|
||||
|
||||
/* specific */
|
||||
connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
|
||||
connect(ui->unsubscribeButton, SIGNAL(clicked()), this, SLOT(unsubscribeForum()));
|
||||
|
||||
ui->subjectLabel->setMinimumWidth(20);
|
||||
|
||||
ui->expandFrame->hide();
|
||||
ui->parentFrame->hide();
|
||||
}
|
||||
|
||||
bool GxsForumMsgItem::isTop()
|
||||
{
|
||||
// if (mMessage.mMeta.mMsgId == mMessage.mMeta.mThreadId || mMessage.mMeta.mThreadId.isNull()) {
|
||||
if (mMessage.mMeta.mParentId.isNull()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GxsForumMsgItem::setGroup(const RsGxsForumGroup &group, bool doFill)
|
||||
{
|
||||
if (groupId() != group.mMeta.mGroupId) {
|
||||
std::cerr << "GxsForumMsgItem::setGroup() - Wrong id, cannot set post";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
mGroup = group;
|
||||
|
||||
if (doFill) {
|
||||
fill();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsForumMsgItem::setMessage(const RsGxsForumMsg &msg, bool doFill)
|
||||
{
|
||||
if (groupId() != msg.mMeta.mGroupId || messageId() != msg.mMeta.mMsgId) {
|
||||
std::cerr << "GxsForumMsgItem::setPost() - Wrong id, cannot set post";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
mMessage = msg;
|
||||
|
||||
if (!isTop()) {
|
||||
requestParentMessage(mMessage.mMeta.mParentId);
|
||||
} else {
|
||||
if (doFill) {
|
||||
fill();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString GxsForumMsgItem::groupName()
|
||||
{
|
||||
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::loadGroup(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
if (!rsGxsForums->getGroupData(token, groups))
|
||||
{
|
||||
std::cerr << "GxsForumGroupItem::loadGroup() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsForumGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
setGroup(groups[0]);
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::loadMessage(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::loadMessage()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsForumMsg> msgs;
|
||||
if (!rsGxsForums->getMsgData(token, msgs))
|
||||
{
|
||||
std::cerr << "GxsForumMsgItem::loadMessage() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgs.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsForumMsgItem::loadMessage() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
setMessage(msgs[0]);
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::loadParentMessage(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::loadParentMessage()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsForumMsg> msgs;
|
||||
if (!rsGxsForums->getMsgData(token, msgs))
|
||||
{
|
||||
std::cerr << "GxsForumMsgItem::loadParentMessage() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgs.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsForumMsgItem::loadParentMessage() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
mParentMessage = msgs[0];
|
||||
|
||||
fill();
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::fill()
|
||||
{
|
||||
/* fill in */
|
||||
|
||||
if (isLoading()) {
|
||||
/* Wait for all requests */
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::fill()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mInFill = true;
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
if (mCloseOnRead && !IS_MSG_NEW(mMessage.mMeta.mMsgStatus)) {
|
||||
removeItem();
|
||||
}
|
||||
}
|
||||
|
||||
QString title = tr("Forum Feed") + ": ";
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, groupName());
|
||||
title += link.toHtml();
|
||||
ui->titleLabel->setText(title);
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags)) {
|
||||
ui->unsubscribeButton->setEnabled(true);
|
||||
|
||||
setReadStatus(IS_MSG_NEW(mMessage.mMeta.mMsgStatus), IS_MSG_UNREAD(mMessage.mMeta.mMsgStatus) || IS_MSG_NEW(mMessage.mMeta.mMsgStatus));
|
||||
} else {
|
||||
ui->unsubscribeButton->setEnabled(false);
|
||||
}
|
||||
|
||||
if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) {
|
||||
ui->iconLabel->setPixmap(QPixmap(":/images/konv_message64.png"));
|
||||
} else {
|
||||
ui->iconLabel->setPixmap(QPixmap(":/images/konversation64.png"));
|
||||
}
|
||||
|
||||
if (!mIsHome) {
|
||||
if (IS_MSG_NEW(mMessage.mMeta.mMsgStatus)) {
|
||||
mCloseOnRead = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ui->avatar->setId(msg.srcId, true);
|
||||
|
||||
// if (rsPeers->getPeerName(msg.srcId) != "") {
|
||||
// RetroShareLink linkMessage;
|
||||
// linkMessage.createMessage(msg.srcId, "");
|
||||
// nameLabel->setText(linkMessage.toHtml());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nameLabel->setText(tr("Anonymous"));
|
||||
// }
|
||||
|
||||
RetroShareLink msgLink;
|
||||
msgLink.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, mMessage.mMeta.mMsgId, messageName());
|
||||
ui->subLabel->setText(msgLink.toHtml());
|
||||
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mMessage.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
ui->timestamplabel->setText(DateTime::formatLongDateTime(mMessage.mMeta.mPublishTs));
|
||||
|
||||
if (isTop()) {
|
||||
ui->parentFrame->hide();
|
||||
} else {
|
||||
// ui->parentAvatar->setId(msgParent.srcId, true);
|
||||
|
||||
RetroShareLink linkParent;
|
||||
linkParent.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mParentMessage.mMeta.mGroupId, mParentMessage.mMeta.mMsgId, QString::fromUtf8(mParentMessage.mMeta.mMsgName.c_str()));
|
||||
ui->parentSubLabel->setText(linkParent.toHtml());
|
||||
ui->parentMsgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mParentMessage.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
// if (rsPeers->getPeerName(msgParent.srcId) !="")
|
||||
// {
|
||||
// RetroShareLink linkMessage;
|
||||
// linkMessage.createMessage(msgParent.srcId, "");
|
||||
// ui->parentNameLabel->setText(linkMessage.toHtml());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ui->parentNameLabel->setText(tr("Anonymous"));
|
||||
// }
|
||||
}
|
||||
|
||||
/* header stuff */
|
||||
ui->subjectLabel->setText(msgLink.toHtml());
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
ui->clearButton->setEnabled(false);
|
||||
|
||||
ui->clearButton->hide();
|
||||
}
|
||||
|
||||
mInFill = false;
|
||||
}
|
||||
|
||||
QString GxsForumMsgItem::messageName()
|
||||
{
|
||||
return QString::fromUtf8(mMessage.mMeta.mMsgName.c_str());
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::expand(bool open)
|
||||
{
|
||||
if (mFeedHolder)
|
||||
{
|
||||
mFeedHolder->lockLayout(this, true);
|
||||
}
|
||||
|
||||
if (open)
|
||||
{
|
||||
ui->expandFrame->show();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
ui->expandButton->setToolTip(tr("Hide"));
|
||||
|
||||
if (!mParentMessage.mMeta.mMsgId.isNull()) {
|
||||
ui->parentFrame->show();
|
||||
}
|
||||
|
||||
setAsRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->expandFrame->hide();
|
||||
ui->parentFrame->hide();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
ui->expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
emit sizeChanged(this);
|
||||
|
||||
if (mFeedHolder)
|
||||
{
|
||||
mFeedHolder->lockLayout(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::toggle()
|
||||
{
|
||||
expand(ui->expandFrame->isHidden());
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::setReadStatus(bool isNew, bool /*isUnread*/)
|
||||
{
|
||||
/* unpolish widget to clear the stylesheet's palette cache */
|
||||
ui->frame->style()->unpolish(ui->frame);
|
||||
|
||||
QPalette palette = ui->frame->palette();
|
||||
palette.setColor(ui->frame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL); // QScrollArea
|
||||
palette.setColor(QPalette::Base, isNew ? COLOR_NEW : COLOR_NORMAL); // QTreeWidget
|
||||
ui->frame->setPalette(palette);
|
||||
|
||||
ui->frame->setProperty("new", isNew);
|
||||
Rshare::refreshStyleSheet(ui->frame, false);
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::requestParentMessage(const RsGxsMessageId &msgId)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsFeedItem::requestMessage()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (!initLoadQueue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mLoadQueue->activeRequestExist(mTokenTypeParentMessage)) {
|
||||
/* Request already running */
|
||||
return;
|
||||
}
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||
vect_msgIds.push_back(msgId);
|
||||
|
||||
uint32_t token;
|
||||
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeParentMessage);
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsFeedItem::loadRequest()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (queue == mLoadQueue) {
|
||||
if (req.mUserType == mTokenTypeParentMessage) {
|
||||
loadParentMessage(req.mToken);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GxsFeedItem::loadRequest(queue, req);
|
||||
}
|
||||
|
||||
bool GxsForumMsgItem::isLoading()
|
||||
{
|
||||
if (GxsFeedItem::isLoading()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mLoadQueue && mLoadQueue->activeRequestExist(mTokenTypeParentMessage)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*********** SPECIFIC FUNCTIONS ***********************/
|
||||
|
||||
void GxsForumMsgItem::readAndClearItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::readAndClearItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
setAsRead();
|
||||
removeItem();
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::unsubscribeForum()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsForumMsgItem::unsubscribeForum()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
|
||||
void GxsForumMsgItem::setAsRead()
|
||||
{
|
||||
if (mInFill) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCloseOnRead = false;
|
||||
|
||||
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
|
||||
|
||||
uint32_t token;
|
||||
rsGxsForums->setMessageReadStatus(token, msgPair, false);
|
||||
|
||||
setReadStatus(false, false);
|
||||
}
|
98
retroshare-gui/src/gui/feeds/GxsForumMsgItem.h
Normal file
98
retroshare-gui/src/gui/feeds/GxsForumMsgItem.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Retroshare Gxs Feed Item
|
||||
*
|
||||
* Copyright 2014 RetroShare Team
|
||||
*
|
||||
* 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 _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);
|
||||
|
||||
/* FeedItem */
|
||||
virtual void expand(bool open);
|
||||
|
||||
protected:
|
||||
/* load message data */
|
||||
void requestParentMessage(const RsGxsMessageId &msgId);
|
||||
virtual void loadParentMessage(const uint32_t &token);
|
||||
|
||||
/* GxsGroupFeedItem */
|
||||
virtual QString groupName();
|
||||
virtual void loadGroup(const uint32_t &token);
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
||||
virtual bool isLoading();
|
||||
|
||||
/* GxsFeedItem */
|
||||
virtual void loadMessage(const uint32_t &token);
|
||||
virtual QString messageName();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void toggle();
|
||||
void readAndClearItem();
|
||||
|
||||
void unsubscribeForum();
|
||||
|
||||
signals:
|
||||
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
||||
|
||||
private:
|
||||
void setup();
|
||||
void fill();
|
||||
void setReadStatus(bool isNew, bool isUnread);
|
||||
void setAsRead();
|
||||
bool isTop();
|
||||
|
||||
private:
|
||||
bool mInFill;
|
||||
bool mCloseOnRead;
|
||||
|
||||
RsGxsForumGroup mGroup;
|
||||
RsGxsForumMsg mMessage;
|
||||
RsGxsForumMsg mParentMessage;
|
||||
uint32_t mTokenTypeParentMessage;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsForumMsgItem *ui;
|
||||
};
|
||||
|
||||
#endif
|
612
retroshare-gui/src/gui/feeds/GxsForumMsgItem.ui
Normal file
612
retroshare-gui/src/gui/feeds/GxsForumMsgItem.ui
Normal file
@ -0,0 +1,612 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GxsForumMsgItem</class>
|
||||
<widget class="QWidget" name="GxsForumMsgItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>577</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Subject: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="subjectLabel">
|
||||
<property name="text">
|
||||
<string notr="true">Subject...</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="unsubscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Unsubscribe To Forum</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readAndClearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set as read and remove item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/konversation64.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Forum Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>358</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLabel" name="timestamplabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Timestamp</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>518</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="AvatarWidget" name="avatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Subject: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="subLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Message is about ???</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2" rowspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="msgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Current Message..</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QFrame" name="parentFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="AvatarWidget" name="parentAvatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="parentNameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="parentSHLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>In Reply to: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="parentSubLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Message is about ???</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>9</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="parentMsgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Previous Message...</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AvatarWidget</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/AvatarWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -85,16 +85,6 @@ void GxsFeedItem::copyMessageLink()
|
||||
}
|
||||
}
|
||||
|
||||
//void GxsFeedItem::updateItemStatic()
|
||||
//{
|
||||
//#ifdef DEBUG_ITEM
|
||||
// std::cerr << "GxsFeedItem::updateItemStatic()";
|
||||
// std::cerr << std::endl;
|
||||
//#endif
|
||||
|
||||
// requestMessage();
|
||||
//}
|
||||
|
||||
void GxsFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, bool complete)
|
||||
{
|
||||
GxsGroupFeedItem::fillDisplay(updateBroadcastBase, complete);
|
||||
@ -122,14 +112,13 @@ void GxsFeedItem::requestMessage()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (!mLoadQueue)
|
||||
{
|
||||
if (mGxsIface)
|
||||
{
|
||||
mLoadQueue = new TokenQueue(mGxsIface->getTokenService(), this);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (!initLoadQueue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mLoadQueue->activeRequestExist(mTokenTypeMessage)) {
|
||||
/* Request already running */
|
||||
return;
|
||||
}
|
||||
|
||||
RsTokReqOptions opts;
|
||||
|
@ -51,6 +51,7 @@ GxsGroupFeedItem::GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, cons
|
||||
mGroupId = groupId;
|
||||
mGxsIface = iface;
|
||||
|
||||
mNextTokenType = 0;
|
||||
mTokenTypeGroup = nextTokenType();
|
||||
|
||||
mLoadQueue = NULL;
|
||||
@ -81,6 +82,20 @@ GxsGroupFeedItem::~GxsGroupFeedItem()
|
||||
}
|
||||
}
|
||||
|
||||
bool GxsGroupFeedItem::initLoadQueue()
|
||||
{
|
||||
if (mLoadQueue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mGxsIface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mLoadQueue = new TokenQueue(mGxsIface->getTokenService(), this);
|
||||
return (mLoadQueue != NULL);
|
||||
}
|
||||
|
||||
void GxsGroupFeedItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
@ -148,22 +163,6 @@ void GxsGroupFeedItem::copyGroupLink()
|
||||
}
|
||||
}
|
||||
|
||||
//void GxsGroupFeedItem::updateItemStatic()
|
||||
//{
|
||||
//#ifdef DEBUG_ITEM
|
||||
// std::cerr << "GxsGroupFeedItem::updateItemStatic()";
|
||||
// std::cerr << std::endl;
|
||||
//#endif
|
||||
//}
|
||||
|
||||
//void GxsGroupFeedItem::updateItem()
|
||||
//{
|
||||
//#ifdef DEBUG_ITEM
|
||||
// std::cerr << "GxsGroupFeedItem::updateItem() EMPTY";
|
||||
// std::cerr << std::endl;
|
||||
//#endif
|
||||
//}
|
||||
|
||||
void GxsGroupFeedItem::fillDisplaySlot(bool complete)
|
||||
{
|
||||
fillDisplay(mUpdateBroadcastBase, complete);
|
||||
@ -188,12 +187,13 @@ void GxsGroupFeedItem::requestGroup()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (!mLoadQueue) {
|
||||
if (mGxsIface) {
|
||||
mLoadQueue = new TokenQueue(mGxsIface->getTokenService(), this);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (!initLoadQueue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mLoadQueue->activeRequestExist(mTokenTypeGroup)) {
|
||||
/* Request already running */
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsGroupId> ids;
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
|
||||
protected:
|
||||
uint32_t nextTokenType() { return ++mNextTokenType; }
|
||||
bool initLoadQueue();
|
||||
|
||||
/* load group data */
|
||||
void requestGroup();
|
||||
|
@ -1170,17 +1170,23 @@ gxsforums {
|
||||
gui/gxsforums/CreateGxsForumMsg.h \
|
||||
gui/gxsforums/GxsForumThreadWidget.h \
|
||||
gui/gxsforums/GxsForumsFillThread.h \
|
||||
gui/gxsforums/GxsForumUserNotify.h
|
||||
gui/gxsforums/GxsForumUserNotify.h \
|
||||
gui/feeds/GxsForumGroupItem.h \
|
||||
gui/feeds/GxsForumMsgItem.h
|
||||
|
||||
FORMS += gui/gxsforums/CreateGxsForumMsg.ui \
|
||||
gui/gxsforums/GxsForumThreadWidget.ui
|
||||
gui/gxsforums/GxsForumThreadWidget.ui \
|
||||
gui/feeds/GxsForumGroupItem.ui \
|
||||
gui/feeds/GxsForumMsgItem.ui
|
||||
|
||||
SOURCES += gui/gxsforums/GxsForumsDialog.cpp \
|
||||
gui/gxsforums/GxsForumGroupDialog.cpp \
|
||||
gui/gxsforums/CreateGxsForumMsg.cpp \
|
||||
gui/gxsforums/GxsForumThreadWidget.cpp \
|
||||
gui/gxsforums/GxsForumsFillThread.cpp \
|
||||
gui/gxsforums/GxsForumUserNotify.cpp
|
||||
gui/gxsforums/GxsForumUserNotify.cpp \
|
||||
gui/feeds/GxsForumGroupItem.cpp \
|
||||
gui/feeds/GxsForumMsgItem.cpp
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user