Merge pull request #1762 from csoler/v0.6-BugFixing

V0.6 bug fixing
This commit is contained in:
csoler 2020-01-17 22:28:12 +01:00 committed by GitHub
commit beab0521c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 189 additions and 317 deletions

View File

@ -2134,8 +2134,7 @@ bool p3MsgService::receiveGxsTransMail( const RsGxsId& authorId,
{ {
RS_STACK_MUTEX(recentlyReceivedMutex); RS_STACK_MUTEX(recentlyReceivedMutex);
if( mRecentlyReceivedMessageHashes.find(hash) != if( mRecentlyReceivedMessageHashes.find(hash) != mRecentlyReceivedMessageHashes.end() )
mRecentlyReceivedMessageHashes.end() )
{ {
RsInfo() << __PRETTY_FUNCTION__ << " (II) receiving " RsInfo() << __PRETTY_FUNCTION__ << " (II) receiving "
<< "message of hash " << hash << " more than once. " << "message of hash " << hash << " more than once. "
@ -2143,14 +2142,12 @@ bool p3MsgService::receiveGxsTransMail( const RsGxsId& authorId,
<< std::endl; << std::endl;
return true; return true;
} }
mRecentlyReceivedMessageHashes[hash] = mRecentlyReceivedMessageHashes[hash] = static_cast<uint32_t>(time(nullptr));
static_cast<uint32_t>(time(nullptr));
} }
IndicateConfigChanged(); IndicateConfigChanged();
RsItem *item = _serialiser->deserialise( RsItem *item = _serialiser->deserialise( const_cast<uint8_t*>(data), &dataSize );
const_cast<uint8_t*>(data), &dataSize );
RsMsgItem *msg_item = dynamic_cast<RsMsgItem*>(item); RsMsgItem *msg_item = dynamic_cast<RsMsgItem*>(item);
if(msg_item) if(msg_item)

View File

@ -47,8 +47,7 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void toggle() override;
void toggle();
void readAndClearItem(); void readAndClearItem();
void copyLink(); void copyLink();
@ -61,9 +60,7 @@ private:
RsFeedReader *mFeedReader; RsFeedReader *mFeedReader;
FeedReaderNotify *mNotify; FeedReaderNotify *mNotify;
FeedHolder *mParent;
std::string mFeedId;
std::string mMsgId; std::string mMsgId;
QString mLink; QString mLink;

View File

@ -202,10 +202,10 @@ void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
handleForumEvent(event); handleForumEvent(event);
if(event->mType == RsEventType::GXS_POSTED && (flags & RS_FEED_TYPE_POSTED)) if(event->mType == RsEventType::GXS_POSTED && (flags & RS_FEED_TYPE_POSTED))
handleMailEvent(event); handlePostedEvent(event);
if(event->mType == RsEventType::MAIL_STATUS && (flags & RS_FEED_TYPE_MSG)) if(event->mType == RsEventType::MAIL_STATUS && (flags & RS_FEED_TYPE_MSG))
handlePostedEvent(event); handleMailEvent(event);
} }
void NewsFeed::handleMailEvent(std::shared_ptr<const RsEvent> event) void NewsFeed::handleMailEvent(std::shared_ptr<const RsEvent> event)
@ -495,14 +495,10 @@ void NewsFeed::addFeedItemIfUnique(FeedItem *item, bool replace)
void NewsFeed::remUniqueFeedItem(FeedItem *item) void NewsFeed::remUniqueFeedItem(FeedItem *item)
{ {
FeedItem *feedItem = ui->feedWidget->findFeedItem(item->uniqueIdentifier()); //FeedItem *feedItem = ui->feedWidget->findFeedItem(item->uniqueIdentifier());
if (feedItem) ui->feedWidget->removeFeedItem(item);
{
delete item; delete item;
ui->feedWidget->removeFeedItem(feedItem);
}
} }
/* FeedHolder Functions (for FeedItem functionality) */ /* FeedHolder Functions (for FeedItem functionality) */
@ -511,7 +507,7 @@ QScrollArea *NewsFeed::getScrollArea()
return NULL; return NULL;
} }
void NewsFeed::deleteFeedItem(QWidget *item, uint32_t /*type*/) void NewsFeed::deleteFeedItem(FeedItem *item, uint32_t /*type*/)
{ {
#ifdef NEWS_DEBUG #ifdef NEWS_DEBUG
std::cerr << "NewsFeed::deleteFeedItem()"; std::cerr << "NewsFeed::deleteFeedItem()";
@ -519,6 +515,7 @@ void NewsFeed::deleteFeedItem(QWidget *item, uint32_t /*type*/)
#endif #endif
if (item) { if (item) {
ui->feedWidget->removeFeedItem(item);
item->close (); item->close ();
} }
} }

View File

@ -74,7 +74,7 @@ public:
/* FeedHolder Functions (for FeedItem functionality) */ /* FeedHolder Functions (for FeedItem functionality) */
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(QWidget *item, uint32_t type); virtual void deleteFeedItem(FeedItem *item, uint32_t type);
virtual void openChat(const RsPeerId& peerId); virtual void openChat(const RsPeerId& peerId);
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);

View File

