Refactor FileSearchQuery and create base class SearchQuery
ClosedPublic

Authored by barchiesi on Mar 3 2019, 11:17 AM.

Details

Summary

As discussed in T10521, it is useful to refactor out the generic query building logic in FileSearchQuery and create the base class SearchQuery. This would allow us to create other domain specific queries without having to reimplement all the building logic, as will be the case with TeamdriveSearchQuery.

Test Plan

All tests defined in FileSearchQueryTest should remain valid and, as of this patch, passing.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
barchiesi created this revision.Mar 3 2019, 11:17 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptMar 3 2019, 11:17 AM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
barchiesi edited the test plan for this revision. (Show Details)Mar 3 2019, 11:41 AM
dvratil requested changes to this revision.Mar 3 2019, 3:21 PM

Again, C++11 allows us to force the compiler to generate code for us, so let's make use of that.

src/drive/filesearchquery.cpp
121

If you just chain up to the parent implementation here, there's no need to have FileSearchQuery::addQuery() at all.

src/drive/searchquery.cpp
34

= default

35

= default

36

= default

114

= default

119

= default

123

= default

This revision now requires changes to proceed.Mar 3 2019, 3:21 PM
barchiesi updated this revision to Diff 53133.Mar 4 2019, 3:59 PM

Use C++11 default constructors and QScopedPointer. I should have fixed all the points, let me know if I missed something.

dvratil accepted this revision.Mar 4 2019, 5:27 PM

Thanks for the fixes, I'll land this on master.

This revision is now accepted and ready to land.Mar 4 2019, 5:27 PM
This revision was automatically updated to reflect the committed changes.