summaryrefslogtreecommitdiffstats
path: root/src/ui-day.c
Commit message (Collapse)AuthorAgeFilesLines
* Add missing string initializationLars Henriksen2017-09-041-0/+1
| | | | | | | | | | | When introducing the fmt_day_heading() function in commit d56cc7a (Make heading in appointments panel configurable, 2017-08-19), we forgot to initialize the dynamic string. This resulted in calling mem_free() with a garbage pointer, potentially resulting in a segmentation fault. Fix this by calling string_init() before using the string. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add a function to wait for any key pressLukas Fleischer2017-09-031-14/+14
| | | | | | | Introduce a new function keys_wait_for_any_key() and use it instead of wgetch() whenever the return value is discarded. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make heading in appointments panel configurableLars Henriksen2017-08-281-6/+15
| | | | | | | | Add a new configuration variable format.dayheading to set the format of the date displayed at the top of the event and appointment list. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2017-01-121-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Prevent free-before-init of timstrVlad Glagolev2016-10-131-1/+1
| | | | | | | | Fixes a crash when editing the repetition of an appointment and passing an empty repetition value. Signed-off-by: Vlad Glagolev <scm@vaygr.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Replace parse_datetime() constants by named flagsLukas Fleischer2016-10-101-3/+3
| | | | | | | Remove the magic constants used in the return value of parse_datetime() and use named flags instead. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Refactor duration/end time parsingLukas Fleischer2016-10-101-35/+39
| | | | | | | Replace all remaining invocations of parse_time() by parse_datetime() which now indicates whether a date was supplied or not. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Support dates when specifying start/end timesLukas Fleischer2016-10-091-30/+27
| | | | | | | | | | Add support for combined date/time or date-only strings when specifying the start or end time of a new item. This is a follow-up to 1f39b5c (Add support for moving items to another day, 2016-09-30). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Factor out parse_datetime()Lukas Fleischer2016-10-091-25/+5
| | | | | | | | Create a new function that takes a time stamp and updates the date or time components of that time stamp according to a given date/time string. Use that function for updating the start time of an item. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add support for moving items to another dayLukas Fleischer2016-10-081-11/+27
| | | | | | | | | | | | | When moving an item (or when changing the start time of an item), allow for optionally specifying a date. If both date and time are entered, the item is updated to start on the given date and time. If only a date is entered, the item is modified to start on the given date, keeping the current start time. If only a time is entered, the item is modified to start on the current date and the new start time. Fixes GitHub issue #12. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Refactor day_edit_time()Lukas Fleischer2016-10-011-8/+7
| | | | | | | Make the function more flexible by returning the updated time instead of single hour and minute components. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Automatically select new appointments/eventsLukas Fleischer2016-09-281-8/+11
| | | | | | | | This is a follow-up to commit 65b699f (Make automatic selection of appointments/events smarter, 2016-02-16). Newly created appointments and events are now selected automatically. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix out-of-bounds memory accessLukas Fleischer2016-09-281-2/+7
| | | | | | | Do not try to access freed day items. This also fixes unexpected selection changes after modifying appointments or events. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Support relative dates when adding recurrencesLukas Fleischer2016-04-011-13/+31
| | | | | | | | | | | | 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>
* Support durations in recurrence ending datesLukas Fleischer2016-02-261-14/+32
| | | | | | | 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>
* Refactor UTF-8 choppingLukas Fleischer2016-02-261-4/+4
| | | | | | | 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>
* ui-day.c: Simplify code using ui_day_selitem()Lukas Fleischer2016-02-161-8/+8
| | | | | | | Use the new ui_day_selitem() utility function to retrieve the currently selected item. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make automatic selection of appointments/events smarterLukas Fleischer2016-02-161-0/+15
| | | | | | | 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>
* Update copyright rangesLukas Fleischer2016-01-301-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use time_t instead of long in several placesLukas Fleischer2015-02-241-6/+5
| | | | | | | Start converting some variables and return values to store times from long to time_t. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2015-02-071-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* ui-day.c: Reorganize some free() operationsLukas Fleischer2014-07-271-7/+7
| | | | | | | Fixes regressions introduced in 21fc7a4 (Replace several uses of snprintf() by asprintf(), 2014-07-21). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Replace several uses of snprintf() by asprintf()Lukas Fleischer2014-07-221-32/+35
| | | | | | | | 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>
* Warn when reloading with unsaved modificationsLukas Fleischer2014-07-161-0/+20
| | | | | | | Since the reload operation overwrites all changes, warn before reloading if there are unsaved modifications. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not highlight items on inactive windowsLukas Fleischer2014-07-091-0/+2
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix segmentation faultLukas Fleischer2014-06-251-10/+10
| | | | | | | | | | This adds some more accurate checks to avoid a segmentation fault that occurred when accessing a nonexistent item. Fixes GitHub issue #7. Reported-by: Bromind <martin.vassor@hotmail.fr> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add default cases to some switch statementsLukas Fleischer2014-05-181-3/+11
| | | | | | This squelches several compiler warnings. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Reintroduce heading and separator in appointmentsLukas Fleischer2014-05-181-10/+25
| | | | | | | This re-introduces the heading (showing the POM and the current date) as well as the separating line between events and appointments. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add support for caption rows in list boxesLukas Fleischer2014-05-181-0/+5
| | | | | | | This adds support for rows that cannot be selected. Such rows can be used for section headings and the like. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* ui-day: Large-scale refactoringLukas Fleischer2014-05-181-156/+78
| | | | | | | | | | 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>
* Pass date parameter to ui_day_update_panel()Lukas Fleischer2014-05-131-3/+1
| | | | | | | This allows for drawing appointment panels for days other than the current day. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add support for moving appointmentsLukas Fleischer2013-07-181-4/+14
| | | | | | | This adds an edit option to change an appointment's start time without changing its duration. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* update_start_time(): Allow for moving an itemLukas Fleischer2013-07-181-3/+7
| | | | | | | 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>
* Allow for making an appointment punctualLukas Fleischer2013-07-181-3/+8
| | | | | | | 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>
* Fix a couple of translatable stringsLukas Fleischer2013-05-141-8/+8
| | | | | | | | * 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>
* Support punctual appointments in the UILukas Fleischer2013-05-141-0/+4
| | | | | | | | | 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>
* Use tabs instead of spaces for indentationLukas Fleischer2013-04-141-723/+780
| | | | | | | | | | | 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>
* ui-day.c: Several minor simplificationsLukas Fleischer2013-02-141-134/+110
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calendar.c: Rename to "ui-calendar.c"Lukas Fleischer2013-02-141-14/+14
| | | | | | | | | 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>
* apoint.c: Split out UI-related functionsLukas Fleischer2013-02-141-13/+135
| | | | | | | * Move UI-related functions to "ui-day.c". * Rename UI-related functions to ui_day_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename appointment/event-related UI functionsLukas Fleischer2013-02-141-0/+798
* 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>