@ -49,7 +49,7 @@ public:
const RsPostedPost &getPost() const; const RsPostedPost &getPost() const;
RsPostedPost &post(); RsPostedPost &post();
uint64_t uniqueIdentifier() const override { return hash_64bits("PostedItem " + mMessageId.toStdString()); } uint64_t uniqueIdentifier() const override { return hash_64bits("PostedItem " + messageId().toStdString()); }
protected: protected:
/* FeedItem */ /* FeedItem */
virtual void doExpand(bool open); virtual void doExpand(bool open);
@ -60,7 +60,7 @@ private slots:
void makeDownVote(); void makeDownVote();
void readToggled(bool checked); void readToggled(bool checked);
void readAndClearItem(); void readAndClearItem();
void toggle(); void toggle() override;
void copyMessageLink(); void copyMessageLink();
void toggleNotes(); void toggleNotes();

View File

@ -143,7 +143,7 @@ QScrollArea *PostedListWidget::getScrollArea()
return ui->scrollArea; return ui->scrollArea;
} }
void PostedListWidget::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/) void PostedListWidget::deleteFeedItem(FeedItem *, uint32_t /*type*/)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET #ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::deleteFeedItem() Nah"; std::cerr << "PostedListWidget::deleteFeedItem() Nah";

View File

@ -48,7 +48,7 @@ public:
/* FeedHolder */ /* FeedHolder */
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(QWidget *item, uint32_t type); virtual void deleteFeedItem(FeedItem *item, uint32_t type);
virtual void openChat(const RsPeerId& peerId); virtual void openChat(const RsPeerId& peerId);
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);

View File

