Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nemo-qml-plugin-calendar] Add a search model. #45

Merged
merged 3 commits into from Mar 31, 2023

Conversation

dcaliste
Copy link
Contributor

Add a search function to CalendarManager. It is based on ExtendedStorage::search() method. The worker is loading all matching incidences and retrieving the corresponding instance identifiers. The later are
passed back to the manager via a new searchResults signal. While the former are sent back viw the
existing dataLoaded signal.

Also add a model listing occurrence of a search
query. This model is based on a EventListModel
where the identifiers are given as the result of
a search call.

@pvuorela, this is based on sailfishos/mkcal#49 and aims at providing a list model for search results. It is conveniently based on evntlistmodel, since such model already provide event listing from instance identifiers. I still keep this as WIP since I would like to add a loading property to the eventlistmodel. But having it public already should help to see how the mkcal PR is working in reality.

@dcaliste
Copy link
Contributor Author

I've added a filter on calendar visibility in the worker thread to send to the manager only visible events.

@dcaliste
Copy link
Contributor Author

I've also added a loading attribute to the EventListModel, so one can display a busy indicator while the model is searching.

@dcaliste
Copy link
Contributor Author

dcaliste commented Mar 3, 2023

I've added a commit adding a limit property to the search model. It has no sense in my opinion to put it in the EventListModel since the later is not sorted while the former is.

@dcaliste
Copy link
Contributor Author

Rebased on latest master changes.

@@ -752,6 +752,39 @@ CalendarData::Event CalendarWorker::createEventStruct(const KCalendarCore::Event
return event;
}

void CalendarWorker::search(const QString &pattern, int limit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word pattern repeating on the API gives me a bit of association with regexps and other systems with wildcards and such, while here it's just a plain search string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I rename the property to searchString and change it everywhere accordingly.

@dcaliste dcaliste changed the title WIP: [nemo-qml-plugin-calendar] Add a search model. [nemo-qml-plugin-calendar] Add a search model. Mar 21, 2023
@dcaliste
Copy link
Contributor Author

I've removed the WIP notice.

There may be some modification still to properly handle next occurrence of recurring events, but it can be done in a later PR.

Add a search function to CalendarManager. It is based
on ExtendedStorage::search() method. The worker is
loading all matching incidences and retrieving the
corresponding instance identifiers. The later are
passed back to the manager via a new searchResults
signal. While the former are sent back viw the
existing dataLoaded signal.

Also add a model listing occurrence of a search
query. This model is based on a EventListModel
where the identifiers are given as the result of
a search call.
@pvuorela pvuorela merged commit b06e41b into sailfishos:master Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants