diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-07-17 22:16:43 +0200 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-07-20 22:29:45 +0200 |
commit | ad8c636dcc0bfc7cd88c98a246453a550a9b26d5 (patch) | |
tree | 00514b6d8a7a2bfc290a115ccd3d1c19ff9ee3fe /src/net/java/sip/communicator/impl | |
parent | 37a8c45280eced1ea33392416fbe0b39c71fe0a1 (diff) | |
download | jitsi-ad8c636dcc0bfc7cd88c98a246453a550a9b26d5.zip jitsi-ad8c636dcc0bfc7cd88c98a246453a550a9b26d5.tar.gz jitsi-ad8c636dcc0bfc7cd88c98a246453a550a9b26d5.tar.bz2 |
Added browser launcher to hyperlink. Now opens the approval URL upon clicking the hyperlink.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
3 files changed, 30 insertions, 7 deletions
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, |