Add item filters

This adds the following filter options that allow for restricting the
set of items that are read from the appointments file:

* --filter-type
* --filter-start-from
* --filter-start-to
* --filter-start-after
* --filter-start-before
* --filter-end-from
* --filter-end-to
* --filter-end-after
* --filter-end-before

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2014-08-06 08:53:51 +02:00
parent 4ec7fe1239
commit bfe73d0e5d
8 changed files with 207 additions and 24 deletions

View File

@@ -464,7 +464,7 @@ static void io_load_error(const char *filename, unsigned line,
* and then load either: a new appointment, a new event, or a new
* recursive item (which can also be either an event or an appointment).
*/
void io_load_app(void)
void io_load_app(struct item_filter *filter)
{
FILE *data_file;
int c, is_appointment, is_event, is_recursive;
@@ -620,18 +620,19 @@ void io_load_app(void)
if (is_recursive) {
recur_apoint_scan(data_file, start, end,
type, freq, until, notep,
&exc, state);
&exc, state, filter);
} else {
apoint_scan(data_file, start, end, state,
notep);
notep, filter);
}
} else if (is_event) {
if (is_recursive) {
recur_event_scan(data_file, start, id,
type, freq, until, notep,
&exc);
&exc, filter);
} else {
event_scan(data_file, start, id, notep);
event_scan(data_file, start, id, notep,
filter);
}
} else {
io_load_error(path_apts, line,