4#include "searchrequest.h"
5#include "searchrequest_p.h"
9using namespace KNSCore;
11SearchRequest::SearchRequest(SortMode sortMode_,
Filter filter_,
const QString &searchTerm_,
const QStringList &categories_,
int page_,
int pageSize_)
12 : d(new SearchRequestPrivate{.sortMode = sortMode_,
14 .searchTerm = searchTerm_,
15 .categories = categories_,
18 .id = SearchRequestPrivate::searchRequestId()})
22SortMode SearchRequest::sortMode()
const
27Filter SearchRequest::filter()
const
32QString SearchRequest::searchTerm()
const
37QStringList SearchRequest::categories()
const
42int SearchRequest::page()
const
47int SearchRequest::pageSize()
const
54 return {sortMode(), filter(), searchTerm(), categories(), page() + 1, pageSize()};
57KNEWSTUFFCORE_EXPORT QDebug KNSCore::operator<<(QDebug dbg,
const SearchRequest &search)
59 QDebugStateSaver saver(dbg);
61 dbg <<
"SearchRequest(";
62 dbg <<
"id: " << search.d->id <<
',';
63 dbg <<
"searchTerm: " << search.d->searchTerm <<
',';
64 dbg <<
"categories: " << search.d->categories <<
',';
65 dbg <<
"filter: " << search.d->filter <<
',';
66 dbg <<
"page: " << search.d->page <<
',';
67 dbg <<
"pageSize: " << search.d->pageSize;
72KNSCore::SearchRequest KNSCore::searchRequestFromLegacy(
const KNSCore::Provider::SearchRequest &request)
75 switch (request.sortMode) {
76 case Provider::SortMode::Alphabetical:
77 return SortMode::Alphabetical;
78 case Provider::SortMode::Downloads:
79 return SortMode::Downloads;
80 case Provider::SortMode::Newest:
81 return SortMode::Newest;
82 case Provider::SortMode::Rating:
83 return SortMode::Rating;
86 return SortMode::Rating;
89 switch (request.filter) {
90 case Provider::Filter::None:
92 case Provider::Filter::Installed:
93 return Filter::Installed;
94 case Provider::Filter::Updates:
95 return Filter::Updates;
96 case Provider::Filter::ExactEntryId:
97 return Filter::ExactEntryId;
KREPORT_EXPORT QPageSize::PageSizeId pageSize(const QString &key)
QFuture< void > filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)