mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-12 07:16:19 -05:00
fixed compilation for feed reader plugin
This commit is contained in:
parent
d3069e9b44
commit
28a5db7204
9 changed files with 57 additions and 49 deletions
|
|
@ -570,7 +570,7 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
|
|||
}
|
||||
|
||||
FeedInfo feedInfo;
|
||||
if (type != NOTIFY_TYPE_DEL) {
|
||||
if (type != FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
if (!mFeedReader->getFeedInfo(feedId, feedInfo)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -580,12 +580,12 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
|
|||
}
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD || type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
QTreeWidgetItemIterator it(ui->feedTreeWidget);
|
||||
QTreeWidgetItem *item;
|
||||
while ((item = *it) != NULL) {
|
||||
if (item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toUInt() == feedId) {
|
||||
if (type == NOTIFY_TYPE_MOD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||
updateFeedItem(item, feedInfo);
|
||||
} else {
|
||||
delete(item);
|
||||
|
|
@ -596,7 +596,7 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
|
|||
}
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_ADD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_ADD) {
|
||||
QTreeWidgetItemIterator it(ui->feedTreeWidget);
|
||||
QTreeWidgetItem *itemParent;
|
||||
while ((itemParent = *it) != NULL) {
|
||||
|
|
|
|||
|
|
@ -40,15 +40,15 @@ class FeedReaderDialog : public MainPage
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
|
||||
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
|
||||
~FeedReaderDialog();
|
||||
|
||||
static QIcon iconFromFeed(const FeedInfo &feedInfo);
|
||||
|
||||
protected:
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||
|
||||
private slots:
|
||||
void settingsChanged();
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ void FeedReaderFeedNotify::msgChanged(uint32_t feedId, const QString &msgId, int
|
|||
return;
|
||||
}
|
||||
|
||||
if (type != NOTIFY_TYPE_ADD) {
|
||||
if (type != FeedReaderNotify::NOTIFY_TYPE_ADD) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -515,12 +515,12 @@ void FeedReaderMessageWidget::feedChanged(uint32_t feedId, int type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_DEL) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
setFeedId(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_MOD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||
if (!mFeedReader->getFeedInfo(mFeedId, mFeedInfo)) {
|
||||
setFeedId(0);
|
||||
return;
|
||||
|
|
@ -555,18 +555,18 @@ void FeedReaderMessageWidget::msgChanged(uint32_t feedId, const QString &msgId,
|
|||
}
|
||||
|
||||
FeedMsgInfo msgInfo;
|
||||
if (type != NOTIFY_TYPE_DEL) {
|
||||
if (type != FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
if (!mFeedReader->getMsgInfo(feedId, msgId.toStdString(), msgInfo)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD || type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
QTreeWidgetItemIterator it(ui->msgTreeWidget);
|
||||
QTreeWidgetItem *item;
|
||||
while ((item = *it) != NULL) {
|
||||
if (item->data(COLUMN_MSG_DATA, ROLE_MSG_ID).toString() == msgId) {
|
||||
if (type == NOTIFY_TYPE_MOD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||
updateMsgItem(item, msgInfo);
|
||||
filterItem(item);
|
||||
} else {
|
||||
|
|
@ -578,13 +578,13 @@ void FeedReaderMessageWidget::msgChanged(uint32_t feedId, const QString &msgId,
|
|||
}
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_MOD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||
if (msgId.toStdString() == currentMsgId()) {
|
||||
updateCurrentMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_ADD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_ADD) {
|
||||
QTreeWidgetItem *item = new RSTreeWidgetItem(mMsgCompareRole);
|
||||
updateMsgItem(item, msgInfo);
|
||||
ui->msgTreeWidget->addTopLevelItem(item);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ class FeedReaderNotify : public QObject, public RsFeedReaderNotify
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// These replace the variables from the old notify system. It's simpler than switching the entire
|
||||
// feedreader plugin to the new rsEvents system
|
||||
|
||||
static const int NOTIFY_TYPE_ADD = 0x01;
|
||||
static const int NOTIFY_TYPE_DEL = 0x02;
|
||||
static const int NOTIFY_TYPE_MOD = 0x03;
|
||||
|
||||
FeedReaderNotify();
|
||||
|
||||
/* RsFeedReaderNotify */
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void FeedReaderUserNotify::iconClicked()
|
|||
|
||||
void FeedReaderUserNotify::feedChanged(uint32_t /*feedId*/, int type)
|
||||
{
|
||||
if (type == NOTIFY_TYPE_DEL) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
updateIcon();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,13 +294,13 @@ void PreviewFeedDialog::feedChanged(uint32_t feedId, int type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_DEL) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||
/* feed deleted */
|
||||
mFeedId = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_ADD || type == NOTIFY_TYPE_MOD) {
|
||||
if (type == FeedReaderNotify::NOTIFY_TYPE_ADD || type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||
FeedInfo feedInfo;
|
||||
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
|
||||
return;
|
||||
|
|
@ -320,18 +320,18 @@ void PreviewFeedDialog::msgChanged(uint32_t feedId, const QString &msgId, int ty
|
|||
}
|
||||
|
||||
switch (type) {
|
||||
case NOTIFY_TYPE_ADD:
|
||||
case FeedReaderNotify::NOTIFY_TYPE_ADD:
|
||||
if (mMsgId.empty()) {
|
||||
mMsgId = msgId.toStdString();
|
||||
updateMsg();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_TYPE_MOD:
|
||||
case FeedReaderNotify::NOTIFY_TYPE_MOD:
|
||||
if (mMsgId == msgId.toStdString()) {
|
||||
updateMsg();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_TYPE_DEL:
|
||||
case FeedReaderNotify::NOTIFY_TYPE_DEL:
|
||||
if (mMsgId == msgId.toStdString()) {
|
||||
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
|
||||
if (it != mMsgIds.end()) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "rsFeedReaderItems.h"
|
||||
#include "p3FeedReader.h"
|
||||
#include "gui/FeedReaderNotify.h"
|
||||
#include "p3FeedReaderThread.h"
|
||||
#include "rsitems/rsconfigitems.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
|
|
@ -415,7 +416,7 @@ RsFeedResult p3FeedReader::addFolder(uint32_t parentId, const std::string &name,
|
|||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
return RS_FEED_RESULT_SUCCESS;
|
||||
|
|
@ -455,7 +456,7 @@ RsFeedResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name)
|
|||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return RS_FEED_RESULT_SUCCESS;
|
||||
|
|
@ -502,7 +503,7 @@ RsFeedResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId)
|
|||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
return RS_FEED_RESULT_SUCCESS;
|
||||
|
|
@ -587,7 +588,7 @@ RsFeedResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
|
|||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
if (!forumId.empty()) {
|
||||
|
|
@ -658,7 +659,7 @@ RsFeedResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
|
|||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -756,7 +757,7 @@ bool p3FeedReader::removeFeed(uint32_t feedId)
|
|||
/* only notify remove of feed */
|
||||
std::list<uint32_t>::iterator it;
|
||||
for (it = removedFeedIds.begin(); it != removedFeedIds.end(); ++it) {
|
||||
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_DEL);
|
||||
mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -803,7 +804,7 @@ bool p3FeedReader::addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId)
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -925,8 +926,8 @@ bool p3FeedReader::removeMsg(uint32_t feedId, const std::string &msgId)
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_DEL);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -977,11 +978,11 @@ bool p3FeedReader::removeMsgs(uint32_t feedId, const std::list<std::string> &msg
|
|||
}
|
||||
|
||||
if (mNotify && !removedMsgs.empty()) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for (it = removedMsgs.begin(); it != removedMsgs.end(); ++it) {
|
||||
mNotify->notifyMsgChanged(feedId, *it, NOTIFY_TYPE_DEL);
|
||||
mNotify->notifyMsgChanged(feedId, *it, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1224,7 +1225,7 @@ bool p3FeedReader::processFeed(uint32_t feedId)
|
|||
|
||||
if (mNotify) {
|
||||
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
|
||||
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1273,8 +1274,8 @@ bool p3FeedReader::setMessageRead(uint32_t feedId, const std::string &msgId, boo
|
|||
if (changed) {
|
||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_OFTEN);
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1328,10 +1329,10 @@ bool p3FeedReader::retransformMsg(uint32_t feedId, const std::string &msgId)
|
|||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||
if (mNotify) {
|
||||
if (feedChanged) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
if (msgChanged) {
|
||||
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1466,7 +1467,7 @@ int p3FeedReader::tick()
|
|||
|
||||
if (mNotify) {
|
||||
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
|
||||
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
if (imageToOptimze) {
|
||||
mNotify->notifyOptimizeImage();
|
||||
|
|
@ -1526,7 +1527,7 @@ void p3FeedReader::cleanFeeds()
|
|||
if (mNotify) {
|
||||
std::list<std::pair<uint32_t, std::string> >::iterator it;
|
||||
for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) {
|
||||
mNotify->notifyMsgChanged(it->first, it->second, NOTIFY_TYPE_DEL);
|
||||
mNotify->notifyMsgChanged(it->first, it->second, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1801,7 +1802,7 @@ bool p3FeedReader::getFeedToDownload(RsFeedReaderFeed &feed, uint32_t neededFeed
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1852,7 +1853,7 @@ void p3FeedReader::onDownloadSuccess(uint32_t feedId, const std::string &content
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1889,7 +1890,7 @@ void p3FeedReader::onDownloadError(uint32_t feedId, RsFeedReaderErrorState resul
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1944,7 +1945,7 @@ bool p3FeedReader::getFeedToProcess(RsFeedReaderFeed &feed, uint32_t neededFeedI
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -2323,11 +2324,11 @@ void p3FeedReader::onProcessSuccess_addMsgs(uint32_t feedId, std::list<RsFeedRea
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for (it = addedMsgs.begin(); it != addedMsgs.end(); ++it) {
|
||||
mNotify->notifyMsgChanged(feedId, *it, NOTIFY_TYPE_ADD);
|
||||
mNotify->notifyMsgChanged(feedId, *it, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2365,7 +2366,7 @@ void p3FeedReader::onProcessError(uint32_t feedId, RsFeedReaderErrorState result
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2433,7 +2434,7 @@ void p3FeedReader::setFeedInfo(uint32_t feedId, const std::string &name, const s
|
|||
}
|
||||
|
||||
if (mNotify) {
|
||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
||||
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ class RsFeedReaderMsg;
|
|||
class p3FeedReaderThread;
|
||||
|
||||
class RsGxsForums;
|
||||
struct RsGxsForumGroup;
|
||||
class RsGxsForumGroup;
|
||||
class RsPosted;
|
||||
struct RsPostedGroup;
|
||||
class RsPostedGroup;
|
||||
class RsGxsIfaceHelper;
|
||||
|
||||
class p3FeedReader : public RsPQIService, public RsFeedReader
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue