From d56a0ad492604eb310ca852a639f2e4f22a702d3 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 3 Mar 2016 21:20:24 +0100 Subject: [PATCH] The format(s) of the contacts list is now exported to display.properties --- src/be/nikiroo/jvcard/Contact.java | 2 +- .../nikiroo/jvcard/resources/colors.properties | 2 +- .../nikiroo/jvcard/resources/display.properties | 12 ++++++++++++ .../jvcard/resources/resources.properties | 2 ++ .../jvcard/resources/resources_en.properties | 2 ++ .../jvcard/resources/resources_fr.properties | 3 +++ .../nikiroo/jvcard/tui/panes/ContactList.java | 17 +++++++++++------ 7 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 src/be/nikiroo/jvcard/resources/display.properties diff --git a/src/be/nikiroo/jvcard/Contact.java b/src/be/nikiroo/jvcard/Contact.java index 8142c29..3289939 100644 --- a/src/be/nikiroo/jvcard/Contact.java +++ b/src/be/nikiroo/jvcard/Contact.java @@ -182,7 +182,7 @@ public class Contact { * The format is basically a list of field names separated by a pipe and * optionally parametrised. The parameters allows you to: * diff --git a/src/be/nikiroo/jvcard/resources/colors.properties b/src/be/nikiroo/jvcard/resources/colors.properties index c57a99e..3fe44b7 100644 --- a/src/be/nikiroo/jvcard/resources/colors.properties +++ b/src/be/nikiroo/jvcard/resources/colors.properties @@ -1,7 +1,7 @@ # application colours # # Note that you can define a colour in one of those 3 ways: -# - WHITE: one of the ANSI colour names, in uppercase +# - WHITE: one of the ANSI colour names, in upper case # - @RRGGBB: a RGB code we will try to match using one of the 256 Terminal colours # - #RRGGBB: an exact RGB colour (please make sure your terminal supports this) # diff --git a/src/be/nikiroo/jvcard/resources/display.properties b/src/be/nikiroo/jvcard/resources/display.properties new file mode 100644 index 0000000..d03d45b --- /dev/null +++ b/src/be/nikiroo/jvcard/resources/display.properties @@ -0,0 +1,12 @@ +# display options configuration + +# The contact list format is basically a list of VCF field names +# separated by a pipe and optionally parametrised. +# The parameters allows you to: +# - @x: (the 'x' is the letter 'x') show only a present/not present info +# - @n: limit the size to a fixed value 'n' +# - @+: expand the size of this field as much as possible +# +# You can cycle through them if you have more than one +# (in this case, separate them with a comma (',') +CONTACT_LIST_FORMAT = NICKNAME@10|FN@+|EMAIL@30|PHOTO@x,FN@+|EMAIL@40 diff --git a/src/be/nikiroo/jvcard/resources/resources.properties b/src/be/nikiroo/jvcard/resources/resources.properties index dce79cc..14428ea 100644 --- a/src/be/nikiroo/jvcard/resources/resources.properties +++ b/src/be/nikiroo/jvcard/resources/resources.properties @@ -1,4 +1,6 @@ # English translation file (UTF-8) +# Note that any key can be doubled with a _NOUTF suffix +# to use when the flag --noutf is passed # those 2 keys MUST be 3-characters long KEY_TAB = TAB diff --git a/src/be/nikiroo/jvcard/resources/resources_en.properties b/src/be/nikiroo/jvcard/resources/resources_en.properties index 7195460..afd62a8 100644 --- a/src/be/nikiroo/jvcard/resources/resources_en.properties +++ b/src/be/nikiroo/jvcard/resources/resources_en.properties @@ -1,4 +1,6 @@ # default translation file (UTF-8) +# Note that any key can be doubled with a _NOUTF suffix +# to use when the flag --noutf is passed # those 2 keys MUST be 3-characters long KEY_TAB = TAB diff --git a/src/be/nikiroo/jvcard/resources/resources_fr.properties b/src/be/nikiroo/jvcard/resources/resources_fr.properties index 260a56b..609beaf 100644 --- a/src/be/nikiroo/jvcard/resources/resources_fr.properties +++ b/src/be/nikiroo/jvcard/resources/resources_fr.properties @@ -1,4 +1,7 @@ # French translation file (UTF-8) +# Note : les clefs peuvent être suffixées de _NOUTF +# pour forcer une autre version quand le flag --noutf +# est passé au programme # les deux touches qui suivent DOIVENT faire 3 caractères de long KEY_TAB = TAB diff --git a/src/be/nikiroo/jvcard/tui/panes/ContactList.java b/src/be/nikiroo/jvcard/tui/panes/ContactList.java index ae1a65b..6287a69 100644 --- a/src/be/nikiroo/jvcard/tui/panes/ContactList.java +++ b/src/be/nikiroo/jvcard/tui/panes/ContactList.java @@ -7,6 +7,7 @@ import java.util.List; import be.nikiroo.jvcard.Card; import be.nikiroo.jvcard.Contact; import be.nikiroo.jvcard.i18n.Trans; +import be.nikiroo.jvcard.resources.Bundles; import be.nikiroo.jvcard.tui.KeyAction; import be.nikiroo.jvcard.tui.UiColors; import be.nikiroo.jvcard.tui.KeyAction.DataType; @@ -20,14 +21,18 @@ public class ContactList extends MainContentList { private List contacts; private String filter; - private List formats = new LinkedList(); - private int selectedFormat = -1; - private String format = ""; + private List formats; + private int selectedFormat; + private String format; public ContactList(Card card) { - // TODO: should get that in an INI file - formats.add("NICKNAME@3|FN@+|EMAIL@30"); - formats.add("FN@+|EMAIL@40"); + formats = new LinkedList(); + for (String format : Bundles.getBundle("display") + .getString("CONTACT_LIST_FORMAT").split(",")) { + formats.add(format); + } + + selectedFormat = -1; switchFormat(); setCard(card); -- 2.27.0