@ -111,7 +111,6 @@ bool RSFeedWidget::eventFilter(QObject *object, QEvent *event)
FeedItem *feedItem = feedItemFromTreeItem(treeItem); FeedItem *feedItem = feedItemFromTreeItem(treeItem);
if (feedItem) { if (feedItem) {
disconnectSignals(feedItem); disconnectSignals(feedItem);
feedRemoved(feedItem);
delete(feedItem); delete(feedItem);
} }
delete(treeItem); delete(treeItem);
@ -135,23 +134,19 @@ void RSFeedWidget::feedAdded(FeedItem *feedItem, QTreeWidgetItem *treeItem)
{ {
} }
void RSFeedWidget::feedRemoved(FeedItem *feedItem)
{
}
void RSFeedWidget::feedsCleared() void RSFeedWidget::feedsCleared()
{ {
} }
void RSFeedWidget::connectSignals(FeedItem *feedItem) void RSFeedWidget::connectSignals(FeedItem *feedItem)
{ {
connect(feedItem, SIGNAL(feedItemDestroyed(FeedItem*)), this, SLOT(feedItemDestroyed(FeedItem*))); connect(feedItem, SIGNAL(feedItemNeedsClosing(qulonglong)), this, SLOT(feedItemDestroyed(qulonglong)));
connect(feedItem, SIGNAL(sizeChanged(FeedItem*)), this, SLOT(feedItemSizeChanged(FeedItem*))); connect(feedItem, SIGNAL(sizeChanged(FeedItem*)), this, SLOT(feedItemSizeChanged(FeedItem*)));
} }
void RSFeedWidget::disconnectSignals(FeedItem *feedItem) void RSFeedWidget::disconnectSignals(FeedItem *feedItem)
{ {
disconnect(feedItem, SIGNAL(feedItemDestroyed(FeedItem*)), this, SLOT(feedItemDestroyed(FeedItem*))); disconnect(feedItem, SIGNAL(feedItemNeedsClosing(qulonglong)), this, SLOT(feedItemDestroyed(qulonglong)));
disconnect(feedItem, SIGNAL(sizeChanged(FeedItem*)), this, SLOT(feedItemSizeChanged(FeedItem*))); disconnect(feedItem, SIGNAL(sizeChanged(FeedItem*)), this, SLOT(feedItemSizeChanged(FeedItem*)));
} }
@ -384,11 +379,10 @@ FeedItem *RSFeedWidget::feedItem(int index)
void RSFeedWidget::removeFeedItem(FeedItem *feedItem) void RSFeedWidget::removeFeedItem(FeedItem *feedItem)
{ {
if (!feedItem) { if (!feedItem)
return; return;
}
QTreeWidgetItem *treeItem = findTreeWidgetItem(feedItem->uniqueIdentifier()); QTreeWidgetItem *treeItem = findTreeWidgetItem(feedItem);// WARNING: do not use the other function based on identifier here, because some items change their identifier when loading.
if (treeItem) if (treeItem)
{ {
@ -396,11 +390,10 @@ void RSFeedWidget::removeFeedItem(FeedItem *feedItem)
if(treeItem_index < 0) if(treeItem_index < 0)
{ {
std::cerr << "(EE) Cannot remove designated item \"" << feedItem->uniqueIdentifier() << "\": not found!" << std::endl; std::cerr << "(EE) Cannot remove designated item \"" << (void*)feedItem << "\": not found!" << std::endl;
return ; return ;
} }
feedRemoved(feedItem);
disconnectSignals(feedItem); disconnectSignals(feedItem);
delete ui->treeWidget->takeTopLevelItem(treeItem_index); delete ui->treeWidget->takeTopLevelItem(treeItem_index);
@ -424,13 +417,12 @@ void RSFeedWidget::feedItemSizeChanged(FeedItem */*feedItem*/)
ui->treeWidget->doItemsLayout(); ui->treeWidget->doItemsLayout();
} }
void RSFeedWidget::feedItemDestroyed(FeedItem *feedItem) void RSFeedWidget::feedItemDestroyed(qulonglong id)
{ {
/* No need to disconnect when object will be destroyed */ /* No need to disconnect when object will be destroyed */
QTreeWidgetItem *treeItem = findTreeWidgetItem(feedItem->uniqueIdentifier()); QTreeWidgetItem *treeItem = findTreeWidgetItem(id);
feedRemoved(feedItem);
if(treeItem) if(treeItem)
delete(treeItem); delete(treeItem);
@ -438,6 +430,26 @@ void RSFeedWidget::feedItemDestroyed(FeedItem *feedItem)
emit feedCountChanged(); emit feedCountChanged();
} }
QTreeWidgetItem *RSFeedWidget::findTreeWidgetItem(const FeedItem *w)
{
QTreeWidgetItemIterator it(ui->treeWidget);
QTreeWidgetItem *treeItem=NULL;
// this search could probably be automatised by giving the tree items the identifier as data for some specific role, then calling QTreeWidget::findItems()
#warning TODO
while (*it)
{
FeedItem *feedItem = feedItemFromTreeItem(*it);
if (feedItem == w)
return *it;
++it;
}
return NULL;
}
QTreeWidgetItem *RSFeedWidget::findTreeWidgetItem(uint64_t identifier) QTreeWidgetItem *RSFeedWidget::findTreeWidgetItem(uint64_t identifier)
{ {
QList<QTreeWidgetItem*> list = ui->treeWidget->findItems(QString("%1").arg(identifier,8,16,QChar('0')),Qt::MatchExactly,COLUMN_IDENTIFIER); QList<QTreeWidgetItem*> list = ui->treeWidget->findItems(QString("%1").arg(identifier,8,16,QChar('0')),Qt::MatchExactly,COLUMN_IDENTIFIER);
@ -490,26 +502,20 @@ void RSFeedWidget::withAll(RSFeedWidgetCallbackFunction callback, void *data)
FeedItem *RSFeedWidget::findFeedItem(uint64_t identifier) FeedItem *RSFeedWidget::findFeedItem(uint64_t identifier)
{ {
QTreeWidgetItemIterator it(ui->treeWidget); QList<QTreeWidgetItem*> list = ui->treeWidget->findItems(QString("%1").arg(identifier,8,16,QChar('0')),Qt::MatchExactly,COLUMN_IDENTIFIER);
QTreeWidgetItem *treeItem=NULL;
// this search could probably be automatised by giving the tree items the identifier as data for some specific role, then calling QTreeWidget::findItems() if(list.empty())
#warning TODO return nullptr;
while ((treeItem = *it) != NULL) { else if(list.size() == 1)
++it; return feedItemFromTreeItem(list.front());
else
FeedItem *feedItem = feedItemFromTreeItem(treeItem); {
if (!feedItem) std::cerr << "(EE) More than a single item with identifier \"" << identifier << "\" in the feed tree widget. This shouldn't happen!" << std::endl;
continue; return nullptr;
}
uint64_t id = feedItem->uniqueIdentifier();
if (id == identifier)
return feedItem;
} }
return NULL;
}
void RSFeedWidget::selectedFeedItems(QList<FeedItem*> &feedItems) void RSFeedWidget::selectedFeedItems(QList<FeedItem*> &feedItems)
{ {

View File

@ -87,11 +87,10 @@ public slots:
protected: protected:
bool eventFilter(QObject *object, QEvent *event); bool eventFilter(QObject *object, QEvent *event);
virtual void feedAdded(FeedItem *feedItem, QTreeWidgetItem *treeItem); virtual void feedAdded(FeedItem *feedItem, QTreeWidgetItem *treeItem);
virtual void feedRemoved(FeedItem *feedItem);
virtual void feedsCleared(); virtual void feedsCleared();
private slots: private slots:
void feedItemDestroyed(FeedItem *feedItem); void feedItemDestroyed(qulonglong id);
void feedItemSizeChanged(FeedItem *feedItem); void feedItemSizeChanged(FeedItem *feedItem);
private: private:
@ -99,6 +98,7 @@ private:
void disconnectSignals(FeedItem *feedItem); void disconnectSignals(FeedItem *feedItem);
FeedItem *feedItemFromTreeItem(QTreeWidgetItem *treeItem); FeedItem *feedItemFromTreeItem(QTreeWidgetItem *treeItem);
QTreeWidgetItem *findTreeWidgetItem(uint64_t identifier); QTreeWidgetItem *findTreeWidgetItem(uint64_t identifier);
QTreeWidgetItem *findTreeWidgetItem(const FeedItem *w);
void filterItems(); void filterItems();
void filterItem(QTreeWidgetItem *treeItem, FeedItem *feedItem); void filterItem(QTreeWidgetItem *treeItem, FeedItem *feedItem);

View File

@ -43,7 +43,7 @@
/** Constructor */ /** Constructor */
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message) : ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message) :
FeedItem(NULL), mParent(parent), mFeedId(feedId), mPeerId(peerId) FeedItem(parent,feedId,NULL), mPeerId(peerId)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); setupUi(this);
@ -153,26 +153,6 @@ void ChatMsgItem::insertChat(const std::string &message)
chatTextlabel->setText(formatMsg); chatTextlabel->setText(formatMsg);
} }
void ChatMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChatMsgItem::removeItem()";
std::cerr << std::endl;
#endif
if (mParent) {
mParent->lockLayout(this, true);
}
hide();
if (mParent) {
mParent->lockLayout(this, false);
mParent->deleteFeedItem(this, mFeedId);
}
}
void ChatMsgItem::gotoHome() void ChatMsgItem::gotoHome()
{ {
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM
@ -191,7 +171,7 @@ void ChatMsgItem::sendMsg()
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if (mParent) if (mFeedHolder)
{ {
MessageComposer *nMsgDialog = MessageComposer::newMsg(); MessageComposer *nMsgDialog = MessageComposer::newMsg();
@ -214,15 +194,15 @@ void ChatMsgItem::openChat()
std::cerr << "ChatMsgItem::openChat()"; std::cerr << "ChatMsgItem::openChat()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if (mParent) if (mFeedHolder)
{ {
mParent->openChat(mPeerId); mFeedHolder->openChat(mPeerId);
} }
} }
void ChatMsgItem::togglequickmessage() void ChatMsgItem::togglequickmessage()
{ {
mParent->lockLayout(this, true); mFeedHolder->lockLayout(this, true);
if (messageFrame->isHidden()) if (messageFrame->isHidden())
{ {
@ -239,7 +219,7 @@ void ChatMsgItem::togglequickmessage()
emit sizeChanged(this); emit sizeChanged(this);
mParent->lockLayout(this, false); mFeedHolder->lockLayout(this, false);
} }
void ChatMsgItem::sendMessage() void ChatMsgItem::sendMessage()

View File

@ -45,7 +45,6 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void gotoHome(); void gotoHome();
void removeItem();
void sendMsg(); void sendMsg();
void openChat(); void openChat();
@ -60,9 +59,6 @@ private slots:
private: private:
void insertChat(const std::string &message); void insertChat(const std::string &message);
FeedHolder *mParent;
uint32_t mFeedId;
RsPeerId mPeerId; RsPeerId mPeerId;
}; };

View File

@ -27,6 +27,7 @@
#include <retroshare/rsgxschannels.h> // WRONG ONE - BUT IT'LL DO FOR NOW. #include <retroshare/rsgxschannels.h> // WRONG ONE - BUT IT'LL DO FOR NOW.
class QScrollArea; class QScrollArea;
class FeedItem;
class FeedHolder class FeedHolder
{ {
@ -34,7 +35,7 @@ public:
FeedHolder(); FeedHolder();
virtual QScrollArea *getScrollArea() = 0; virtual QScrollArea *getScrollArea() = 0;
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0; virtual void deleteFeedItem(FeedItem *item, uint32_t type) = 0;
virtual void openChat(const RsPeerId& peerId) = 0; virtual void openChat(const RsPeerId& peerId) = 0;
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &msg_versions, const RsGxsMessageId &msgId, const QString &title)=0; virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &msg_versions, const RsGxsMessageId &msgId, const QString &title)=0;

View File

@ -20,17 +20,15 @@
#include <iostream> #include <iostream>
#include "FeedItem.h" #include "FeedItem.h"
#include "FeedHolder.h"
/** Constructor */ /** Constructor */
FeedItem::FeedItem(QWidget *parent) : QWidget(parent), mHash(0) FeedItem::FeedItem(FeedHolder *fh, uint32_t feedId, QWidget *parent) : QWidget(parent), mHash(0),mFeedHolder(fh),mFeedId(feedId)
{ {
mWasExpanded = false; mWasExpanded = false;
} }
FeedItem::~FeedItem() FeedItem::~FeedItem() { }
{
emit feedItemDestroyed(this);
}
void FeedItem::expand(bool open) void FeedItem::expand(bool open)
{ {
@ -48,12 +46,28 @@ void FeedItem::expand(bool open)
uint64_t FeedItem::hash_64bits(const std::string& s) const uint64_t FeedItem::hash_64bits(const std::string& s) const
{ {
if(mHash == 0) if(mHash == 0)
{ mHash = hash64(s);
mHash = 0x01110bbfa09;
for(uint32_t i=0;i<s.size();++i)
mHash = ~(((mHash << 31) ^ (mHash >> 3)) + s[i]*0x217898fbba7 + 0x0294379);
}
return mHash; return mHash;
} }
uint64_t FeedItem::hash64(const std::string& s)
{
uint64_t hash = 0x01110bbfa09;
for(uint32_t i=0;i<s.size();++i)
hash = ~(((hash << 31) ^ (hash >> 3)) + s[i]*0x217898fbba7 + 0x0294379);
return hash;
}
void FeedItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::removeItem()";
std::cerr << std::endl;
#endif
mFeedHolder->deleteFeedItem(this,0);
}

View File

@ -23,13 +23,15 @@
#include <QWidget> #include <QWidget>
class FeedHolder;
class FeedItem : public QWidget class FeedItem : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
FeedItem(QWidget *parent = 0); FeedItem(FeedHolder *fh,uint32_t feedId,QWidget *parent = 0);
/** Default Destructor */ /** Default Destructor */
virtual ~FeedItem(); virtual ~FeedItem();
@ -42,14 +44,25 @@ public:
* would contain the same information. It should therefore sumarise the data represented by the item. * would contain the same information. It should therefore sumarise the data represented by the item.
*/ */
virtual uint64_t uniqueIdentifier() const =0; virtual uint64_t uniqueIdentifier() const =0;
static uint64_t hash64(const std::string& s);
protected slots:
void removeItem();
protected: protected:
virtual void doExpand(bool open) = 0; virtual void doExpand(bool open) = 0;
virtual void expandFill(bool /*first*/) {} virtual void expandFill(bool /*first*/) {}
virtual void toggle() {}
uint64_t hash_64bits(const std::string& s) const; uint64_t hash_64bits(const std::string& s) const;
FeedHolder *mFeedHolder;
uint32_t mFeedId;
signals: signals:
void sizeChanged(FeedItem *feedItem); void sizeChanged(FeedItem *feedItem);
void feedItemDestroyed(FeedItem *feedItem); void feedItemNeedsClosing(qulonglong);
private: private:
bool mWasExpanded; bool mWasExpanded;

View File

@ -53,7 +53,7 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void toggle(); void toggle() override;
void subscribeChannel(); void subscribeChannel();

View File

@ -46,12 +46,14 @@
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) : GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate)
{ {
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
init(messageId,older_versions) ; init(messageId,older_versions) ;
} }
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) : GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate) GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
{ {
mPost.mMeta.mMsgId.clear(); // security
init(post.mMeta.mMsgId,older_versions) ; init(post.mMeta.mMsgId,older_versions) ;
mPost = post ; mPost = post ;
} }
@ -71,7 +73,6 @@ void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsG
setup(); setup();
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
mLoaded = false ; mLoaded = false ;
} }
@ -326,12 +327,14 @@ void GxsChannelPostItem::loadMessage(const uint32_t &token)
if (posts.size() == 1) if (posts.size() == 1)
{ {
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
setPost(posts[0]); setPost(posts[0]);
} }
else if (cmts.size() == 1) else if (cmts.size() == 1)
{ {
RsGxsComment cmt = cmts[0]; RsGxsComment cmt = cmts[0];
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
ui->newCommentLabel->show(); ui->newCommentLabel->show();
ui->commLabel->show(); ui->commLabel->show();
ui->commLabel->setText(QString::fromUtf8(cmt.mComment.c_str())); ui->commLabel->setText(QString::fromUtf8(cmt.mComment.c_str()));

View File

@ -53,7 +53,7 @@ public:
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); //GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
virtual ~GxsChannelPostItem(); virtual ~GxsChannelPostItem();
uint64_t uniqueIdentifier() const override { hash_64bits("GxsChannelPostItem " + mPost.mMeta.mMsgId.toStdString()) ; } uint64_t uniqueIdentifier() const override { hash_64bits("GxsChannelPostItem " + messageId().toStdString()) ; }
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true); bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
bool setPost(const RsGxsChannelPost &post, bool doFill = true); bool setPost(const RsGxsChannelPost &post, bool doFill = true);
@ -66,6 +66,7 @@ public:
bool isUnread() const ; bool isUnread() const ;
static uint64_t computeIdentifier(const RsGxsMessageId& msgid) { return hash64("GxsChannelPostItem " + msgid.toStdString()) ; }
protected: protected:
void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions); void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions);
@ -90,7 +91,7 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void toggle(); void toggle() override;
void readAndClearItem(); void readAndClearItem();
void download(); void download();
void play(); void play();

