git://git.nikiroo.be
/
jvcard.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: default FN should be trimmed
[jvcard.git]
/
src
/
be
/
nikiroo
/
jvcard
/
launcher
/
Main.java
diff --git
a/src/be/nikiroo/jvcard/launcher/Main.java
b/src/be/nikiroo/jvcard/launcher/Main.java
index eeeae4153a57eada0b58e04da065ea2d119101bc..f96e5581b05f99c12f69c3af4603284f4065815f 100644
(file)
--- a/
src/be/nikiroo/jvcard/launcher/Main.java
+++ b/
src/be/nikiroo/jvcard/launcher/Main.java
@@
-319,8
+319,15
@@
public class Main {
if (f.exists()) {
System.out.println("Loading " + f);
try {
if (f.exists()) {
System.out.println("Loading " + f);
try {
- String b64 = StringUtils.fromImage(ImageIO
- .read(f));
+ String type = "jpeg";
+ int dotIndex = filename.indexOf('.');
+ if (dotIndex >= 0
+ && (dotIndex + 1) < filename.length()) {
+ type = filename.substring(dotIndex + 1)
+ .toLowerCase();
+ }
+
+ String b64 = StringUtils.fromImage(f);
// remove previous photos:
for (Data photo = contact
// remove previous photos:
for (Data photo = contact
@@
-332,7
+339,7
@@
public class Main {
List<TypeInfo> types = new LinkedList<TypeInfo>();
types.add(new TypeInfo("ENCODING", "b"));
List<TypeInfo> types = new LinkedList<TypeInfo>();
types.add(new TypeInfo("ENCODING", "b"));
- types.add(new TypeInfo("TYPE",
"jpeg"
));
+ types.add(new TypeInfo("TYPE",
type
));
Data photo = new Data(types, "PHOTO", b64, null);
contact.add(photo);
} catch (IOException e) {
Data photo = new Data(types, "PHOTO", b64, null);
contact.add(photo);
} catch (IOException e) {
@@
-422,7
+429,8
@@
public class Main {
+ trans(StringId.CLI_HELP_LANG));
System.out.println("\t--tui : " + trans(StringId.CLI_HELP_TUI));
System.out.println("\t--gui : " + trans(StringId.CLI_HELP_GUI));
+ trans(StringId.CLI_HELP_LANG));
System.out.println("\t--tui : " + trans(StringId.CLI_HELP_TUI));
System.out.println("\t--gui : " + trans(StringId.CLI_HELP_GUI));
- System.out.println("\t--noutf : " + trans(StringId.CLI_HELP_NOUTF));
+ System.out.println("\t--noutf : "
+ + trans(StringId.CLI_HELP_NOUTF_OPTION));
System.out.println("\t--config : "
+ trans(StringId.CLI_HELP_CONFIG));
System.out.println();
System.out.println("\t--config : "
+ trans(StringId.CLI_HELP_CONFIG));
System.out.println();
@@
-493,7
+501,7
@@
public class Main {
Data name = contact.getPreferredData("FN");
if (name == null || name.getValue().length() == 0
|| forceComputedFn) {
Data name = contact.getPreferredData("FN");
if (name == null || name.getValue().length() == 0
|| forceComputedFn) {
- name.setValue(contact.toString(defaultFn, ""));
+ name.setValue(contact.toString(defaultFn, "")
.trim()
);
}
}
} catch (Exception e) {
}
}
} catch (Exception e) {