mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Move openWebpage method to GUIUtils. Add warning popup when tor is enabled for http
This commit is contained in:
parent
d3e63a4470
commit
c3143600da
20 changed files with 84 additions and 61 deletions
|
@ -33,9 +33,7 @@ import java.awt.*;
|
|||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.Permission;
|
||||
import java.security.PermissionCollection;
|
||||
import java.util.Locale;
|
||||
|
@ -207,26 +205,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 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;
|
||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.gui;
|
|||
import io.bitsquare.BitsquareException;
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import javafx.application.Platform;
|
||||
import javafx.stage.Stage;
|
||||
|
@ -123,7 +124,7 @@ public class SystemTray {
|
|||
|
||||
aboutItem.addActionListener(e -> {
|
||||
try {
|
||||
Utilities.openWebPage("https://bitsquare.io");
|
||||
GUIUtil.openWebPage("https://bitsquare.io");
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import io.bitsquare.btc.listeners.TxConfidenceListener;
|
|||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.components.indicator.TxConfidenceIndicator;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.user.Preferences;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -135,7 +136,7 @@ public class TxIdTextField extends AnchorPane {
|
|||
private void openBlockExplorer(String txID) {
|
||||
try {
|
||||
if (preferences != null)
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().txUrl + txID);
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + txID);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
|
|
@ -24,7 +24,6 @@ import io.bitsquare.btc.pricefeed.PriceFeedService;
|
|||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.common.util.Tuple3;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.common.view.*;
|
||||
import io.bitsquare.gui.components.BusyAnimation;
|
||||
|
@ -38,6 +37,7 @@ import io.bitsquare.gui.main.overlays.Overlay;
|
|||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.gui.main.portfolio.PortfolioView;
|
||||
import io.bitsquare.gui.main.settings.SettingsView;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.Transitions;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -325,7 +325,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
btcAverageIconButton.setFocusTraversable(false);
|
||||
btcAverageIconButton.setStyle("-fx-background-color: transparent;");
|
||||
HBox.setMargin(btcAverageIconButton, new Insets(0, 27, 0, 0));
|
||||
btcAverageIconButton.setOnAction(e -> Utilities.openWebPage("https://bitcoinaverage.com"));
|
||||
btcAverageIconButton.setOnAction(e -> GUIUtil.openWebPage("https://bitcoinaverage.com"));
|
||||
btcAverageIconButton.visibleProperty().bind(model.isFiatCurrencyPriceFeedSelected);
|
||||
btcAverageIconButton.managedProperty().bind(model.isFiatCurrencyPriceFeedSelected);
|
||||
btcAverageIconButton.setTooltip(new Tooltip("Market price is provided by https://bitcoinaverage.com"));
|
||||
|
@ -337,7 +337,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
poloniexIconButton.setFocusTraversable(false);
|
||||
poloniexIconButton.setStyle("-fx-background-color: transparent;");
|
||||
HBox.setMargin(poloniexIconButton, new Insets(1, 27, 0, 0));
|
||||
poloniexIconButton.setOnAction(e -> Utilities.openWebPage("https://poloniex.com"));
|
||||
poloniexIconButton.setOnAction(e -> GUIUtil.openWebPage("https://poloniex.com"));
|
||||
poloniexIconButton.visibleProperty().bind(model.isCryptoCurrencyPriceFeedSelected);
|
||||
poloniexIconButton.managedProperty().bind(model.isCryptoCurrencyPriceFeedSelected);
|
||||
poloniexIconButton.setTooltip(new Tooltip("Market price is provided by https://poloniex.com"));
|
||||
|
|
|
@ -39,7 +39,6 @@ import io.bitsquare.common.Clock;
|
|||
import io.bitsquare.common.Timer;
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.crypto.*;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.filter.FilterManager;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.common.model.ViewModel;
|
||||
|
@ -53,6 +52,7 @@ import io.bitsquare.gui.main.overlays.windows.DisplayAlertMessageWindow;
|
|||
import io.bitsquare.gui.main.overlays.windows.TacWindow;
|
||||
import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.locale.TradeCurrency;
|
||||
import io.bitsquare.p2p.P2PService;
|
||||
|
@ -590,7 +590,7 @@ public class MainViewModel implements ViewModel {
|
|||
.actionButtonText("Shut down")
|
||||
.onAction(BitsquareApp.shutDownHandler::run)
|
||||
.closeButtonText("Report bug at Github issues")
|
||||
.onClose(() -> Utilities.openWebPage("https://github.com/bitsquare/bitsquare/issues"))
|
||||
.onClose(() -> GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues"))
|
||||
.show());
|
||||
}
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ public class MainViewModel implements ViewModel {
|
|||
.actionButtonText("Shut down")
|
||||
.onAction(BitsquareApp.shutDownHandler::run)
|
||||
.closeButtonText("Report bug at Github issues")
|
||||
.onClose(() -> Utilities.openWebPage("https://github.com/bitsquare/bitsquare/issues"))
|
||||
.onClose(() -> GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues"))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,17 +20,13 @@ package io.bitsquare.gui.main.account.content.altcoinaccounts;
|
|||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.common.util.Tuple3;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.common.view.ActivatableViewAndModel;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.components.TitledGroupBg;
|
||||
import io.bitsquare.gui.components.paymentmethods.CryptoCurrencyForm;
|
||||
import io.bitsquare.gui.components.paymentmethods.PaymentMethodForm;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.FormBuilder;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.gui.util.*;
|
||||
import io.bitsquare.gui.util.validation.*;
|
||||
import io.bitsquare.locale.CryptoCurrency;
|
||||
import io.bitsquare.locale.TradeCurrency;
|
||||
|
@ -173,7 +169,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
|
|||
new Popup().information("The EHT/ETC fork situation carries considerable risks.\n" +
|
||||
"Be sure you fully understand the situation and check out the information on the \"Ethereum Classic\" and \"Ethereum\" project web pages.")
|
||||
.closeButtonText("I understand")
|
||||
.onAction(() -> Utilities.openWebPage("https://ethereumclassic.github.io/"))
|
||||
.onAction(() -> GUIUtil.openWebPage("https://ethereumclassic.github.io/"))
|
||||
.actionButtonText("Open Ethereum Classic web page")
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import io.bitsquare.btc.WalletService;
|
|||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.common.view.ActivatableView;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.components.AddressTextField;
|
||||
|
@ -278,7 +277,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
|||
private void openBlockExplorer(DepositListItem item) {
|
||||
if (item.getAddressString() != null) {
|
||||
try {
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
|
|
@ -21,7 +21,6 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
|||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.common.view.ActivatableView;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.components.HyperlinkWithIcon;
|
||||
|
@ -29,6 +28,7 @@ import io.bitsquare.gui.main.overlays.popups.Popup;
|
|||
import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow;
|
||||
import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.trade.Tradable;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.TradeManager;
|
||||
|
@ -157,7 +157,7 @@ public class LockedView extends ActivatableView<VBox, Void> {
|
|||
|
||||
private void openBlockExplorer(LockedListItem item) {
|
||||
try {
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
|
|
@ -21,7 +21,6 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
|||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.common.view.ActivatableView;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.components.HyperlinkWithIcon;
|
||||
|
@ -29,6 +28,7 @@ import io.bitsquare.gui.main.overlays.popups.Popup;
|
|||
import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow;
|
||||
import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.trade.Tradable;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.TradeManager;
|
||||
|
@ -157,7 +157,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
|
|||
|
||||
private void openBlockExplorer(ReservedListItem item) {
|
||||
try {
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
|
|
@ -294,7 +294,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
|||
private void openTxInBlockExplorer(TransactionsListItem item) {
|
||||
if (item.getTxId() != null) {
|
||||
try {
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().txUrl + item.getTxId());
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + item.getTxId());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
@ -306,7 +306,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
|||
private void openAddressInBlockExplorer(TransactionsListItem item) {
|
||||
if (item.getAddressString() != null) {
|
||||
try {
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
|
|
@ -25,13 +25,13 @@ import io.bitsquare.btc.AddressEntryException;
|
|||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.common.view.ActivatableView;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.components.HyperlinkWithIcon;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.validation.BtcAddressValidator;
|
||||
import io.bitsquare.trade.Tradable;
|
||||
import io.bitsquare.trade.Trade;
|
||||
|
@ -287,7 +287,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
private void openBlockExplorer(WithdrawalListItem item) {
|
||||
if (item.getAddressString() != null) {
|
||||
try {
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.main.help;
|
||||
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class Help {
|
|||
public static void openWindow(HelpId id) {
|
||||
try {
|
||||
// TODO create user guide
|
||||
Utilities.openWebPage("http://bitsquare.io/faq");
|
||||
GUIUtil.openWebPage("http://bitsquare.io/faq");
|
||||
// Utilities.openWebPage("https://github.com/bitsquare/bitsquare/wiki/User-Guide");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
|
|
|
@ -333,7 +333,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
|||
"When another trader wants to take your offer it requires that your application is online and able to react.\n" +
|
||||
"Be sure that you have standby mode deactivated as that would disconnect your client from the network (standby of the monitor is not a problem).")
|
||||
.actionButtonText("Visit FAQ web page")
|
||||
.onAction(() -> Utilities.openWebPage("https://bitsquare.io/faq#6"))
|
||||
.onAction(() -> GUIUtil.openWebPage("https://bitsquare.io/faq#6"))
|
||||
.closeButtonText("I understand")
|
||||
.dontShowAgainId(key, preferences)
|
||||
.show();
|
||||
|
|
|
@ -22,7 +22,6 @@ import io.bitsquare.btc.pricefeed.MarketPrice;
|
|||
import io.bitsquare.btc.pricefeed.PriceFeedService;
|
||||
import io.bitsquare.common.Timer;
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.common.model.ActivatableWithDataModel;
|
||||
import io.bitsquare.gui.common.model.ViewModel;
|
||||
|
@ -33,6 +32,7 @@ import io.bitsquare.gui.main.overlays.popups.Popup;
|
|||
import io.bitsquare.gui.main.settings.SettingsView;
|
||||
import io.bitsquare.gui.main.settings.preferences.PreferencesView;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.validation.BtcValidator;
|
||||
import io.bitsquare.gui.util.validation.FiatValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
|
@ -355,7 +355,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
"Be sure you fully understand the situation and check out the information on the \"Ethereum Classic\" and \"Ethereum\" project web pages.\n\n" +
|
||||
"Please note, that the price is denominated as ETC/BTC not BTC/ETC!")
|
||||
.closeButtonText("I understand")
|
||||
.onAction(() -> Utilities.openWebPage("https://ethereumclassic.github.io/"))
|
||||
.onAction(() -> GUIUtil.openWebPage("https://ethereumclassic.github.io/"))
|
||||
.actionButtonText("Open Ethereum Classic web page")
|
||||
.dontShowAgainId(key, preferences)
|
||||
.show();
|
||||
|
|
|
@ -334,7 +334,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
"The deposit will stay in your local trading wallet until the offer gets accepted by another trader.\n" +
|
||||
"It will be refunded to you after the trade has successfully completed.")
|
||||
.actionButtonText("Visit FAQ web page")
|
||||
.onAction(() -> Utilities.openWebPage("https://bitsquare.io/faq#6"))
|
||||
.onAction(() -> GUIUtil.openWebPage("https://bitsquare.io/faq#6"))
|
||||
.closeButtonText("I understand")
|
||||
.dontShowAgainId(key, preferences)
|
||||
.show();
|
||||
|
|
|
@ -19,7 +19,6 @@ package io.bitsquare.gui.main.offer.takeoffer;
|
|||
|
||||
import io.bitsquare.arbitration.Arbitrator;
|
||||
import io.bitsquare.btc.pricefeed.PriceFeedService;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.common.model.ActivatableWithDataModel;
|
||||
import io.bitsquare.gui.common.model.ViewModel;
|
||||
|
@ -28,6 +27,7 @@ import io.bitsquare.gui.main.funds.FundsView;
|
|||
import io.bitsquare.gui.main.funds.deposit.DepositView;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.validation.BtcValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
@ -148,7 +148,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
"Be sure you fully understand the situation and check out the information on the \"Ethereum Classic\" and \"Ethereum\" project web pages.\n\n" +
|
||||
"Please note, that the price is denominated as ETC/BTC not BTC/ETC!")
|
||||
.closeButtonText("I understand")
|
||||
.onAction(() -> Utilities.openWebPage("https://ethereumclassic.github.io/"))
|
||||
.onAction(() -> GUIUtil.openWebPage("https://ethereumclassic.github.io/"))
|
||||
.actionButtonText("Open Ethereum Classic web page")
|
||||
.dontShowAgainId(key, dataModel.getPreferences())
|
||||
.show();
|
||||
|
|
|
@ -22,6 +22,7 @@ import io.bitsquare.common.UserThread;
|
|||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.components.BusyAnimation;
|
||||
import io.bitsquare.gui.main.MainView;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.Transitions;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.user.Preferences;
|
||||
|
@ -680,7 +681,7 @@ public abstract class Overlay<T extends Overlay> {
|
|||
|
||||
githubButton.setOnAction(event -> {
|
||||
Utilities.copyToClipboard(message);
|
||||
Utilities.openWebPage("https://github.com/bitsquare/bitsquare/issues");
|
||||
GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues");
|
||||
});
|
||||
|
||||
Button mailButton = new Button("Report by email");
|
||||
|
@ -690,7 +691,7 @@ public abstract class Overlay<T extends Overlay> {
|
|||
gridPane.getChildren().add(mailButton);
|
||||
mailButton.setOnAction(event -> {
|
||||
Utilities.copyToClipboard(message);
|
||||
Utilities.openMail("manfred@bitsquare.io",
|
||||
GUIUtil.openMail("manfred@bitsquare.io",
|
||||
"Error report",
|
||||
"Error message:\n" + message);
|
||||
});
|
||||
|
|
|
@ -19,8 +19,8 @@ package io.bitsquare.gui.main.overlays.windows;
|
|||
|
||||
import io.bitsquare.alert.Alert;
|
||||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.main.overlays.Overlay;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.user.Preferences;
|
||||
import javafx.geometry.HPos;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -90,7 +90,7 @@ public class AddBridgeEntriesWindow extends Overlay<AddBridgeEntriesWindow> {
|
|||
actionButton.setOnAction(event -> save());
|
||||
|
||||
Button urlButton = new Button("Open Tor project web page");
|
||||
urlButton.setOnAction(event -> Utilities.openWebPage("https://bridges.torproject.org/bridges"));
|
||||
urlButton.setOnAction(event -> GUIUtil.openWebPage("https://bridges.torproject.org/bridges"));
|
||||
|
||||
Pane spacer = new Pane();
|
||||
HBox hBox = new HBox();
|
||||
|
|
|
@ -21,7 +21,6 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
|||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.common.util.Tuple3;
|
||||
import io.bitsquare.common.util.Tuple4;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.components.*;
|
||||
import javafx.geometry.HPos;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -170,7 +169,7 @@ public class FormBuilder {
|
|||
|
||||
public static HyperlinkWithIcon addHyperlinkWithIcon(GridPane gridPane, int rowIndex, String title, String url, double top) {
|
||||
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK);
|
||||
hyperlinkWithIcon.setOnAction(e -> Utilities.openWebPage(url));
|
||||
hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
|
||||
GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
|
||||
GridPane.setColumnIndex(hyperlinkWithIcon, 0);
|
||||
GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
|
||||
|
@ -191,7 +190,7 @@ public class FormBuilder {
|
|||
Label label = addLabel(gridPane, rowIndex, labelTitle, top);
|
||||
|
||||
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK);
|
||||
hyperlinkWithIcon.setOnAction(e -> Utilities.openWebPage(url));
|
||||
hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
|
||||
GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
|
||||
GridPane.setColumnIndex(hyperlinkWithIcon, 1);
|
||||
GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.googlecode.jcsv.writer.CSVEntryConverter;
|
|||
import com.googlecode.jcsv.writer.CSVWriter;
|
||||
import com.googlecode.jcsv.writer.internal.CSVWriterBuilder;
|
||||
import io.bitsquare.app.DevFlags;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.locale.CryptoCurrency;
|
||||
import io.bitsquare.locale.FiatCurrency;
|
||||
|
@ -45,6 +46,9 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -195,4 +199,48 @@ public class GUIUtil {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static void openWebPage(String target) {
|
||||
String key = "warnOpenURLWhenTorEnabled";
|
||||
final Preferences preferences = Preferences.INSTANCE;
|
||||
if (preferences.getUseTorForHttpRequests() && preferences.showAgain(key)) {
|
||||
new Popup<>().information("You have Tor enabled for Http requests and are going to open a web page " +
|
||||
"in your system web browser.\n" +
|
||||
"Do you want to open the web page now?\n\n" +
|
||||
"If you are not using the \"Tor Browser\" as your default system web browser you " +
|
||||
"will connect to the web page in clear net.\n\n" +
|
||||
"URL: \"" + target)
|
||||
.actionButtonText("Open the web page and don't ask again")
|
||||
.onAction(() -> {
|
||||
preferences.dontShowAgain(key, true);
|
||||
doOpenWebPage(target);
|
||||
})
|
||||
.closeButtonText("Copy URL and cancel")
|
||||
.onClose(() -> Utilities.copyToClipboard(target))
|
||||
.show();
|
||||
} else {
|
||||
doOpenWebPage(target);
|
||||
}
|
||||
}
|
||||
|
||||
private static void doOpenWebPage(String target) {
|
||||
try {
|
||||
Utilities.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");
|
||||
Utilities.openURI(new URI("mailto:" + to + "?subject=" + subject + "&body=" + body));
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
log.error("openMail failed " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue