| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/services/abstract/importantnode.cpp`/ |
| 2 | |
| 3 | #include "services/abstract/importantnode.h"cxx . . $ `<file>/src/librssguard/services/abstract/importantnode.h`/ |
| 4 | |
| 5 | #include "database/databasequeries.h"cxx . . $ `<file>/src/librssguard/database/databasequeries.h`/ |
| 6 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 7 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 8 | #include "services/abstract/cacheforserviceroot.h"cxx . . $ `<file>/src/librssguard/services/abstract/cacheforserviceroot.h`/ |
| 9 | #include "services/abstract/serviceroot.h"cxx . . $ `<file>/src/librssguard/services/abstract/serviceroot.h`/ |
| 10 | |
| 11 | ImportantNodecxx . . $ ImportantNode#::ImportantNodecxx . . $ ImportantNode#ImportantNode(cb16baca005cfe86).(RootItemcxx . . $ RootItem#* parent_item) : RootItemcxx . . $ RootItem#(parent_item) { |
| 12 | setKindcxx . . $ RootItem#setKind(77afe77d4ce7bfe8).(RootItemcxx . . $ RootItem#::Kindcxx . . $ RootItem#Kind#::Importantcxx . . $ RootItem#Kind#Important.); |
| 13 | setIdcxx . . $ RootItem#setId(d4f767463ce0a6b3).(ID_IMPORTANTcxx . . $ `src/librssguard/definitions/definitions.h:44:9`!); |
| 14 | setIconcxx . . $ RootItem#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("mail-mark-important"))); |
| 15 | setTitlecxx . . $ RootItem#setTitle(3520e46b33348bf6).(trcxx . . $ ImportantNode#tr(75d9f1c324b4579d).("Important articles")); |
| 16 | setDescriptioncxx . . $ RootItem#setDescription(3520e46b33348bf6).(trcxx . . $ ImportantNode#tr(75d9f1c324b4579d).("You can find all important articles here.")); |
| 17 | } |
| 18 | |
| 19 | QListcxx . . $ QList#<Messagecxx . . $ Message#> ImportantNodecxx . . $ ImportantNode#::undeletedMessagescxx . . $ ImportantNode#undeletedMessages(96785ab56182243a).() const { |
| 20 | QSqlDatabasecxx . . $ QSqlDatabase# database = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->databasecxx . . $ Application#database(4a253a6ca99872d8).()->drivercxx . . $ DatabaseFactory#driver(5299be7c9afd522d).()->connectioncxx . . $ DatabaseDriver#connection(32d6d64cc6e35a97).(metaObjectcxx . . $ QString#QString(85c52e162fed56f9).()->classNamecxx . . $ QMetaObject#className(a9f41ea0e82d88cf).()); |
| 21 | |
| 22 | return DatabaseQueriescxx . . $ DatabaseQueries#::getUndeletedImportantMessagescxx . . $ DatabaseQueries#getUndeletedImportantMessages(4df15bb3942892d6).(database, getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->accountIdcxx . . $ ServiceRoot#accountId(455f465bc33b4cdf).()); |
| 23 | } |
| 24 | |
| 25 | void ImportantNodecxx . . $ ImportantNode#::updateCountscxx . . $ ImportantNode#updateCounts(b45ddcbc8423892c).(bool including_total_count) { |
| 26 | QSqlDatabasecxx . . $ QSqlDatabase# database = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->databasecxx . . $ Application#database(4a253a6ca99872d8).()->drivercxx . . $ DatabaseFactory#driver(5299be7c9afd522d).()->threadSafeConnectioncxx . . $ DatabaseDriver#threadSafeConnection(32d6d64cc6e35a97).(metaObjectcxx . . $ QString#QString(85c52e162fed56f9).()->classNamecxx . . $ QMetaObject#className(a9f41ea0e82d88cf).()); |
| 27 | int account_id = getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->accountIdcxx . . $ ServiceRoot#accountId(455f465bc33b4cdf).(); |
| 28 | auto ac = DatabaseQueriescxx . . $ DatabaseQueries#::getImportantMessageCountscxx . . $ DatabaseQueries#getImportantMessageCounts(133d0ce429650026).(database, account_id); |
| 29 | |
| 30 | if (including_total_count) { |
| 31 | m_totalCountcxx . . $ ImportantNode#m_totalCount. = ac.m_totalcxx . . $ ArticleCounts#m_total.; |
| 32 | } |
| 33 | |
| 34 | m_unreadCountcxx . . $ ImportantNode#m_unreadCount. = ac.m_unreadcxx . . $ ArticleCounts#m_unread.; |
| 35 | } |
| 36 | |
| 37 | bool ImportantNodecxx . . $ ImportantNode#::cleanMessagescxx . . $ ImportantNode#cleanMessages(efaadfb7dc14930a).(bool clean_read_only) { |
| 38 | ServiceRootcxx . . $ ServiceRoot#* service = getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).(); |
| 39 | QSqlDatabasecxx . . $ QSqlDatabase# database = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->databasecxx . . $ Application#database(4a253a6ca99872d8).()->drivercxx . . $ DatabaseFactory#driver(5299be7c9afd522d).()->connectioncxx . . $ DatabaseDriver#connection(32d6d64cc6e35a97).(metaObjectcxx . . $ QString#QString(85c52e162fed56f9).()->classNamecxx . . $ QMetaObject#className(a9f41ea0e82d88cf).()); |
| 40 | |
| 41 | if (DatabaseQueriescxx . . $ DatabaseQueries#::cleanImportantMessagescxx . . $ DatabaseQueries#cleanImportantMessages(c36b96d9cb3706e6).(database, clean_read_only, service->accountIdcxx . . $ ServiceRoot#accountId(455f465bc33b4cdf).())) { |
| 42 | service->updateCountscxx . . $ ServiceRoot#updateCounts(b45ddcbc8423892c).(true); |
| 43 | service->itemChangedcxx . . $ ServiceRoot#itemChanged(47657a4e8825adca).(service->getSubTreecxx . . $ RootItem#getSubTree(38d8ae5645f2bbf1).<RootItemcxx . . $ RootItem#>()); |
| 44 | service->requestReloadMessageListcxx . . $ ServiceRoot#requestReloadMessageList(b45ddcbc8423892c).(true); |
| 45 | return true; |
| 46 | } |
| 47 | else { |
| 48 | return false; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | bool ImportantNodecxx . . $ ImportantNode#::markAsReadUnreadcxx . . $ ImportantNode#markAsReadUnread(c2f07a1f8834328b).(RootItemcxx . . $ RootItem#::ReadStatuscxx . . $ RootItem#ReadStatus# status) { |
| 53 | ServiceRootcxx . . $ ServiceRoot#* service = getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).(); |
| 54 | auto* cache = dynamic_cast<CacheForServiceRootcxx . . $ CacheForServiceRoot#*>(service); |
| 55 | |
| 56 | if (cache != nullptr) { |
| 57 | cache->addMessageStatesToCachecxx . . $ CacheForServiceRoot#addMessageStatesToCache(c21502b1d481d06b).(service->customIDSOfMessagesForItemcxx . . $ ServiceRoot#customIDSOfMessagesForItem(2acd0df652f9aeb7).(this, status), status); |
| 58 | } |
| 59 | |
| 60 | QSqlDatabasecxx . . $ QSqlDatabase# database = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->databasecxx . . $ Application#database(4a253a6ca99872d8).()->drivercxx . . $ DatabaseFactory#driver(5299be7c9afd522d).()->connectioncxx . . $ DatabaseDriver#connection(32d6d64cc6e35a97).(metaObjectcxx . . $ QString#QString(85c52e162fed56f9).()->classNamecxx . . $ QMetaObject#className(a9f41ea0e82d88cf).()); |
| 61 | |
| 62 | if (DatabaseQueriescxx . . $ DatabaseQueries#::markImportantMessagesReadUnreadcxx . . $ DatabaseQueries#markImportantMessagesReadUnread(a6849f7a0a1d92ee).(database, service->accountIdcxx . . $ ServiceRoot#accountId(455f465bc33b4cdf).(), status)) { |
| 63 | service->updateCountscxx . . $ ServiceRoot#updateCounts(b45ddcbc8423892c).(false); |
| 64 | service->itemChangedcxx . . $ ServiceRoot#itemChanged(47657a4e8825adca).(service->getSubTreecxx . . $ RootItem#getSubTree(38d8ae5645f2bbf1).<RootItemcxx . . $ RootItem#>()); |
| 65 | service->requestReloadMessageListcxx . . $ ServiceRoot#requestReloadMessageList(b45ddcbc8423892c).(status == RootItemcxx . . $ RootItem#::ReadStatuscxx . . $ RootItem#ReadStatus#::Readcxx . . $ RootItem#ReadStatus#Read.); |
| 66 | return true; |
| 67 | } |
| 68 | else { |
| 69 | return false; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | int ImportantNodecxx . . $ ImportantNode#::countOfUnreadMessagescxx . . $ ImportantNode#countOfUnreadMessages(455f465bc33b4cdf).() const { |
| 74 | return m_unreadCountcxx . . $ ImportantNode#m_unreadCount.; |
| 75 | } |
| 76 | |
| 77 | int ImportantNodecxx . . $ ImportantNode#::countOfAllMessagescxx . . $ ImportantNode#countOfAllMessages(455f465bc33b4cdf).() const { |
| 78 | return m_totalCountcxx . . $ ImportantNode#m_totalCount.; |
| 79 | } |