FeedReader: Renamed enum RsFeedAddResult to RsFeedResult

This commit is contained in:
thunder2 2023-04-13 20:16:10 +02:00
parent 186976e209
commit 63390fddee
7 changed files with 82 additions and 82 deletions

View File

@ -449,12 +449,12 @@ void AddFeedDialog::createFeed()
if (mFeedId == 0) {
/* add new feed */
RsFeedAddResult result = mFeedReader->addFeed(feedInfo, mFeedId);
RsFeedResult result = mFeedReader->addFeed(feedInfo, mFeedId);
if (FeedReaderStringDefs::showError(this, result, tr("Create feed"), tr("Cannot create feed."))) {
return;
}
} else {
RsFeedAddResult result = mFeedReader->setFeed(mFeedId, feedInfo);
RsFeedResult result = mFeedReader->setFeed(mFeedId, feedInfo);
if (FeedReaderStringDefs::showError(this, result, tr("Edit feed"), tr("Cannot change feed."))) {
return;
}

View File

@ -748,7 +748,7 @@ void FeedReaderDialog::newFolder()
if (dialog.exec() == QDialog::Accepted && !dialog.textValue().isEmpty()) {
uint32_t feedId;
RsFeedAddResult result = mFeedReader->addFolder(currentFeedId(), dialog.textValue().toUtf8().constData(), feedId);
RsFeedResult result = mFeedReader->addFolder(currentFeedId(), dialog.textValue().toUtf8().constData(), feedId);
FeedReaderStringDefs::showError(this, result, tr("Create folder"), tr("Cannot create folder."));
}
}
@ -801,7 +801,7 @@ void FeedReaderDialog::editFeed()
dialog.setTextValue(item->data(COLUMN_FEED_DATA, ROLE_FEED_NAME).toString());
if (dialog.exec() == QDialog::Accepted && !dialog.textValue().isEmpty()) {
RsFeedAddResult result = mFeedReader->setFolder(feedId, dialog.textValue().toUtf8().constData());
RsFeedResult result = mFeedReader->setFolder(feedId, dialog.textValue().toUtf8().constData());
FeedReaderStringDefs::showError(this, result, tr("Create folder"), tr("Cannot create folder."));
}
} else {
@ -856,7 +856,7 @@ void FeedReaderDialog::feedTreeReparent(QTreeWidgetItem *item, QTreeWidgetItem *
return;
}
RsFeedAddResult result = mFeedReader->setParent(feedId, parentId);
RsFeedResult result = mFeedReader->setParent(feedId, parentId);
if (FeedReaderStringDefs::showError(this, result, tr("Move feed"), tr("Cannot move feed."))) {
return;
}

View File

@ -23,27 +23,27 @@
#include "FeedReaderStringDefs.h"
bool FeedReaderStringDefs::showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text)
bool FeedReaderStringDefs::showError(QWidget *parent, RsFeedResult result, const QString &title, const QString &text)
{
QString error;
switch (result) {
case RS_FEED_ADD_RESULT_SUCCESS:
case RS_FEED_RESULT_SUCCESS:
/* no error */
return false;
case RS_FEED_ADD_RESULT_FEED_NOT_FOUND:
case RS_FEED_RESULT_FEED_NOT_FOUND:
error = QApplication::translate("FeedReaderStringDefs", "Feed not found.");
break;
case RS_FEED_ADD_RESULT_PARENT_NOT_FOUND:
case RS_FEED_RESULT_PARENT_NOT_FOUND:
error = QApplication::translate("FeedReaderStringDefs", "Parent not found.");
break;
case RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER:
case RS_FEED_RESULT_PARENT_IS_NO_FOLDER:
error = QApplication::translate("FeedReaderStringDefs", "Parent is no folder.");
break;
case RS_FEED_ADD_RESULT_FEED_IS_FOLDER:
case RS_FEED_RESULT_FEED_IS_FOLDER:
error = QApplication::translate("FeedReaderStringDefs", "Feed is a folder.");
break;
case RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER:
case RS_FEED_RESULT_FEED_IS_NO_FOLDER:
error = QApplication::translate("FeedReaderStringDefs", "Feed is no folder.");
break;
default:

View File

@ -30,7 +30,7 @@ class QWidget;
class FeedReaderStringDefs
{
public:
static bool showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text);
static bool showError(QWidget *parent, RsFeedResult result, const QString &title, const QString &text);
static QString workState(FeedInfo::WorkState state);
static QString errorString(const FeedInfo &feedInfo);
static QString errorString(RsFeedReaderErrorState errorState, const std::string &errorString);

View File

@ -60,14 +60,14 @@ enum RsFeedReaderErrorState {
RS_FEED_ERRORSTATE_PROCESS_XSLT_NO_RESULT = 156
};
enum RsFeedAddResult
enum RsFeedResult
{
RS_FEED_ADD_RESULT_SUCCESS,
RS_FEED_ADD_RESULT_FEED_NOT_FOUND,
RS_FEED_ADD_RESULT_PARENT_NOT_FOUND,
RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER,
RS_FEED_ADD_RESULT_FEED_IS_FOLDER,
RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER
RS_FEED_RESULT_SUCCESS,
RS_FEED_RESULT_FEED_NOT_FOUND,
RS_FEED_RESULT_PARENT_NOT_FOUND,
RS_FEED_RESULT_PARENT_IS_NO_FOLDER,
RS_FEED_RESULT_FEED_IS_FOLDER,
RS_FEED_RESULT_FEED_IS_NO_FOLDER
};
enum RsFeedTransformationType
@ -212,25 +212,25 @@ public:
virtual bool getSaveInBackground() = 0;
virtual void setSaveInBackground(bool saveInBackground) = 0;
virtual RsFeedAddResult addFolder(uint32_t parentId, const std::string &name, uint32_t &feedId) = 0;
virtual RsFeedAddResult setFolder(uint32_t feedId, const std::string &name) = 0;
virtual RsFeedAddResult addFeed(const FeedInfo &feedInfo, uint32_t &feedId) = 0;
virtual RsFeedAddResult setFeed(uint32_t feedId, const FeedInfo &feedInfo) = 0;
virtual RsFeedAddResult setParent(uint32_t feedId, uint32_t parentId) = 0;
virtual bool removeFeed(uint32_t feedId) = 0;
virtual bool addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId) = 0;
virtual void getFeedList(uint32_t parentId, std::list<FeedInfo> &feedInfos) = 0;
virtual bool getFeedInfo(uint32_t feedId, FeedInfo &feedInfo) = 0;
virtual bool getMsgInfo(uint32_t feedId, const std::string &msgId, FeedMsgInfo &msgInfo) = 0;
virtual bool removeMsg(uint32_t feedId, const std::string &msgId) = 0;
virtual bool removeMsgs(uint32_t feedId, const std::list<std::string> &msgIds) = 0;
virtual bool getMessageCount(uint32_t feedId, uint32_t *msgCount, uint32_t *newCount, uint32_t *unreadCount) = 0;
virtual bool getFeedMsgList(uint32_t feedId, std::list<FeedMsgInfo> &msgInfos) = 0;
virtual bool getFeedMsgIdList(uint32_t feedId, std::list<std::string> &msgIds) = 0;
virtual bool processFeed(uint32_t feedId) = 0;
virtual bool setMessageRead(uint32_t feedId, const std::string &msgId, bool read) = 0;
virtual bool retransformMsg(uint32_t feedId, const std::string &msgId) = 0;
virtual bool clearMessageCache(uint32_t feedId) = 0;
virtual RsFeedResult addFolder(uint32_t parentId, const std::string &name, uint32_t &feedId) = 0;
virtual RsFeedResult setFolder(uint32_t feedId, const std::string &name) = 0;
virtual RsFeedResult addFeed(const FeedInfo &feedInfo, uint32_t &feedId) = 0;
virtual RsFeedResult setFeed(uint32_t feedId, const FeedInfo &feedInfo) = 0;
virtual RsFeedResult setParent(uint32_t feedId, uint32_t parentId) = 0;
virtual bool removeFeed(uint32_t feedId) = 0;
virtual bool addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId) = 0;
virtual void getFeedList(uint32_t parentId, std::list<FeedInfo> &feedInfos) = 0;
virtual bool getFeedInfo(uint32_t feedId, FeedInfo &feedInfo) = 0;
virtual bool getMsgInfo(uint32_t feedId, const std::string &msgId, FeedMsgInfo &msgInfo) = 0;
virtual bool removeMsg(uint32_t feedId, const std::string &msgId) = 0;
virtual bool removeMsgs(uint32_t feedId, const std::list<std::string> &msgIds) = 0;
virtual bool getMessageCount(uint32_t feedId, uint32_t *msgCount, uint32_t *newCount, uint32_t *unreadCount) = 0;
virtual bool getFeedMsgList(uint32_t feedId, std::list<FeedMsgInfo> &msgInfos) = 0;
virtual bool getFeedMsgIdList(uint32_t feedId, std::list<std::string> &msgIds) = 0;
virtual bool processFeed(uint32_t feedId) = 0;
virtual bool setMessageRead(uint32_t feedId, const std::string &msgId, bool read) = 0;
virtual bool retransformMsg(uint32_t feedId, const std::string &msgId) = 0;
virtual bool clearMessageCache(uint32_t feedId) = 0;
virtual RsFeedReaderErrorState processXPath(const std::list<std::string> &xpathsToUse, const std::list<std::string> &xpathsToRemove, std::string &description, std::string &errorString) = 0;
virtual RsFeedReaderErrorState processXslt(const std::string &xslt, std::string &description, std::string &errorString) = 0;

