aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2011-09-20 14:17:47 +0000
committerYana Stamcheva <yana@jitsi.org>2011-09-20 14:17:47 +0000
commit38c7572c9fff8e44e4a912973e50681aef16dd21 (patch)
tree96725259f5e9e1e8c1e276d808589209e89767fb /src/net/java/sip/communicator/plugin
parent1cf69bfe7bd21d4ded8187e50a6396a8d532c03b (diff)
downloadjitsi-38c7572c9fff8e44e4a912973e50681aef16dd21.zip
jitsi-38c7572c9fff8e44e4a912973e50681aef16dd21.tar.gz
jitsi-38c7572c9fff8e44e4a912973e50681aef16dd21.tar.bz2
Fixes enabling/disabling Address Book (Patch provided by Ingo Bauersachs). Added the possibility to enable/disable without restarting Jitsi.
Diffstat (limited to 'src/net/java/sip/communicator/plugin')
-rw-r--r--src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java60
-rw-r--r--src/net/java/sip/communicator/plugin/addrbook/AdvancedConfigForm.java9
2 files changed, 54 insertions, 15 deletions
diff --git a/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java b/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java
index bfdcf90..67db365 100644
--- a/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java
+++ b/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java
@@ -27,6 +27,19 @@ public class AddrBookActivator
implements BundleActivator
{
/**
+ * Boolean property that defines whether the integration of the Outlook
+ * address book is enabled.
+ */
+ public static final String PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH =
+ "plugin.addrbook.ENABLE_MICROSOFT_OUTLOOK_SEARCH";
+ /**
+ * Boolean property that defines whether the integration of the OS X
+ * address book is enabled.
+ */
+ public static final String PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH =
+ "plugin.addrbook.ENABLE_MACOSX_ADDRESS_BOOK_SEARCH";
+
+ /**
* The <tt>Logger</tt> used by the <tt>AddrBookActivator</tt> class and its
* instances for logging output.
*/
@@ -42,14 +55,14 @@ public class AddrBookActivator
* The <tt>ContactSourceService</tt> implementation for the OS-specific
* Address Book.
*/
- private ContactSourceService css;
+ private static ContactSourceService css;
/**
* The <tt>ServiceRegistration</tt> of {@link #css} in the
* <tt>BundleContext</tt> in which this <tt>AddrBookActivator</tt> has been
* started.
*/
- private ServiceRegistration cssServiceRegistration;
+ private static ServiceRegistration cssServiceRegistration;
/**
* The cached reference to the <tt>PhoneNumberI18nService</tt> instance used
@@ -161,16 +174,44 @@ public class AddrBookActivator
101, false),
properties);
+ startService();
+ }
+
+ /**
+ * Stops the addrbook plug-in.
+ *
+ * @param bundleContext the <tt>BundleContext</tt> in which the addrbook
+ * plug-in is to be stopped
+ * @throws Exception if anything goes wrong while stopping the addrbook
+ * plug-in
+ * @see BundleActivator#stop(BundleContext)
+ */
+ public void stop(BundleContext bundleContext)
+ throws Exception
+ {
+ stopService();
+ }
+
+ /**
+ * Starts the address book service.
+ */
+ static void startService()
+ {
/* Register the ContactSourceService implementation (if any). */
String cssClassName;
- if (OSUtils.IS_WINDOWS)
+ if (OSUtils.IS_WINDOWS
+ && getConfigService().getBoolean(
+ PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH, true))
+
{
cssClassName
= "net.java.sip.communicator.plugin.addrbook"
+ ".msoutlook.MsOutlookAddrBookContactSourceService";
}
- else if (OSUtils.IS_MAC)
+ else if (OSUtils.IS_MAC
+ && getConfigService().getBoolean(
+ PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH, true))
{
cssClassName
= "net.java.sip.communicator.plugin.addrbook"
@@ -210,16 +251,9 @@ public class AddrBookActivator
}
/**
- * Stops the addrbook plug-in.
- *
- * @param bundleContext the <tt>BundleContext</tt> in which the addrbook
- * plug-in is to be stopped
- * @throws Exception if anything goes wrong while stopping the addrbook
- * plug-in
- * @see BundleActivator#stop(BundleContext)
+ * Stop the previously registered service.
*/
- public void stop(BundleContext bundleContext)
- throws Exception
+ static void stopService()
{
try
{
diff --git a/src/net/java/sip/communicator/plugin/addrbook/AdvancedConfigForm.java b/src/net/java/sip/communicator/plugin/addrbook/AdvancedConfigForm.java
index 1861a9e..1b9d069 100644
--- a/src/net/java/sip/communicator/plugin/addrbook/AdvancedConfigForm.java
+++ b/src/net/java/sip/communicator/plugin/addrbook/AdvancedConfigForm.java
@@ -47,12 +47,12 @@ public class AdvancedConfigForm
if (OSUtils.IS_MAC)
propertiesPanel.add(createEnableCheckBox(
- "plugin.addrbook.ENABLE_MACOSX_ADDRESS_BOOK_SEARCH",
+ AddrBookActivator.PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH,
"plugin.addrbook.ENABLE_MACOSX_ADDRESSBOOK"));
if (OSUtils.IS_WINDOWS)
propertiesPanel.add(createEnableCheckBox(
- "plugin.addrbook.ENABLE_MICROSOFT_OUTLOOK_SEARCH",
+ AddrBookActivator.PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH,
"plugin.addrbook.ENABLE_MICROSOFT_OUTLOOK"));
propertiesPanel.add(Box.createVerticalStrut(15));
@@ -83,6 +83,11 @@ public class AdvancedConfigForm
AddrBookActivator.getConfigService().setProperty(
configPropName,
new Boolean(checkBox.isSelected()).toString());
+
+ if (checkBox.isSelected())
+ AddrBookActivator.startService();
+ else
+ AddrBookActivator.stopService();
}
});
return checkBox;