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
KOrganizer
Commits
cf75cf12
Commit
cf75cf12
authored
Oct 10, 2022
by
Laurent Montel
Browse files
Port to qregularexpression
parent
3694c064
Pipeline
#245282
passed with stage
in 12 minutes and 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/dialog/searchdialog.cpp
View file @
cf75cf12
...
...
@@ -107,9 +107,8 @@ void SearchDialog::searchPatternChanged(const QString &pattern)
void
SearchDialog
::
doSearch
()
{
QRegExp
re
;
re
.
setPatternSyntax
(
QRegExp
::
Wildcard
);
// most people understand these better.
re
.
setCaseSensitivity
(
Qt
::
CaseInsensitive
);
QRegularExpression
re
;
re
.
setPatternOptions
(
QRegularExpression
::
CaseInsensitiveOption
);
re
.
setPattern
(
m_ui
->
searchEdit
->
text
());
if
(
!
re
.
isValid
())
{
KMessageBox
::
error
(
this
,
...
...
@@ -148,9 +147,8 @@ void SearchDialog::updateMatchesText()
void
SearchDialog
::
updateView
()
{
QRegExp
re
;
re
.
setPatternSyntax
(
QRegExp
::
Wildcard
);
// most people understand these better.
re
.
setCaseSensitivity
(
Qt
::
CaseInsensitive
);
QRegularExpression
re
;
re
.
setPatternOptions
(
QRegularExpression
::
CaseInsensitiveOption
);
re
.
setPattern
(
m_ui
->
searchEdit
->
text
());
m_listView
->
clear
();
if
(
re
.
isValid
())
{
...
...
@@ -162,7 +160,7 @@ void SearchDialog::updateView()
updateMatchesText
();
}
void
SearchDialog
::
search
(
const
QReg
Exp
&
re
)
void
SearchDialog
::
search
(
const
QReg
ularExpression
&
regularExpression
)
{
const
QDate
startDt
=
m_ui
->
startDate
->
date
();
const
QDate
endDt
=
m_ui
->
endDate
->
date
();
...
...
@@ -213,25 +211,25 @@ void SearchDialog::search(const QRegExp &re)
Q_ASSERT
(
ev
);
Akonadi
::
Item
item
=
m_calendarview
->
calendar
()
->
item
(
ev
->
uid
());
if
(
m_ui
->
summaryCheck
->
isChecked
())
{
if
(
re
.
indexIn
(
ev
->
summary
())
!=
-
1
)
{
if
(
re
gularExpression
.
match
(
ev
->
summary
())
.
hasMatch
()
)
{
m_matchedEvents
.
append
(
item
);
continue
;
}
}
if
(
m_ui
->
descriptionCheck
->
isChecked
())
{
if
(
re
.
indexIn
(
ev
->
description
())
!=
-
1
)
{
if
(
re
gularExpression
.
match
(
ev
->
description
())
.
hasMatch
()
)
{
m_matchedEvents
.
append
(
item
);
continue
;
}
}
if
(
m_ui
->
categoryCheck
->
isChecked
())
{
if
(
re
.
indexIn
(
ev
->
categoriesStr
())
!=
-
1
)
{
if
(
re
gularExpression
.
match
(
ev
->
categoriesStr
())
.
hasMatch
()
)
{
m_matchedEvents
.
append
(
item
);
continue
;
}
}
if
(
m_ui
->
locationCheck
->
isChecked
())
{
if
(
re
.
indexIn
(
ev
->
location
())
!=
-
1
)
{
if
(
re
gularExpression
.
match
(
ev
->
location
())
.
hasMatch
()
)
{
m_matchedEvents
.
append
(
item
);
continue
;
}
...
...
@@ -239,7 +237,7 @@ void SearchDialog::search(const QRegExp &re)
if
(
m_ui
->
attendeeCheck
->
isChecked
())
{
const
KCalendarCore
::
Attendee
::
List
lstAttendees
=
ev
->
attendees
();
for
(
const
KCalendarCore
::
Attendee
&
attendee
:
lstAttendees
)
{
if
(
re
.
indexIn
(
attendee
.
fullName
())
!=
-
1
)
{
if
(
re
gularExpression
.
match
(
attendee
.
fullName
())
.
hasMatch
()
)
{
m_matchedEvents
.
append
(
item
);
break
;
}
...
...
src/dialog/searchdialog.h
View file @
cf75cf12
...
...
@@ -59,7 +59,7 @@ protected:
private:
void
doSearch
();
void
searchPatternChanged
(
const
QString
&
pattern
);
void
search
(
const
QReg
Exp
&
re
);
void
search
(
const
QReg
ularExpression
&
regularExpression
);
void
readConfig
();
void
writeConfig
();
void
updateMatchesText
();
...
...
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