View File

@ -366,7 +366,7 @@ void p3FeedReader::stopPreviewThreads_locked()
}
}
RsFeedAddResult p3FeedReader::addFolder(uint32_t parentId, const std::string &name, uint32_t &feedId)
RsFeedResult p3FeedReader::addFolder(uint32_t parentId, const std::string &name, uint32_t &feedId)
{
feedId = 0;
@ -380,14 +380,14 @@ RsFeedAddResult p3FeedReader::addFolder(uint32_t parentId, const std::string &na
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::addFolder - parent id " << parentId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_NOT_FOUND;
return RS_FEED_RESULT_PARENT_NOT_FOUND;
}
if ((parentIt->second->flag & RS_FEED_FLAG_FOLDER) == 0) {
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::addFolder - parent " << parentIt->second->name << " is no folder" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER;
return RS_FEED_RESULT_PARENT_IS_NO_FOLDER;
}
}
@ -407,10 +407,10 @@ RsFeedAddResult p3FeedReader::addFolder(uint32_t parentId, const std::string &na
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
}
return RS_FEED_ADD_RESULT_SUCCESS;
return RS_FEED_RESULT_SUCCESS;
}
RsFeedAddResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name)
RsFeedResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name)
{
{
RsStackMutex stack(mFeedReaderMtx); /******* LOCK STACK MUTEX *********/
@ -424,19 +424,19 @@ RsFeedAddResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setFolder - feed id " << feedId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_FEED_NOT_FOUND;
return RS_FEED_RESULT_FEED_NOT_FOUND;
}
if ((feedIt->second->flag & RS_FEED_FLAG_FOLDER) == 0) {
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setFolder - feed " << feedIt->second->name << " is no folder" << std::endl;
#endif
return RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER;
return RS_FEED_RESULT_FEED_IS_NO_FOLDER;
}
RsFeedReaderFeed *fi = feedIt->second;
if (fi->name == name) {
return RS_FEED_ADD_RESULT_SUCCESS;
return RS_FEED_RESULT_SUCCESS;
}
fi->name = name;
}
@ -447,10 +447,10 @@ RsFeedAddResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
}
return RS_FEED_ADD_RESULT_SUCCESS;
return RS_FEED_RESULT_SUCCESS;
}
RsFeedAddResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId)
RsFeedResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId)
{
feedId = 0;
@ -468,14 +468,14 @@ RsFeedAddResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::addFeed - parent id " << feedInfo.parentId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_NOT_FOUND;
return RS_FEED_RESULT_PARENT_NOT_FOUND;
}
if ((parentIt->second->flag & RS_FEED_FLAG_FOLDER) == 0) {
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::addFeed - parent " << parentIt->second->name << " is no folder" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER;
return RS_FEED_RESULT_PARENT_IS_NO_FOLDER;
}
}
@ -494,10 +494,10 @@ RsFeedAddResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
}
return RS_FEED_ADD_RESULT_SUCCESS;
return RS_FEED_RESULT_SUCCESS;
}
RsFeedAddResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
RsFeedResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
{
std::string forumId;
std::string forumName;
@ -518,14 +518,14 @@ RsFeedAddResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setFeed - feed id " << feedId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_FEED_NOT_FOUND;
return RS_FEED_RESULT_FEED_NOT_FOUND;
}
if (feedIt->second->flag & RS_FEED_FLAG_FOLDER) {
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setFeed - feed " << feedIt->second->name << " is a folder" << std::endl;
#endif
return RS_FEED_ADD_RESULT_FEED_IS_FOLDER;
return RS_FEED_RESULT_FEED_IS_FOLDER;
}
if (feedInfo.parentId) {
@ -535,14 +535,14 @@ RsFeedAddResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setFeed - parent id " << feedInfo.parentId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_NOT_FOUND;
return RS_FEED_RESULT_PARENT_NOT_FOUND;
}
if ((parentIt->second->flag & RS_FEED_FLAG_FOLDER) == 0) {
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setFeed - parent " << parentIt->second->name << " is no folder" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER;
return RS_FEED_RESULT_PARENT_IS_NO_FOLDER;
}
}
@ -595,10 +595,10 @@ RsFeedAddResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
//TODO: error
}
return RS_FEED_ADD_RESULT_SUCCESS;
return RS_FEED_RESULT_SUCCESS;
}
RsFeedAddResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
RsFeedResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
{
bool changed = false;
@ -614,7 +614,7 @@ RsFeedAddResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setParent - feed id " << feedId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_FEED_NOT_FOUND;
return RS_FEED_RESULT_FEED_NOT_FOUND;
}
if (parentId) {
@ -624,14 +624,14 @@ RsFeedAddResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setParent - parent id " << parentId << " not found" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_NOT_FOUND;
return RS_FEED_RESULT_PARENT_NOT_FOUND;
}
if ((parentIt->second->flag & RS_FEED_FLAG_FOLDER) == 0) {
#ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReader::setParent - parent " << parentIt->second->name << " is no folder" << std::endl;
#endif
return RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER;
return RS_FEED_RESULT_PARENT_IS_NO_FOLDER;
}
}
@ -651,7 +651,7 @@ RsFeedAddResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
}
}
return RS_FEED_ADD_RESULT_SUCCESS;
return RS_FEED_RESULT_SUCCESS;
}
void p3FeedReader::deleteAllMsgs_locked(RsFeedReaderFeed *fi)

