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
image --load now store the file as is
[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 66625f7e37d892f9585c4a21a041191dd1f7e945..65fbf9c635f51d4a097ca16604680faabe63c3eb 100644
(file)
--- a/
src/be/nikiroo/jvcard/launcher/Main.java
+++ b/
src/be/nikiroo/jvcard/launcher/Main.java
@@
-63,7
+63,7
@@
public class Main {
* @return the translated text with the given value where required
*/
static public String trans(StringId id, Object... values) {
* @return the translated text with the given value where required
*/
static public String trans(StringId id, Object... values) {
- return transService.getString(id,
(Object[])
values);
+ return transService.getString(id, values);
}
/**
}
/**
@@
-278,6
+278,7
@@
public class Main {
new RemoteBundle().updateFile(dir);
} catch (IOException e) {
e.printStackTrace();
new RemoteBundle().updateFile(dir);
} catch (IOException e) {
e.printStackTrace();
+ System.err.flush();
System.exit(ERR_INTERNAL);
}
break;
System.exit(ERR_INTERNAL);
}
break;
@@
-316,9
+317,17
@@
public class Main {
File f = new File(dir, filename);
if (f.exists()) {
File f = new File(dir, filename);
if (f.exists()) {
+ System.out.println("Loading " + f);
try {
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
@@
-330,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",
"png"
));
+ 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) {
@@
-356,6
+365,7
@@
public class Main {
if (photo != null) {
String filename = contact.toString(format, "");
File f = new File(dir, filename + ".png");
if (photo != null) {
String filename = contact.toString(format, "");
File f = new File(dir, filename + ".png");
+ System.out.println("Saving " + f);
try {
ImageIO.write(
StringUtils.toImage(photo.getValue()),
try {
ImageIO.write(
StringUtils.toImage(photo.getValue()),
@@
-630,6
+640,7
@@
public class Main {
else
System.err.println(trans(err, trans(suberr, subvalues)));
else
System.err.println(trans(err, trans(suberr, subvalues)));
+ System.err.flush();
System.exit(CODE);
}
}
System.exit(CODE);
}
}