189 Commits

Author SHA1 Message Date
Lukas Fleischer
794e950942 Make the generic-credits key binding work again
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2015-04-15 06:12:30 +02:00
Lukas Fleischer
dfd008717a Show an error message on missing documentation
Show a warning when the user presses the generic-help binding and the
main help document is not available.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2015-04-15 06:08:32 +02:00
Lukas Fleischer
f91208c2f4 Make "Add Item" work from the calendar panel
Support the "Add item" key binding in the calendar panel and make it add
a new appointment.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2015-02-23 19:59:58 +01:00
Lukas Fleischer
9ef427693b Update copyright ranges
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2015-02-07 11:42:20 +01:00
Tim Hentenaar
7f62fb185c Let SIGUSR1 trigger a reload
In an effort to better integrate the import process with external
applications, it's desirable to have a mechanism by which external
programs can trigger a reload of calcurse's data.

This patch adds that functionality via SIGUSR1. The reload request is
handled in the main loop. When the user is currently entering data, the
request is delayed until the main loop is re-entered.

Signed-off-by: Tim Hentenaar <tim@hentenaar.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-10-10 09:33:57 +02:00
Lukas Fleischer
7f06c25230 Factor out item reload code
Adds a new function io_reload_data() which can be used to reload all
appointments and TODO items.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-10-10 01:47:27 +02:00
Lukas Fleischer
8553a99161 Add io_load_data() wrapper
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-10-10 01:38:25 +02:00
Lukas Fleischer
1878b7c4b0 Allow for filtering TODO items
The item filters now apply to both appointments and TODO items. Also,
add a new type mask "todo" and the following new filter options:

* --filter-priority
* --filter-completed
* --filter-uncompleted

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-06 12:08:14 +02:00
Lukas Fleischer
bfe73d0e5d 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>
2014-08-06 12:08:14 +02:00
Lukas Fleischer
ea900a863a Set default panel before showing system dialogs
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-03 23:51:10 +02:00
Lukas Fleischer
b32adc8b7b Show system dialog after reloading items
Suggested-by: Håkan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-28 12:51:14 +02:00
Lukas Fleischer
21fc7a4b74 Replace several uses of snprintf() by asprintf()
Use asprintf() in some cold code paths. While allocating memory on the
heap is a bit slower, using asprintf() is a bit more memory efficient
and less prone to buffer overflow errors.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-22 11:47:14 +02:00
Lukas Fleischer
e9d4d3c505 Do not use malloc() or xmalloc()
Use mem_malloc() instead which automatically picks the right
implementation depending on whether memory debugging is enabled or not.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-18 08:47:23 +02:00
Lukas Fleischer
8f28b8f9cc Pause notification thread when reloading items
Prevent the notification thread from accessing data structures for
appointments and todo items while we are recreating them.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-17 20:12:27 +02:00
Lukas Fleischer
ae7d2d4c6b Only run the merge tool on files with differences
If the backup file and the data file are equal, there is no need to run
the merge tool.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-17 12:03:34 +02:00
Lukas Fleischer
71234ec0bd Refactor wins_launch_external()
Allow for passing an arbitrary number of arguments. This also allows us
to remove wins_launch_external2() and use wins_launch_external() at all
call sites instead.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16 23:53:30 +02:00
Lukas Fleischer
5aec540895 Allow for merging data files when reloading
This allows for merging the (unsaved) items with the items from the data
files when invoking the reload operation. To this end, an external merge
tool (defaults to vimdiff) is used.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16 23:31:31 +02:00
Lukas Fleischer
46d260a438 Warn when reloading with unsaved modifications
Since the reload operation overwrites all changes, warn before reloading
if there are unsaved modifications.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16 20:05:21 +02:00
Lukas Fleischer
6550591b08 Add a key binding to reload appointments and todos
This allows for reloading the appointment and todo item files without
having to restart calcurse.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16 16:03:26 +02:00
Lukas Fleischer
f7f49da17c Initialize linked list for recurrent items
When switching to the generic linked list implementation for recurring
events in 9fab248 (Use generic lists for recurring apointments and
events., 2011-04-16), no initialization routine for the list of
recurring events was added. Fix this and properly initialize the list on
startup.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16 15:52:33 +02:00
Lukas Fleischer
cac973fee3 Load todo items on startup
Reload (and show) items into the list box after reading data files.

