1477 Commits

Author SHA1 Message Date
Lukas Fleischer
244b6c927d Make day_store_items() public
Remove the "static" keyword from day_store_items(), so that it is
accessible from other compilation units. Also, allow for discarding the
event/appointment counters by passing NULL pointers and move the
"regex.h" header inclusion to "calcurse.h".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:34 +02:00
Lukas Fleischer
1f2fe16a84 day_store_*(): Add regular expression filter parameter
Allows to filter stored items using a regular expression. This is
currently unused but can be used to implement a filter in interactive
mode and will also be needed when we switch to using day_store_items()
in non-interactive mode.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:34 +02:00
Lukas Fleischer
75dd5eb037 Do not re-fetch items in day_*_{item,note}()
We can access these using the pointer field of the generic item
structure now -- there's no need to search for these twice any more.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:34 +02:00
Lukas Fleischer
75d0c4dc17 Remove the need for the "day_saved_item" struct
Do not store the currently selected item in day_write_pad() -- use
day_get_item() and apoint_hilt() in day_popup_item() instead.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:34 +02:00
Lukas Fleischer
920875d7cb Simplify display_item*()
Pass the generic item container instead of individual fields to
display_item() and display_item_date(). This reduces some code
duplication and cleans up day_write_pad() a bit.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:34 +02:00
Lukas Fleischer
80e24954c2 Simplify recur_apoint_switch_notify()
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>
2012-06-30 14:34:33 +02:00
Lukas Fleischer
52bfc54333 Rework generic item container
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>
2012-06-30 14:34:33 +02:00
Lukas Fleischer
cbc5d46880 test/data/apts: Add a fair bit of items to 01/01/1902
This might turn out to be useful if we want to do performance tests and
check what happens if a day with a large amount of items is processed.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:33 +02:00
Lukas Fleischer
6b6067a53b Release 3.0.0
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 13:27:33 +02:00
Lukas Fleischer
41f70382bd src/config.c: Fix parsing an unset color theme
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>
2012-06-30 13:25:49 +02:00
Lukas Fleischer
82d86ad7c7 Fix compilation with NLS disabled
* 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>
2012-06-30 12:34:54 +02:00
Lukas Fleischer
681a63ea76 po/: Translation updates from Transifex
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-24 01:25:54 +02:00
Lukas Fleischer
e08809bef8 po/calcurse.pot: Update message catalog
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-24 01:11:53 +02:00
Lukas Fleischer
ed55cdcb16 src/args.c: Fix bugs address in usage message
* 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>
2012-06-18 17:49:04 +02:00
Lukas Fleischer
b8393ef948 src/help.c: Add missing _()
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>
2012-06-18 00:15:29 +02:00
Lukas Fleischer
78c460a246 src/keys.c: Fix help strings for generic-{cut,paste}
Reported-by: rafael ff1 <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-18 00:09:40 +02:00
Lukas Fleischer
1d74966a60 src/keys.c: Add vim-style default bindings for generic-*
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>
2012-06-13 00:16:55 +02:00
Lukas Fleischer
cabc22e032 Add key bindings to go to the previous/next month/year
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>
2012-06-13 00:12:32 +02:00
Lukas Fleischer
42c486d30d Rename displacement enumeration elements
* 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>
2012-06-13 00:12:27 +02:00
Lukas Fleischer
844d35e851 calcurse-upgrade: Create a backup before upgrading
Make sure the user doesn't end up in a configuration file being totally
broken if the upgrade script fails unexpectedly. The backup file is
removed if the conversion completed successfully.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-10 11:47:18 +02:00
Lukas Fleischer
fa1f0a5c44 calcurse-upgrade: Display error if temp file exists
Instead of bailing out without any hint, show an error message if the
temporary file we use in calcurse-upgrade already exists.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 16:07:48 +02:00
Lukas Fleischer
f44b307e22 calcurse-upgrade: Change location of temporary file
Instead of creating the temporary file in a central location, place it
in the same directory as the configuration file. Pros:

* No need to rely on the "$TMPDIR" environment variable.

* Multiple users can upgrade their configuration files at the same time,
  even if "$!" isn't set properly.

* One user can upgrade several configuration files (in different
  directories or with different file names) at once.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 16:07:48 +02:00
Lukas Fleischer
1022781821 calcurse-upgrade: Add "-h" and "-v" options
Add "-h"/"--help" options to print a usage message and "-v"/"--version"
to print the current version.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 16:07:48 +02:00
Lukas Fleischer
9be3a9c1f0 scripts/: Add support for placeholders
Allow for specifying placeholders in shell scripts that are replaced
during build time. Predefine a "@PACKAGE_VERSION@" placeholder that is
replaced with the current version number. Also, rename all shell scripts
to ".sh.in".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 16:07:46 +02:00
Lukas Fleischer
2afa0db66f calcurse-upgrade: Error out on unknown option
Display an error message and bail out if an invalid command line option
is passed.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 15:51:00 +02:00
Lukas Fleischer
0d50e4539f scripts/calcurse-upgrade.sh: Fix POSIX compatibility
* Split sed(1) one-liners into multiple lines. POSIX sed(1) doesn't
  allow separating functions by semicolons.