View File

@ -55,25 +55,25 @@ public:
virtual bool getSaveInBackground();
virtual void setSaveInBackground(bool saveInBackground);
virtual RsFeedAddResult addFolder(uint32_t parentId, const std::string &name, uint32_t &feedId);
virtual RsFeedAddResult setFolder(uint32_t feedId, const std::string &name);
virtual RsFeedAddResult addFeed(const FeedInfo &feedInfo, uint32_t &feedId);
virtual RsFeedAddResult setFeed(uint32_t feedId, const FeedInfo &feedInfo);
virtual RsFeedAddResult setParent(uint32_t feedId, uint32_t parentId);
virtual bool removeFeed(uint32_t feedId);
virtual bool addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId);
virtual void getFeedList(uint32_t parentId, std::list<FeedInfo> &feedInfos);
virtual bool getFeedInfo(uint32_t feedId, FeedInfo &feedInfo);
virtual bool getMsgInfo(uint32_t feedId, const std::string &msgId, FeedMsgInfo &msgInfo);
virtual bool removeMsg(uint32_t feedId, const std::string &msgId);
virtual bool removeMsgs(uint32_t feedId, const std::list<std::string> &msgIds);
virtual bool getMessageCount(uint32_t feedId, uint32_t *msgCount, uint32_t *newCount, uint32_t *unreadCount);
virtual bool getFeedMsgList(uint32_t feedId, std::list<FeedMsgInfo> &msgInfos);
virtual bool getFeedMsgIdList(uint32_t feedId, std::list<std::string> &msgIds);
virtual bool processFeed(uint32_t feedId);
virtual bool setMessageRead(uint32_t feedId, const std::string &msgId, bool read);
virtual bool retransformMsg(uint32_t feedId, const std::string &msgId);
virtual bool clearMessageCache(uint32_t feedId);
virtual RsFeedResult addFolder(uint32_t parentId, const std::string &name, uint32_t &feedId);
virtual RsFeedResult setFolder(uint32_t feedId, const std::string &name);
virtual RsFeedResult addFeed(const FeedInfo &feedInfo, uint32_t &feedId);
virtual RsFeedResult setFeed(uint32_t feedId, const FeedInfo &feedInfo);
virtual RsFeedResult setParent(uint32_t feedId, uint32_t parentId);
virtual bool removeFeed(uint32_t feedId);
virtual bool addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId);
virtual void getFeedList(uint32_t parentId, std::list<FeedInfo> &feedInfos);
virtual bool getFeedInfo(uint32_t feedId, FeedInfo &feedInfo);
virtual bool getMsgInfo(uint32_t feedId, const std::string &msgId, FeedMsgInfo &msgInfo);
virtual bool removeMsg(uint32_t feedId, const std::string &msgId);
virtual bool removeMsgs(uint32_t feedId, const std::list<std::string> &msgIds);
virtual bool getMessageCount(uint32_t feedId, uint32_t *msgCount, uint32_t *newCount, uint32_t *unreadCount);
virtual bool getFeedMsgList(uint32_t feedId, std::list<FeedMsgInfo> &msgInfos);
virtual bool getFeedMsgIdList(uint32_t feedId, std::list<std::string> &msgIds);
virtual bool processFeed(uint32_t feedId);
virtual bool setMessageRead(uint32_t feedId, const std::string &msgId, bool read);
virtual bool retransformMsg(uint32_t feedId, const std::string &msgId);
virtual bool clearMessageCache(uint32_t feedId);
virtual RsFeedReaderErrorState processXPath(const std::list<std::string> &xpathsToUse, const std::list<std::string> &xpathsToRemove, std::string &description, std::string &errorString);
virtual RsFeedReaderErrorState processXslt(const std::string &xslt, std::string &description, std::string &errorString);