Reported-by: BARE Willy sprl <barewillysprl@euphonynet.be>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-09 00:33:01 +02:00
Lukas Fleischer
990897b2f0 Resize panels properly
Rewrite the panel resize code and remove the code that reinitializes the
caption and the selected item when the window is resized.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-19 10:54:50 +02:00
Lukas Fleischer
35314dfdeb ui-day: Large-scale refactoring
Use the generic list box implementation for the appointments panel. This
results in some major changes to how the items are printed.

Note that this temporarily removes the heading showing the POM and the
date as well as the separating line between events and appointments.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:06:43 +02:00
Lukas Fleischer
655218b7df ui-todo: Large-scale refactoring
This is a complete overhaul of the TODO list user interface. The new
implementation uses the generic list box panel.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:03:10 +02:00
Lukas Fleischer
9c1d50eee2 Redraw screen if command prompt is canceled
When pressing escape or entering an empty command, we returned from
key_generic_cmd() without updating the screen. Fix this by creating a
cleanup section at the bottom of key_generic_cmd() and jump to that
section when the command prompt is cancelled.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-08-13 12:58:23 +02:00
Lukas Fleischer
aea877145e Add write and quit commands
This adds following vim-style commands to the command mode:

* write
* w
* quit
* q
* wq

Commands can be suffixed with a "!" to force execution.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 12:31:37 +02:00
Lukas Fleischer
2b5f891ba3 key_generic_help(): Use display_help()
Now that we moved the online help code into a separate function, use
that to display the introduction help page when pressing the generic
help key binding.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 11:34:48 +02:00
Lukas Fleischer
f36484f404 Split online help code into a separate function
Reintroduce help.c and move the online help code into a new function
display_help().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 11:29:10 +02:00
Lukas Fleischer
beac8bdd9b Rename io_file_exist{,s}()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:54 +02:00
Lukas Fleischer
98fb747e6a Add several help topic aliases
Add aliases and choose the right help topic if the user requests help on
a key binding or a key binding label.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:54 +02:00
Lukas Fleischer
0d053e2b2b Allow for getting help on key bindings
In addition to getting help on specific topics, users can type things
like ":help s" or ":help ^A" to get help on specific key bindings now.
Note that we do not add help texts for these keys here -- we will alias
key bindings to already existing topics in a follow-up patch.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
20709b7a7e Drop legacy online help system
Remove the old online help system and change the generic help key to do
the same thing as ":help".

This also removes some context-sensitive help. We should think about
re-adding support for this later.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
08f5064ef7 Add introduction to the new online help system
This adds a very basic explanation of the new help command that can be
displayed using ":help intro". This introduction is also added as
default page so that users can simply type ":help" instead.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
2c25d99ad0 Add help command
This adds a "help" command to the list of available command mode
commands. You can currently type "help", followed by a topic like "add".
calcurse will then try to open a file named "add.txt" in the
documentation directory and display it in an external pager.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
c4dae80dd2 Add command prompt
This adds support for vim-style command mode. The command mode can be
entered with pressing ":" (by default, the key binding is configurable).

Currently, no command is supported. Support for various commands will be
added later.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
a3d43ead87 Fix a couple of translatable strings
* Remove space before punctuation.
* Use "TODO" instead of "ToDo".
* Strip some formats to make sure lines are <=80 characters wide.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-14 12:03:04 +02:00
Lukas Fleischer
694d28eb78 Use tabs instead of spaces for indentation
This completes our switch to the Linux kernel coding style. Note that we
still use deeply nested constructs at some places which need to be fixed
up later.

