Added browser launcher to hyperlink. Now opens the approval URL upon clicking the hyperlink.

maven
Danny van Heumen 11 years ago
parent 37a8c45280
commit ad8c636dcc

@ -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"

@ -8,6 +8,7 @@
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.*;
@ -65,6 +66,11 @@ public class GoogleContactsActivator implements BundleActivator
*/
private static GoogleContactsServiceImpl googleContactsService;
/**
* Browser launcher service.
*/
private static BrowserLauncherService browserLauncherService;
/**
* List of contact source service registrations.
*/
@ -143,6 +149,22 @@ public static ResourceManagementService getResourceManagementService()
return resourceService;
}
/**
* 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
*

@ -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 @@ private static void saveRefreshToken(final TokenData token,
* @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 OAuthApprovalDialog(final String identity)
{
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());

@ -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,

Loading…
Cancel
Save