| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/services/abstract/searchsnode.cpp`/ |
| 2 | |
| 3 | #include "services/abstract/searchsnode.h"cxx . . $ `<file>/src/librssguard/services/abstract/searchsnode.h`/ |
| 4 | |
| 5 | #include "3rd-party/boolinq/boolinq.h"cxx . . $ `<file>/src/librssguard/3rd-party/boolinq/boolinq.h`/ |
| 6 | #include "database/databasefactory.h"cxx . . $ `<file>/src/librssguard/database/databasefactory.h`/ |
| 7 | #include "database/databasequeries.h"cxx . . $ `<file>/src/librssguard/database/databasequeries.h`/ |
| 8 | #include "exceptions/applicationexception.h"cxx . . $ `<file>/src/librssguard/exceptions/applicationexception.h`/ |
| 9 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 10 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 11 | #include "services/abstract/gui/formaddeditprobe.h"cxx . . $ `<file>/src/librssguard/services/abstract/gui/formaddeditprobe.h`/ |
| 12 | #include "services/abstract/serviceroot.h"cxx . . $ `<file>/src/librssguard/services/abstract/serviceroot.h`/ |
| 13 | |
| 14 | SearchsNodecxx . . $ SearchsNode#::SearchsNodecxx . . $ SearchsNode#SearchsNode(cb16baca005cfe86).(RootItemcxx . . $ RootItem#* parent_item) : RootItemcxx . . $ RootItem#(parent_item), m_actProbeNewcxx . . $ SearchsNode#m_actProbeNew.(nullptr) { |
| 15 | setKindcxx . . $ RootItem#setKind(77afe77d4ce7bfe8).(RootItemcxx . . $ RootItem#::Kindcxx . . $ RootItem#Kind#::Probescxx . . $ RootItem#Kind#Probes.); |
| 16 | setIdcxx . . $ RootItem#setId(d4f767463ce0a6b3).(ID_PROBEScxx . . $ `src/librssguard/definitions/definitions.h:47:9`!); |
| 17 | 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`!("system-search"))); |
| 18 | setTitlecxx . . $ RootItem#setTitle(3520e46b33348bf6).(trcxx . . $ SearchsNode#tr(75d9f1c324b4579d).("Regex queries")); |
| 19 | setDescriptioncxx . . $ RootItem#setDescription(3520e46b33348bf6).(trcxx . . $ SearchsNode#tr(75d9f1c324b4579d).("You can see all your permanent regex queries here.")); |
| 20 | } |
| 21 | |
| 22 | void SearchsNodecxx . . $ SearchsNode#::loadProbescxx . . $ SearchsNode#loadProbes(18b030a483675ebf).(const QListcxx . . $ QList#<Searchcxx . . $ Search#*>& probes) { |
| 23 | for (auto* prb : probes) { |
| 24 | appendChildcxx . . $ RootItem#appendChild(cb16baca005cfe86).(prb); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | QListcxx . . $ QList#<Messagecxx . . $ Message#> SearchsNodecxx . . $ SearchsNode#::undeletedMessagescxx . . $ SearchsNode#undeletedMessages(96785ab56182243a).() const { |
| 29 | 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).()); |
| 30 | |
| 31 | return {cxx . . $ QList#QList(ced63f7c635d850d).}; |
| 32 | } |
| 33 | |
| 34 | Searchcxx . . $ Search#* SearchsNodecxx . . $ SearchsNode#::probeByIdcxx . . $ SearchsNode#probeById(9bff553486fba3fa).(const QStringcxx . . $ QString#& custom_id) { |
| 35 | auto chi = childItemscxx . . $ RootItem#childItems(f275a58a8bc5f139).(); |
| 36 | |
| 37 | return qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<Searchcxx . . $ Search#*>(boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(1a44d082b2747720).(chi).firstOrDefaultcxx . . $ boolinq/Linq#firstOrDefault(72be2761f3eff290).([cxx . . $ std/function#function(bdc3712e480e4d04).custom_idcxx . . $ QString#QString(132dd6869045752b).](RootItemcxx . . $ RootItem#* it) { |
| 38 | return it->customIdcxx . . $ RootItem#customId(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(5bc2975d2d751687). custom_id; |
| 39 | })); |
| 40 | } |
| 41 | |
| 42 | QListcxx . . $ QList#<Searchcxx . . $ Search#*> SearchsNodecxx . . $ SearchsNode#::probescxx . . $ SearchsNode#probes(ea7ad03514a00eb2).() const { |
| 43 | auto list = boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(1a44d082b2747720).(childItemscxx . . $ RootItem#childItems(8f33d497292471a8).()) |
| 44 | .selectcxx . . $ boolinq/Linq#select(a3f5bd4cd382e0ee).([](RootItemcxx . . $ RootItem#* it) { |
| 45 | return static_cast<Searchcxx . . $ Search#*>(it); |
| 46 | }) |
| 47 | .toStdListcxx . . $ boolinq/Linq#toStdList(2989115be80c3067).(); |
| 48 | |
| 49 | return FROM_STD_LISTcxx . . $ `src/librssguard/definitions/definitions.h:405:9`!(QList<Search*>, list); |
| 50 | } |
| 51 | |
| 52 | QListcxx . . $ QList#<QActioncxx . . $ QAction#*> SearchsNodecxx . . $ SearchsNode#::contextMenuFeedsListcxx . . $ SearchsNode#contextMenuFeedsList(c4b3bc0793dee689).() { |
| 53 | if (m_actProbeNewcxx . . $ SearchsNode#m_actProbeNew. == nullptr) { |
| 54 | m_actProbeNewcxx . . $ SearchsNode#m_actProbeNew. = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("system-search")), trcxx . . $ SearchsNode#tr(75d9f1c324b4579d).("New regex query"), this); |
| 55 | |
| 56 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_actProbeNewcxx . . $ SearchsNode#m_actProbeNew., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &SearchsNodecxx . . $ SearchsNode#::createProbecxx . . $ SearchsNode#createProbe(49f6e7a06ebc5aa8).); |
| 57 | } |
| 58 | |
| 59 | return QListcxx . . $ QList#QList(b6da5b9a9f304025).<QActioncxx . . $ QAction#*>{m_actProbeNewcxx . . $ SearchsNode#m_actProbeNew.}; |
| 60 | } |
| 61 | |
| 62 | int SearchsNodecxx . . $ SearchsNode#::countOfUnreadMessagescxx . . $ SearchsNode#countOfUnreadMessages(455f465bc33b4cdf).() const { |
| 63 | return -1; |
| 64 | } |
| 65 | |
| 66 | int SearchsNodecxx . . $ SearchsNode#::countOfAllMessagescxx . . $ SearchsNode#countOfAllMessages(455f465bc33b4cdf).() const { |
| 67 | return -1; |
| 68 | } |
| 69 | |
| 70 | void SearchsNodecxx . . $ SearchsNode#::createProbecxx . . $ SearchsNode#createProbe(49f6e7a06ebc5aa8).() { |
| 71 | FormAddEditProbecxx . . $ FormAddEditProbe# frmcxx . . $ FormAddEditProbe#FormAddEditProbe(108f35f7aa7f3cf9).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->mainFormWidgetcxx . . $ Application#mainFormWidget(9b769eeb00a33a04).()); |
| 72 | Searchcxx . . $ Search#* new_prb = frm.execForAddcxx . . $ FormAddEditProbe#execForAdd(4c4a5418ea3d70c5).(); |
| 73 | |
| 74 | if (new_prb != nullptr) { |
| 75 | 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).()); |
| 76 | |
| 77 | try { |
| 78 | DatabaseQueriescxx . . $ DatabaseQueries#::createProbecxx . . $ DatabaseQueries#createProbe(d7d88ad6777f6b46).(db, new_prb, getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->accountIdcxx . . $ ServiceRoot#accountId(455f465bc33b4cdf).()); |
| 79 | |
| 80 | getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->requestItemReassignmentcxx . . $ ServiceRoot#requestItemReassignment(a5628b38272995c3).(new_prb, this); |
| 81 | getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->requestItemExpandcxx . . $ ServiceRoot#requestItemExpand(8e785c59da43649).({cxx . . $ QList#QList(b6da5b9a9f304025).this}, true); |
| 82 | |
| 83 | new_prb->updateCountscxx . . $ Search#updateCounts(b45ddcbc8423892c).(true); |
| 84 | } |
| 85 | catch (const ApplicationExceptioncxx . . $ ApplicationException#&) { |
| 86 | new_prb->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 87 | } |
| 88 | } |
| 89 | } |