1130 Commits

Author SHA1 Message Date
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
Lukas Fleischer
94a5d4cb1b Fix default time format for multi-day appointments
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>
2012-05-21 12:10:51 +02:00
Lukas Fleischer
cfd8ede2b3 Switch to Linux kernel coding style
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-21 10:13:05 +02:00
Lukas Fleischer
47c52ae7bb src/utils.c: Disable canonical mode in press_any_key()
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>
2012-05-20 17:22:13 +02:00
Lukas Fleischer
6c11b8985c Fix data type of "general.firstdayofweek"
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>
2012-05-17 22:08:00 +02:00
Lukas Fleischer
dec97c7c81 doc/manual.txt: Update configuration options
Rename all configuration options in the manual to match the new naming
scheme. Also, update the default values of "general.systemdialogs" and
"general.progressbar".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 22:08:00 +02:00
Lukas Fleischer
7f68083027 Update configuration dialogs
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>
2012-05-17 22:07:44 +02:00
Lukas Fleischer
7c7c65d194 Document removal of the "-N" command line option
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>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
43282fcbee Document simple format specifiers
Add documentation for "--format"* to the manual and man page. See
commits 7f0c3003ac561a25eeb3c735b32e3ee312ef58c9 etc. for details.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
649231b083 doc/manual.txt: Document motion count prefixes
Displacement commands can be preceded by motion counts since commit
59e006e56d9f893506af56a4ca114fe53b537e49.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
6d88b330f2 doc/manual.txt: Update note file naming scheme
We are now using hash-based note file names instead of mkstemp() (cf.
commit 5c6a00ee93e54cc044aee5146e9fcfbcb732a2ee). Update the
documentation accordingly. Also, add a note on the garbage collector we
added in 8d71923d4f498c8d2fcb22a72346e3e77a7c4a5b.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
60ad4adb37 doc/manual.txt: Fix a couple of typos
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:03 +02:00
Lukas Fleischer
49d6e19a6b src/wins.c: Run editor and pager in a shell
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>
2012-05-16 19:31:48 +02:00
Lukas Fleischer
ce13b70c5a Allow passing additional parameters to shell_exec()
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-16 19:31:47 +02:00
Baptiste Jonglez
2951cf8320 Add dummy help for cut and paste
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>
2012-05-14 19:32:18 +02:00
Baptiste Jonglez
d6e551c1a5 Allow resize events while prompting the user
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>
2012-05-14 19:32:18 +02:00
Baptiste Jonglez
b17475128d Various fixes.
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-14 19:32:18 +02:00
Baptiste Jonglez
13d6f8703b Factorize boolean user prompting.
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>
2012-05-14 19:31:13 +02:00
Baptiste Jonglez
7d4ef08345 Use status_ask_choice() on more difficult cases
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-14 19:31:13 +02:00
Baptiste Jonglez
1d9c90bb18 Use status_ask_choice() where applicable
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-14 19:31:13 +02:00
Baptiste Jonglez
4087cd4e5e Use status_ask_simplechoice() where applicable
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:31:13 +02:00
Baptiste Jonglez
b2c92b2eb4 src/utils.c: Add a status_ask_simplechoice() function
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>
2012-05-14 19:31:12 +02:00
Baptiste Jonglez
f5dd276edb src/utils.c: Add a status_ask_choice() function
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>
2012-05-14 19:31:12 +02:00
Lukas Fleischer
6da787a5cc Declare several parameters/variables constant
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-08 21:50:05 +02:00
Lukas Fleischer
a20f36c5de src/args.c: Add "void" in some function declarations
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>
2012-05-08 21:49:59 +02:00
Baptiste Jonglez
f2c94fb19c src/args.c: Add a mention of "--read-only" in "calcurse --help"
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-02 17:11:23 +02:00
Baptiste Jonglez
6f80d84d5e Various code cleanup
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>
2012-05-02 17:11:19 +02:00
Baptiste Jonglez
0a352fe519 src/utils.c: Get rid of "semantic range checks" when parsing duration
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>
2012-05-02 17:11:13 +02:00
Baptiste Jonglez
6fd0ae2ea7 src/apoint.c: Change the status message displayed when editing a duration
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-05-02 17:10:58 +02:00
Lukas Fleischer
1691d562a3 src/htable.h: Add missing prototypes
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>
2012-04-21 11:22:50 +02:00
Lukas Fleischer
2c77124972 Add prototypes for hash table functions
These can be generated dynamically using the HTABLE_PROTOTYPE macro.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-21 11:22:50 +02:00
Lukas Fleischer
674f398ee9 src/mem.c: Skip dbg_*() if memory stats are disabled
These functions only need to be compiled if calcurse is built with
"--enable-memory-debug". Tell the preprocessor to strip them if memory
debugging/stats are disabled.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-21 11:05:38 +02:00
Lukas Fleischer
315b33540a Mark several functions static
These are not needed outside of the corresponding compilation units.
Spotted with "-Wmissing-prototypes".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-20 23:10:56 +02:00
Lukas Fleischer
0791eaabca Merge "%(start"{,str}")" and "%(end"{,str}")"
Add "default" and "epoch" extended formats for dates. "default" is the
same as "%H:%M", "epoch" prints the number of seconds since January 1,
1970.

