summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Use wins_set_bindings() for the configuration menuLukas Fleischer2014-07-183-42/+75
| | | | | | | Make use of the general key binding context switching implementation for the configuration main menu. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make bindings always fill the whole status barLukas Fleischer2014-07-181-0/+2
| | | | | | | Compute padding for key bindings in the status bar such that they use all available space (without exceeding the given page size). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Always fix selection in listbox_load_items()Lukas Fleischer2014-07-181-5/+3
| | | | | | | | | | Since commit 80a7267 (Fix selection in listbox_load_items(), 2014-07-18), listbox_fix_sel() is called if the selection is out of range after loading the new set of items. However, we should *always* fix the selection to make sure the selection doesn't move to a caption row when reloading items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not use malloc() or xmalloc()Lukas Fleischer2014-07-183-7/+7
| | | | | | | 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>
* Do not display dialog on periodic saveLukas Fleischer2014-07-181-1/+2
| | | | | | | | When periodic save is enabled, do not print the "The data files were successfully saved" dialog every time io_save_cal() is called. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Initialize prompt buffers in the configuration menusLukas Fleischer2014-07-182-1/+5
| | | | | | | | malloc() does not make sure that the buffer is initialized to contain all zeros. Initialize the buffer with the empty string. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix selection in listbox_load_items()Lukas Fleischer2014-07-181-7/+13
| | | | | | | Call listbox_fix_sel() after setting an initial selection in listbox_load_items() to make sure we do not pick a caption row. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* keys.c: Merge keydef and binding_labelsLukas Fleischer2014-07-171-100/+51
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rework key binding context switchingLukas Fleischer2014-07-175-142/+132
| | | | | | | Store key binding contexts using another data structure to optimize space usage and execution time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Pause notification thread when reloading itemsLukas Fleischer2014-07-171-0/+6
| | | | | | | 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>
* Only run the merge tool on files with differencesLukas Fleischer2014-07-173-7/+42
| | | | | | | 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>
* Reintroduce key bindings in configuration menusLukas Fleischer2014-07-172-4/+28
| | | | | | | | | | The key bindings display in the status bar was removed from the general options menu in bd182fb (Use generic list box for general options, 2014-05-13) and from the notification options menu in 5eea05a (Use generic list box for notification options, 2014-05-13). Display the new key bindings to use for navigation. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Split out code to set bindingsLukas Fleischer2014-07-172-16/+28
| | | | | | | | Split wins_status_bar() into wins_set_bindings(), wins_update_bindings() and wins_status_bar(). This allows for using wins_set_bindings() to set custom key bindings to be displayed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* wins.c: Drop NB_*_CMDSLukas Fleischer2014-07-171-28/+11
| | | | | | | Store the current number of commands in a static variable and drop the NB_*_CMDS variables which we outdated anyway. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor wins_launch_external()Lukas Fleischer2014-07-166-29/+20
| | | | | | | | 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>
* Avoid cancelling the save thread during savingLukas Fleischer2014-07-161-4/+8
| | | | | | | Ensure that we never cancel the periodic save thread when it currently saves the configuration and data files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Allow for merging data files when reloadingLukas Fleischer2014-07-166-18/+97
| | | | | | | | 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>
* Add a cleanup handler for the notify main threadLukas Fleischer2014-07-161-0/+13
| | | | | | | Make sure we do not leave behind unusable mutexes when calling pthread_cancel(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* day.c: Fix typo in error messageLukas Fleischer2014-07-161-2/+2
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Warn when reloading with unsaved modificationsLukas Fleischer2014-07-165-0/+58
| | | | | | | Since the reload operation overwrites all changes, warn before reloading if there are unsaved modifications. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Automatically select first item in list boxesLukas Fleischer2014-07-161-0/+3
| | | | | | | If the selection is empty during listbox_load_items() and there is at least one item in the list, automatically select the first item. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a key binding to reload appointments and todosLukas Fleischer2014-07-164-25/+49
| | | | | | | This allows for reloading the appointment and todo item files without having to restart calcurse. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>