mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Fix bug on linux when using mailto
This commit is contained in:
parent
58e6db3b49
commit
1c60bf383c
1 changed files with 30 additions and 24 deletions
|
@ -135,15 +135,6 @@ public class Utilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static void openWebPage(String target) {
|
||||
try {
|
||||
openURI(new URI(target));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void openDirectory(File directory) throws IOException {
|
||||
if (!isLinux()
|
||||
&& Desktop.isDesktopSupported()
|
||||
|
@ -161,6 +152,26 @@ public class Utilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static void openWebPage(String target) {
|
||||
try {
|
||||
openURI(new URI(target));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void openMail(String to, String subject, String body) {
|
||||
try {
|
||||
subject = URLEncoder.encode(subject, "UTF-8").replace("+", "%20");
|
||||
body = URLEncoder.encode(body, "UTF-8").replace("+", "%20");
|
||||
openURI(new URI("mailto:" + to + "?subject=" + subject + "&body=" + body));
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
log.error("openMail failed " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void printSystemLoad() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
long free = runtime.freeMemory() / 1024 / 1024;
|
||||
|
@ -169,23 +180,18 @@ public class Utilities {
|
|||
log.info("System load (nr. threads/used memory (MB)): " + Thread.activeCount() + "/" + used);
|
||||
}
|
||||
|
||||
public static void openMail(String to, String subject, String body) {
|
||||
try {
|
||||
subject = URLEncoder.encode(subject, "UTF-8").replace("+", "%20");
|
||||
body = URLEncoder.encode(body, "UTF-8").replace("+", "%20");
|
||||
Desktop.getDesktop().mail(new URI("mailto:" + to + "?subject=" + subject + "&body=" + body));
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyToClipboard(String content) {
|
||||
try {
|
||||
if (content != null && content.length() > 0) {
|
||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||
ClipboardContent clipboardContent = new ClipboardContent();
|
||||
clipboardContent.putString(content);
|
||||
clipboard.setContent(clipboardContent);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("copyToClipboard failed " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] concatByteArrays(byte[]... arrays) {
|
||||
|
|
Loading…
Add table
Reference in a new issue