| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/services/abstract/search.cpp`/ |
| 2 | |
| 3 | #include "services/abstract/search.h"cxx . . $ `<file>/src/librssguard/services/abstract/search.h`/ |
| 4 | |
| 5 | #include "database/databasefactory.h"cxx . . $ `<file>/src/librssguard/database/databasefactory.h`/ |
| 6 | #include "database/databasequeries.h"cxx . . $ `<file>/src/librssguard/database/databasequeries.h`/ |
| 7 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 8 | #include "services/abstract/cacheforserviceroot.h"cxx . . $ `<file>/src/librssguard/services/abstract/cacheforserviceroot.h`/ |
| 9 | #include "services/abstract/gui/formaddeditprobe.h"cxx . . $ `<file>/src/librssguard/services/abstract/gui/formaddeditprobe.h`/ |
| 10 | #include "services/abstract/serviceroot.h"cxx . . $ `<file>/src/librssguard/services/abstract/serviceroot.h`/ |
| 11 | |
| 12 | #include <QPainter> |
| 13 | #include <QPainterPath> |
| 14 | |
| 15 | Searchcxx . . $ Search#::Searchcxx . . $ Search#Search(f041c5f58b9268d).(const QStringcxx . . $ QString#& name, const QStringcxx . . $ QString#& filter, const QColorcxx . . $ QColor#& color, RootItemcxx . . $ RootItem#* parent_item) |
| 16 | : Searchcxx . . $ Search#Search(cb16baca005cfe86).(parent_item) { |
| 17 | setColorcxx . . $ Search#setColor(129a55e114526ad3).(color); |
| 18 | setTitlecxx . . $ RootItem#setTitle(3520e46b33348bf6).(name); |
| 19 | setFiltercxx . . $ Search#setFilter(3520e46b33348bf6).(filter); |
| 20 | } |
| 21 | |
| 22 | Searchcxx . . $ Search#::Searchcxx . . $ Search#Search(cb16baca005cfe86).(RootItemcxx . . $ RootItem#* parent_item) : RootItemcxx . . $ RootItem#(parent_item), m_totalCountcxx . . $ Search#m_totalCount.(-1), m_unreadCountcxx . . $ Search#m_unreadCount.(-1) { |
| 23 | setKindcxx . . $ RootItem#setKind(77afe77d4ce7bfe8).(RootItemcxx . . $ RootItem#::Kindcxx . . $ RootItem#Kind#::Probecxx . . $ RootItem#Kind#Probe.); |
| 24 | } |
| 25 | |
| 26 | QColorcxx . . $ QColor# Searchcxx . . $ Search#::colorcxx . . $ Search#color(6d62b116d5d1b12f).() const { |
| 27 | return m_colorcxx . . $ Search#m_color.; |
| 28 | } |
| 29 | |
| 30 | void Searchcxx . . $ Search#::setColorcxx . . $ Search#setColor(129a55e114526ad3).(const QColorcxx . . $ QColor#& color) { |
| 31 | setIconcxx . . $ RootItem#setIcon(71dcdac178620ed6).(IconFactorycxx . . $ IconFactory#::generateIconcxx . . $ IconFactory#generateIcon(e60330f79968ef46).(color)); |
| 32 | m_colorcxx . . $ Search#m_color. =cxx . . $ QColor#`operator=`(a3db1be773b26671). color; |
| 33 | } |
| 34 | |
| 35 | int Searchcxx . . $ Search#::countOfUnreadMessagescxx . . $ Search#countOfUnreadMessages(455f465bc33b4cdf).() const { |
| 36 | return m_unreadCountcxx . . $ Search#m_unreadCount.; |
| 37 | } |
| 38 | |
| 39 | int Searchcxx . . $ Search#::countOfAllMessagescxx . . $ Search#countOfAllMessages(455f465bc33b4cdf).() const { |
| 40 | return m_totalCountcxx . . $ Search#m_totalCount.; |
| 41 | } |
| 42 | |
| 43 | bool Searchcxx . . $ Search#::canBeEditedcxx . . $ Search#canBeEdited(50ce9a9e25b4a850).() const { |
| 44 | return true; |
| 45 | } |
| 46 | |
| 47 | bool Searchcxx . . $ Search#::canBeDeletedcxx . . $ Search#canBeDeleted(50ce9a9e25b4a850).() const { |
| 48 | return true; |
| 49 | } |
| 50 | |
| 51 | bool Searchcxx . . $ Search#::deleteItemcxx . . $ Search#deleteItem(c9857a73d68e59ba).() { |
| 52 | try { |
| 53 | QSqlDatabasecxx . . $ QSqlDatabase# db = 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).()); |
| 54 | DatabaseQueriescxx . . $ DatabaseQueries#::deleteProbecxx . . $ DatabaseQueries#deleteProbe(fa2550e03bfb9411).(db, this); |
| 55 | getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->requestItemRemovalcxx . . $ ServiceRoot#requestItemRemoval(cb16baca005cfe86).(this); |
| 56 | return true; |
| 57 | } |
| 58 | catch (const ApplicationExceptioncxx . . $ ApplicationException#& ex) { |
| 59 | qCriticalNNcxx . . $ `src/librssguard/definitions/definitions.h:421:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_COREcxx . . $ `src/librssguard/definitions/definitions.h:178:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Failed to remove probe:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(ex.message()); |
| 60 | return false; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void Searchcxx . . $ Search#::updateCountscxx . . $ Search#updateCounts(b45ddcbc8423892c).(bool including_total_count) { |
| 65 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(including_total_count) |
| 66 | |
| 67 | setCountOfAllMessagescxx . . $ Search#setCountOfAllMessages(d4f767463ce0a6b3).(-1); |
| 68 | setCountOfUnreadMessagescxx . . $ Search#setCountOfUnreadMessages(d4f767463ce0a6b3).(-1); |
| 69 | } |
| 70 | |
| 71 | QListcxx . . $ QList#<Messagecxx . . $ Message#> Searchcxx . . $ Search#::undeletedMessagescxx . . $ Search#undeletedMessages(96785ab56182243a).() const { |
| 72 | 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).()); |
| 73 | |
| 74 | return DatabaseQueriescxx . . $ DatabaseQueries#::getUndeletedMessagesForProbecxx . . $ DatabaseQueries#getUndeletedMessagesForProbe(7b8a7475cb73a7c7).(database, this); |
| 75 | } |
| 76 | |
| 77 | QStringcxx . . $ QString# Searchcxx . . $ Search#::filtercxx . . $ Search#filter(6ef7b6c27b00b43d).() const { |
| 78 | return m_filtercxx . . $ QString#QString(132dd6869045752b).; |
| 79 | } |
| 80 | |
| 81 | void Searchcxx . . $ Search#::setFiltercxx . . $ Search#setFilter(3520e46b33348bf6).(const QStringcxx . . $ QString#& new_filter) { |
| 82 | m_filtercxx . . $ Search#m_filter. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). new_filter; |
| 83 | } |
| 84 | |
| 85 | void Searchcxx . . $ Search#::setCountOfAllMessagescxx . . $ Search#setCountOfAllMessages(d4f767463ce0a6b3).(int totalCount) { |
| 86 | m_totalCountcxx . . $ Search#m_totalCount. = totalCount; |
| 87 | } |
| 88 | |
| 89 | void Searchcxx . . $ Search#::setCountOfUnreadMessagescxx . . $ Search#setCountOfUnreadMessages(d4f767463ce0a6b3).(int unreadCount) { |
| 90 | m_unreadCountcxx . . $ Search#m_unreadCount. = unreadCount; |
| 91 | } |
| 92 | |
| 93 | bool Searchcxx . . $ Search#::cleanMessagescxx . . $ Search#cleanMessages(efaadfb7dc14930a).(bool clear_only_read) { |
| 94 | ServiceRootcxx . . $ ServiceRoot#* service = getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).(); |
| 95 | 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).()); |
| 96 | |
| 97 | try { |
| 98 | DatabaseQueriescxx . . $ DatabaseQueries#::cleanProbedMessagescxx . . $ DatabaseQueries#cleanProbedMessages(c95b318ca26899a0).(database, clear_only_read, this); |
| 99 | service->updateCountscxx . . $ ServiceRoot#updateCounts(b45ddcbc8423892c).(true); |
| 100 | service->itemChangedcxx . . $ ServiceRoot#itemChanged(47657a4e8825adca).(service->getSubTreecxx . . $ RootItem#getSubTree(38d8ae5645f2bbf1).<RootItemcxx . . $ RootItem#>()); |
| 101 | service->requestReloadMessageListcxx . . $ ServiceRoot#requestReloadMessageList(b45ddcbc8423892c).(true); |
| 102 | return true; |
| 103 | } |
| 104 | catch (const ApplicationExceptioncxx . . $ ApplicationException#& ex) { |
| 105 | qCriticalNNcxx . . $ `src/librssguard/definitions/definitions.h:421:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_COREcxx . . $ `src/librssguard/definitions/definitions.h:178:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Failed to clean messages of probe:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(ex.message()); |
| 106 | return false; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | QStringcxx . . $ QString# Searchcxx . . $ Search#::additionalTooltipcxx . . $ Search#additionalTooltip(6ef7b6c27b00b43d).() const { |
| 111 | return trcxx . . $ Search#tr(75d9f1c324b4579d).("Regular expression: %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<code>%1</code>").argcxx . . $ QString#arg(ad0bca07273edcc2).(filtercxx . . $ Search#filter(6ef7b6c27b00b43d).())); |
| 112 | } |
| 113 | |
| 114 | bool Searchcxx . . $ Search#::markAsReadUnreadcxx . . $ Search#markAsReadUnread(c2f07a1f8834328b).(RootItemcxx . . $ RootItem#::ReadStatuscxx . . $ RootItem#ReadStatus# status) { |
| 115 | ServiceRootcxx . . $ ServiceRoot#* service = getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).(); |
| 116 | auto* cache = dynamic_cast<CacheForServiceRootcxx . . $ CacheForServiceRoot#*>(service); |
| 117 | |
| 118 | if (cache != nullptr) { |
| 119 | try { |
| 120 | cache->addMessageStatesToCachecxx . . $ CacheForServiceRoot#addMessageStatesToCache(c21502b1d481d06b).(service->customIDSOfMessagesForItemcxx . . $ ServiceRoot#customIDSOfMessagesForItem(2acd0df652f9aeb7).(this, status), status); |
| 121 | } |
| 122 | catch (const ApplicationExceptioncxx . . $ ApplicationException#& ex) { |
| 123 | qCriticalNNcxx . . $ `src/librssguard/definitions/definitions.h:421:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_DBcxx . . $ `src/librssguard/definitions/definitions.h:180:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Cannot add some IDs to state cache:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(ex.message()); |
| 124 | return false; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | 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).()); |
| 129 | |
| 130 | try { |
| 131 | DatabaseQueriescxx . . $ DatabaseQueries#::markProbeReadUnreadcxx . . $ DatabaseQueries#markProbeReadUnread(992e896b25c4f4e).(database, this, status); |
| 132 | service->updateCountscxx . . $ ServiceRoot#updateCounts(b45ddcbc8423892c).(false); |
| 133 | service->itemChangedcxx . . $ ServiceRoot#itemChanged(47657a4e8825adca).(service->getSubTreecxx . . $ RootItem#getSubTree(38d8ae5645f2bbf1).<RootItemcxx . . $ RootItem#>()); |
| 134 | service->requestReloadMessageListcxx . . $ ServiceRoot#requestReloadMessageList(b45ddcbc8423892c).(status == RootItemcxx . . $ RootItem#::ReadStatuscxx . . $ RootItem#ReadStatus#::Readcxx . . $ RootItem#ReadStatus#Read.); |
| 135 | return true; |
| 136 | } |
| 137 | catch (const ApplicationExceptioncxx . . $ ApplicationException#& ex) { |
| 138 | qCriticalNNcxx . . $ `src/librssguard/definitions/definitions.h:421:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_DBcxx . . $ `src/librssguard/definitions/definitions.h:180:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Cannot mark probe as read/unread:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(ex.message()); |
| 139 | return false; |
| 140 | } |
| 141 | } |