aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2015-07-17 22:16:43 +0200
committerDanny van Heumen <danny@dannyvanheumen.nl>2015-07-20 22:29:45 +0200
commitad8c636dcc0bfc7cd88c98a246453a550a9b26d5 (patch)
tree00514b6d8a7a2bfc290a115ccd3d1c19ff9ee3fe
parent37a8c45280eced1ea33392416fbe0b39c71fe0a1 (diff)
downloadjitsi-ad8c636dcc0bfc7cd88c98a246453a550a9b26d5.zip
jitsi-ad8c636dcc0bfc7cd88c98a246453a550a9b26d5.tar.gz
jitsi-ad8c636dcc0bfc7cd88c98a246453a550a9b26d5.tar.bz2
Added browser launcher to hyperlink. Now opens the approval URL upon clicking the hyperlink.
-rw-r--r--build.xml2
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsActivator.java22
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java14
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/googlecontacts.manifest.mf1
4 files changed, 31 insertions, 8 deletions
diff --git a/build.xml b/build.xml
index 7aecbfd..90df5a1 100644
--- a/build.xml
+++ b/build.xml
@@ -1379,7 +1379,7 @@
</target>
<!--BUNDLE-GOOGLECONTACTS-->
- <target name="bundle-googlecontacts" depends="bundle-httputil">
+ <target name="bundle-googlecontacts" depends="bundle-httputil,bundle-browserlauncher">
<jar compress="false" destfile="${bundles.dest}/googlecontacts.jar"
manifest="${src}/net/java/sip/communicator/impl/googlecontacts/googlecontacts.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/service/googlecontacts"
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsActivator.java b/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsActivator.java
index 75c6f14..a0ffdcd 100644
--- a/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsActivator.java
+++ b/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsActivator.java
@@ -8,6 +8,7 @@ package net.java.sip.communicator.impl.googlecontacts;
import java.util.*;
+import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.googlecontacts.*;
@@ -66,6 +67,11 @@ public class GoogleContactsActivator implements BundleActivator
private static GoogleContactsServiceImpl googleContactsService;
/**
+ * Browser launcher service.
+ */
+ private static BrowserLauncherService browserLauncherService;
+
+ /**
* List of contact source service registrations.
*/
private static Map<GoogleContactsSourceService, ServiceRegistration<?>> cssList
@@ -144,6 +150,22 @@ public class GoogleContactsActivator implements BundleActivator
}
/**
+ * Return reference to a browser launcher service implementation.
+ *
+ * @return Returns the browser launcher service instance.
+ */
+ public static BrowserLauncherService getBrowserLauncherService()
+ {
+ if (browserLauncherService == null)
+ {
+ browserLauncherService =
+ ServiceUtils.getService(bundleContext,
+ BrowserLauncherService.class);
+ }
+ return browserLauncherService;
+ }
+
+ /**
* Starts the Google Contacts service
*
* @param bundleContext BundleContext
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java b/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java
index 3dfaaea..8f1a619 100644
--- a/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java
+++ b/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java
@@ -146,7 +146,7 @@ public class OAuth2TokenStore
* @throws FailedAcquireCredentialException
* @throws MalformedURLException In case requesting authn token failed.
*/
- public Credential get(final String identity)
+ public synchronized Credential get(final String identity)
throws FailedAcquireCredentialException
{
if (this.store.get() == null)
@@ -239,7 +239,7 @@ public class OAuth2TokenStore
* @throws FailedTokenRefreshException In case of failed token refresh
* operation.
*/
- public void refresh() throws IOException, FailedTokenRefreshException
+ public synchronized void refresh() throws IOException, FailedTokenRefreshException
{
final Credential credential = this.store.get();
if (credential == null)
@@ -412,17 +412,17 @@ public class OAuth2TokenStore
{
this.setModal(true);
this.label =
- new SIPCommLinkButton(
- "Click here to approve. Make sure you log in as "
- + identity);
+ new SIPCommLinkButton("Approve Jitsi's access to " + identity);
this.label.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- LOGGER.info("Request user for approval via web page: " + APPROVAL_URL);
- // FIXME open browser
+ LOGGER.info("Request user for approval via web page: "
+ + APPROVAL_URL);
+ GoogleContactsActivator.getBrowserLauncherService()
+ .openURL(APPROVAL_URL);
}
});
this.setLayout(new BorderLayout());
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/googlecontacts.manifest.mf b/src/net/java/sip/communicator/impl/googlecontacts/googlecontacts.manifest.mf
index 4fd9387..a385df7 100644
--- a/src/net/java/sip/communicator/impl/googlecontacts/googlecontacts.manifest.mf
+++ b/src/net/java/sip/communicator/impl/googlecontacts/googlecontacts.manifest.mf
@@ -15,6 +15,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.plugin.desktoputil,
+ net.java.sip.communicator.service.browserlauncher,
org.xml.sax,
org.xml.sax.helpers,
javax.xml.parsers,