Fix some obsolete usage warnings.
This commit is contained in:
parent
76ffe8cbee
commit
9b8ad9546b
@ -226,10 +226,10 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
|||||||
|
|
||||||
if (!important_msgs.isEmpty()) {
|
if (!important_msgs.isEmpty()) {
|
||||||
// Now we push new read states to the service.
|
// Now we push new read states to the service.
|
||||||
QList<ImportanceChange> chngs = QList<ImportanceChange>::fromStdList(
|
auto list = boolinq::from(important_msgs).select([](const Message& msg) {
|
||||||
boolinq::from(important_msgs).select([](const Message& msg) {
|
|
||||||
return ImportanceChange(msg, RootItem::Importance::Important);
|
return ImportanceChange(msg, RootItem::Importance::Important);
|
||||||
}).toStdList());
|
}).toStdList();
|
||||||
|
QList<ImportanceChange> chngs = FROM_STD_LIST(QList<ImportanceChange>, list);
|
||||||
|
|
||||||
if (feed->getParentServiceRoot()->onBeforeSwitchMessageImportance(feed, chngs)) {
|
if (feed->getParentServiceRoot()->onBeforeSwitchMessageImportance(feed, chngs)) {
|
||||||
qDebugNN << LOGSEC_FEEDDOWNLOADER
|
qDebugNN << LOGSEC_FEEDDOWNLOADER
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constants.
|
||||||
|
//
|
||||||
#define SERVICE_CODE_STD_RSS "std-rss"
|
#define SERVICE_CODE_STD_RSS "std-rss"
|
||||||
#define SERVICE_CODE_TT_RSS "tt-rss"
|
#define SERVICE_CODE_TT_RSS "tt-rss"
|
||||||
#define SERVICE_CODE_OWNCLOUD "owncloud"
|
#define SERVICE_CODE_OWNCLOUD "owncloud"
|
||||||
@ -157,49 +160,6 @@
|
|||||||
#define APP_LOCAL_THEME_FOLDER "icons"
|
#define APP_LOCAL_THEME_FOLDER "icons"
|
||||||
#define APP_NO_THEME ""
|
#define APP_NO_THEME ""
|
||||||
|
|
||||||
#ifndef qDebugNN
|
|
||||||
#define qDebugNN qDebug().noquote().nospace()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef qWarningNN
|
|
||||||
#define qWarningNN qWarning().noquote().nospace()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef qCriticalNN
|
|
||||||
#define qCriticalNN qCritical().noquote().nospace()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef qInfoNN
|
|
||||||
#define qInfoNN qInfo().noquote().nospace()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define QUOTE_W_SPACE_DOT(x) " '" << (x) << "'."
|
|
||||||
#define QUOTE_W_SPACE(x) " '" << (x) << "' "
|
|
||||||
#define QUOTE_NO_SPACE(x) "'" << (x) << "'"
|
|
||||||
|
|
||||||
#ifndef QSL
|
|
||||||
|
|
||||||
// Thin macro wrapper for literal strings.
|
|
||||||
// They are much more memory efficient and faster.
|
|
||||||
// Use it for all literals except for two cases:
|
|
||||||
// a) Methods which take QLatin1String (use QLatin1String for literal argument too),
|
|
||||||
// b) Construction of empty literals "", use QString() instead of QStringLiteral("").
|
|
||||||
#define QSL(x) QStringLiteral(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef QL1S
|
|
||||||
|
|
||||||
// Macro for latin strings. Latin strings are
|
|
||||||
// faster than QStrings created from literals.
|
|
||||||
#define QL1S(x) QLatin1String(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef QL1C
|
|
||||||
|
|
||||||
// Macro for latin chars.
|
|
||||||
#define QL1C(x) QLatin1Char(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Indexes of columns as they are DEFINED IN THE TABLE for MESSAGES.
|
// Indexes of columns as they are DEFINED IN THE TABLE for MESSAGES.
|
||||||
#define MSG_DB_ID_INDEX 0
|
#define MSG_DB_ID_INDEX 0
|
||||||
#define MSG_DB_READ_INDEX 1
|
#define MSG_DB_READ_INDEX 1
|
||||||
@ -285,4 +245,56 @@
|
|||||||
#define APP_DESKTOP_ENTRY_PATH QSL(":/desktop")
|
#define APP_DESKTOP_ENTRY_PATH QSL(":/desktop")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Source code specific enhancements.
|
||||||
|
//
|
||||||
|
#if QT_VERSION >= 0x050E00 // Qt >= 5.14.0
|
||||||
|
#define FROM_STD_LIST(x, y) (x(y.begin(), y.end()))
|
||||||
|
#else
|
||||||
|
#define FROM_STD_LIST(x, y) (x::fromStdList(y))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef qDebugNN
|
||||||
|
#define qDebugNN qDebug().noquote().nospace()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef qWarningNN
|
||||||
|
#define qWarningNN qWarning().noquote().nospace()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef qCriticalNN
|
||||||
|
#define qCriticalNN qCritical().noquote().nospace()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef qInfoNN
|
||||||
|
#define qInfoNN qInfo().noquote().nospace()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define QUOTE_W_SPACE_DOT(x) " '" << (x) << "'."
|
||||||
|
#define QUOTE_W_SPACE(x) " '" << (x) << "' "
|
||||||
|
#define QUOTE_NO_SPACE(x) "'" << (x) << "'"
|
||||||
|
|
||||||
|
#ifndef QSL
|
||||||
|
|
||||||
|
// Thin macro wrapper for literal strings.
|
||||||
|
// They are much more memory efficient and faster.
|
||||||
|
// Use it for all literals except for two cases:
|
||||||
|
// a) Methods which take QLatin1String (use QLatin1String for literal argument too),
|
||||||
|
// b) Construction of empty literals "", use QString() instead of QStringLiteral("").
|
||||||
|
#define QSL(x) QStringLiteral(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef QL1S
|
||||||
|
|
||||||
|
// Macro for latin strings. Latin strings are
|
||||||
|
// faster than QStrings created from literals.
|
||||||
|
#define QL1S(x) QLatin1String(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef QL1C
|
||||||
|
|
||||||
|
// Macro for latin chars.
|
||||||
|
#define QL1C(x) QLatin1Char(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // DEFINITIONS_H
|
#endif // DEFINITIONS_H
|
||||||
|
@ -237,7 +237,7 @@ void MessagesView::initializeContextMenu() {
|
|||||||
auto rows = boolinq::from(mapped_indexes).select([](const QModelIndex& idx) {
|
auto rows = boolinq::from(mapped_indexes).select([](const QModelIndex& idx) {
|
||||||
return idx.row();
|
return idx.row();
|
||||||
}).toStdList();
|
}).toStdList();
|
||||||
auto messages = m_sourceModel->messagesAt(QList<int>::fromStdList(rows));
|
auto messages = m_sourceModel->messagesAt(FROM_STD_LIST(QList<int>, rows));
|
||||||
auto extra_context_menu = m_sourceModel->loadedItem()->getParentServiceRoot()->contextMenuMessagesList(messages);
|
auto extra_context_menu = m_sourceModel->loadedItem()->getParentServiceRoot()->contextMenuMessagesList(messages);
|
||||||
|
|
||||||
if (!extra_context_menu.isEmpty()) {
|
if (!extra_context_menu.isEmpty()) {
|
||||||
|
@ -2,21 +2,35 @@
|
|||||||
|
|
||||||
#include "services/abstract/cacheforserviceroot.h"
|
#include "services/abstract/cacheforserviceroot.h"
|
||||||
|
|
||||||
|
#include "3rd-party/boolinq/boolinq.h"
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
#include "miscellaneous/mutex.h"
|
#include "miscellaneous/mutex.h"
|
||||||
|
#include "services/abstract/label.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
CacheForServiceRoot::CacheForServiceRoot() : m_cacheSaveMutex(new Mutex(QMutex::NonRecursive, nullptr)) {}
|
CacheForServiceRoot::CacheForServiceRoot() : m_cacheSaveMutex(new QMutex(QMutex::NonRecursive)) {}
|
||||||
|
|
||||||
CacheForServiceRoot::~CacheForServiceRoot() {
|
void CacheForServiceRoot::addMessageStatesToCache(const QList<Message>& ids_of_messages, Label* lbl, bool assign) {
|
||||||
m_cacheSaveMutex->deleteLater();
|
auto custom_ids = lbl->getParentServiceRoot()->customIDsOfMessages(ids_of_messages);
|
||||||
|
|
||||||
|
if (assign) {
|
||||||
|
m_cachedLabelAssignments[lbl->customId()].append(custom_ids);
|
||||||
|
m_cachedLabelAssignments[lbl->customId()].removeDuplicates();
|
||||||
|
|
||||||
|
// Remove the same messages from "deassign" list.
|
||||||
|
auto deassign = m_cachedLabelDeassignments[lbl->customId()];
|
||||||
|
auto list = boolinq::from(deassign.begin(), deassign.end()).where([custom_ids](const QString& id) {
|
||||||
|
return !custom_ids.contains(id);
|
||||||
|
}).toStdList();
|
||||||
|
|
||||||
|
m_cachedLabelDeassignments[lbl->customId()] = FROM_STD_LIST(QStringList, list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CacheForServiceRoot::addMessageStatesToCache(const QList<Message>& ids_of_messages, RootItem::Importance importance) {
|
void CacheForServiceRoot::addMessageStatesToCache(const QList<Message>& ids_of_messages, RootItem::Importance importance) {
|
||||||
m_cacheSaveMutex->lock();
|
QMutexLocker lck(m_cacheSaveMutex.data());
|
||||||
|
|
||||||
QList<Message>& list_act = m_cachedStatesImportant[importance];
|
QList<Message>& list_act = m_cachedStatesImportant[importance];
|
||||||
QList<Message>& list_other = m_cachedStatesImportant[importance == RootItem::Importance::Important
|
QList<Message>& list_other = m_cachedStatesImportant[importance == RootItem::Importance::Important
|
||||||
? RootItem::Importance::NotImportant
|
? RootItem::Importance::NotImportant
|
||||||
@ -39,13 +53,10 @@ void CacheForServiceRoot::addMessageStatesToCache(const QList<Message>& ids_of_m
|
|||||||
list_act.append(set_act.values());
|
list_act.append(set_act.values());
|
||||||
list_other.clear();
|
list_other.clear();
|
||||||
list_other.append(set_other.values());
|
list_other.append(set_other.values());
|
||||||
|
|
||||||
m_cacheSaveMutex->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CacheForServiceRoot::addMessageStatesToCache(const QStringList& ids_of_messages, RootItem::ReadStatus read) {
|
void CacheForServiceRoot::addMessageStatesToCache(const QStringList& ids_of_messages, RootItem::ReadStatus read) {
|
||||||
m_cacheSaveMutex->lock();
|
QMutexLocker lck(m_cacheSaveMutex.data());
|
||||||
|
|
||||||
QStringList& list_act = m_cachedStatesRead[read];
|
QStringList& list_act = m_cachedStatesRead[read];
|
||||||
QStringList& list_other = m_cachedStatesRead[read == RootItem::ReadStatus::Read
|
QStringList& list_other = m_cachedStatesRead[read == RootItem::ReadStatus::Read
|
||||||
? RootItem::ReadStatus::Unread
|
? RootItem::ReadStatus::Unread
|
||||||
@ -68,12 +79,10 @@ void CacheForServiceRoot::addMessageStatesToCache(const QStringList& ids_of_mess
|
|||||||
list_act.append(set_act.values());
|
list_act.append(set_act.values());
|
||||||
list_other.clear();
|
list_other.clear();
|
||||||
list_other.append(set_other.values());
|
list_other.append(set_other.values());
|
||||||
|
|
||||||
m_cacheSaveMutex->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CacheForServiceRoot::saveCacheToFile(int acc_id) {
|
void CacheForServiceRoot::saveCacheToFile(int acc_id) {
|
||||||
m_cacheSaveMutex->lock();
|
QMutexLocker lck(m_cacheSaveMutex.data());
|
||||||
|
|
||||||
// Save to file.
|
// Save to file.
|
||||||
const QString file_cache = qApp->userDataFolder() + QDir::separator() + QString::number(acc_id) + "-cached-msgs.dat";
|
const QString file_cache = qApp->userDataFolder() + QDir::separator() + QString::number(acc_id) + "-cached-msgs.dat";
|
||||||
@ -87,15 +96,13 @@ void CacheForServiceRoot::saveCacheToFile(int acc_id) {
|
|||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||||
QDataStream stream(&file);
|
QDataStream stream(&file);
|
||||||
|
|
||||||
stream << m_cachedStatesImportant << m_cachedStatesRead;
|
stream << m_cachedStatesImportant << m_cachedStatesRead << m_cachedLabelAssignments << m_cachedLabelDeassignments;
|
||||||
file.flush();
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cacheSaveMutex->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CacheForServiceRoot::clearCache() {
|
void CacheForServiceRoot::clearCache() {
|
||||||
@ -104,7 +111,8 @@ void CacheForServiceRoot::clearCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CacheForServiceRoot::loadCacheFromFile(int acc_id) {
|
void CacheForServiceRoot::loadCacheFromFile(int acc_id) {
|
||||||
m_cacheSaveMutex->lock();
|
QMutexLocker lck(m_cacheSaveMutex.data());
|
||||||
|
|
||||||
clearCache();
|
clearCache();
|
||||||
|
|
||||||
// Load from file.
|
// Load from file.
|
||||||
@ -115,24 +123,19 @@ void CacheForServiceRoot::loadCacheFromFile(int acc_id) {
|
|||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
QDataStream stream(&file);
|
QDataStream stream(&file);
|
||||||
|
|
||||||
stream >> m_cachedStatesImportant >> m_cachedStatesRead;
|
stream >> m_cachedStatesImportant >> m_cachedStatesRead >> m_cachedLabelAssignments >> m_cachedLabelDeassignments;
|
||||||
file.flush();
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
file.remove();
|
file.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cacheSaveMutex->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>> CacheForServiceRoot::takeMessageCache() {
|
QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>> CacheForServiceRoot::takeMessageCache() {
|
||||||
m_cacheSaveMutex->lock();
|
QMutexLocker lck(m_cacheSaveMutex.data());
|
||||||
|
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
// No cached changes.
|
|
||||||
m_cacheSaveMutex->unlock();
|
|
||||||
|
|
||||||
return QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>>();
|
return QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,11 +149,11 @@ QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<
|
|||||||
cached_data_imp.detach();
|
cached_data_imp.detach();
|
||||||
|
|
||||||
clearCache();
|
clearCache();
|
||||||
m_cacheSaveMutex->unlock();
|
|
||||||
|
|
||||||
return QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>>(cached_data_read, cached_data_imp);
|
return QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>>(cached_data_read, cached_data_imp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CacheForServiceRoot::isEmpty() const {
|
bool CacheForServiceRoot::isEmpty() const {
|
||||||
return m_cachedStatesRead.isEmpty() && m_cachedStatesImportant.isEmpty();
|
return m_cachedStatesRead.isEmpty() && m_cachedStatesImportant.isEmpty() &&
|
||||||
|
m_cachedLabelAssignments.isEmpty() && m_cachedLabelDeassignments.isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
class Mutex;
|
class QMutex;
|
||||||
|
|
||||||
class CacheForServiceRoot {
|
class CacheForServiceRoot {
|
||||||
public:
|
public:
|
||||||
explicit CacheForServiceRoot();
|
explicit CacheForServiceRoot();
|
||||||
virtual ~CacheForServiceRoot();
|
|
||||||
|
|
||||||
|
void addMessageStatesToCache(const QList<Message>& ids_of_messages, Label* lbl, bool assign);
|
||||||
void addMessageStatesToCache(const QList<Message>& ids_of_messages, RootItem::Importance importance);
|
void addMessageStatesToCache(const QList<Message>& ids_of_messages, RootItem::Importance importance);
|
||||||
void addMessageStatesToCache(const QStringList& ids_of_messages, RootItem::ReadStatus read);
|
void addMessageStatesToCache(const QStringList& ids_of_messages, RootItem::ReadStatus read);
|
||||||
|
|
||||||
@ -29,9 +29,20 @@ class CacheForServiceRoot {
|
|||||||
protected:
|
protected:
|
||||||
QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>> takeMessageCache();
|
QPair<QMap<RootItem::ReadStatus, QStringList>, QMap<RootItem::Importance, QList<Message>>> takeMessageCache();
|
||||||
|
|
||||||
Mutex* m_cacheSaveMutex;
|
QScopedPointer<QMutex> m_cacheSaveMutex;
|
||||||
|
|
||||||
|
// Map where key is label's custom ID and value is list of message custom IDs
|
||||||
|
// which we want to assign to the label.
|
||||||
|
QMap<QString, QStringList> m_cachedLabelAssignments;
|
||||||
|
|
||||||
|
// Map where key is label's custom ID and value is list of message custom IDs
|
||||||
|
// which we want to remove from the label assignment.
|
||||||
|
QMap<QString, QStringList> m_cachedLabelDeassignments;
|
||||||
|
|
||||||
|
// Map of cached read/unread changes.
|
||||||
QMap<RootItem::ReadStatus, QStringList> m_cachedStatesRead;
|
QMap<RootItem::ReadStatus, QStringList> m_cachedStatesRead;
|
||||||
|
|
||||||
|
// Map of cached important/unimportant changes.
|
||||||
QMap<RootItem::Importance, QList<Message>> m_cachedStatesImportant;
|
QMap<RootItem::Importance, QList<Message>> m_cachedStatesImportant;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -27,9 +27,11 @@ void LabelsNode::loadLabels(const QList<Label*>& labels) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<Label*> LabelsNode::labels() const {
|
QList<Label*> LabelsNode::labels() const {
|
||||||
return QList<Label*>::fromStdList(boolinq::from(childItems()).select([](RootItem* it) {
|
auto list = boolinq::from(childItems()).select([](RootItem* it) {
|
||||||
return static_cast<Label*>(it);
|
return static_cast<Label*>(it);
|
||||||
}).toStdList());
|
}).toStdList();
|
||||||
|
|
||||||
|
return FROM_STD_LIST(QList<Label*>, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QAction*> LabelsNode::contextMenuFeedsList() {
|
QList<QAction*> LabelsNode::contextMenuFeedsList() {
|
||||||
|
@ -296,10 +296,6 @@ LabelsNode* ServiceRoot::labelsNode() const {
|
|||||||
return m_labelsNode;
|
return m_labelsNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceRoot::setRecycleBin(RecycleBin* recycle_bin) {
|
|
||||||
m_recycleBin = recycle_bin;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceRoot::syncIn() {
|
void ServiceRoot::syncIn() {
|
||||||
QIcon original_icon = icon();
|
QIcon original_icon = icon();
|
||||||
|
|
||||||
|
@ -32,19 +32,15 @@ class ServiceRoot : public RootItem {
|
|||||||
explicit ServiceRoot(RootItem* parent = nullptr);
|
explicit ServiceRoot(RootItem* parent = nullptr);
|
||||||
virtual ~ServiceRoot();
|
virtual ~ServiceRoot();
|
||||||
|
|
||||||
void updateCounts(bool including_total_count);
|
// These methods bellow are part of "interface".
|
||||||
bool deleteViaGui();
|
virtual void updateCounts(bool including_total_count);
|
||||||
bool markAsReadUnread(ReadStatus status);
|
virtual bool deleteViaGui();
|
||||||
|
virtual bool markAsReadUnread(ReadStatus status);
|
||||||
virtual RecycleBin* recycleBin() const;
|
virtual RecycleBin* recycleBin() const;
|
||||||
|
|
||||||
void setRecycleBin(RecycleBin* recycle_bin);
|
|
||||||
|
|
||||||
virtual ImportantNode* importantNode() const;
|
virtual ImportantNode* importantNode() const;
|
||||||
virtual LabelsNode* labelsNode() const;
|
virtual LabelsNode* labelsNode() const;
|
||||||
virtual bool downloadAttachmentOnMyOwn(const QUrl& url) const;
|
virtual bool downloadAttachmentOnMyOwn(const QUrl& url) const;
|
||||||
|
virtual QList<Message> undeletedMessages() const;
|
||||||
QList<Message> undeletedMessages() const;
|
|
||||||
virtual bool supportsFeedAdding() const;
|
virtual bool supportsFeedAdding() const;
|
||||||
virtual bool supportsCategoryAdding() const;
|
virtual bool supportsCategoryAdding() const;
|
||||||
|
|
||||||
@ -53,13 +49,13 @@ class ServiceRoot : public RootItem {
|
|||||||
// a) Add new feed
|
// a) Add new feed
|
||||||
// b) Add new category
|
// b) Add new category
|
||||||
// c) ...
|
// c) ...
|
||||||
// NOTE: Caller does NOT take ownership of created menu!
|
// NOTE: Caller does NOT take ownership of created menu/actions!
|
||||||
virtual QList<QAction*> addItemMenu();
|
virtual QList<QAction*> addItemMenu();
|
||||||
|
|
||||||
// NOTE: Caller does NOT take ownership of created menu!
|
// NOTE: Caller does NOT take ownership of created menu/actions!
|
||||||
virtual QList<QAction*> contextMenuFeedsList();
|
virtual QList<QAction*> contextMenuFeedsList();
|
||||||
|
|
||||||
// NOTE: Caller does NOT take ownership of created menu!
|
// NOTE: Caller does NOT take ownership of created menu/actions!
|
||||||
virtual QList<QAction*> contextMenuMessagesList(const QList<Message>& messages);
|
virtual QList<QAction*> contextMenuMessagesList(const QList<Message>& messages);
|
||||||
|
|
||||||
// Returns list of specific actions to be shown in main window menu
|
// Returns list of specific actions to be shown in main window menu
|
||||||
@ -67,7 +63,7 @@ class ServiceRoot : public RootItem {
|
|||||||
// NOTE: Caller does NOT take ownership of created menu!
|
// NOTE: Caller does NOT take ownership of created menu!
|
||||||
virtual QList<QAction*> serviceMenu();
|
virtual QList<QAction*> serviceMenu();
|
||||||
|
|
||||||
// If plugin uses online synchronization, then returns true.
|
// If plugin uses online synchronization of feeds/labels/etc, then returns true.
|
||||||
virtual bool isSyncable() const;
|
virtual bool isSyncable() const;
|
||||||
|
|
||||||
// Start/stop services.
|
// Start/stop services.
|
||||||
@ -80,29 +76,6 @@ class ServiceRoot : public RootItem {
|
|||||||
virtual void start(bool freshly_activated);
|
virtual void start(bool freshly_activated);
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
|
|
||||||
// Account ID corresponds with DB attribute Accounts (id).
|
|
||||||
int accountId() const;
|
|
||||||
void setAccountId(int account_id);
|
|
||||||
|
|
||||||
// Returns the UNIQUE code of the given service.
|
|
||||||
// NOTE: Keep in sync with ServiceEntryRoot::code().
|
|
||||||
virtual QString code() const = 0;
|
|
||||||
|
|
||||||
// Removes all/read only messages from given underlying feeds.
|
|
||||||
bool cleanFeeds(QList<Feed*> items, bool clean_read_only);
|
|
||||||
|
|
||||||
void completelyRemoveAllData();
|
|
||||||
QStringList customIDSOfMessagesForItem(RootItem* item);
|
|
||||||
bool markFeedsReadUnread(QList<Feed*> items, ReadStatus read);
|
|
||||||
|
|
||||||
// Obvious methods to wrap signals.
|
|
||||||
void itemChanged(const QList<RootItem*>& items);
|
|
||||||
void requestReloadMessageList(bool mark_selected_messages_read);
|
|
||||||
void requestItemExpand(const QList<RootItem*>& items, bool expand);
|
|
||||||
void requestItemExpandStateSave(RootItem* subtree_root);
|
|
||||||
void requestItemReassignment(RootItem* item, RootItem* new_parent);
|
|
||||||
void requestItemRemoval(RootItem* item);
|
|
||||||
|
|
||||||
// This method should prepare messages for given "item" (download them maybe?)
|
// This method should prepare messages for given "item" (download them maybe?)
|
||||||
// into predefined "Messages" table
|
// into predefined "Messages" table
|
||||||
// and then use method QSqlTableModel::setFilter(....).
|
// and then use method QSqlTableModel::setFilter(....).
|
||||||
@ -160,6 +133,43 @@ class ServiceRoot : public RootItem {
|
|||||||
// Selected item is naturally recycle bin.
|
// Selected item is naturally recycle bin.
|
||||||
virtual bool onAfterMessagesRestoredFromBin(RootItem* selected_item, const QList<Message>& messages);
|
virtual bool onAfterMessagesRestoredFromBin(RootItem* selected_item, const QList<Message>& messages);
|
||||||
|
|
||||||
|
// Returns the UNIQUE code of the given service.
|
||||||
|
// NOTE: Keep in sync with ServiceEntryRoot::code().
|
||||||
|
virtual QString code() const = 0;
|
||||||
|
|
||||||
|
// These are not part of "interface".
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Account ID corresponds with DB attribute Accounts (id).
|
||||||
|
int accountId() const;
|
||||||
|
void setAccountId(int account_id);
|
||||||
|
|
||||||
|
// Removes all data associated with this account from DB
|
||||||
|
// and from model.
|
||||||
|
void completelyRemoveAllData();
|
||||||
|
|
||||||
|
// Removes all/read only messages from given underlying feeds.
|
||||||
|
bool cleanFeeds(QList<Feed*> items, bool clean_read_only);
|
||||||
|
|
||||||
|
// Marks all messages from feeds read/unread.
|
||||||
|
bool markFeedsReadUnread(QList<Feed*> items, ReadStatus read);
|
||||||
|
|
||||||
|
// Obvious methods to wrap signals.
|
||||||
|
void itemChanged(const QList<RootItem*>& items);
|
||||||
|
void requestReloadMessageList(bool mark_selected_messages_read);
|
||||||
|
void requestItemExpand(const QList<RootItem*>& items, bool expand);
|
||||||
|
void requestItemExpandStateSave(RootItem* subtree_root);
|
||||||
|
void requestItemReassignment(RootItem* item, RootItem* new_parent);
|
||||||
|
void requestItemRemoval(RootItem* item);
|
||||||
|
|
||||||
|
// Some message/feed attribute selectors.
|
||||||
|
QStringList textualFeedUrls(const QList<Feed*>& feeds) const;
|
||||||
|
QStringList textualFeedIds(const QList<Feed*>& feeds) const;
|
||||||
|
QStringList customIDsOfMessages(const QList<ImportanceChange>& changes);
|
||||||
|
QStringList customIDsOfMessages(const QList<Message>& messages);
|
||||||
|
QStringList customIDSOfMessagesForItem(RootItem* item);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void addNewFeed(RootItem* selected_item, const QString& url = QString());
|
virtual void addNewFeed(RootItem* selected_item, const QString& url = QString());
|
||||||
virtual void addNewCategory(RootItem* selected_item);
|
virtual void addNewCategory(RootItem* selected_item);
|
||||||
@ -196,11 +206,6 @@ class ServiceRoot : public RootItem {
|
|||||||
// assigned from non-existing labels.
|
// assigned from non-existing labels.
|
||||||
void removeLeftOverMessageLabelAssignments();
|
void removeLeftOverMessageLabelAssignments();
|
||||||
|
|
||||||
QStringList textualFeedUrls(const QList<Feed*>& feeds) const;
|
|
||||||
QStringList textualFeedIds(const QList<Feed*>& feeds) const;
|
|
||||||
QStringList customIDsOfMessages(const QList<ImportanceChange>& changes);
|
|
||||||
QStringList customIDsOfMessages(const QList<Message>& messages);
|
|
||||||
|
|
||||||
// Takes lists of feeds/categories and assembles them into the tree structure.
|
// Takes lists of feeds/categories and assembles them into the tree structure.
|
||||||
void assembleCategories(Assignment categories);
|
void assembleCategories(Assignment categories);
|
||||||
void assembleFeeds(Assignment feeds);
|
void assembleFeeds(Assignment feeds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user