Also, change the semantics of "%(start)" to return dates in default
format (same format that "%(startstr)" used to use before this patch).
The old "%(start)" behavior can be emulated by using "%(start:epoch)".
The same applies to "%(end)" and "%(endstr)".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-17 11:10:11 +02:00
Lukas Fleischer
b80c1f6364 Support extended date formats
Add support for appending a strftime()-style format string to "%(start)"
and "%(end)".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-17 11:10:11 +02:00
Lukas Fleischer
68b26ff854 Allow passing extended formats
Extended formats can be specified by adding custom format strings to the
end of a long format specifier, separated by a colon (":"). This feature
is currently unused. Extended format support for several format
specifiers will be added in following patches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-17 11:10:11 +02:00
Lukas Fleischer
b73ce859db Add support for long format specifiers
Adds following long format specifiers for each short format specifier:

* s: (start)
* S: (startstr)
* d: (duration)
* e: (end)
* E: (endstr)
* m: (message)
* n: (noteid)
* N: (note)
* p: (priority)

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-17 11:10:11 +02:00
Lukas Fleischer
cd4f8bb68f src/utils.c: Break out format specifier parsing
Move the format specifier parser to a separate function. This is done in
preparation for supporting long format specifiers.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-17 11:10:11 +02:00
Lukas Fleischer
45f2b76285 test/: Add a README
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Signed-off-by: Frederic Culot <frederic@culot.org>
Signed-off-by: Erik Saule <esaule@bmi.osu.edu>
2012-04-17 11:10:11 +02:00
Lukas Fleischer
ec12276079 src/calcurse.c: Start all helper threads in one go
Makes our initialization code a tad cleaner and seems to reduce flicker
when starting calcurse (the notification bar is no longer drawn before
other windows are shown).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-12 23:53:09 +02:00
Lukas Fleischer
691f8a6015 Refactor startup screen branch
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>
2012-04-12 23:43:20 +02:00
Lukas Fleischer
c65ccb0e77 Use percentage-based width for the sidebar
Use percentage-based widths internally. This slightly impairs (user)
feedback but brings the sidebar configuration menu closer to the actual
configuration format (the user now configures percentage-based widths,
not absolute width values). As a bonus, the sidebar is now resized
automatically on each window resize (based on the percentage values).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-12 23:11:33 +02:00
Lukas Fleischer
b4d5316125 src/mem.c: Fix putchar() parameter
putchar() expects a single character, not a string.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-06 23:51:13 +02:00
Lukas Fleischer
1c442e6aef Miscellaneous small code cleanups
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-06 23:23:58 +02:00
Lukas Fleischer
d0b0ed3c20 src/keys.c: Use generic list implementation
Be consistent and replace the custom linked list implementation we used
here by the generic list implementation we use everywhere else. This
reduces code complexity, while slightly improving memory overhead.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-05 23:47:14 +02:00
Lukas Fleischer
50be1a1772 Mark some more variables/parameters constant
Fixes a couple of warnings seen with GCC 4.7.

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