View File

@ -40,7 +40,7 @@
GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type) GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type)
:FeedItem(NULL), mFeedHolder(feedHolder), mFeedId(feedId), mType(type), mCircleId(circleId), mGxsId(gxsId) :FeedItem(feedHolder,feedId,NULL), mType(type), mCircleId(circleId), mGxsId(gxsId)
{ {
setup(); setup();
} }
@ -172,22 +172,6 @@ uint64_t GxsCircleItem::uniqueIdentifier() const
return hash_64bits("GxsCircle " + mCircleId.toStdString() + " " + mGxsId.toStdString() + " " + QString::number(mType).toStdString()); return hash_64bits("GxsCircle " + mCircleId.toStdString() + " " + mGxsId.toStdString() + " " + QString::number(mType).toStdString());
} }
void GxsCircleItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "GxsCircleItem::removeItem()" << std::endl;
#endif
if (mFeedHolder)
{
mFeedHolder->lockLayout(this, true);
hide();
mFeedHolder->lockLayout(this, false);
mFeedHolder->deleteFeedItem(this, mFeedId);
}
}
void GxsCircleItem::loadRequest(const TokenQueue * queue, const TokenRequest &req) void GxsCircleItem::loadRequest(const TokenQueue * queue, const TokenRequest &req)
{ {
#ifdef ID_DEBUG #ifdef ID_DEBUG

View File

@ -65,9 +65,6 @@ protected:
private slots: private slots:
/* default stuff */
void removeItem();
void showCircleDetails(); void showCircleDetails();
void acceptCircleSubscription(); void acceptCircleSubscription();
void grantCircleMembership() ; void grantCircleMembership() ;
@ -76,8 +73,6 @@ private slots:
private: private:
void setup(); void setup();
FeedHolder *mFeedHolder;
uint32_t mFeedId;
uint32_t mType; uint32_t mType;
RsGxsCircleId mCircleId; RsGxsCircleId mCircleId;

View File

@ -158,7 +158,6 @@ void GxsForumGroupItem::fill()
ui->clearButton->setEnabled(false); ui->clearButton->setEnabled(false);
} }
} }
void GxsForumGroupItem::toggle() void GxsForumGroupItem::toggle()
{ {
expand(ui->expandFrame->isHidden()); expand(ui->expandFrame->isHidden());

View File

@ -46,6 +46,7 @@ public:
protected: protected:
/* FeedItem */ /* FeedItem */
virtual void doExpand(bool open); virtual void doExpand(bool open);
void toggle() override;
/* GxsGroupFeedItem */ /* GxsGroupFeedItem */
virtual QString groupName(); virtual QString groupName();
@ -53,9 +54,6 @@ protected:
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; } virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
private slots: private slots:
/* default stuff */
void toggle();
void subscribeForum(); void subscribeForum();
private: private:

View File

@ -43,7 +43,7 @@ public:
bool setGroup(const RsGxsForumGroup &group, bool doFill = true); bool setGroup(const RsGxsForumGroup &group, bool doFill = true);
bool setMessage(const RsGxsForumMsg &msg, bool doFill = true); bool setMessage(const RsGxsForumMsg &msg, bool doFill = true);
uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumMsgItem " + mMessage.mMeta.mMsgId.toStdString()) ; } uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumMsgItem " + messageId().toStdString()) ; }
protected: protected:
/* FeedItem */ /* FeedItem */
virtual void doExpand(bool open); virtual void doExpand(bool open);
@ -67,7 +67,7 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void toggle(); void toggle() override;
void readAndClearItem(); void readAndClearItem();
void unsubscribeForum(); void unsubscribeForum();

