mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-25 13:38:44 +01:00
Fixed newspaper handling.
This commit is contained in:
parent
6c12059987
commit
8c20ca7025
@ -148,7 +148,7 @@ message(rssguard: Prefix directory: \"$$PREFIX\".)
|
||||
message(rssguard: Build revision: \"$$APP_REVISION\".)
|
||||
message(rssguard: lrelease executable name: \"$$LRELEASE_EXECUTABLE\".)
|
||||
|
||||
QT += core gui widgets sql network xml printsupport # webenginewidgets
|
||||
QT += core gui widgets sql network xml printsupport
|
||||
CONFIG *= c++11 debug_and_release warn_on
|
||||
DEFINES *= QT_USE_QSTRINGBUILDER QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS UNICODE _UNICODE
|
||||
VERSION = $$APP_VERSION
|
||||
|
@ -88,19 +88,17 @@ void MessagesModel::loadMessages(RootItem *item) {
|
||||
}
|
||||
|
||||
bool MessagesModel::setMessageImportantById(int id, RootItem::Importance important) {
|
||||
Q_UNUSED(important)
|
||||
|
||||
for (int i = 0; i < rowCount(); i++) {
|
||||
int found_id = data(i, MSG_DB_ID_INDEX, Qt::EditRole).toInt();
|
||||
|
||||
if (found_id == id) {
|
||||
bool result;
|
||||
bool set = setData(index(i, MSG_DB_IMPORTANT_INDEX), important);
|
||||
|
||||
if (result = switchMessageImportance(i)) {
|
||||
if (set) {
|
||||
emit dataChanged(index(i, 0), index(i, MSG_DB_CUSTOM_HASH_INDEX));
|
||||
}
|
||||
|
||||
return result;
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,13 +285,13 @@ bool MessagesModel::setMessageReadById(int id, RootItem::ReadStatus read) {
|
||||
int found_id = data(i, MSG_DB_ID_INDEX, Qt::EditRole).toInt();
|
||||
|
||||
if (found_id == id) {
|
||||
bool result;
|
||||
bool set = setData(index(i, MSG_DB_READ_INDEX), read);
|
||||
|
||||
if (result = setMessageRead(i, read)) {
|
||||
if (set) {
|
||||
emit dataChanged(index(i, 0), index(i, MSG_DB_CUSTOM_HASH_INDEX));
|
||||
}
|
||||
|
||||
return result;
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,25 +137,51 @@ void MessagePreviewer::loadMessage(const Message &message, RootItem *root) {
|
||||
}
|
||||
|
||||
void MessagePreviewer::markMessageAsRead() {
|
||||
if (!m_root.isNull()) {
|
||||
emit markMessageRead(m_message.m_id, RootItem::Read);
|
||||
m_message.m_isRead = true;
|
||||
updateButtons();
|
||||
}
|
||||
markMessageAsReadUnread(RootItem::Read);
|
||||
}
|
||||
|
||||
void MessagePreviewer::markMessageAsUnread() {
|
||||
markMessageAsReadUnread(RootItem::Unread);
|
||||
}
|
||||
|
||||
void MessagePreviewer::markMessageAsReadUnread(RootItem::ReadStatus read) {
|
||||
if (!m_root.isNull()) {
|
||||
emit markMessageRead(m_message.m_id, RootItem::Unread);
|
||||
m_message.m_isRead = false;
|
||||
updateButtons();
|
||||
if (m_root->getParentServiceRoot()->onBeforeSetMessagesRead(m_root.data(),
|
||||
QList<Message>() << m_message,
|
||||
read)) {
|
||||
DatabaseQueries::markMessagesReadUnread(qApp->database()->connection(objectName(), DatabaseFactory::FromSettings),
|
||||
QStringList() << QString::number(m_message.m_id),
|
||||
read);
|
||||
m_root->getParentServiceRoot()->onAfterSetMessagesRead(m_root.data(),
|
||||
QList<Message>() << m_message,
|
||||
read);
|
||||
m_message.m_isRead = true;
|
||||
|
||||
emit markMessageRead(m_message.m_id, read);
|
||||
updateButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessagePreviewer::switchMessageImportance(bool checked) {
|
||||
if (!m_root.isNull()) {
|
||||
emit markMessageImportant(m_message.m_id, checked ? RootItem::Important : RootItem::NotImportant);
|
||||
m_message.m_isImportant = checked;
|
||||
if (m_root->getParentServiceRoot()->onBeforeSwitchMessageImportance(m_root.data(),
|
||||
QList<ImportanceChange>() << ImportanceChange(m_message,
|
||||
m_message.m_isImportant ?
|
||||
RootItem::NotImportant :
|
||||
RootItem::Important))) {
|
||||
DatabaseQueries::switchMessagesImportance(qApp->database()->connection(objectName(), DatabaseFactory::FromSettings),
|
||||
QStringList() << QString::number(m_message.m_id));
|
||||
|
||||
m_root->getParentServiceRoot()->onBeforeSwitchMessageImportance(m_root.data(),
|
||||
QList<ImportanceChange>() << ImportanceChange(m_message,
|
||||
m_message.m_isImportant ?
|
||||
RootItem::NotImportant :
|
||||
RootItem::Important));
|
||||
|
||||
emit markMessageImportant(m_message.m_id, checked ? RootItem::Important : RootItem::NotImportant);
|
||||
m_message.m_isImportant = checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ class MessagePreviewer : public QWidget {
|
||||
private slots:
|
||||
void markMessageAsRead();
|
||||
void markMessageAsUnread();
|
||||
void markMessageAsReadUnread(RootItem::ReadStatus read);
|
||||
void switchMessageImportance(bool checked);
|
||||
|
||||
signals:
|
||||
|
@ -262,8 +262,19 @@ void WebBrowser::markMessageAsRead(int id, bool read) {
|
||||
if (!m_root.isNull()) {
|
||||
Message *msg = findMessage(id);
|
||||
|
||||
emit markMessageRead(msg->m_id, read ? RootItem::Read : RootItem::Unread);
|
||||
msg->m_isRead = read ? RootItem::Read : RootItem::Unread;
|
||||
if (msg != nullptr && m_root->getParentServiceRoot()->onBeforeSetMessagesRead(m_root.data(),
|
||||
QList<Message>() << *msg,
|
||||
read ? RootItem::Read : RootItem::Unread)) {
|
||||
DatabaseQueries::markMessagesReadUnread(qApp->database()->connection(objectName(), DatabaseFactory::FromSettings),
|
||||
QStringList() << QString::number(msg->m_id),
|
||||
read ? RootItem::Read : RootItem::Unread);
|
||||
m_root->getParentServiceRoot()->onAfterSetMessagesRead(m_root.data(),
|
||||
QList<Message>() << *msg,
|
||||
read ? RootItem::Read : RootItem::Unread);
|
||||
|
||||
emit markMessageRead(msg->m_id, read ? RootItem::Read : RootItem::Unread);
|
||||
msg->m_isRead = read ? RootItem::Read : RootItem::Unread;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,8 +282,23 @@ void WebBrowser::switchMessageImportance(int id, bool checked) {
|
||||
if (!m_root.isNull()) {
|
||||
Message *msg = findMessage(id);
|
||||
|
||||
emit markMessageImportant(msg->m_id, msg->m_isImportant ? RootItem::NotImportant : RootItem::Important);
|
||||
msg->m_isImportant = checked;
|
||||
if (msg != nullptr && m_root->getParentServiceRoot()->onBeforeSwitchMessageImportance(m_root.data(),
|
||||
QList<ImportanceChange>() << ImportanceChange(*msg,
|
||||
msg->m_isImportant ?
|
||||
RootItem::NotImportant :
|
||||
RootItem::Important))) {
|
||||
DatabaseQueries::switchMessagesImportance(qApp->database()->connection(objectName(), DatabaseFactory::FromSettings),
|
||||
QStringList() << QString::number(msg->m_id));
|
||||
|
||||
m_root->getParentServiceRoot()->onBeforeSwitchMessageImportance(m_root.data(),
|
||||
QList<ImportanceChange>() << ImportanceChange(*msg,
|
||||
msg->m_isImportant ?
|
||||
RootItem::NotImportant :
|
||||
RootItem::Important));
|
||||
|
||||
emit markMessageImportant(msg->m_id, msg->m_isImportant ? RootItem::NotImportant : RootItem::Important);
|
||||
msg->m_isImportant = checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user