aboutsummaryrefslogtreecommitdiffstats
path: root/src/calcurse.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Make appearance.calendarview more explicit in config fileBaptiste Jonglez2012-05-311-0/+7
| | | | | | | | | | 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>
* Provide an array of available date input formatsBaptiste Jonglez2012-05-311-0/+1
| | | | | | | | 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-311-1/+4
| | | | | | | | | | | 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>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-481/+471
| | | | | | | | | | | | | | 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>
* Allow passing additional parameters to shell_exec()Lukas Fleischer2012-05-161-1/+1
| | | | | | | | 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>
* Factorize boolean user prompting.Baptiste Jonglez2012-05-141-1/+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>
* src/utils.c: Add a status_ask_simplechoice() functionBaptiste Jonglez2012-05-141-0/+1
| | | | | | | | | | 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-141-0/+1
| | | | | | | | | | | | | | | | | 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-081-51/+52
| | | | | | | | | | | | 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>
* Refactor startup screen branchLukas Fleischer2012-04-121-1/+1
| | | | | | | Removes the pointless first parameter to io_startup_screen() and saves one wins_update() call if system dialogs are disabled. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Miscellaneous small code cleanupsLukas Fleischer2012-04-061-0/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Mark some more variables/parameters constantLukas Fleischer2012-04-051-3/+3
| | | | | | Fixes a couple of warnings seen with GCC 4.7. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix semantics of "general."{systemdialogs,progressbar}Lukas Fleischer2012-03-291-2/+2
| | | | | | | | | These were renamed from "skip_"* to *. However, we only changed syntax and didn't invert their semantic meaning. Fix this by negating the semantics of those variables. Also, negate these in the configuration file automatically when running `calcurse-upgrade`. 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>
* Do not strncpy() strings returned by gettext()Lukas Fleischer2012-03-121-4/+4
| | | | | | | | Translated strings returned by gettext() are statically allocated. There's no need to copy them to a buffer, we can use the pointers returned by gettext() instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Get rid of string structuresLukas Fleischer2012-03-121-6/+0
| | | | | | | | These were only used to construct constant strings with additional length fields. However, we can just use standard constant character arrays instead and let the compiler calculate the string length. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Break out configuration main menuLukas Fleischer2012-03-021-0/+1
| | | | | | | This was the only big block of code left in our main loop. Move it to a separate function, making the main loop a bit clearer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Revamp key bindings displayLukas Fleischer2012-03-021-1/+2
| | | | | | | | | | | | | Refactor the logic inside keys_display_bindings_bar() and remove the need to place the "show next page" key binding at the right positions. This used to be a pain to maintain, since we always had to move key bindings around when introducing a new key. Fix this by passing the actual key bindings in an array and using a separate parameter for the "show next page" key binding (which is automatically inserted at the right places from now on). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a read-only optionLukas Fleischer2012-02-241-0/+1
| | | | | | | We don't save any configuration nor items if this is set. This should be used with care, and hence there's no short option for this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Split note file generation into separate functionLukas Fleischer2012-01-171-0/+1
| | | | | | | We currently use this in one place only but might reuse this a couple of times later (when migrating to libical). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Break out different import/export formatsLukas Fleischer2012-01-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | Extract iCal and pcal import/export routines into separate files. This reduces complexity of the super huge "io.c" source file and makes it easier to follow changes that affect the iCal and pcal routines only (commits affecting both formats are very uncommon). Before: $ wc -l src/io.c 2938 src/io.c After: $ wc -l src/{io,ical,pcal}.c 1445 src/io.c 1263 src/ical.c 317 src/pcal.c 3025 total Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/utils.c: Mark is_all_digit() parameter constLukas Fleischer2011-12-091-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Extract config file handlers into a separate fileLukas Fleischer2011-12-091-2/+5
| | | | | | | | We used custom_load_conf() to load the configuration file and io_save_conf() to save configuration. Move these functions, including all helpers, to a central location. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a dynamic method to print todo items to stdoutLukas Fleischer2011-11-141-0/+1
| | | | | | | | | | | | This goes in line with the other commits adding print_*() support. Following format specifiers are allowed: * p: Print the priority of the item * m: Print the description of the item * n: Print the name of the note file belonging to the item Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Remove apoint_recur_s2apoint_s()Lukas Fleischer2011-11-141-1/+0
| | | | | | | This one is hackish, obsolete and no longer used by any other function. Drop it! Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a dynamic method to print recurrent items to stdoutLukas Fleischer2011-11-141-0/+3
| | | | | | | | | Add print_recur_apoint() and print_recur_event() helper functions to print recurrent items to stdout and use them everywhere. Currently, these are only wrapper functions to print_apoint() and print_event() that create temporary, non-recurrent items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a dynamic method to print events to stdoutLukas Fleischer2011-11-141-0/+1
| | | | | | | | | | | | | Add a flexible helper function print_event() and use it whenever we print events to stdout. This reduces the number of copy-pasted code and eventually allows for specifying custom format strings. Following format specifiers are supported: * m: Print the description of the item * n: Print the name of the note file belonging to the item Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a dynamic method to print appointments to stdoutLukas Fleischer2011-11-141-0/+1
| | | | | | | | | | | | | | | | | | Add a flexible helper function print_apoint() and use it whenever we print appointments to stdout. This reduces the number of copy-pasted code and eventually allows for specifying custom format strings. Following format specifiers are supported: * s: Print the start time of the appointment as UNIX time stamp * S: Print the start time of the appointment using the "hh:mm" format * d: Print the duration of the appointment in seconds * e: Print the end time of the appointment as UNIX time stamp * E: Print the end time of the appointment using the "hh:mm" format * m: Print the description of the item * n: Print the name of the note file belonging to the item 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-14/+15
| | | | | | | 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>
* Merge branch 'maint'Lukas Fleischer2011-11-111-0/+3
|\ | | | | | | | | | | Conflicts: src/calcurse.h src/io.c
| * Do not hardcode paths to the default editor/pagerLukas Fleischer2011-10-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "vi" instead of "/usr/bin/vi" and "less" instead of "/usr/bin/less". Hardcoding absolute paths is a bad idea: $ uname -rsv Linux 3.0-ARCH #1 SMP PREEMPT Tue Aug 30 07:32:23 UTC 2011 $ which less /bin/less The "$PATH" environment variable will almost always have a better idea of where these binaries are located. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not cast unused return values to voidLukas Fleischer2011-11-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 unnecessary start time calculationsLukas Fleischer2011-10-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Pass item durations to recur_item_inday()Lukas Fleischer2011-10-211-1/+2
| | | | | | | | | | | | | | | | Having item's durations eventually allows for better parsing of recurrent appointments as we might be interested in how many days are covered by a multi-day appointment. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/utils.c: Remove check_time()Lukas Fleischer2011-10-061-1/+0
| | | | | | | | | | | | | | Now that parse_time() and parse_duration() do all the validation work, this isn't used (nor needed) any longer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/utils.c: Introduce parse_{time,duration}()Lukas Fleischer2011-10-061-0/+2
| | | | | | | | | | | | | | | | | | These helpers can be used in a fashion similar to parse_date(). In addition to check_time(), parse_time() and parse_duration() support short forms such as "23:" (instead of "23:00") and ":45" (instead of "00:45"). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/calcurse.h: Rework date manipulation constantsLukas Fleischer2011-10-061-5/+13
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/utils.c: Mark input string of parse_date() constLukas Fleischer2011-10-061-1/+1
| | | | | | | | | | | | | | We don't mess about with the date string here, so it should be declared const. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add count buffer to keys_getch()Lukas Fleischer2011-10-061-1/+1
| | | | | | | | | | | | | | | | Key commands can be prefixed with a natural number - keys_getch() will store this number in the buffer pointed to by the second parameter. Set this parameter to NULL to disable count prefixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add count parameter to *_{in,de}crease()Lukas Fleischer2011-10-061-6/+6
| | | | | | | | | | | | | | | | | | 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>
* | src/calendar.c: Add a count parameter to calendar_move()Lukas Fleischer2011-10-061-1/+1
| | | | | | | | | | | | | | | | | | Allows for moving more than one step forward/backward. This is not used anywhere yet but a key binding will likely be added in one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Avoid unnecessary window updatesLukas Fleischer2011-10-061-3/+10
| | | | | | | | | | | | | | | | Add a window bitmask to wins_update() and only update windows that might actually require an update in our main loop. This improves response times of the user interface a bit. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to run the GC on exitLukas Fleischer2011-10-051-0/+1
| | | | | | | | | | | | | | | | If "auto_gc" is enabled, the garbage collector for note files will be run on every exit. As this is an experimental feature and may cause data loss, this is disabled by default. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add a garbage collector for note filesLukas Fleischer2011-10-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Now that we use hashes to identify notes, a garbage collector comes in handy. We search for note files that aren't referenced anywhere. Such files might come up if a note, that isn't connected with any other item, is edited. Huge parts of this code are very hackish due to our data structure layout and the way our hash table implementation works. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not unlink() note files on note removalLukas Fleischer2011-10-051-6/+5
| | | | | | | | | | | | | | | | | | | | 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>
* | Accept variable length note namesLukas Fleischer2011-10-051-1/+2
| | | | | | | | | | | | | | | | Read up to the first blank in note_read() instead of assuming a fixed-width note file name. Accept everything up to 40 characters (which is the length of a SHA1 hash in hexadecimal representation). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor out note deserializationLukas Fleischer2011-10-051-0/+1
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add a copy file routineLukas Fleischer2011-10-051-0/+1
| | | | | | | | | | | | | | | | Add io_file_cp() which can be used to copy an existing source file to another location. We will need this for our new hash-based note file names. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to notify all appointmentsLukas Fleischer2011-07-311-0/+1
| | | | | | | | | | | | | | | | If "notify-all" is enabled, all non-flagged appointments will be notified (instead of flagged ones). This is useful for users that want to be notified of everything. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>