summaryrefslogtreecommitdiffstats
path: root/src/apoint.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused functionsLukas Fleischer2012-06-301-12/+0
| | | | | | | Remove apoint_get(), event_get(), recur_get_apoint() and recur_get_event(), since they are no longer used. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Simplify apoint_switch_notify()Lukas Fleischer2012-06-301-22/+1
| | | | | | | | | Pull out code from apoint_switch_notify() -- especially the fallback routine that calls recur_apoint_switch_notify() if the currently selected item is a recurrent item -- and move it to a wrapper function day_item_switch_notify(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Simplify recur_apoint_switch_notify()Lukas Fleischer2012-06-301-1/+1
| | | | | | | | | Pass the recurrent appointment itself instead of passing a date and an item number. This is quite simple as we can just pass the pointer that is contained in the generic item structure and don't have to LLIST_TS_FIND_*() the item first any more. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-342/+280
| | | | | | | | | | | | | | Convert our code base to adhere to Linux kernel coding style using Lindent, with the following exceptions: * Use spaces, instead of tabs, for indentation. * Use 2-character indentations (instead of 8 characters). Rationale: We currently have too much levels of indentation. Using 8-character tabs would make huge code parts unreadable. These need to be cleaned up before we can switch to 8 characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Factorize boolean user prompting.Baptiste Jonglez2012-05-141-2/+1
| | | | | | | | | | | Introduce a new `status_ask_bool()` function, and use it where applicable. This greatly reduces code duplication, and will allow handling special events (resize, user escape) much more uniformely. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Miscellaneous small code cleanupsLukas Fleischer2012-04-061-7/+2
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Mark localized string literals constantLukas Fleischer2012-04-051-7/+7
| | | | | | | Translated strings returned by gettext() are statically allocated and shouldn't be modified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Trap fgets() failure in *_scan()Lukas Fleischer2012-02-181-1/+3
| | | | | | | | Ensure we don't read arbitrary data when fgets() returns a NULL string (meaning that either the EOF is encountered or an error occurred). This also fixes a couple of compiler warnings seen with "-Wunused-result". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Update in-notify-bar help for new duration syntaxBaptiste Jonglez2012-01-071-2/+2
| | | | | Signed-off-by: Baptiste Jonglez <baptiste@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Fix a length bug introduced by new duration formatBaptiste Jonglez2012-01-071-1/+1
| | | | | | | | | | | | | | | | Commit 4ff3bb9d introduced a new format for parsing durations, thus allowing a larger string to be retrieved from user input. However, the string used is still declared with the old length, leading to crashes when compiling with stack-smashing protection features (the default on Archlinux). Inputting a duration string of more than 8 characters (such as "+1d11h11m") would crash calcurse with a *** stack smashing detected *** message. Using a larger string from the start fixes the bug. Signed-off-by: Baptiste Jonglez <baptiste@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Remove several unneeded variablesLukas Fleischer2011-12-051-36/+30
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Remove apoint_recur_s2apoint_s()Lukas Fleischer2011-11-141-16/+0
| | | | | | | This one is hackish, obsolete and no longer used by any other function. Drop it! Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Removed unused parameter from apoint_sec2str()Lukas Fleischer2011-11-141-1/+1
| | | | | | This is no longer needed as of commit 2d89d336. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a global configuration variableLukas Fleischer2011-11-141-2/+2
| | | | | | | This is one of the few valid use cases for a global variable. No need to make it pseudo-local and pass it from one function to another. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove parentheses from return statementsLukas Fleischer2011-11-021-8/+8
| | | | | | | | | | | | | | No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not cast unused return values to voidLukas Fleischer2011-11-021-25/+20
| | | | | | | | | | | | | | | | | | | | A small style fix that removes all remaining "(void)" casts. Using these isn't encouraged in GNU coding guidelines and doesn't serve a certain purpose, except for satisfying a few static code analysis tools. We already nuked some of these in previous patches, but this semantic patch should fix what's left: @@ identifier func; @@ - (void)func ( + func ( ...); Long lines were re-formatted manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid use of printf()/fprintf()Lukas Fleischer2011-11-021-2/+2
| | | | | | | | | | | | | | | | Use one of the following functions where appropriate: * puts() (whenever we print hard coded strings to stdout) * fputs() (whenever we print hard coded strings to a stream) * putchar() (whenever we print a single character to stdout) * fputc() (whenever we print a single character to a stream) * strncpy() (whenever we copy hard coded strings to a buffer) This removes the overhead introduced by the format string parser and reduces the number of false positive C-format strings spotted by xgettext(1)'s heuristics. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Format recurrent multi-day items properlyLukas Fleischer2011-10-211-2/+2
| | | | | | | | | Enable "..:.." formatting for recurrent appointments that last beyond midnight. Apart from our recurrent item handler being a tad broken, there is no reason not to do the same thing we already do with regular appointments here. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make events start on 00:00 (12:00 a.m.)Lukas Fleischer2011-10-211-1/+1
| | | | | | | | There is absolutely no reason to make events start on noon, 12:00. Switching to 00:00 seems totally reasonable here, and makes event handling a bit easier, also. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Resize duration input fieldLukas Fleischer2011-10-061-1/+2
| | | | | | | | Now that we support more powerful duration strings, we should also resize the input field for duration strings. Twelve characters is enough space for "+999d23h59m". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use parse_{time,duration}() where appropriateLukas Fleischer2011-10-061-25/+25
| | | | | | | | | | | | | | Make use of these new helpers at various places. Note that this patch implies a few behavioural changes: * Short forms such as "23:" and ":45" are allowed when entering times. * Durations always need to be prefixed with a plus sign ("+"), with the nice side effect that you can now use "+3:30" to declare an appointment that lasts three hours and thirty minutes (that's much more convenient than "+210"). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add count parameter to *_{in,de}crease()Lukas Fleischer2011-10-061-4/+4
| | | | | | | | | This allows for moving more than one item up/down. This currently isn't used anywhere but will be bound to a key with one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove temporary highlight pointersLukas Fleischer2011-10-061-1/+1
| | | | | | | | | Add an additional check to apoint_update_panel() and todo_update_panel() and only highlight currently selected items if the corresponding panel is active. This allows us to remove all the highlight pointer juggling that we used whenever the panel selection changed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not unlink() note files on note removalLukas Fleischer2011-10-051-9/+7
| | | | | | | | | | Now that we use hash-based note file names, note files should never be unlinked as a note file might be shared. Also, remove the ERASE_FORCE_KEEP_NOTE flag that no longer makes any sense. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix apoint_get() call in apoint_switch_notify()Lukas Fleischer2011-07-291-1/+1
| | | | | | | We passed the function arguments the wrong way round. This regression was introduced in commit 77ef3fe76e4ce4c9a990e8a5904ad2d83420ca02. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update the notification item in *_paste_item()Lukas Fleischer2011-07-291-0/+4
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add "force" parameter to notify_check_next_app()Lukas Fleischer2011-07-291-2/+2
| | | | | | | | This allows to force notify_check_next_app() to update the notification appointment, even if start times are equal (e.g. if the item description was changed). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for appointments.Lukas Fleischer2011-04-191-138/+94
| | | | | | | Use the new generic list implementation instead of "apoint_list" everywhere. Simplify stuff and drop unused variables as well. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use do-while loops when reading start time and duration in apoint_add().Lukas Fleischer2011-04-121-2/+5
| | | | | | | | Using do-while loops seems more appropriate here as "item_time" hasn't even been read when either of the loops are entered. Spotted by clang-analyzer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove some more dead assignments spotted by clang-analyzer.Lukas Fleischer2011-04-121-1/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Compare pointers to "NULL" instead of "0".Lukas Fleischer2011-04-051-4/+4
| | | | | | "bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-155/+155
| | | | | | | Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Parse appointment end times correctly if they date back.Lukas Fleischer2011-03-131-1/+1
| | | | | | | | | End times used to be parsed incorrectly if start and end time's hour components were equal, but the end time was smaller than the start time. This is fixed by comparing the minute components as well in case of equal hour components. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update website links to match the new URL.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update mail addresses to match the new mailing lists.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove CVS "$Id" headers.Lukas Fleischer2011-03-031-2/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fixed file permissions.Lukas Fleischer2011-03-031-0/+0
|
* All headers gathered into a single one. Typedefs suppressed.Frederic Culot2010-03-201-45/+34
|
* Make use of erase_note() whenever possible.Frederic Culot2009-07-191-15/+4
|
* stdbool header removed, unsigned type used insteadFrederic Culot2009-07-121-5/+5
|
* Switch to BSD license.Frederic Culot2009-07-051-14/+26
|
* The buffer should be allocated dynamically, but I am quite busy right now ↵Frederic Culot2009-05-221-3/+3
| | | | :'( Anyway, thanks Kamil for feedback
* more code cleanupFrederic Culot2009-01-031-12/+19
|
* code cleanupFrederic Culot2009-01-021-13/+13
|
* various bugfixesFrederic Culot2009-01-021-3/+3
|
* cut/paste feature adedFrederic Culot2009-01-011-9/+115
| | | | | fixed a 2-years old bug that made repeated items with exceptions to load uncorrectly in some cases (thanks Jan for reporting it)
* Added wrappers around libc's memory management functions, to easily debug ↵Frederic Culot2008-12-281-53/+64
| | | | memory usage
* small bugfixes and a major one (freeze when deleting an appointment's note, ↵Frederic Culot2008-12-151-5/+6
| | | | thanks Jan for reporting it)