Tag: cws_src680_macaddressbook01 User: cremlae Date: 2007-07-15 22:22:04+0000 Modified: dba/connectivity/source/drivers/macab/MacabRecords.cxx
Log: #79610# Added localization to Mac OS X Address Book labels, though an installation issue remains for seeing the localized labels - issue 79610 has details File Changes: Directory: /dba/connectivity/source/drivers/macab/ ================================================== File [changed]: MacabRecords.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/macab/MacabRecords.cxx?r1=1.1.2.4&r2=1.1.2.5 Delta lines: +30 -15 --------------------- --- MacabRecords.cxx 2007-07-15 01:56:55+0000 1.1.2.4 +++ MacabRecords.cxx 2007-07-15 22:22:02+0000 1.1.2.5 @@ -4,9 +4,9 @@ * * $RCSfile: MacabRecords.cxx,v $ * - * $Revision: 1.1.2.4 $ + * $Revision: 1.1.2.5 $ * - * last change: $Author: cremlae $ $Date: 2007/07/15 01:56:55 $ + * last change: $Author: cremlae $ $Date: 2007/07/15 22:22:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -507,6 +507,7 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABRecordRef _record, const CFStringRef _propertyName, const CFStringRef _recordType, const sal_Bool _isPropertyRequired) const { // local variables + CFStringRef localizedPropertyName; CFTypeRef propertyValue; ABPropertyType propertyType; MacabHeader *result; @@ -517,8 +518,9 @@ return NULL; propertyType = ABTypeOfProperty(addressBook, _recordType, _propertyName); + localizedPropertyName = ABCopyLocalizedPropertyOrLabel(_propertyName); - result = createHeaderForProperty(propertyType, propertyValue, _propertyName); + result = createHeaderForProperty(propertyType, propertyValue, localizedPropertyName); if(propertyValue != NULL) CFRelease(propertyValue); @@ -564,7 +566,7 @@ sal_Int32 i; sal_Int32 multiLength = ABMultiValueCount((ABMutableMultiValueRef) _propertyValue); - CFStringRef multiLabel; + CFStringRef multiLabel, localizedMultiLabel; ::rtl::OUString multiLabelString; ::rtl::OUString multiPropertyString; ::rtl::OUString headerNameString; @@ -580,8 +582,10 @@ for(i = 0; i < multiLength; i++) { multiLabel = ABMultiValueCopyLabelAtIndex((ABMutableMultiValueRef) _propertyValue, i); - multiLabelString = CFStringToOUString(multiLabel); + localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel); + multiLabelString = CFStringToOUString(localizedMultiLabel); CFRelease(multiLabel); + CFRelease(localizedMultiLabel); headerNameString = multiPropertyString + ::rtl::OUString::createFromAscii(": ") + fixLabel(multiLabelString); headerNames[i] = new macabfield; headerNames[i]->value = OUStringToCFString(headerNameString); @@ -610,7 +614,7 @@ */ sal_Int32 multiLengthSecondLevel = 0; - CFStringRef multiLabel; + CFStringRef multiLabel, localizedMultiLabel; CFTypeRef multiValue; ::rtl::OUString multiLabelString; ::rtl::OUString multiPropertyString; @@ -632,8 +636,10 @@ multiValue = ABMultiValueCopyValueAtIndex((ABMutableMultiValueRef) _propertyValue, i); if(multiValue && multiLabel) { - multiLabelString = multiPropertyString + ::rtl::OUString::createFromAscii(": ") + fixLabel(CFStringToOUString(multiLabel)); + localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel); + multiLabelString = multiPropertyString + ::rtl::OUString::createFromAscii(": ") + fixLabel(CFStringToOUString(localizedMultiLabel)); CFRelease(multiLabel); + CFRelease(localizedMultiLabel); multiLabel = OUStringToCFString(multiLabelString); multiHeaders[i] = createHeaderForProperty(multiType, multiValue, multiLabel); if (!multiHeaders[i]) @@ -695,7 +701,7 @@ ABPropertyType dictType; MacabHeader **dictHeaders = new MacabHeader *[numRecords]; ::rtl::OUString dictLabelString; - CFStringRef dictLabel; + CFStringRef dictLabel, localizedDictKey; /* Get the keys and values */ dictKeys = (CFStringRef *) malloc(sizeof(CFStringRef)*numRecords); @@ -717,7 +723,8 @@ for(i = 0; i < numRecords; i++) { dictType = (ABPropertyType) getABTypeFromCFType( CFGetTypeID(dictValues[i]) ); - dictKeyString = CFStringToOUString(dictKeys[i]); + localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]); + dictKeyString = CFStringToOUString(localizedDictKey); dictLabelString = propertyNameString + ::rtl::OUString::createFromAscii(": ") + fixLabel(dictKeyString); dictLabel = OUStringToCFString(dictLabelString); dictHeaders[i] = createHeaderForProperty(dictType, dictValues[i], dictLabel); @@ -725,6 +732,7 @@ dictHeaders[i] = new MacabHeader(); length += dictHeaders[i]->getSize(); CFRelease(dictLabel); + CFRelease(localizedDictKey); } /* Combine all of the macabfields in each MacabHeader into the @@ -886,12 +894,14 @@ CFTypeRef propertyValue; ABPropertyType propertyType; - CFStringRef propertyName; + CFStringRef propertyName, localizedPropertyName; ::rtl::OUString propertyNameString; for(i = 0; i < numProperties; i++) { propertyName = (CFStringRef) CFArrayGetValueAtIndex(recordProperties, i); - propertyNameString = CFStringToOUString(propertyName); + localizedPropertyName = ABCopyLocalizedPropertyOrLabel(propertyName); + propertyNameString = CFStringToOUString(localizedPropertyName); + CFRelease(localizedPropertyName); /* Get the property's value */ propertyValue = ABRecordCopyValue(_abrecord,propertyName); @@ -1036,6 +1046,7 @@ * do that. */ CFStringRef *dictKeys; + CFStringRef localizedDictKey; CFTypeRef *dictValues; dictKeys = (CFStringRef *) malloc(sizeof(CFStringRef)*numRecords); dictValues = (CFTypeRef *) malloc(sizeof(CFTypeRef)*numRecords); @@ -1044,7 +1055,9 @@ /* Going through each element... */ for(i = 0; i < numRecords; i++) { - dictKeyString = CFStringToOUString(dictKeys[i]); + localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]); + dictKeyString = CFStringToOUString(localizedDictKey); + CFRelease(localizedDictKey); newPropertyName = _propertyName + ::rtl::OUString::createFromAscii(": ") + fixLabel(dictKeyString); insertPropertyIntoMacabRecord(_abrecord, _header, newPropertyName, dictValues[i]); } @@ -1074,7 +1087,7 @@ sal_Int32 i; sal_Int32 multiLength = ABMultiValueCount((ABMutableMultiValueRef) _propertyValue); - CFStringRef multiLabel; + CFStringRef multiLabel, localizedMultiLabel; CFTypeRef multiValue; ::rtl::OUString multiLabelString, newPropertyName; ABPropertyType multiType = (ABPropertyType) (ABMultiValuePropertyType((ABMutableMultiValueRef) _propertyValue) - 0x100); @@ -1086,12 +1099,14 @@ multiLabel = ABMultiValueCopyLabelAtIndex((ABMutableMultiValueRef) _propertyValue, i); multiValue = ABMultiValueCopyValueAtIndex((ABMutableMultiValueRef) _propertyValue, i); - multiLabelString = CFStringToOUString(multiLabel); + localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel); + multiLabelString = CFStringToOUString(localizedMultiLabel); newPropertyName = _propertyName + ::rtl::OUString::createFromAscii(": ") + fixLabel(multiLabelString); insertPropertyIntoMacabRecord(multiType, _abrecord, _header, newPropertyName, multiValue); /* free our variables */ CFRelease(multiLabel); + CFRelease(localizedMultiLabel); CFRelease(multiValue); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