View File

@ -43,7 +43,7 @@
/** Constructor */ /** Constructor */
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome) : MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome) :
FeedItem(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome) FeedItem(parent,feedId,NULL), mMsgId(msgId), mIsHome(isHome)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); setupUi(this);
@ -222,15 +222,10 @@ void MsgItem::updateItem()
} }
} }
void MsgItem::toggle()
{
expand(expandFrame->isHidden());
}
void MsgItem::doExpand(bool open) void MsgItem::doExpand(bool open)
{ {
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, true); mFeedHolder->lockLayout(this, true);
} }
if (open) if (open)
@ -252,8 +247,8 @@ void MsgItem::doExpand(bool open)
emit sizeChanged(this); emit sizeChanged(this);
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, false); mFeedHolder->lockLayout(this, false);
} }
} }
@ -266,23 +261,6 @@ void MsgItem::expandFill(bool first)
} }
} }
void MsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void MsgItem::gotoHome() void MsgItem::gotoHome()
{ {
@ -315,7 +293,7 @@ void MsgItem::replyMsg()
std::cerr << "MsgItem::replyMsg()"; std::cerr << "MsgItem::replyMsg()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if (mParent) if (mFeedHolder)
{ {
//mParent->openMsg(FEEDHOLDER_MSG_MESSAGE, mPeerId, mMsgId); //mParent->openMsg(FEEDHOLDER_MSG_MESSAGE, mPeerId, mMsgId);
@ -339,6 +317,11 @@ void MsgItem::playMedia()
#endif #endif
} }
void MsgItem::toggle()
{
expand(expandFrame->isHidden());
}
void MsgItem::checkMessageReadStatus() void MsgItem::checkMessageReadStatus()
{ {
if (!mCloseOnRead) { if (!mCloseOnRead) {

View File

@ -50,7 +50,6 @@ private:
private slots: private slots:
/* default stuff */ /* default stuff */
void gotoHome(); void gotoHome();
void removeItem();
void toggle(); void toggle();
void playMedia(); void playMedia();
@ -62,9 +61,6 @@ private slots:
void updateItem(); void updateItem();
private: private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mMsgId; std::string mMsgId;
QString mMsg; QString mMsg;

View File

@ -41,7 +41,7 @@
/** Constructor */ /** Constructor */
PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome) : PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome) :
FeedItem(NULL), mParent(parent), mFeedId(feedId), FeedItem(parent,feedId,NULL),
mPeerId(peerId), mType(type), mIsHome(isHome) mPeerId(peerId), mType(type), mIsHome(isHome)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
@ -50,11 +50,11 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
sendmsgButton->setEnabled(false); sendmsgButton->setEnabled(false);
/* general ones */ /* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); connect( expandButton, SIGNAL( clicked() ), this, SLOT( toggle() ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); connect( clearButton, SIGNAL( clicked() ), this, SLOT( removeItem() ) );
/* specific ones */ /* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) ); connect( chatButton, SIGNAL( clicked() ), this, SLOT( openChat() ) );
connect( sendmsgButton, SIGNAL( clicked() ), this, SLOT( sendMsg() ) ); connect( sendmsgButton, SIGNAL( clicked() ), this, SLOT( sendMsg() ) );
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
@ -225,7 +225,7 @@ void PeerItem::updateItem()
/* slow Tick */ /* slow Tick */
int msec_rate = 10129; int msec_rate = 10129;
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) )); QTimer::singleShot( msec_rate, this, SLOT(updateItem() ));
return; return;
} }
@ -236,8 +236,8 @@ void PeerItem::toggle()
void PeerItem::doExpand(bool open) void PeerItem::doExpand(bool open)
{ {
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, true); mFeedHolder->lockLayout(this, true);
} }
if (open) if (open)
@ -255,25 +255,8 @@ void PeerItem::doExpand(bool open)
emit sizeChanged(this); emit sizeChanged(this);
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, false); mFeedHolder->lockLayout(this, false);
}
}
void PeerItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
} }
} }
@ -321,9 +304,9 @@ void PeerItem::openChat()
std::cerr << "PeerItem::openChat()"; std::cerr << "PeerItem::openChat()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if (mParent) if (mFeedHolder)
{ {
mParent->openChat(mPeerId); mFeedHolder->openChat(mPeerId);
} }
} }