Converted using the `Lindent` script from the Linux kernel code base,
along with some manual fixes.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-04-14 00:19:01 +02:00
Lukas Fleischer
a363cb9b91 Fix braces in if-else statements
From the Linux kernel coding guidelines:

    Do not unnecessarily use braces where a single statement will do.
    [...] This does not apply if one branch of a conditional statement
    is a single statement. Use braces in both branches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-17 09:19:04 +01:00
Lukas Fleischer
806673dd9b calendar.c: Rename to "ui-calendar.c"
This unit belongs to the presentation layer -- rename the file
accordingly.

Also, rename calendar_*() to ui_calendar_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 11:08:03 +01:00
Lukas Fleischer
971df8d215 todo.c: Split out UI-related functions
* Move UI-related functions to "ui-todo.c".
* Rename UI-related functions to ui_todo_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 11:08:03 +01:00
Lukas Fleischer
601709b173 apoint.c: Split out UI-related functions
* Move UI-related functions to "ui-day.c".
* Rename UI-related functions to ui_day_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 10:43:40 +01:00
Lukas Fleischer
c7f3888607 Rename appointment/event-related UI functions
* Rename "interaction.c" to "ui-day.c" since it no longer contains
  todo-related UI functions.

* Rename appointment/event-related UI functions to ui_day_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 10:34:00 +01:00
Lukas Fleischer
267bf0fc1c Split out UI functions for todo items
* Move todo-related UI functions from "interaction.c" to a new
  compilation unit "ui-todo.c".

* Rename all todo-related UI functions to todo_ui_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 10:28:31 +01:00
Lukas Fleischer
b30ccc6319 Merge branch 'maint' 2013-02-04 20:11:58 +01:00
Lukas Fleischer
a7944d335e Update copyright ranges
Add 2013 to the copyright range for all source and documentation files.

Reported-by: Frederic Culot <frederic@culot.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-04 20:10:14 +01:00
Lukas Fleischer
d5cbe794e9 Do not prompt for a todo after adding an appointment
We effectively turned the addition of an appointment into a fall through
case by deleting the break statement during refactoring. Revert this
deletion to skip the second prompt.

Regression introduced in f2dca7de3e8b164a4b3af3d58dde2f6776bfbee6.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-03 09:55:52 +01:00
Lukas Fleischer
9a6df45c4b day_process_storage(): Remove redundant parameter
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-01 18:42:45 +01:00
Lukas Fleischer
574306ff85 do_storage(): Unset highlighted item if list is empty
Check if the appointment panel contains any items and unset the
highlight counter if it doesn't. Not doing this resulted in core dumps
if the edit command was invoked after switching to a day without any
appointments/events.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-16 02:27:39 +01:00
Lukas Fleischer
e492ac6f95 Add hidden key handler window
After BUG#6 had apparently been closed with the screen locks introduced
in commit a80f8dcf2c6eb3b54658218bc081ee9694204dd5, some people still
had problems with random characters appearing in the notification bar.
This was obviously caused by wgetch() refreshing the screen if the
status panel was changed. From wgetch(3):

    If the window is not a pad, and it has been moved or modified since
    the last call to wrefresh, wrefresh will be called before another
    character is read.

Since the wgetch(3) isn't thread-safe, there were race conditions
between the notification bar thread drawing to the notification bar and
wgetch() updating the screen. Introduce a (hidden) window that handles
all key presses and never gets changed in order to avoid this.

Also, call wins_wrefresh() explicitly in status_mesg(), since we can no
longer rely on wgetch() updating windows automatically.

Fixes reopened BUG#6. Note that this is a hotfix -- FR#26 has been
opened to ensure we fix this properly in the next major release.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-16 02:27:36 +01:00
Lukas Fleischer
660eef88e4 Add configuration option to set a default panel
This allows for customizing the panel that is selected by default when
calcurse is started.

Note that this patch doesn't add any documentation. Also, this
configuration option currently cannot be configured using the
configuration menu.

Implements FR#19.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25 18:13:37 +01:00