* Escape a newline in the awk(1) script. POSIX awk(1) only allows
  non-escaped line breaks in specific contexts.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 15:50:57 +02:00
Lukas Fleischer
6e490e979c src/sigs.c: Define "_BSD_SOURCE" and "__BSD_VISIBLE"
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>
2012-06-01 11:21:46 +02:00
Lukas Fleischer
8ee853b748 po/: Translation updates from Transifex
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 00:42:28 +02:00
Lukas Fleischer
0bc63d97ab po/: Add Portuguese (Brazil) translation
Thanks-to: Rafael Ferreira <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 00:34:00 +02:00
Lukas Fleischer
c9163c92de po/calcurse.pot: Update message catalog
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 00:33:49 +02:00
Lukas Fleischer
6139235488 src/custom.c: Mark sidebar help string "no-c-format"
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>
2012-06-01 00:03:58 +02:00
Lukas Fleischer
3e1e82cdeb test/data/conf: Update with recent changes
Update the value of "appearance.calendarview" used in the default
configuration file of our test suite (we now use "monthly"/"weekly"
instead of integer values). Late fix for what we broke in commit
2c5235cca70bf1c5b5e92dd5b6b178ab13b695f2.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-31 22:06:51 +02:00
Baptiste Jonglez
2c5235cca7 Make appearance.calendarview more explicit in config file
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>
2012-05-31 20:45:42 +02:00
Baptiste Jonglez
f7a88a5515 Use our array of available date input formats
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-31 20:42:23 +02:00
Baptiste Jonglez
9adacec623 Provide an array of available date input formats
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>
2012-05-31 20:42:23 +02:00
Baptiste Jonglez
9e1185f526 Give a meaning to DATE_FORMATS
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>
2012-05-31 20:42:15 +02:00
Baptiste Jonglez
7eb3abb08a src/custom.c: Use status_ask_simplechoice()
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>
2012-05-31 20:30:46 +02:00
Baptiste Jonglez
72995601e7 Directly use fprintf() where applicable
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>
2012-05-31 20:30:46 +02:00
Baptiste Jonglez
4b58b0938f src/day.c: Fix typo
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-31 20:30:46 +02:00
Baptiste Jonglez
4c4d4d3eb3 Use mvwaddstr() instead of mvwprintw()
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>
2012-05-31 20:27:43 +02:00
Lukas Fleischer
bc7c0be84c src/config.c: Bail out on incomplete directive
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>
2012-05-29 21:00:39 +02:00
Baptiste Jonglez
b5a911421f Fix incorrect i18n usage for some strings
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>
2012-05-25 13:28:26 +02:00
Lukas Fleischer
1019be7cce po/POTFILES.in: Add missing source files
We forgot to add these when splitting existing or creating new source
files.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 23:17:03 +02:00
Lukas Fleischer
6898a9dcf1 Do not localize configuration options
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>
2012-05-23 23:09:55 +02:00
Lukas Fleischer
f5efea85a6 Merge branch 'maint'
Conflicts:
	src/io.c
	src/notify.c
	src/utils.c
2012-05-23 22:26:05 +02:00
Lukas Fleischer
7fa1f0e2aa Add localization to calcurse-upgrade
* Use gettext in "scripts/calcurse-upgrade".

* Add "scripts/calcurse-upgrade" to "po/POTFILES.in".

* Rename "scripts/calcurse-upgrade" to "scripts/calcurse-upgrade.sh" to
  make sure xgettext(1) detects the correct input file format.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 17:25:41 +02:00
Lukas Fleischer
de114ce437 scripts/calcurse-upgrade: Add debug output
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 16:41:47 +02:00
Lukas Fleischer
7bec0d47ee scripts/calcurse-upgrade: Add a "--config" option
This allows for specifying an alternate configuration file which is
useful if you use a non-default data directory.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 16:31:02 +02:00
Lukas Fleischer
61472a32cd scripts/calcurse-upgrade: Set "-e"
From the set(1p) man page:

  When this option is on, if a simple command fails for any of the
  reasons listed in Consequences of Shell Errors or returns an exit
  status value >0, and is not part of the compound list following a
  while, until, or if keyword, and is not a part of an AND or OR list,
  and is not a pipeline preceded by the ! reserved word, then the shell
  shall immediately exit.

This allows us to remove all the "|| exit 1" statements we used to bail
out if one command fails.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 16:12:24 +02:00
Lukas Fleischer
9719de8ea3 Document extended format specifiers
Add documentation for extended format specifiers (which were introduced
in 68b26ff85415ee687b082fbd5150de58cdce0935) to the man page and the
manual. Add a note about strftime()-style extended formats for
"%(start)" and "%(end)".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 02:04:59 +02:00