summaryrefslogtreecommitdiff
path: root/src/day.c
AgeCommit message (Collapse)Author
2012-05-21Switch to Linux kernel coding styleLukas Fleischer
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>
2012-05-16Allow passing additional parameters to shell_exec()Lukas Fleischer
This allows for specifying multiple command line parameters to be passed on to the command in a way similar to fork_exec(). This is useful if we want to wrap editor or pager invocations in a shell. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14Various fixes.Baptiste Jonglez
Use snprintf(3) instead of sprintf(3) and fix a missing i18n tag. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14Use status_ask_choice() on more difficult casesBaptiste Jonglez
These cases are also candidates for the factorisation process, but they are somewhat more tricky to get right. Since we use a completely different approach, the result (from a user perspective) looks different. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14Use status_ask_choice() where applicableBaptiste Jonglez
These cases make obvious candidates for factorisation. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14Use status_ask_simplechoice() where applicableBaptiste Jonglez
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-08Declare several parameters/variables constantLukas Fleischer
Add the "const" keyword to parameters and variables that are never modified. Most of these were spotted by "-Wwrite-strings". We cast the second parameter to execvp() explicitly as it expects a "char *const[]" where it should expect a "const char *const[]" (according to the documentation, this is due to compatibility reasons). This should be changed once we come up with a better solution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-02src/apoint.c: Change the status message displayed when editing a durationBaptiste Jonglez
The duration format has recently changed to allow durations of the form "2d18h42m", but the status message didn't advertize this new possibility. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-05Mark localized string literals constantLukas Fleischer
Translated strings returned by gettext() are statically allocated and shouldn't be modified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-03-30Do not use LLIST_*_CONT for appointmentsLukas Fleischer
This no longer works since we allow appointments lasting longer than 24 hours. This means that there might be an appointment that starts after another one and lasts until the selected day, even though the former doesn't. A simple example, where the old LLIST_TS_FOREACH_CONT approach fails, is: 03/29/2012 @ 19:00 -> 03/30/2012 @ 10:00 |Long event 03/29/2012 @ 21:00 -> 03/29/2012 @ 23:15 |Event 1 (shown) 03/30/2012 @ 14:00 -> 03/30/2012 @ 15:00 |Event 2 (not shown) Instead, allow incoherent appointments and only break if the current appointment *starts after* the selected day. Reported-by: Baptiste Jonglez <baptiste@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-03-26Update copyright rangesLukas Fleischer
Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-12-09src/day.c: Nuke unneeded variableLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-14Removed unused parameter from apoint_sec2str()Lukas Fleischer
This is no longer needed as of commit 2d89d336. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-14Use a global configuration variableLukas Fleischer
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>
2011-11-02Remove parentheses from return statementsLukas Fleischer
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>
2011-11-02Do not cast unused return values to voidLukas Fleischer
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>
2011-10-21Avoid unnecessary start time calculationsLukas Fleischer
Rename recur_*_inday() to recur_*_find_occurrence() and use the new functions whenever we actually care about the start time of an occurrence. Reintroduce recur_*_inday() as wrappers to recur_*_find_occurrence() and pass NULL as start time buffer (which means "skip start time calculation"). Keep using these when we only want to know if a recurrent item belongs to a specific day but do not care about the actual start time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-21src/day.c: Allow editing an item's durationLukas Fleischer
We have the option to enter either an end time or a duration when creating an item - the same choice should be available when editing an item. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-21src/day.c: Allow cancelling an editLukas Fleischer
Once the user picked any property to edit, we didn't give him any chance to cancel editing. Abort if the user presses the escape key or enters an empty string. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06Use parse_{time,duration}() where appropriateLukas Fleischer
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>
2011-10-06Use LLIST_{,TS}_FIND_FOREACH_CONT where appropriateLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-30Merge branch 'maint'Lukas Fleischer
2011-07-29Update the notification item in day_edit_item()Lukas Fleischer
Ensure the start time as well as the description of the notification appointment are synced after editing it. We use notify_check_next_app()'s force parameter to ensure that the notification item is updated even if only the description was modified. Reported-by: Andraž 'ruskie' Levstik <ruskie@codemages.net> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-21Refactor out note functionsLukas Fleischer
* Add new note_edit() and note_view() helper functions. Use these instead of copy-pasted code in *_note_edit(). * Move all note-related functions (note_edit(), note_view(), note_erase()) to a new source file "note.c". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-05Add day_pipe_item() functionLukas Fleischer
Serializes an appointment or an event, prompts for a shell command and executes that command in a new process, piping serialized item data to its stdin. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02Use constant for maximum UTF-8 character sizeLukas Fleischer
Introduce a UTF8_MAXLEN constant instead of using the literal value "6" at various places. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-29Make display_item() UTF-8 compatibleLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-28Do not try to display items with negative widthLukas Fleischer
Don't display anything rather than segfault if the appointment panel becomes too small (e.g. during a terminal resize). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer
* 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>
2011-04-22Return -1 in io_file_is_empty() if file cannot be accessed.Lukas Fleischer
Ensure files don't appear as empty if fopen() fails (e.g. on temporary EACCES failures). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19Use generic lists for recurring apointments and events.Lukas Fleischer
Use them instead of "recur_apoint_list" and "next" pointers in "recur_event" type variables. Includes some code simplifications and cleanups. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19Use generic lists for generic day items.Lukas Fleischer
Use the new generic list implementation instead of "next" pointers in day_item type variables. Includes some cleanups and fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19Use generic lists for events.Lukas Fleischer
Use the new generic list implementation instead of those insane "next" pointers in events. Includes some cleanups. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19Use generic lists for appointments.Lukas Fleischer
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>
2011-04-12Drop empty notes after editing.Lukas Fleischer
Keeping empty notes doesn't make sense here. Also, there doesn't seem to be a simple way to erase notes yet. This will make calcurse delete any notes that are empty (meaning that they are either 0-byte files or contain nothing but a newline character) when returning from the editor. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-05Compare pointers to "NULL" instead of "0".Lukas Fleischer
"bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03Remove dead assignments spotted by clang-analyzer.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14Overall indentation fixes.Lukas Fleischer
Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Update website links to match the new URL.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Update mail addresses to match the new mailing lists.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Remove date_sec2hour_str() from "utils.c".Lukas Fleischer
date_sec2hour_str() is superseded by date_sec2date_str() with "%H:%M" as date format string, so replace all invocations and remove that function from "utils.c". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03Remove CVS "$Id" headers.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03Fixed file permissions.Lukas Fleischer
2011-01-11Make parse_date accept several short forms.Lukas Fleischer
Short forms are only accepted in interactive mode (e.g. when using the "Go to" function, editing a recurrent item's end date, and so on). Samples: "1/1/30" for "01/01/2030", "26" for the 26th of the currently selected month/year or "3/1" for Mar 01 (or Jan 03, depending on the date format) of the currently selected year.
2010-03-20All headers gathered into a single one. Typedefs suppressed.Frederic Culot
2009-10-16Bugfix in the way time slices are filled.Frederic Culot
2009-10-08More work on the weekly calendar view.Frederic Culot
2009-07-12stdbool header removed, unsigned type used insteadFrederic Culot
2009-07-05Switch to BSD license.Frederic Culot
2009-01-03more code cleanupFrederic Culot