2040 Commits

Author SHA1 Message Date
Lars Henriksen
06a4449afa Fix initialization of the day_items vector
This patch fixes all failings tests, but one, in PR #193.

Until now the missing initialization of day_items_nb has caused no
problems, because the variable was assigned to (=) before being used. In
the Multiple days implementation it is repeatedly increased (+=) in a
loop without being initialized first. Indeed, this may considered an
easily fixed bug. But the initialization really belongs in
day_init_vector() so that the call day_item_count(0) returns 0 if done
right after the call day_init_vector(). The bug only shows up in command
line mode because day_items_nb is not used in interactive mode.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-22 01:56:59 -04:00
Lars Henriksen
df2cb2a9c0 Refactor listbox code
The changes are related to the selected item and the visible lines in
the scroll window viewport.

In particular, the function listbox_fix_visible_region() has been
eliminated, and functions previously only called by it have been
removed. It performed several tasks that are now elsewhere. One was
removed in an earlier commit (scroll window pad improvement). The task
of making a multi-line item visible has been moved to
listbox_item_in_view(). The task of making a caption line above a text
line visible is listbox specific (for the ap_list) and will be moved to
ui_day_sel_move(), where it is needed.

Boundary checks for the listbox selection have been moved to
listbox_fix_sel().

For future use listbox_sel_move() returns success or failure.

The function wins_scrollwin_ensure_visible() has been renamed
wins_scrollwin_in_view().

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-22 01:56:59 -04:00
Lars Henriksen
576994de00 Improve scroll window pad
A scroll window consists of a pad to write on, and a window through
which to view the pad, the viewport. The pad may change in size when new
contents are loaded into the scroll window. If so, the pad size is set
with wins_scrollwin_set_linecount(). But the offset into the pad (the
top line to be displayed in the viewport) is not adjusted, although it
may not be appropriate for the new pad size. The same is the case when a
scroll window is resized and the viewport changes size. This is probably
the cause of the problem solved by commit 0b46ad4, Avoid blank space
after the last list box item, and the fix has been removed.

The wins_scrollwin_set_linecount() has been renamed
wins_scrollwin_set_pad() and sets size as well as offset. The offset is
only changed if necessary.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-22 01:56:59 -04:00
Lars Henriksen
52d52208c8 Test cases for impossible dates in recurrence rule
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-20 09:37:17 -04:00
Lars Henriksen
2be32c4bda Impossible dates in recurrence rules
According to RFC 5545 dates like 30 February and 31 June must be ignored
when derived from a recurrence rule.

calcurse relies on mktime() "normalization" of dates (e.g. turning 32
December 2019 into 1 January 2020 when moving from 31 December to the
next day).

Normalization may also lead to impossible dates in monthly and yearly
recurrence rules, and this must be avoided.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-20 09:37:11 -04:00
Lars Henriksen
8741334d83 New test cases for next appoinment
The change by commit "Fix display of time left before next appointment"
is not detected by the existing test because the time set has zero
seconds.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-04-13 11:58:16 +02:00
Lars Henriksen
371c7eb00f Fix display of time left before next appointment
In the notify bar, the clock is shown in hours, minutes and seconds,
whereas the time left to the next appointment is shown in hours and
minutes only. When you read the clock in hours and minutes (discarding
the seconds), you are mentally rounding down to the nearest minute. To
agree with that reading, the time left (in seconds) should be
(programmatically) rounded up to the nearest minute for display.

In that way the time left is counted down whenever the minute "hand" of
the clock "ticks", and reaches zero when the clock reaches the time of
the next appointment, not one minute before. Also, the clock (in hours
and minutes) and the time left always add up to the time of the next
appointment.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-04-13 11:58:04 +02:00
Lars Henriksen
c8d5397214 Fix daemon notification for short warning periods
When the warning period for notifications is less than 60 seconds
(DAEMON_SLEEP_TIME), the daemon may be at sleep when the appointment
comes up. If that happens, no notification is launched. In stead, the
daemon should launch the notification early.

Addresses GitHub issue #204, part 2.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-04-13 11:57:59 +02:00
Lars Henriksen
a5d8ca5cbf Fix one-second warning period for notifications
Adresses GitHub issue #204, the interactive part.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-04-13 11:57:58 +02:00
Henrik Grimler
d9aea39713 Use ICALDATETIMEFMT for EXDATE
Some servers (Radicale) cannot handle YYYYMM.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-04-13 11:55:39 +02:00
Lars Henriksen
78a46ac7cb Avoid deadlock in config_save()
Must not exit with nbar.mutex locked.

Addresses GitHub issue #201.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-21 06:41:46 +01:00
vxid
d26164fb72 Add support for vdir synchronization
Add a script to synchronize calcurse with a VDIR collection.

Add a wrapper script around vdirsyncer to automatically synchronize
calcurse data to a vdirsyncer collection.

Add script documentation and Makefile.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-14 21:21:46 +01:00
Brandon Munger
5eff08777b Make AsciiDoc check more stringent
Add an additional check to configure.ac to error out if AsciiDoc is not
found and pre-built documentation also does not exist.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-13 17:02:26 +01:00
Lars Henriksen
90f96059c5 Fix calendar (re)draw
Window erasure is moved to the drawing functions.

Adresses GitHub issue #196.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-13 17:02:26 +01:00
Lars Henriksen
45fd62cab4 Fix vector_remove()
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-13 17:02:26 +01:00
vxid
2c50f0700a Change -C and -D long option names
The config dir long option has been changed from --conf to --confdir.
The data dir long option has been changed from --directory to --datadir.

Both old options are kept for backward compatibility but are removed
from the manual.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-13 17:01:54 +01:00
vxid
ccdd3391f3 calcurse-caldav: add custom data directory support
Added the --datadir flag to calcurse-caldav which enables to specify a
custom calcurse data directory similarly to the -D flag in calcurse.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-12 09:08:22 +01:00
Lars Henriksen
528368932c View or edit exception days of a recurrent item
The exception days are presented for viewing/editing as a string of
space-separated dates (in the user-preferred input format). After
editing the string is checked for valid dates, but there is no check
that a date is meaningful (an occurrence day of the item between start
day and until day). Although possible, it is best to add exception days
in the usual way by deletion of occurrences.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-28 08:03:53 +01:00
Lars Henriksen
a47a562322 Fix empty dynamic string
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-28 08:02:35 +01:00
Lukas Fleischer
90b91d92db Fix note on -P in the 4.4.0 release notes
Reported-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-24 12:50:11 +01:00
Lukas Fleischer
e72d984906 Release 4.4.0
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-21 07:50:08 +01:00
Lukas Fleischer
61ca7cf864 Update po files
This is just automated updates from `make update-po` and does not
include any new translations from Transifex.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-21 07:20:24 +01:00
Lukas Fleischer
6cd67311e3 Check for KEY_ENTER in getstring()
In some cases (e.g., TERM=pccon0) wgetch(3) can return KEY_ENTER instead
of '\n' when the return key is pressed, causing getstring() to fail.

Suggested-by: Mikolaj Kucharski <mikolaj@kucharski.name>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-10 21:40:11 +01:00
Lukas Fleischer
0bbe802002 Use portable default day heading format
The %-d format string is not standards-compliant. Use %e instead.

Reported-by: Mikolaj Kucharski <mikolaj@kucharski.name>
Suggested-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-10 21:36:39 +01:00
Lukas Fleischer
1f74ad3357 calcurse-caldav: fix -x argument
The optional argument to -x must be given as "-xical" (without a space).

Partly addresses GitHub issue #177.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-10 21:33:35 +01:00
crvs
7b81e69a19 Close stream after exporting iCal item
Fixes GitHub issue #178.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-04 21:45:08 +01:00
Lukas Fleischer
5657e19e17 Invalidate calendar cache when adding an exception
Removing an occurrence of a recurrent item can turn a busy day into a
free day.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-02 18:21:08 +01:00
Lars Henriksen
99c7493cd5 Fix deletion of a multi-day recurrent appointment
When the selected day in the calendar is a continuation day (not the first day)
of such an appointment, deleting the occurrence does not work. The reason is
that the selected day, and not the first day of the occurrence, is added as an
exception day.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-02 18:19:22 +01:00
Lukas Fleischer
4eda8f6937 calcurse-caldav: drop misplaced filter argument
We cannot use the filter options when importing events.

This was noticed because the new calcurse argument parser catches
invalid input flag combinations and bails out.

Partly addresses GitHub issue #177.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-02 18:13:49 +01:00
Lukas Fleischer
0169ba0934 doc/flag.txt: fix typo
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-24 08:23:22 +01:00
Lukas Fleischer
b0984e71b0 Refactor keys_format_label()
Simplify the key formatting function and enforce display width properly
using the UTF8 chopping function.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-19 15:07:42 +01:00
Lukas Fleischer
bffa517250 Bind RETURN to view-item by default
Also, use the modern key name instead of the backwards compatibility
name.

Addresses GitHub issue #168.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-19 10:41:05 +01:00
Lars Henriksen
870fa1aa32 Overflow check for 32-bit types only
Included is a check of the 'until' date for pasted recurrent items.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-18 23:38:33 +01:00
Lukas Fleischer
03340db72e Use time_t for system time values
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-14 06:21:34 +01:00
Lukas Fleischer
51f17fb9c6 Update message catalog 2019-01-12 18:09:58 +01:00
Lars Henriksen
4af76af5ae Legalese for queue.c
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-12 01:53:51 +01:00
Lars Henriksen
8cbd456640 Fix next recurring appointment
Recurring appointments do not show up in the notification bar as next
appointment. This was partly corrected by 2084f35 (Fix notification of
recurrent appointments, 2017-02-09) and 5aa7a09 (Fix another error in
the notification code, 2017-02-11).

The search function recur_apoint_starts_before() had a wrong second
argument, but is really of no use: the start time of a recurring
appointment is the start time of the very first occurrence (in the
past). A comparison against the item in the notify_app structure tells
nothing of the start time of the current day; at most it eliminates some
future recurring appointments. The function can be dropped, and the
entire recurring appointment list looked through.

The proper start time is found in the main search loop (and called
real_recur_start_time) and must be compared against the item in the
notify_app structure.

But because recur_apoint_find_occurrence() is limited to a particular
day (second argument), two searches are necessary to cover 24 hours.

Unrelated cleanups: removed function return value; changed long to
time_t.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-11 18:11:52 +01:00
Lars Henriksen
f2ca5980e9 Initialize data paths once only
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-08 01:23:21 +01:00
Lars Henriksen
63b03c6b36 Explicit calendar and todo view configuration
The configuration settings for calendar view (monthly/weekly) and todo
view (hide/show completed) used to be saved automatically on calcurse
exit, with values taken from the current interactive settings. They
could not be set explicitly in the configuration menues. Configuration
settings are no longer saved on program exit, but on exit from the
configuration menu. This means that the saved values are those that were
current when the configuration menu was entered. To change a saved
value, you must set the view as desired and then enter/exit the
configuration menu.

The preferred calendar and todo views are no longer automatically taken
from the interactive settings, but are explicitly set in the general
options menu.  Default values are monthly view and hide completed view.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:58:11 +01:00
Lars Henriksen
b9f23e134a Purge option glorified
The invert filter option is automatically set for -P (and cannot be used
on the command line). The intention is that the grep option (-G) is used
to find the items that should be removed. To remove them, the same
command is run with -P instead of -G.

In general, purge will remove matching items (silently).

Backward compatibility for option -F (no invert filter).

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:58:08 +01:00
Lars Henriksen
42abbf5346 Filter option: invert
New filter option: --filter-invert. When present it inverts (negates)
the other filter options combined. This is mostly useful with the -G
option (with -Q the output is limited by the query range (day range)).

The ouput from "calcurse -G <filter options>" is the (set) complement of
"calcurse -G <filter options> --filter-invert". Here <filter options>
may be any combination of filter options.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:58:06 +01:00
Lars Henriksen
9300e9154c CLI: detect conflicting filter options
Several start/end-time filter options set the same filter criterion.
Only allow one such filter option at a time.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:58:03 +01:00
Lars Henriksen
620c4eeca5 CLI: Revert to and update of parse_datetimearg()
An earlier commit ("CLI: take input date format from configuration file,
do not accept time") replaced parse_datetimearg() with parse_datearg()
and eliminated time-of-day from command line date arguments. This made
the full use of filter options impossible.

That earlier commit is reverted and updated. The parse_datearg()
function is replaced by an updated parse_datetimearg() function that

- takes the date format from the configuration file
- accepts date, date-time or time

The updated parse_datetimearg() function has been extended to report
back the type of the date string received in order to set (filter)
options correctly.  Input dates for query ranges (--from, --to, --days)
are still limited to dates only.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:58:01 +01:00
Lars Henriksen
bcfc71f4fe Safety exit and read-only mode
The key_generic_command() function provides a "safety exit" in case of
online changes that should be dropped at exit when auto_save is on, or
(NEW) should be saved at exit when in read-only mode. A check for
unsaved changes has been added. The command prompt has been extended
with minimal help information.

After commit 05e0fd0 "Quit, autosave and interactive save" you could not
leave calcurse in read-only mode with the quit command because the
key_generic_quit() function interpreted IO_SAVE_CANCEL as a decision (by
the user) to cancel a save-conflict and cancelled the quit as well. Now
the function will quit unconditionally in read-only mode (as stated in
the man page). In normal mode a check for unsaved changes has been added
in case auto-save is off.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:58 +01:00
Lars Henriksen
a5e6608992 CLI: tests aligned
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:57 +01:00
Lars Henriksen
d0602625bc Update man page
Rework man page. Add invert filter and purge option.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:56 +01:00
Lars Henriksen
daa30ef3bb Fix print_date()
In print_date(date, day, ...) it is silently assumed that day is
midnight (beginning) of the day to be printed. Assume only that it
belongs to the day.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:55 +01:00
Lars Henriksen
ad183c61a9 CLI: do not start daemon if calcurse is running
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:53 +01:00
Lars Henriksen
7851f46fbb CLI: filter options have no effect for dates before the epoch
With the exception of filter.type_mask, a filter is only applied if set
explicitly on the command line with a filter option. Whether that is the
case, is determined by comparison with the initialization value. For
date related filters (start_from/to, end_from/to) that is -1, hence the
criterion is != -1, not >= 0.

In generel, a filter initialization value should be invalid (i.e. one
that cannot be set explicitly). As times before the epoch (1 January
1970 00:00:00 UTC) are negative, -1 is a valid Unix time. However, as it
cannot be set from the command line, it is probably no problem?

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:52 +01:00
Lars Henriksen
4ba2cc46d7 CLI: time assignments for filter options
Explanation. There is an important difference between "to <date>" (e.g.
to 15/11/2018)  and "to <date time>" (e.g. to "15/11/2018 13:30"):
<date> is a time span (of 24 hours), while <date time> is a point in
time.

"To <date>" really means "to the end of <date>", while "before <date>"
means "before the beginning of <date>". There are 24 hours between the
two, whereas there is only one second between "before <date time>" and
"to <date time>".  Similar for from/after.

An earlier commit introduced parse_datearg() that only accepts a date
without a time. Hence, a date should be treated as a time span from
midnight to one second before next midnight.

The commit also fixes an error detection bug (filter.start_from/to and
filter.end_from/to were updated too early).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:51 +01:00