| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Overview of existing implementation
-----------------------------------
The APP panel displays the 'day_items' vector in the 'lb_apt' listbox. A
listbox consists of a scrollwin (structure) in which a number of items
is displayed. The listbox keeps track of:
- the number of items
- the selected item
- the type of each item in an array type[]
- the height of each item (ie. how many screen lines) in an array ch[]
- how to display an item (on the screen)
The latter three are handled by functions fn_type(), fn_height(),
fn_draw(). The first two are used to fill in the corresponding array
entry, type[] or ch[], for item number i, the third draws item number i.
The items are taken from the global variables
vector_t day_items
int day_items_nb
in day.c. Items include captions (DAY_HEADING, DAY_SEPARATOR).
Everything is sorted for display (DAY_HEADING, events, DAY_SEPARATOR,
appts). These are filled in ("stored") [by day_store_items() for the
selected day in the calendar], before being "loaded" into the listbox.
See do_storage() in calcurse.c and ui_day_item_add() in ui-day.c.
New APP panel design
--------------------
Several days are displayed in the APP panel by loading them with
day_store_items().
With several days come several headings and separators. DAY_SEPARATOR is
reinterpreted to separate days, and a new separator, EVNT_SEPARATOR,
separates events from appointments. To sort everything, an 'order'
member of type time_t is added to the day_item structure. It is set for
headings and separators as well as for appointments and events as
follows:
item order
---------------------
DAY_HEADING BGNOFDAY (= midnight)
EVNT_SEPARATOR BGNOFDAY
DAY_SEPARATOR ENDOFDAY
event start time (midnight)
appointment start time (first day)
BGNOFDAY (following days, if any)
The sort function day_cmp() (used by vector_sort) is extended to sort by
order first.
The order field always indicates the day to which an item belongs. This
comes in handy, because with several days in the APP panel it is
necessary to distinguish between the selected day in the calendar and
the selected day in the APP panel. This raises the question which day
should actions (commands) operate on: the one selected in the calendar
or the one selected in the APP panel? Unquestionably the one on the APP
panel which is the one tacitly implied. In most cases it is not a
problem, though, because actions work on the selected item and the
selected day does not come into play. But in some cases it does:
delete item When deleting an occurrence of a repeated item, the
selected day is the exception day to add.
view item day_popup_item() needs the day of the selected item
for display of correct start/end times.
cut/paste item Paste needs the selected day in which to paste.
add item The day of the new item is taken from the calendar.
Instead a dummy event is inserted in an empty day.
This makes the day selectable, which is otherwise
impossible with only the DAY_HEADING displayed. The
dummy event is selectable but cannot be edited or
deleted (but viewed or piped).
With more than one day in the day_items vecter, an appointment spanning
more than one day may occur more than once in the vector (with start/end
times suitably adjusted for display). A day_item is no longer (always)
identified by the aptev_ptr (item) value. Instead the combination
(order, item.<ptr>) is used; order is roughly the day.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
The input and output date formats may be set from the command line.
Intended for scripts that must be independent of the local user
configuration.
Cannot be used in interactive mode.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch the input date parsing accepts three formats:
yyyy/mm/dd, mm/dd/yyyy, yyyy-mm-dd. They are tried in sequence. It also
accepts an additional time (hh:mm), or a time without a date.
There are several issues with this:
- it is not documented
- the date format dd/mm/yyyy is not accepted
- print_date() and filter option settings (in parse_args()) can only
handle midnight times (which are the result of a date without time)
- it is highly uncertain what happens if a time (without a date) is
given; at least the -d option treats a time without colon (1215 for
12:15) as a number
It seems that acceptance of time input is a by-product and not needed.
For these reasons the input date parsing has been changed:
- the format is taken from the configuration file (as is the case for
the output date format)
- only a date, and no time, is accepted
Because the input date format is used during parsing of the command
line, the configuration file must be loaded first, i.e. the options -D
or -C must be parsed before the remaining ones. Loading the
configuration file may result in errors (e.g. caused by changes between
versions). For this reason config_load() has been made more tolerant and
issues warnings instead of exiting.
A followup patch will introduce two options to allow the configuration
file settings to be overridden for input and output date formats.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
Option -F/--filter renamed to -P/--purge; -F retained as deprecated.
Check for non-option arguments and for filter, format and query-range
options only. Update of help and usage messages.
Fixed --status output when calcurse is not running.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In "--from a --to z", a is included in the range, z not. This is
non-intuitive and disagrees with the semantics of "to" in filter options
like --filter-start-to, where "to" (and "from") are used inclusively (as
opposed to "before" and "after"). It also has the effect that "--from
today --to tomorrow" has a range of 1 day, "--to z" a range of 0 days
(otherwise not allowed), and "--to today --days -1" is allowed and
displays yesterday!
The implementation has been fixed to agree with "inclusive" semantics.
Options --from and -days with negative range are allowed, while --to and
--days are disallowed also when the range is negative.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The introduction of the "-C <confdir>" option is an opportunity to
review the initialization of data paths. It lead to a rewrite.
Two "root" directories are used (data and configuration files); by
default they are identical. The statically allocated path buffers are
turned into dynamically allocated buffers.
Missing files/directories now include hooks.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a replacement for commits 57dd3d6 and 912124b.
The idea is to move the check for modified files and the list initialization
into io_load_data(), and let io_load_data() decide what to load. A new
argument is used to force a load.
The return code from new_data() (the renamed version of
io_check_data_files_modified()) tells which files have changed.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
The changed handling of thread ids implies that they must be initialized
before exit of calcurse where they are used. Hence the function
vars_init() is now called irrespective of command line arguments.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allows to specify a configuration directory containing:
* conf
* keys
* hooks
When used in combination with -D $ddir, $ddir contains all the other
files not mentioned above.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
The configuration file (~/.calcurse/conf by default) can now be
specified with -C or --conf.
Workaround for GitHub issue #86.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
When specifying date ranges using -d, allow for passing negative values
to indicate that the date range should start a certain number of days
ago.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
| |
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Avoid starting multiple daemon instances if the --daemon argument is
passed and the daemon is already running. Terminate the already running
instance before spawning a new one instead.
Suggested-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Use mem_*() wrappers instead of directly accessing libc functions when
allocating/deallocating memory.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
When specifying --daemon, calcurse immediately forks and runs the
notification daemon in the background.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Implement a -q/--quiet command line option to disable system dialogs
temporarily.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Start converting some variables and return values to store times from
long to time_t.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Fixes tests range-002.sh and search-001.sh.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
We cannot use -1 here since negative values are valid dates.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Try to support dates past year 2038 on systems with 64-bit time_t.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
Allow for specifying both date and time in all dates and date ranges
used in filters.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
These are shorthands for --filter-start-from/--filter-start-to and
--filter-end-from/--filter-end-to.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
This allows for printing a subset of the items in the data files by
using filters.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
Use the same error message if option arguments have the same data type
and always add the violating value.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Print TODO items before appointments in query outputs and add an empty
line between the list of TODO items and the list of appointments. This
is how items were printed before the big parser refactoring.
Also, add a test to ensure we do not unintentionally change that format
in the future.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
Filtering items when running garbage collection or when importing data
might result in data loss, so simply ignore filters here.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|