mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +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 {
|
public static void openDirectory(File directory) throws IOException {
|
||||||
if (!isLinux()
|
if (!isLinux()
|
||||||
&& Desktop.isDesktopSupported()
|
&& Desktop.isDesktopSupported()
|
||||||
|
@ -160,6 +151,26 @@ public class Utilities {
|
||||||
throw new IOException("Failed to open directory: " + directory.toString());
|
throw new IOException("Failed to open directory: " + directory.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
public static void printSystemLoad() {
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
@ -169,22 +180,17 @@ public class Utilities {
|
||||||
log.info("System load (nr. threads/used memory (MB)): " + Thread.activeCount() + "/" + used);
|
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) {
|
public static void copyToClipboard(String content) {
|
||||||
if (content != null && content.length() > 0) {
|
try {
|
||||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
if (content != null && content.length() > 0) {
|
||||||
ClipboardContent clipboardContent = new ClipboardContent();
|
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||||
clipboardContent.putString(content);
|
ClipboardContent clipboardContent = new ClipboardContent();
|
||||||
clipboard.setContent(clipboardContent);
|
clipboardContent.putString(content);
|
||||||
|
clipboard.setContent(clipboardContent);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error("copyToClipboard failed " + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue