summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Simplify recur_apoint_switch_notify()Lukas Fleischer2012-06-303-11/+3
| | | | | | | | | 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>
* Rework generic item containerLukas Fleischer2012-06-303-90/+134
| | | | | | | | | Instead of copying all members of the individual item structures to a generic structure containing all fields, create compulsory fields only and set up a pointer to the actual item. This results in lower memory footprint and lets us clean up some code. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Fix parsing an unset color themeLukas Fleischer2012-06-301-1/+5
| | | | | | | | | If color support is disabled, the color theme configuration value is set to "0" or "none", which is a value we no longer accepted since commit a5486605696f92a749277d49c77bb5b194dc67a5. Re-introduce the branch that checks for an unset color theme before actually parsing it. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix compilation with NLS disabledLukas Fleischer2012-06-302-0/+5
| | | | | | | * src/utils.c: Only call setlocale() if NLS is enabled. * src/calcurse.h: Define a fallback macro ngettext() if NLS is disabled. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/args.c: Fix bugs address in usage messageLukas Fleischer2012-06-181-12/+11
| | | | | | | | | | | * Point out that bug reports should be sent to the bugs mailing list, not to misc in help and usage messages. * Call more_info() when displaying the help message instead of copy-pasting strings to avoid double translation. Reported-by: rafael ff1 <rafael.f.f1@gmail.com> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/help.c: Add missing _()Lukas Fleischer2012-06-181-1/+1
| | | | | | | Add a missing gettext wrapper. This string should be translated. Reported-by: rafael ff1 <rafael.f.f1@gmail.com> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/keys.c: Fix help strings for generic-{cut,paste}Lukas Fleischer2012-06-181-2/+2
| | | | | Reported-by: rafael ff1 <rafael.f.f1@gmail.com> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/keys.c: Add vim-style default bindings for generic-*Lukas Fleischer2012-06-131-4/+4
| | | | | | | | | | Add vim-style key bindings for generic-prev-day, generic-next-day, generic-prev-week and generic-next-week in a fashion similar to what we use for generic-*-month and generic-*-year. The key "t"/"T" for generic-prev-day/generic-next-day is somewhat less than perfect but this is okay given that we're running out of keys... Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add key bindings to go to the previous/next month/yearLukas Fleischer2012-06-136-4/+88
| | | | | | | | | | In addition to generic key bindings for moving one day (week) forward/backward, define similar bindings for moving a month or a year. Of course, count prefixes are allowed here as well. Also add status bar hints and help texts. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename displacement enumeration elementsLukas Fleischer2012-06-136-45/+44
| | | | | | | | | | * Rename "LEFT" to "DAY_PREV", "RIGHT" to "DAY_NEXT", "UP" to "WEEK_PREV" and "DOWN" to "WEEK_NEXT" to reflect the semantics of these operations. Remove the unneeded "MOVES" element. * Reorder code to improve consistency. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/sigs.c: Define "_BSD_SOURCE" and "__BSD_VISIBLE"Lukas Fleischer2012-06-011-0/+10
| | | | | | | | | | | | | | | | | | | SIGWINCH isn't POSIX-compatible and causes a compile error on several platforms, such as OpenBSD: sigs.c: In function 'generic_hdlr': sigs.c:63: error: 'SIGWINCH' undeclared (first use in this function) sigs.c:63: error: (Each undeclared identifier is reported only once sigs.c:63: error: for each function it appears in.) sigs.c: In function 'sigs_init': sigs.c:97: error: 'SIGWINCH' undeclared (first use in this function) *** Error code 1 Define "_BSD_SOURCE" explicitly in this compilation unit to enforce definition of the "SIGWINCH" constant. Also, set "__BSD_VISIBLE" to 1 since FreeBSD doesn't honor "_BSD_SOURCE". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/custom.c: Mark sidebar help string "no-c-format"Lukas Fleischer2012-06-011-0/+1
| | | | | | | | This one was incorrectly detected as C format string due to the literal percent sign ("%") contained in the message. Add a comment that explicitly marks it as non-format string to avoid translation issues. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make appearance.calendarview more explicit in config fileBaptiste Jonglez2012-05-313-9/+20
| | | | | | | | | | Instead of using 0 or 1 as a value for `appearance.calendarview`, introduce the more explicit "monthly" and "weekly". Also update `scripts/calcurse-upgrade.sh` to reflect the change. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use our array of available date input formatsBaptiste Jonglez2012-05-311-10/+3
| | | | | Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Provide an array of available date input formatsBaptiste Jonglez2012-05-312-0/+9
| | | | | | | | This will allow to fix the current hardcoding of strings describing date input formats in multiple places. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Give a meaning to DATE_FORMATSBaptiste Jonglez2012-05-313-3/+6
| | | | | | | | | | | It's a bit weird to consider DATE_FORMATS as part of the date input format enum, all the more so as it does not even represent the number of available formats (since those are numbered from 1). Turn DATE_FORMATS into the number of available date input formats. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/custom.c: Use status_ask_simplechoice()Baptiste Jonglez2012-05-311-11/+14
| | | | | | | | | | | | | This eases up i18n somewhat, since the various date format available are used on other places as well, and thus need to be translated only once. Note that this commit incidentally fixes a small bug introduced by 38912b36: the user was able to set the date input format to a number between 1 and 5, while there are only 4 such formats available. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Directly use fprintf() where applicableBaptiste Jonglez2012-05-311-12/+4
| | | | | | | | | | For some reasons, we were using snprintf() to format a string into a buffer, and then displaying this buffer to stdout using fputs(). That's exactly what fprintf() is here for, so use it. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/day.c: Fix typoBaptiste Jonglez2012-05-311-1/+1
| | | | | Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use mvwaddstr() instead of mvwprintw()Baptiste Jonglez2012-05-317-80/+75
| | | | | | | | | | | | | When we only want to display a string at a specific place of the screen, there's no need to use the more complex mvwprintw(), use mvwaddstr() instead. This should be slightly more efficient, and, above all, it prevents weird things to happen if our string contains a '%', being interpreted as an unwanted format string. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Bail out on incomplete directiveLukas Fleischer2012-05-291-0/+3
| | | | | | | | | | Fixes a segmentation fault that arose if a line in the configuration file didn't contain a value/key separator ("="). Instead of operating on a NULL pointer, throw an error message containing the erroneous directive and bail out. Reported-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix incorrect i18n usage for some stringsBaptiste Jonglez2012-05-256-22/+22
| | | | | | | | | | | Some strings are initialized without wrapping them in _(); instead, _() is applied on the variable when it is used. This is incorrect, since these strings don't get added to the catalog. Fix that by applying _() only once, when the string is declared. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not localize configuration optionsLukas Fleischer2012-05-232-18/+18
| | | | | | | | | The configuration options shown in the configuration menu are meant to reflect the keys used in the configuration file. The descriptions displayed alongside each option should be sufficient for non-English speakers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2012-05-233-3/+10
|\ | | | | | | | | | | | | Conflicts: src/io.c src/notify.c src/utils.c
| * Do not localize dates in pcal exportsLukas Fleischer2012-05-192-1/+8
| | | | | | | | | | | | | | | | | | * Do not localize the word "week" in pcal export headers. * Reset current locale before formatting dates in pcal export data. Addresses BUG#1. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * src/notify.c: Fix printf() misuseLukas Fleischer2012-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Make sure we actually copy the notification warning interval to the correct buffer instead of printing it to stdout (using an arbitrary format string). This makes sure the current warning interval is shown when editing the field and also eliminates a potential format string vulnerability. Spotted with "-Wformat-nonliteral". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Fix default time format for multi-day appointmentsLukas Fleischer2012-05-211-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of commit 0791eaabca0fb1ef8a8675e47d701bbcde4d4a3f, we use strftime() instead of apoint_sec2str() to format start and end dates of appointments. "%H:%M" is the default strftime() format string used to simulate apoint_sec2str(). However, apoint_sec2str() additionally checks for intersection with the current day and displays "..:.." instead of the actual time if the item doesn't start (end) at the current day. Add an additional check to the new default time format and recreate the old behavior for items starting before or ending after the current day. Fixes BUG#3. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Switch to Linux kernel coding styleLukas Fleischer2012-05-2132-10660/+9174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | src/utils.c: Disable canonical mode in press_any_key()Lukas Fleischer2012-05-201-0/+10
| | | | | | | | | | | | | | | | | | Use tcsetattr() to disable canonical mode in press_any_key() before waiting for a key press. This makes sure that input is available immediately (instead of line by line). Also, disable echoing until a key is pressed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Fix data type of "general.firstdayofweek"Lukas Fleischer2012-05-172-16/+19
| | | | | | | | | | | | | | | | | | | | | | This option wasn't converted to a proper data type when it was renamed from "week_begins_on_monday" to "general.firstdayofweek". Convert the boolean option into an enumeration type that can take the values "monday" and "sunday". Also, update the documentation, add a conversion rule to the upgrade script and convert the configuration file used in the test suite. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Update configuration dialogsLukas Fleischer2012-05-172-24/+24
| | | | | | | | | | | | | | Rename the configuration options shown in the configuration dialogs to match the new naming scheme used in the configuration file. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Document removal of the "-N" command line optionLukas Fleischer2012-05-171-4/+1
| | | | | | | | | | | | | | This option was removed in 6b95f7b67dc8e29072fed4e05efa450422661348. Update the usage message, the man page and the manual accordingly. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/wins.c: Run editor and pager in a shellLukas Fleischer2012-05-161-1/+1
| | | | | | | | | | | | | | | | | | This allows for specifying an editor or a pager with additional command line parameters, such as "vim -e". Instead of interpreting "vim -e" as an executable file, we leave it to the shell to tokenize and parse the editor command now. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Allow passing additional parameters to shell_exec()Lukas Fleischer2012-05-164-6/+45
| | | | | | | | | | | | | | | | 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>
* | Add dummy help for cut and pasteBaptiste Jonglez2012-05-141-0/+4
| | | | | | | | | | | | | | | | It looks like cutting and pasting are only half-implemented: this only avoids a segfault when trying to get help on these functions. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Allow resize events while prompting the userBaptiste Jonglez2012-05-141-1/+6
| | | | | | | | | | | | | | | | | | | | When asking the user to choose between multiple alternatives, properly handle resize events. Note that we would also need to do so in getstring()... Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Various fixes.Baptiste Jonglez2012-05-142-3/+3
| | | | | | | | | | | | | | 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>
* | Factorize boolean user prompting.Baptiste Jonglez2012-05-146-35/+19
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Use status_ask_choice() on more difficult casesBaptiste Jonglez2012-05-142-38/+87
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Use status_ask_choice() where applicableBaptiste Jonglez2012-05-142-40/+42
| | | | | | | | | | | | | | These cases make obvious candidates for factorisation. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use status_ask_simplechoice() where applicableBaptiste Jonglez2012-05-141-33/+30
| | | | | | | | | | Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/utils.c: Add a status_ask_simplechoice() functionBaptiste Jonglez2012-05-142-0/+34
| | | | | | | | | | | | | | | | | | | | We need a simpler version, based on the previously defined `status_ask_choice()` function, that asks to choose amongst a number of alternatives that can simply enumerated, without needing to bind keys on them. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/utils.c: Add a status_ask_choice() functionBaptiste Jonglez2012-05-142-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function allows the user to choose between various alternatives, each one being associated to a given key. This will allow a great deal of factorisation, which will make it easier to handle special events (like resizing, user escape...) in an uniform manner. The cool part of the approach taken here is that it allows full i18n (i.e. the key bound to an alternative can be different depending on the language), at the expense of a somewhat less readable code on the caller side. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Declare several parameters/variables constantLukas Fleischer2012-05-0817-122/+125
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | src/args.c: Add "void" in some function declarationsLukas Fleischer2012-05-081-4/+4
| | | | | | | | | | | | | | | | | | These functions don't take any parameters, "void" is the right parameter signature to use here. Fixes some warnings seen with "-Wstrict-prototypes". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/args.c: Add a mention of "--read-only" in "calcurse --help"Baptiste Jonglez2012-05-021-1/+4
| | | | | | | | | | Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Various code cleanupBaptiste Jonglez2012-05-021-11/+3
| | | | | | | | | | | | | | | | Remove obsolete bits of code that weren't thrown away by b5c1981; simplify some others areas of the code. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/utils.c: Get rid of "semantic range checks" when parsing durationBaptiste Jonglez2012-05-021-13/+0
| | | | | | | | | | | | | | | | | | | | Don't restrict ranges when entering durations. We now accept duration like "+1d42h600m". This might not seem very logical, but it's perfectly valid, and being able to enter "+36h" is useful when you don't want to do the maths yourself. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/apoint.c: Change the status message displayed when editing a durationBaptiste Jonglez2012-05-021-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | src/htable.h: Add missing prototypesLukas Fleischer2012-04-211-1/+5
| | | | | | | | | | | | | | | | | | | | We only generated prototypes for a small subset of all supported functions in the HTABLE_PROTOTYPE macro. Add missing prototypes to allow for accessing corresponding functions if HTABLE_GENERATE is used in a separate compilation unit. This also fixes a couple of compiler warnings seen with "-Wmissing-prototypes". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>