aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Simplify code in status_ask_choice()Lukas Fleischer2015-02-241-7/+5
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use time_t instead of long in several placesLukas Fleischer2015-02-249-89/+69
| | | | | | | Start converting some variables and return values to store times from long to time_t. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* ical.c: Reduce nesting depthLukas Fleischer2015-02-241-318/+257
| | | | | | Refactor the iCal parser to reduce nesting depth. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Introduce starts_with() and starts_with_ci()Lukas Fleischer2015-02-244-123/+72
| | | | | | | | Create user-defined functions to check whether a string contains a certain prefix instead of messing around with strncmp() and strncasecmp(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make "Add Item" work from the calendar panelLukas Fleischer2015-02-231-0/+1
| | | | | | | 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>
* Redraw calendar panel when switching viewsLukas Fleischer2015-02-231-0/+6
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Support resize in all configuration menusLukas Fleischer2015-02-231-0/+25
| | | | | | | Add missing resize support in the configuration main menu and in the key bindings menu. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add support for UTC times in iCal importsLukas Fleischer2015-02-233-8/+39
| | | | | | | | | | | | | | According to the iCal standard (4.3.12 Time): UTC time, or absolute time, is identified by a LATIN CAPITAL LETTER Z suffix character (US-ASCII decimal 90), the UTC designator, appended to the time value. Parse such time values properly when importing iCal files. Fixes GitHub issue #3. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use date_sec_change() for adding day deltasLukas Fleischer2015-02-222-10/+9
| | | | | | Fixes tests range-002.sh and search-001.sh. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use LONG_MAX for invalid dates in parse_datearg()Lukas Fleischer2015-02-221-3/+3
| | | | | | We cannot use -1 here since negative values are valid dates. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Support weekday names as date specifiersLukas Fleischer2015-02-111-5/+51
| | | | | | Allow for using shorthands like "Monday" as date specifiers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2015-02-0737-38/+38
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a couple of shorthands to parse_date()Lukas Fleischer2015-02-071-0/+25
| | | | | | | We now understand the shorthands "today", "yesterday", "tomorrow" and "now" which might come in useful sometimes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Handle dates past January 19th, 2038Lukas Fleischer2015-02-073-13/+5
| | | | | | Try to support dates past year 2038 on systems with 64-bit time_t. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Only werase() calendar if month is changedLukas Fleischer2014-10-171-8/+6
| | | | | | | Optimize the monthly view by only erasing the window content when a new month is selected. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Let SIGUSR1 trigger a reloadTim Hentenaar2014-10-104-0/+14
| | | | | | | | | | | | | 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>
* Factor out item reload codeLukas Fleischer2014-10-103-92/+97
| | | | | | | 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>
* Add io_load_data() wrapperLukas Fleischer2014-10-104-14/+15
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Correctly parse all types of iCal durationsLukas Fleischer2014-08-181-5/+14
| | | | | | | | This was supposed to be fixed in 6ca2535 (ical.c: Simplify and fix ical_durtime2long(), 2014-07-28) but some cases were not covered. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Retain comments in descriptions and config valuesLukas Fleischer2014-08-182-2/+4
| | | | | | | | | Comments should only be stripped if they start at the beginning of a line. We do not want to chop off an TODO item description or a configuration value. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Gracefully handle all day events in iCal importsLukas Fleischer2014-08-181-11/+24
| | | | | | | | | Do not create two events when importing an event that lasts an entire day. Reported-by: Jörn Tillmanns <tillmanns@tuxzone.org> Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Handle CRLF line endings in iCal filesLukas Fleischer2014-08-181-4/+12
| | | | | | | | RFC 2445 mentions that CRLF line endings may be used in iCal files. Handle them properly when importing. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix parsing of times in parse_datetimearg()Lukas Fleischer2014-08-091-2/+2
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Extend date formats for filtersLukas Fleischer2014-08-091-14/+48
| | | | | | | Allow for specifying both date and time in all dates and date ranges used in filters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add --filter-{start,end}-rangeLukas Fleischer2014-08-081-0/+48
| | | | | | | 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>
* Add a grep modeLukas Fleischer2014-08-072-13/+40
| | | | | | | This allows for printing a subset of the items in the data files by using filters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* args.c: Reword error messagesLukas Fleischer2014-08-061-14/+14
| | | | | | | 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>
* io.c: Error out on non-existent calendar fileLukas Fleischer2014-08-061-38/+3
| | | | | | | | Show an error message and die if the user specified a non-existent custom calendar file. This fixes some random hangs when calcurse is used in non-interactive mode within scripts. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use backwards-compatible out format for queriesLukas Fleischer2014-08-061-10/+13
| | | | | | | | | | | 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>
* Do not use filters in GC or import modeLukas Fleischer2014-08-061-4/+4
| | | | | | | 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>
* Rework command line argument handlingLukas Fleischer2014-08-061-431/+164
| | | | | | | | | | | Add a new range query mode (--days) and refactor the command line argument parser. Note: This slightly changes the behavior of some command line parameters, since date arguments no longer use the input date format from the configuration file! Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Allow for filtering TODO itemsLukas Fleischer2014-08-064-16/+68
| | | | | | | | | | | 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>
* Add a query modeLukas Fleischer2014-08-061-6/+69
| | | | | | | | | | Add a new parameter -Q that can be used to print all appointments inside a given query range, followed by all TODO items. The date range can be specified using the --from and --to arguments. The start date defaults to the current day, the end date defaults to the day after the start date if not specified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add pattern filter optionLukas Fleischer2014-08-066-56/+51
| | | | | | | This adds a new item filter option --filter-pattern and removes the whole -S parameter logic, while making -S an alias for --filter-pattern. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add item filtersLukas Fleischer2014-08-068-24/+207
| | | | | | | | | | | | | | | | | 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>
* Set default panel before showing system dialogsLukas Fleischer2014-08-031-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make compact mode and default panel configurableLukas Fleischer2014-08-031-33/+68
| | | | | | | | | Create configuration entries for these (currently undocumented) options which were added in 4d0c095 (Add compact panels support, 2012-11-25) and in 660eef8 (Add configuration option to set a default panel, 2012-11-24). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Document the reload featureLukas Fleischer2014-07-281-0/+2
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Show system dialog after reloading itemsLukas Fleischer2014-07-281-0/+8
| | | | | Suggested-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* ical.c: Parse multiple exception rules properlyLukas Fleischer2014-07-281-1/+1
| | | | | | | | There can be multiple EXDATE lines per event. Parse them correctly instead of making the last line overwrite the previous ones. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* ical.c: Simplify and fix ical_durtime2long()Lukas Fleischer2014-07-281-20/+15
| | | | | | | | Correctly parse all types of durations. Before this change, durations without an hour or minute component were not parsed properly. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* io.c: Remove superfluous space from messageLukas Fleischer2014-07-281-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>
* Do not error out when calling xfree(NULL)Lukas Fleischer2014-07-271-1/+0
| | | | | | | Calling free() with NULL as parameter is perfectly safe, no need to error out here. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix find_basedir() and display_help()Lukas Fleischer2014-07-271-4/+2
| | | | | | | Fixes two regressions introduced in 21fc7a4 (Replace several uses of snprintf() by asprintf(), 2014-07-21). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* config.c: Rework configuration serializationLukas Fleischer2014-07-221-66/+58
| | | | | | | Avoid preallocating buffers on the stack, use dynamic memory allocation instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor new_tempfile()Lukas Fleischer2014-07-225-45/+47
| | | | | | | | Avoid preallocating buffers on the stack, use dynamic memory allocation instead. Also, change the semantics of new_tempfile() so that it returns the full name of the temporary file and fix all call sites. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Replace several uses of snprintf() by asprintf()Lukas Fleischer2014-07-229-135/+150
| | | | | | | | 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>
* Add vasprintf() and asprintf()Lukas Fleischer2014-07-222-0/+40
| | | | | | | | | The new utils.c functions vasprintf() and asprintf() are analogs to sprintf() and vsprintf(). However, instead of requiring a buffer that is large enough to hold the output data, the functions allocate a string and return a pointer to it. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Small code cleanupsLukas Fleischer2014-07-182-20/+16
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>