1722 Commits

Author SHA1 Message Date
William Pettersson
c2d324be51 Document for -l/--limit and %(remaing)/%(duration)
Update man-page and manual to describe limit option, and new formatting options
for %(remaining) and %(duration).

Signed-off-by: William Pettersson <william.pettersson@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-19 16:21:50 +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
ed9b22bd9b Add support for moving appointments
This adds an edit option to change an appointment's start time without
changing its duration.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 12:19:06 +02:00
Lukas Fleischer
30639ef6de update_start_time(): Allow for moving an item
Add a parameter that specifies whether the duration should be updated
when updating the start time of an item.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 12:13:54 +02:00
Lukas Fleischer
19290ca39a Allow for making an appointment punctual
This allows for setting an empty end time when editing an item,
converting it into a punctual appointment.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 12:10:25 +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
5c6131d5ec Add help text files to dist_doc_DATA
We exported online help texts in commit 906c2fa. Make sure they are
actually installed when running `make install`.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
39dff3f685 Add a short format specifier for "%(remaining)"
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:00:25 +02:00
Lukas Fleischer
99b39e5d0d Allow extended formats for durations
Use print_datediff() to print durations. This allows for using something
like "%(duration:%EH:%M)".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 13:57:11 +02:00
Lukas Fleischer
ae93db284e print_datediff(): Actually print a date difference
Instead of passing a date and printing the date difference between that
date and the current date, pass an actual date difference. This allows
for using the function in other places, such as for printing item
durations.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 13:55:42 +02:00
William Pettersson
18b6e360b8 Add %(remaining) style formatting
Adds %(remaining) style formatting, with parameter substitution
for %d, %H, %M, %S with E and - variables.

Signed-off-by: William Pettersson <william.pettersson@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 12:55:29 +02:00
William Pettersson
fb61744f33 Add -l/--limit option
Adds the -l/--limit command line option. Limits the number of appointments
and/or ToDo items displayed.

Signed-off-by: William Pettersson <william.pettersson@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-16 11:44:55 +02:00
Lukas Fleischer
906c2fa027 Export online help as text files
Move the texts of each online help screen to a separate text file. The
set of files is supposed to replace the online help screens later.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-09 00:34:21 +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
616677fb34 Support punctual appointments in the UI
Allow for skipping the end date which means that a punctual appointment
will be created.

Implements FR#25.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-14 12:03:04 +02:00
Lukas Fleischer
e8e73e223b display_item_date(): Support punctual appointments
Display appointments having the same starting date as ending date using
a specific format that hides the end time ("12:00" instead of "12:00 ->
12:00").

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-14 11:25:42 +02:00
Lukas Fleischer
9e86e258f2 Refactor display_item_date()
Replace nested case differentiations by initializing every single
character for each flag separately and joining all characters
afterwards. This makes it much easier to extend the function later.

Note that the same approach is already used in display_item().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-14 11:23:27 +02:00
Lukas Fleischer
ce93fa8adb Use a macro to determine the size of arrays
Use following macro instead of "sizeof(x) / sizeof(x[0])" everywhere:

    #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-04 20:32:26 +02:00
Lukas Fleischer
370c4031be recur.c: Refactor/Reformat recur_item_find_occurrence()
Fix a couple of whitespace and line breaks. Bail out early instead of
using nested if statements.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-02 15:38:57 +02:00
Lukas Fleischer
ec837150a0 recur_exc_scan(): Do not check time of exceptions
Exceptions do not contain a time field -- do not check time fields which
may be uninitialized.

Regression introduced in 9907069f442c56c90b67accb2d8fbd046dfce6db. This
fixes test/recur-*.sh.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-04-14 00:56:18 +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
9907069f44 Validate date/time when scanning items
Bail out when reading dates such as "02/30/2013" from the appointments
file. These *could* be converted into valid dates but since we never
write invalid dates to that file, these indicate a user error.

Fixes following test cases:

* appointment-009.sh
* appointment-012.sh
* appointment-016.sh
* appointment-019.sh
* event-003.sh

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-27 11:36:29 +01:00
Lukas Fleischer
43bdd12254 parse_{date,time}(): Split out date/time validation
Split date/time validation into separate functions check_date() and
check_time(). These will be used to validate date/time information when
reading items from the appointments file.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-27 11:36:28 +01:00
Lukas Fleischer
ba2c5c14f6 test/: Add default values for configuration variables
Add a small helper script called "test-init.sh" that is sourced in each
test case and initializes the CALCURSE and DATA_DIR environment
variables.

Update the test suite README to point out that setting these environment
variables is no longer required.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-27 11:36:28 +01:00
Lukas Fleischer
5501dae328 test/: Add a couple of black-box tests for items
This introduces five test suite failures which will be fixed in one of
the following patches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-27 11:36:28 +01:00
Lukas Fleischer
3d7fdaec58 date_sec2date_str(): Add missing semicolon
Regression introduced in a363cb9b9111aed22d105adb0e7a8e9caab9bbe3.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-19 00:57:24 +01: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
8e16853201 parse_duration(): Bail out early in final state
Bail out early if we are reading a character while being in a final
state.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 12:22:34 +01:00
Lukas Fleischer
de0092a1e9 ui-day.c: Several minor simplifications
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 12:12:08 +01:00
Lukas Fleischer
abca2f10b5 ui-todo.c: Refactor ui_todo_chg_priority()
Add the new item *before* deleting the old one and get rid of temporary
buffers for the item message and note.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 11:49:15 +01:00
Lukas Fleischer
8de7399360 Mark todo_get_position() public
This is needed in "ui-todo.c" now.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 11:10:38 +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
720189d03f Merge branch 'maint' 2013-02-09 14:11:22 +01:00
Lukas Fleischer
6d6f76e76d Release 3.1.4
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-09 13:41:16 +01:00
Lukas Fleischer
b3280b8bca Do not ignore "--datarootdir" in "po/Makefile.in.in"
This fixes the "--datarootdir" warning seen with autotools >=2.59c. Note
that this is a workaround for a bug in autopoint(1).

Inspired by util-linux commit cc3c3fdd29719883605687fc0d11391386ab46c6.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-05 21:37:01 +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
Michael Smith
ce22b13a4d Close key binding window when reassigning the same key
This allows for canceling a key reassignment. We cannot use a static key
here since every key could potentially be used in a binding. Instead,
just cancel if we are trying to reassign a key that has already been
used for that action before.

Signed-off-by: Michael Smith <crazedpsyc@mail4us.net>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-04 20:06:09 +01:00