Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
a8e61e0f
Commit
a8e61e0f
authored
May 21, 2021
by
Volker Krause
Browse files
Factor out gadget match implementation for use by other sub-classes
parent
efd0220d
Changes
3
Show whitespace changes
Inline
Side-by-side
src/lib/engine/extractordocumentprocessor.cpp
View file @
a8e61e0f
...
...
@@ -62,6 +62,11 @@ bool ExtractorDocumentProcessor::matches(const ExtractorFilter &filter, const Ex
// Q_GADGET content
const
auto
mo
=
QMetaType
(
node
.
content
().
userType
()).
metaObject
();
return
matchesGadget
(
filter
,
mo
,
node
.
content
().
constData
());
}
bool
ExtractorDocumentProcessor
::
matchesGadget
(
const
ExtractorFilter
&
filter
,
const
QMetaObject
*
mo
,
const
void
*
obj
)
{
if
(
!
mo
)
{
return
false
;
}
...
...
@@ -70,7 +75,7 @@ bool ExtractorDocumentProcessor::matches(const ExtractorFilter &filter, const Ex
return
false
;
}
const
auto
prop
=
mo
->
property
(
propIdx
);
const
auto
value
=
prop
.
readOnGadget
(
node
.
content
().
constData
()
);
const
auto
value
=
prop
.
readOnGadget
(
obj
);
return
filter
.
matches
(
value
.
toString
());
}
...
...
src/lib/engine/extractordocumentprocessor.h
View file @
a8e61e0f
...
...
@@ -81,6 +81,13 @@ protected:
{
delete
static_cast
<
T
*>
(
node
.
content
<
Internal
::
OwnedPtr
<
T
>>
());
}
static
bool
matchesGadget
(
const
ExtractorFilter
&
filter
,
const
QMetaObject
*
mo
,
const
void
*
obj
);
template
<
typename
T
>
static
inline
bool
matchesGadget
(
const
ExtractorFilter
&
filter
,
const
T
*
obj
)
{
return
matchesGadget
(
filter
,
&
T
::
staticMetaObject
,
obj
);
}
};
}
...
...
src/lib/processors/icaldocumentprocessor.cpp
View file @
a8e61e0f
...
...
@@ -83,13 +83,7 @@ bool IcalEventProcessor::matches(const ExtractorFilter &filter, const ExtractorD
{
#ifdef HAVE_KCAL
const
auto
event
=
node
.
content
<
KCalCore
::
Event
::
Ptr
>
();
const
auto
propIdx
=
KCalendarCore
::
Event
::
staticMetaObject
.
indexOfProperty
(
filter
.
fieldName
().
toUtf8
().
constData
());
if
(
propIdx
<
0
)
{
return
false
;
}
const
auto
prop
=
KCalendarCore
::
Event
::
staticMetaObject
.
property
(
propIdx
);
const
auto
value
=
prop
.
readOnGadget
(
event
.
data
());
return
filter
.
matches
(
value
.
toString
());
return
matchesGadget
(
filter
,
event
.
data
());
#else
return
false
;
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment