diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-01-07 20:07:54 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-01-07 20:07:54 +0000 |
commit | 09d688c00a58854d5f0eb066f752feea061e135e (patch) | |
tree | fa993c6183e806d49ab6e82e13501bc41f7fe9f1 /src/net/java/sip | |
parent | 72bc56dbb32f2e311a9250ad561c9e3feef2e066 (diff) | |
download | jitsi-09d688c00a58854d5f0eb066f752feea061e135e.zip jitsi-09d688c00a58854d5f0eb066f752feea061e135e.tar.gz jitsi-09d688c00a58854d5f0eb066f752feea061e135e.tar.bz2 |
Displays kABOrganizationProperty as the displayName of SourceContact for companies fetched from the Address Book of Mac OS X.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r-- | src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java index 525ebd9..4dbd609 100644 --- a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java +++ b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java @@ -40,7 +40,9 @@ public class MacOSXAddrBookContactQuery kABMSNInstantProperty(),
kABNicknameProperty(),
kABPhoneProperty(),
- kABYahooInstantProperty()
+ kABYahooInstantProperty(),
+ kABPersonFlags(),
+ kABOrganizationProperty()
};
/**
@@ -116,12 +118,36 @@ public class MacOSXAddrBookContactQuery private static final int kABNicknameProperty = 11;
/**
+ * The index of the <tt>kABOrganizationProperty</tt> <tt>ABPerson</tt>
+ * property in {@link #ABPERSON_PROPERTIES}.
+ */
+ private static final int kABOrganizationProperty = 15;
+
+ /**
+ * The index of the <tt>kABPersonFlags</tt> <tt>ABPerson</tt> property in
+ * {@link #ABPERSON_PROPERTIES}.
+ */
+ private static final int kABPersonFlags = 14;
+
+ /**
* The index of the <tt>kABPhoneProperty</tt> <tt>ABPerson</tt> property in
* {@link #ABPERSON_PROPERTIES}.
*/
private static final int kABPhoneProperty = 12;
/**
+ * The flag which indicates that an <tt>ABRecord</tt> is to be displayed as
+ * a company.
+ */
+ private static final long kABShowAsCompany = 1;
+
+ /**
+ * The mask which extracts the <tt>kABShowAsXXX</tt> flag from the
+ * <tt>personFlags</tt> of an <tt>ABPerson</tt>.
+ */
+ private static final long kABShowAsMask = 7;
+
+ /**
* The index of the <tt>kABYahooInstantProperty</tt> <tt>ABPerson</tt>
* property in {@link #ABPERSON_PROPERTIES}.
*/
@@ -242,11 +268,26 @@ public class MacOSXAddrBookContactQuery */
private String getDisplayName(Object[] values)
{
- String displayName
+ long personFlags
+ = (values[kABPersonFlags] instanceof Long)
+ ? ((Long) values[kABPersonFlags]).longValue()
+ : 0;
+ String displayName;
+
+ if ((personFlags & kABShowAsMask) == kABShowAsCompany)
+ {
+ displayName
+ = (values[kABOrganizationProperty] instanceof String)
+ ? (String) values[kABOrganizationProperty]
+ : "";
+ if (displayName.length() != 0)
+ return displayName;
+ }
+
+ displayName
= (values[kABNicknameProperty] instanceof String)
? (String) values[kABNicknameProperty]
: "";
-
if (displayName.length() != 0)
return displayName;
@@ -407,6 +448,20 @@ public class MacOSXAddrBookContactQuery private static native long kABNicknameProperty();
/**
+ * Gets the value of the <tt>kABOrganizationProperty</tt> constant.
+ *
+ * @return the value of the <tt>kABOrganizationProperty</tt> constant
+ */
+ private static native long kABOrganizationProperty();
+
+ /**
+ * Gets the value of the <tt>kABPersonFlags</tt> constant.
+ *
+ * @return the value of the <tt>kABPersonFlags</tt> constant
+ */
+ private static native long kABPersonFlags();
+
+ /**
* Gets the value of the <tt>kABPhoneProperty</tt> constant.
*
* @return the value of the <tt>kABPhoneProperty</tt> constant
|