View File

@ -51,8 +51,7 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void toggle() override;
void toggle();
void addFriend(); void addFriend();
void removeFriend(); void removeFriend();
@ -63,8 +62,6 @@ private slots:
private: private:
FeedHolder *mParent;
uint32_t mFeedId;
RsPeerId mPeerId; RsPeerId mPeerId;
uint32_t mType; uint32_t mType;

View File

@ -54,9 +54,7 @@ protected:
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; } virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
private slots: private slots:
/* default stuff */ void toggle() override;
void toggle();
void subscribePosted(); void subscribePosted();
private: private:

View File

@ -40,14 +40,14 @@
/** Constructor */ /** Constructor */
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string &ipAddr, uint32_t result, uint32_t type, bool isTest) : SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string &ipAddr, uint32_t result, uint32_t type, bool isTest) :
FeedItem(NULL), mParent(parent), mType(type), mSslId(sslId), mIpAddr(ipAddr), mResult(result), mIsTest(isTest), FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mResult(result), mIsTest(isTest),
ui(new(Ui::SecurityIpItem)) ui(new(Ui::SecurityIpItem))
{ {
setup(); setup();
} }
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, uint32_t type, bool isTest) : SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, uint32_t type, bool isTest) :
FeedItem(NULL), mParent(parent), mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported), mResult(0), mIsTest(isTest), FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported), mResult(0), mIsTest(isTest),
ui(new(Ui::SecurityIpItem)) ui(new(Ui::SecurityIpItem))
{ {
setup(); setup();
@ -192,8 +192,8 @@ void SecurityIpItem::toggle()
void SecurityIpItem::doExpand(bool open) void SecurityIpItem::doExpand(bool open)
{ {
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, true); mFeedHolder->lockLayout(this, true);
} }
if (open) if (open)
@ -211,25 +211,8 @@ void SecurityIpItem::doExpand(bool open)
emit sizeChanged(this); emit sizeChanged(this);
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, false); mFeedHolder->lockLayout(this, false);
}
}
void SecurityIpItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityIpItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
} }
} }

