mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-10 06:15:50 -05:00
Added new method to GxsFeedItem to set content with QVariant.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7477 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3458cdc8fc
commit
e588b25b67
6 changed files with 36 additions and 3 deletions
|
|
@ -73,7 +73,17 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, cons
|
|||
loadPost(post);
|
||||
}
|
||||
|
||||
bool GxsChannelPostItem::setPost(const RsGxsChannelPost &post)
|
||||
void GxsChannelPostItem::setContent(const QVariant &content)
|
||||
{
|
||||
if (!content.canConvert<RsGxsChannelPost>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsChannelPost post = content.value<RsGxsChannelPost>();
|
||||
setContent(post);
|
||||
}
|
||||
|
||||
bool GxsChannelPostItem::setContent(const RsGxsChannelPost &post)
|
||||
{
|
||||
if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) {
|
||||
std::cerr << "GxsChannelPostItem::setPost() - Wrong id, cannot set post";
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef _GXS_CHANNEL_POST_ITEM_H
|
||||
#define _GXS_CHANNEL_POST_ITEM_H
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
#include "gui/gxs/GxsFeedItem.h"
|
||||
#include <stdint.h>
|
||||
|
|
@ -46,8 +48,10 @@ public:
|
|||
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome, bool autoUpdate);
|
||||
virtual ~GxsChannelPostItem();
|
||||
|
||||
virtual void setContent(const QVariant &content);
|
||||
bool setContent(const RsGxsChannelPost &post);
|
||||
|
||||
void setFileCleanUpWarning(uint32_t time_left);
|
||||
bool setPost(const RsGxsChannelPost &post);
|
||||
|
||||
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); }
|
||||
|
|
@ -96,4 +100,6 @@ private:
|
|||
Ui::GxsChannelPostItem *ui;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(RsGxsChannelPost)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue