1431 Commits

Author SHA1 Message Date
Lukas Fleischer
203ac0aa61 Highlight days with non-recurrent items
Use a different color for days with non-recurrent items in the calendar
panel. This makes it possible to easily spot days that actually contain
appointments.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-06-27 08:57:42 +02:00
Lukas Fleischer
1531425005 Support relative dates when adding recurrences
In commit f5d8b5e (Support durations in recurrence ending dates,
2016-02-25), we added support for the `+xxwxxd` syntax when specifying
recurrence end dates. However, this only worked when *editing* the
recurrence, not when converting a regular item to a recurrent one. Fix
this and support the new syntax in both cases.

Also, mention the new syntax in the prompt.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-04-01 08:51:26 +02:00
Lukas Fleischer
4633846550 Fix apoint_inday() with long appointments
Fixes a regression introduced in 9e160fa (Do not assume that days always
have 86400 seconds, 2016-03-27).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-03-28 08:45:49 +02:00
Lukas Fleischer
9e160fac16 Do not assume that days always have 86400 seconds
Make that date membership is computed correctly, even if a day has less
than 86400 seconds (e.g. after changing clocks).

Reported-by: Hakan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-03-27 13:06:18 +02:00
Lukas Fleischer
e1b6d22669 Add proper UTF-8 support to the notification area
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-26 21:52:14 +01:00
Lukas Fleischer
f5d8b5e021 Support durations in recurrence ending dates
When spending the end date of recurring items, allow date duration
specifiers such as "+5d" or "+3w2d".

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-26 09:14:40 +01:00
Lukas Fleischer
c34f9aba29 Refactor UTF-8 chopping
Add a function that makes sure a string does not exceed a given display
size. If the string is too long, dots ("...") are appended.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-26 09:14:40 +01:00
Lukas Fleischer
8c32812fe1 ui-day.c: Simplify code using ui_day_selitem()
Use the new ui_day_selitem() utility function to retrieve the currently
selected item.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-16 07:55:19 +01:00
Lukas Fleischer
65b699f770 Make automatic selection of appointments/events smarter
Keep item selection when an item is moved (e.g. by changing the start
time or description).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-16 07:53:12 +01:00
Lukas Fleischer
feb059e8cf Fix segmentation fault on reload with pre-load hook
We need to manually force a reinitialization of the todo item list box
before reloading the items. Otherwise, the list box contains dangling
references to the linked list of todo items which has already been
cleared at this point. After the pre-load hook is called, the windows
are redrawn by wins_unprepare_external() and these invalid references
are accessed, leading to a segmentation fault.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-15 19:03:26 +01:00
Lukas Fleischer
eaf8f96e06 Improve ordering of appointments/events
* Order by start time first.
* Order items with the same start time by priority.
* Order items with the same start and priority by description.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-15 18:25:55 +01:00
Lukas Fleischer
07954626c6 Support format strings when dumping imported items
In commit 3eae7ce (Add --list-imported command line option, 2016-01-12),
we added an option to print the hashes of imported items to stdout.
Extend this command line option such that it dumps the items using the
specified formatting strings. With the new behavior it is, for example,
easier to check items for import errors.

Also, rename the option from --list-imported to --dump-imported (it is
not part of any official release yet so we do not need to care about
backwards compatibility).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-11 18:33:57 +01:00
Lukas Fleischer
fe0621bafd Allow decimals in durations
Parse durations containing decimal numbers (such as "1.5h") gracefully.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-10 08:24:01 +01:00
Lukas Fleischer
616c3759a5 Fix highlighting of busy days on initialization
Make sure that the monthly view cache is invalidated after the data
files are loaded.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-07 14:06:21 +01:00
Lukas Fleischer
537b2859f2 hooks.c: Fix window preparation in interactive mode
In commit 2857bac (Fix segfault when running hooks in non-interactive
mode, 2016-01-16), we added checks to fix a segmentation fault in
non-interactive mode. However, at the same time, that commit broke
window preparation in interactive mode.

When wins_prepare_external() is called, the UI mode is changed to
command line, such that we cannot determine whether we need to call
wins_unprepare_external() when returning from the hook. As a workaround,
we now store the mode in a temporary variable.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-07 13:51:35 +01:00
Lukas Fleischer
4ada3deda2 Fix %(hash) formatting of events
Actually print the hash instead of raw object data.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-05 19:11:43 +01:00
Lukas Fleischer
62f04c3f9a Support format specifiers in grep mode
Honor --format-* parameters when using the -G operation. In the case of
recurring items, the first occurrence is used.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-05 19:09:36 +01:00
Lukas Fleischer
e9c8197e4e Refactor grep mode
Split io_save_{apts,todo}() into functions that write raw data to a file
and functions that write formatted items to stdout such that one can
easily extend the grep mode for format string support in a follow-up
commit.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-05 19:06:54 +01:00
Lukas Fleischer
978d24a9d2 Update copyright ranges
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-30 11:21:53 +01:00
Lukas Fleischer
03c4465baf Fix behavior of --todo with an optional argument
The previous behavior of --todo was to always only list uncompleted
items, unless zero was specified as additional argument. Restore and
document this behavior.

Also, fix two tests that failed because the --todo output is now sorted.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 18:37:31 +01:00
Lukas Fleischer
41389abd55 args.c: Revise help/usage/version output
Remove obsolete options from the help text, add new options, clean
everything up, cut translatable strings into atomic chunks.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 08:55:54 +01:00
Lukas Fleischer
6061fec01d Add a --daemon command-line parameter
When specifying --daemon, calcurse immediately forks and runs the
notification daemon in the background.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 00:04:00 +01:00
Lukas Fleischer
d127ce9447 Display priority todo items above regular items
We now support todo items with undefined priority and currently display
them above todo items with a strictly positive priority. Change this and
always list items with a priority greater than zero first.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-27 23:56:39 +01:00
Lukas Fleischer
ebe483c058 Support sending notifications for all appointments
In 45417bc (Add configuration option to notify all appointments,
2011-07-31), we added an option that allows for choosing whether the
user receives notifications only for flagged or only for unflagged
appointments. Convert this setting into a three-state option and allow
the user to additionally enable notifications for *all* appointments.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-27 08:29:33 +01:00
Lukas Fleischer
e1bffdb52d sigs.c: Suppress compiler warning
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-26 22:10:07 +01:00
Lukas Fleischer
f0ec3247bc Support SIGUSR1 in daemon mode
In commit 7f62fb1 (Let SIGUSR1 trigger a reload, 2014-10-10), we added
support for reloading the data files by sending SIGUSR1 to an
interactive calcurse process. Add the same functionality to the daemon
mode.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-26 19:14:08 +01:00
Lukas Fleischer
df1bc59812 Make automatic selection of todo items smarter
* Automatically focus new todo items after adding them to the list.
* Keep selection when an item is moved (e.g. by changing its priority).
* Focus the next item in the list when an item is removed.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 19:19:18 +01:00
Lukas Fleischer
25a049951c Improve ordering of todo items
* Show uncompleted items first.
* Order uncompleted and completed items by priority.
* Order items with the same priority alphabetically.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:52:24 +01:00
Lukas Fleischer
4bd8717d80 Hide "0." prefix of todo items with undefined priority
In the todo panel, all uncompleted items are currently prefixed with
their priorities. Drop this prefix from items with priority 0, i.e.
undefined priority.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:09:32 +01:00
Lukas Fleischer
1b75acf01b Save active view on the todo panel
Add a configuration option appearance.todoview and use it to
automatically save the currently active todo panel view and restore it
when restarting calcurse.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:09:23 +01:00
Lukas Fleischer
e3ac5542aa Support todo items with an undefined priority
In addition to priorities 1-9, support todo items without any specific
priority, internally represented by priority 0.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:08:45 +01:00
Lukas Fleischer
beea88e5fe Use a separate field for the completed status
Add a new field that indicates whether a todo item is completed or not
instead of encoding completed todo items by negative priorities.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:08:34 +01:00
Lukas Fleischer
1a4bf2b0a2 Add a "hide completed" view to the todo panel
Add a second view to the todo panel that hides all completed items.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:04:18 +01:00
Lukas Fleischer
2857bac971 Fix segfault when running hooks in non-interactive mode
Do not run wins_prepare_external() and wins_unprepare_external() before
and after running hooks in non-interactive mode.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-16 14:11:32 +01:00
Lukas Fleischer
c3648f08c7 Run pre-save and post-save hooks on reload
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-15 18:36:41 +01:00
Lukas Fleischer
caee34449c Export item UIDs upon request
Add a new --export-uid command line option that adds each item's hash to
the UID property when exporting.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-15 18:25:05 +01:00
Lukas Fleischer
39a3c04144 Import data from stdin when the import file is "-"
Support "-" as file name to the -i/--import option and read from stdin
when that file is specified.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-15 08:44:57 +01:00
Lukas Fleischer
2994ea7003 ical: Handle items without an end date gracefully
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 18:15:59 +01:00
Lukas Fleischer
2c4a650dbe ical: Refactor item date/time parser
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 18:06:22 +01:00
Lukas Fleischer
56f615ffe2 Reimplement ical_unformat_line() using dynamic strings
Use the new dynamic string utility functions instead of relying on a
fixed-size buffer.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
5f344e177f ical: Export completed todo items properly
Do not skip completed todo items when exporting to an iCal file.
Instead, mark them as "STATUS:COMPLETED".

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
0053dd5cdc ical: Honor completed status of todo items
When importing todo items from an iCal file, mark completed items as
completed.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
576784bca8 Hide import statistics in quiet mode
Do not show the import summary when system dialogs are disabled or when
the --quiet option is specified, even if calcurse is executed in
non-interactive mode.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
3eae7ce828 Add --list-imported command line option
When this option is used together with -i/--import, the object
identifiers of imported objects are printed to stdout.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
c58087d591 Add command line option to suppress dialogs
Implement a -q/--quiet command line option to disable system dialogs
temporarily.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
6d9129764b Implement filter mode
Add a new -F mode that is identical to -G but writes the result back to
the calcurse data files instead of stdout.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
7f8c62bf57 Add an option to filter by object hash
Implement a new --filter-hash option to filter by object identifiers.
Each object having an identifier that has the specified pattern as a
prefix is matched. Patterns starting with an exclamation mark (!) are
interpreted as negative patterns.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
dd85a73746 Add long format specifiers "raw" and "hash"
Add new format specifiers to print the raw item representation or an
object's hash value.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
ae49ef1974 Implement recur_{apoint,event}_tostr()
Add functions to serialize recurrent items without immediately writing
them to stdout.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00
Lukas Fleischer
d118beceee Implement {apoint,event,todo}_tostr()
Add functions to serialize non-recurrent objects without immediately
writing them to stdout.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-13 17:39:44 +01:00