View File

@ -54,16 +54,12 @@ private:
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void toggle() override;
void toggle();
void peerDetails(); void peerDetails();
void updateItem(); void updateItem();
void banIpListChanged(const QString &ipAddress); void banIpListChanged(const QString &ipAddress);
private: private:
FeedHolder *mParent;
uint32_t mFeedId;
uint32_t mType; uint32_t mType;
RsPeerId mSslId; RsPeerId mSslId;
std::string mIpAddr; std::string mIpAddr;

View File

@ -44,7 +44,7 @@
/** Constructor */ /** Constructor */
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome) : SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome) :
FeedItem(NULL), mParent(parent), mFeedId(feedId), FeedItem(parent,feedId,NULL),
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome) mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
@ -288,8 +288,8 @@ void SecurityItem::toggle()
void SecurityItem::doExpand(bool open) void SecurityItem::doExpand(bool open)
{ {
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, true); mFeedHolder->lockLayout(this, true);
} }
if (open) if (open)
@ -307,25 +307,8 @@ void SecurityItem::doExpand(bool open)
emit sizeChanged(this); emit sizeChanged(this);
if (mParent) { if (mFeedHolder) {
mParent->lockLayout(this, false); mFeedHolder->lockLayout(this, false);
}
}
void SecurityItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
} }
} }
@ -413,8 +396,8 @@ void SecurityItem::openChat()
std::cerr << "SecurityItem::openChat()"; std::cerr << "SecurityItem::openChat()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if (mParent) if (mFeedHolder)
{ {
mParent->openChat(mSslId); mFeedHolder->openChat(mSslId);
} }
} }

View File

@ -50,8 +50,7 @@ protected:
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void toggle() override;
void toggle();
void friendRequest(); void friendRequest();
void removeFriend(); void removeFriend();
@ -62,9 +61,6 @@ private slots:
void updateItem(); void updateItem();
private: private:
FeedHolder *mParent;
uint32_t mFeedId;
RsPgpId mGpgId; RsPgpId mGpgId;
RsPeerId mSslId; RsPeerId mSslId;
std::string mSslCn; std::string mSslCn;

View File

