X-Git-Url: http://git.sourceforge.jp/view?p=neighbornote%2FNeighborNote.git;a=blobdiff_plain;f=src%2Fcx%2Ffbn%2Fnevernote%2Fgui%2FBrowserWindow.java;h=37e143a2e162efdb64d7aeb9f0ff5a16cd50d387;hp=077c90692dcc140ed0c0fac2defdf16802197163;hb=d21a5488a708a520188f38489701e4a41b88df18;hpb=f3cbefedc6ffd23d55eaf7344c17187b7581d271 diff --git a/src/cx/fbn/nevernote/gui/BrowserWindow.java b/src/cx/fbn/nevernote/gui/BrowserWindow.java index 077c906..37e143a 100644 --- a/src/cx/fbn/nevernote/gui/BrowserWindow.java +++ b/src/cx/fbn/nevernote/gui/BrowserWindow.java @@ -106,7 +106,7 @@ public class BrowserWindow extends QWidget { private final QComboBox geoBox; public final TagLineEdit tagEdit; public final QLabel tagLabel; - private final QLabel urlLabel; + private final QPushButton urlLabel; private final QLabel alteredLabel; private final QDateEdit alteredDate; private final QTimeEdit alteredTime; @@ -194,7 +194,8 @@ public class BrowserWindow extends QWidget { urlText = new QLineEdit(); authorText = new QLineEdit(); geoBox = new QComboBox(); - urlLabel = new QLabel(); + urlLabel = new QPushButton(); + urlLabel.clicked.connect(this, "sourceUrlClicked()"); authorLabel = new QLabel(); conn = c; @@ -570,6 +571,21 @@ public class BrowserWindow extends QWidget { urlText.setText(t); } + // The user want's to launch a web browser on the source of the URL + public void sourceUrlClicked() { + // Make sure we have a valid URL + if (urlText.text().trim().equals("")) + return; + + String url = urlText.text(); + if (!url.toLowerCase().startsWith(tr("http://"))) + url = tr("http://") +url; + + if (!QDesktopServices.openUrl(new QUrl(url))) { + logger.log(logger.LOW, "Error opening file :" +url); + } + } + public void setAuthor(String t) { authorLabel.setText(tr("Author:\t")); authorText.setText(t);