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
Force headless mode if "--tui" is passed
[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 997cdecc4842b0759b183bbdc243c32137c3a0fa..178dff106d11394fa0b08bf7fb754134caf5a52f 100644
(file)
--- a/
src/be/nikiroo/jvcard/launcher/Main.java
+++ b/
src/be/nikiroo/jvcard/launcher/Main.java
@@
-9,6
+9,7
@@
import java.util.LinkedList;
import java.util.List;
import be.nikiroo.jvcard.Card;
import java.util.List;
import be.nikiroo.jvcard.Card;
+import be.nikiroo.jvcard.launcher.CardResult.MergeCallback;
import be.nikiroo.jvcard.parsers.Format;
import be.nikiroo.jvcard.remote.Command;
import be.nikiroo.jvcard.remote.SimpleSocket;
import be.nikiroo.jvcard.parsers.Format;
import be.nikiroo.jvcard.remote.Command;
import be.nikiroo.jvcard.remote.SimpleSocket;
@@
-27,7
+28,7
@@
import be.nikiroo.jvcard.resources.Trans.StringId;
*/
public class Main {
static public final String APPLICATION_TITLE = "jVcard";
*/
public class Main {
static public final String APPLICATION_TITLE = "jVcard";
- static public final String APPLICATION_VERSION = "1.0-beta
2
-dev";
+ static public final String APPLICATION_VERSION = "1.0-beta
3
-dev";
static private final int ERR_NO_FILE = 1;
static private final int ERR_SYNTAX = 2;
static private final int ERR_NO_FILE = 1;
static private final int ERR_SYNTAX = 2;
@@
-159,13
+160,19
@@
public class Main {
System.exit(ERR_SYNTAX);
return;
}
System.exit(ERR_SYNTAX);
return;
}
-
+
i18nDir = args[index];
} else {
filesTried = true;
files.addAll(open(arg));
}
}
i18nDir = args[index];
} else {
filesTried = true;
files.addAll(open(arg));
}
}
+
+ // Force headless mode if we run in forced-text mode
+ if (textMode != null && textMode) {
+ // same as -Djava.awt.headless=true
+ System.setProperty("java.awt.headless", "true");
+ }
if (unicode) {
utf8();
if (unicode) {
utf8();
@@
-243,13
+250,18
@@
public class Main {
* @param input
* a filename or a remote jvcard url with named resource (e.g.:
* <tt>jvcard://localhost:4444/coworkers.vcf</tt>)
* @param input
* a filename or a remote jvcard url with named resource (e.g.:
* <tt>jvcard://localhost:4444/coworkers.vcf</tt>)
+ * @param callback
+ * the {@link MergeCallback} to call in case of conflict, or NULL
+ * to disallow conflict management (the {@link Card} will not be
+ * allowed to synchronise in case of conflicts)
*
* @return the {@link Card}
*
* @throws IOException
* in case of IO error or remoting not available
*/
*
* @return the {@link Card}
*
* @throws IOException
* in case of IO error or remoting not available
*/
- static public Card getCard(String input) throws IOException {
+ static public CardResult getCard(String input, MergeCallback callback)
+ throws IOException {
boolean remote = false;
Format format = Format.Abook;
String ext = input;
boolean remote = false;
Format format = Format.Abook;
String ext = input;
@@
-265,12
+277,13
@@
public class Main {
remote = true;
}
remote = true;
}
- Card card = null;
+ Card
Result
card = null;
try {
if (remote) {
try {
if (remote) {
- card = Optional.syncCard(input);
+ card = Optional.syncCard(input
, callback
);
} else {
} else {
- card = new Card(new File(input), format);
+ card = new CardResult(new Card(new File(input), format), false,
+ false, false);
}
} catch (IOException ioe) {
throw ioe;
}
} catch (IOException ioe) {
throw ioe;