@ -46,8 +46,6 @@ void GxsFeedWidget::feedAdded(FeedItem *feedItem, QTreeWidgetItem *treeItem)
void GxsFeedWidget::feedRemoved(FeedItem *feedItem) void GxsFeedWidget::feedRemoved(FeedItem *feedItem)
{ {
RSFeedWidget::feedRemoved(feedItem);
GxsFeedItem *gxsFeedItem = dynamic_cast<GxsFeedItem*>(feedItem); GxsFeedItem *gxsFeedItem = dynamic_cast<GxsFeedItem*>(feedItem);
if (!gxsFeedItem) { if (!gxsFeedItem) {
return; return;

View File

@ -32,7 +32,7 @@
**/ **/
GxsGroupFeedItem::GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate) : GxsGroupFeedItem::GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate) :
FeedItem(NULL) FeedItem(feedHolder,feedId,NULL)
{ {
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM
std::cerr << "GxsGroupFeedItem::GxsGroupFeedItem()"; std::cerr << "GxsGroupFeedItem::GxsGroupFeedItem()";
@ -40,8 +40,6 @@ GxsGroupFeedItem::GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, cons
#endif #endif
/* this are just generally useful for all children */ /* this are just generally useful for all children */
mFeedHolder = feedHolder;
mFeedId = feedId;
mIsHome = isHome; mIsHome = isHome;
/* load data if we can */ /* load data if we can */
@ -93,27 +91,6 @@ bool GxsGroupFeedItem::initLoadQueue()
return (mLoadQueue != NULL); return (mLoadQueue != NULL);
} }
void GxsGroupFeedItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "GxsGroupFeedItem::removeItem()";
std::cerr << std::endl;
#endif
if (mFeedHolder)
{
mFeedHolder->lockLayout(this, true);
}
hide();
if (mFeedHolder)
{
mFeedHolder->lockLayout(this, false);
mFeedHolder->deleteFeedItem(this, mFeedId);
}
}
void GxsGroupFeedItem::unsubscribe() void GxsGroupFeedItem::unsubscribe()
{ {
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM

View File

@ -64,12 +64,9 @@ protected:
protected slots: protected slots:
void subscribe(); void subscribe();
void unsubscribe(); void unsubscribe();
void removeItem();
void copyGroupLink(); void copyGroupLink();
protected: protected:
FeedHolder *mFeedHolder;
uint32_t mFeedId;
bool mIsHome; bool mIsHome;
RsGxsIfaceHelper *mGxsIface; RsGxsIfaceHelper *mGxsIface;
TokenQueue *mLoadQueue; TokenQueue *mLoadQueue;

View File

@ -230,8 +230,12 @@ QScrollArea *GxsChannelPostsWidget::getScrollArea()
return NULL; return NULL;
} }
void GxsChannelPostsWidget::deleteFeedItem(QWidget * /*item*/, uint32_t /*type*/) void GxsChannelPostsWidget::deleteFeedItem(FeedItem *feedItem, uint32_t /*type*/)
{ {
if (!feedItem)
return;
ui->feedWidget->removeFeedItem(feedItem);
} }
void GxsChannelPostsWidget::openChat(const RsPeerId & /*peerId*/) void GxsChannelPostsWidget::openChat(const RsPeerId & /*peerId*/)
@ -457,7 +461,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
if(!post.mMeta.mOrigMsgId.isNull()) if(!post.mMeta.mOrigMsgId.isNull())
{ {
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(post.mMeta.mGroupId, post.mMeta.mOrigMsgId); FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mOrigMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem); item = dynamic_cast<GxsChannelPostItem*>(feedItem);
if(item) if(item)
@ -473,7 +477,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
if (related) if (related)
{ {
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(post.mMeta.mGroupId, post.mMeta.mMsgId); FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem); item = dynamic_cast<GxsChannelPostItem*>(feedItem);
} }
if (item) { if (item) {
@ -666,7 +670,7 @@ void GxsChannelPostsWidget::blank()
bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId) bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId)
{ {
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(groupId(), msgId); FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(msgId));
if (!feedItem) { if (!feedItem) {
return false; return false;
} }
@ -715,17 +719,17 @@ void GxsChannelPostsWidget::toggleAutoDownload()
return; return;
} }
RsQThreadUtils::postToObject( [=]() // RsQThreadUtils::postToObject( [=]()
{ // {
/* Here it goes any code you want to be executed on the Qt Gui // /* Here it goes any code you want to be executed on the Qt Gui
* thread, for example to update the data model with new information // * thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete, note that // * after a blocking call to RetroShare API complete, note that
* Qt::QueuedConnection is important! // * Qt::QueuedConnection is important!
*/ // */
//
std::cerr << __PRETTY_FUNCTION__ << " Has been executed on GUI " // std::cerr << __PRETTY_FUNCTION__ << " Has been executed on GUI "
<< "thread but was scheduled by async thread" << std::endl; // << "thread but was scheduled by async thread" << std::endl;
}, this ); // }, this );
}); });
} }

View File

@ -58,7 +58,7 @@ public:
/* FeedHolder */ /* FeedHolder */
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(QWidget *item, uint32_t type); virtual void deleteFeedItem(FeedItem *feedItem, uint32_t type);
virtual void openChat(const RsPeerId& peerId); virtual void openChat(const RsPeerId& peerId);
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &msg_versions, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &msg_versions, const RsGxsMessageId &msgId, const QString &title);

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>880</width> <width>977</width>
<height>557</height> <height>628</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -369,7 +369,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
@ -525,7 +525,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item> <item>
<widget class="GxsFeedWidget" name="feedWidget" native="true"> <widget class="RSFeedWidget" name="feedWidget" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -572,22 +572,22 @@ p, li { white-space: pre-wrap; }
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header> <header location="global">gui/common/LineEditClear.h</header>
</customwidget> </customwidget>
<customwidget>
<class>GxsFeedWidget</class>
<extends>QWidget</extends>
<header>gui/gxs/GxsFeedWidget.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>GxsChannelFilesWidget</class> <class>GxsChannelFilesWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>gui/gxschannels/GxsChannelFilesWidget.h</header> <header>gui/gxschannels/GxsChannelFilesWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>RSFeedWidget</class>
<extends>QWidget</extends>
<header>gui/common/RSFeedWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>