| Summary: | kaddressbook uses X-KADDRESSBOOK-X-Department where ORG:organization;department should be used | ||
|---|---|---|---|
| Product: | [Unmaintained] kab3 | Reporter: | Nabil Sayegh <bugzilla-kde> |
| Component: | general | Assignee: | Tobias Koenig <tokoe> |
| Status: | RESOLVED UNMAINTAINED | ||
| Severity: | wishlist | CC: | rdieter, tuju |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Debian testing | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Nabil Sayegh
2005-10-27 20:47:48 UTC
We confirm this from opensync.org. vconvert debugging tool is able to compose proper internal XML format data from valid RFC vcard30, but not from one that kaddressbook creates.
$ cat Steve_Ballmer.invalid.vcf
BEGIN:VCARD
CATEGORIES:Business
CLASS:PUBLIC
FN:Steve Ballmer
N:Ballmer;Steve;;;
ORG:Micro Soft\, Inc.
TEL;TYPE=CELL:+445551234
UID:i5McZbI28a
VERSION:3.0
X-KADDRESSBOOK-X-Department:North American Division; Marketing
END:VCARD
$ vconvert Steve_Ballmer.invalid.vcf --to-xmlformat
<?xml version="1.0"?>
<contact>
<Categories>
<Category>Business</Category>
</Categories>
<Class>
<Content>PUBLIC</Content>
</Class>
<FormattedName>
<Content>Steve Ballmer</Content>
</FormattedName>
<Name>
<LastName>Ballmer</LastName>
<FirstName>Steve</FirstName>
</Name>
<Organization>
<Name>Micro Soft, Inc.</Name>
</Organization>
<Telephone Type="Cellular">
<Content>+445551234</Content>
</Telephone>
<Uid>
<Content>i5McZbI28a</Content>
</Uid>
</contact>
$ cat Steve_Ballmer.valid.vcf
BEGIN:VCARD
CATEGORIES:Business
CLASS:PUBLIC
FN:Steve Ballmer
N:Ballmer;Steve;;;
ORG:Micro Soft\, Inc.;North American Division;Marketing
TEL;TYPE=CELL:+445551234
UID:i5McZbI28a
VERSION:3.0
END:VCARD
vconvert Steve_Ballmer.valid.vcf --to-xmlformat
<?xml version="1.0"?>
<contact>
<Categories>
<Category>Business</Category>
</Categories>
<Class>
<Content>PUBLIC</Content>
</Class>
<FormattedName>
<Content>Steve Ballmer</Content>
</FormattedName>
<Name>
<LastName>Ballmer</LastName>
<FirstName>Steve</FirstName>
</Name>
<Organization>
<Name>Micro Soft, Inc.</Name>
<Unit>North American Division</Unit>
<Unit>Marketing</Unit>
</Organization>
<Telephone Type="Cellular">
<Content>+445551234</Content>
</Telephone>
<Uid>
<Content>i5McZbI28a</Content>
</Uid>
</contact>
Even having both valid ORG and proprietary X-KADDRESSBOOK-X-Department in the same card works fine with opensync vconversion.
Basically that causes synchronizations to break into conflicts when doing the second sync with same actual data.
Is there any change to get this fixed for 3.5.x branch? 4.0 is close but not cigar yet. It can be hacked into kdepim-sync plugin at opensync end, but it doesn't change the fact that data ends into wrong place.
*** This bug has been confirmed by popular vote. *** The format in question is VCARD 3.0, here is the RFC: http://www.rfc-editor.org/cgi-bin/rfcdoctype.pl?loc=RFC&letsgo=2426&type=ftp&file_format=txt Related Red Hat Bugs: fc6 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=253495 f7 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=253496 rhel5 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=253497 SVN commit 702317 by bvirlet:
Port fix (r702252) to KDE4
CCBUG: 115219
M +8 -2 ldifconverter.cpp
M +1 -0 scripts/entrylist
M +12 -4 vcardtool.cpp
--- trunk/KDE/kdepimlibs/kabc/ldifconverter.cpp #702316:702317
@@ -145,7 +145,13 @@
ldif_out( t, "o", addr.organization() );
ldif_out( t, "organization", addr.organization() );
ldif_out( t, "organizationname", addr.organization() );
- ldif_out( t, "department", addr.custom( "KADDRESSBOOK", "X-Department" ) );
+
+ // Compatibility with older kabc versions.
+ if ( addr.department().isEmpty() )
+ ldif_out( t, "department", addr.department() );
+ else
+ ldif_out( t, "department", addr.custom("KADDRESSBOOK", "X-Department") );
+
ldif_out( t, "workurl", addr.url().prettyUrl() );
ldif_out( t, "homeurl", addr.url().prettyUrl() );
ldif_out( t, "description", addr.note() );
@@ -459,7 +465,7 @@
}
if ( fieldname == QLatin1String( "department" ) ) {
- a.insertCustom( "KADDRESSBOOK", "X-Department", value );
+ a.setDepartment( value );
return true;
}
--- trunk/KDE/kdepimlibs/kabc/scripts/entrylist #702316:702317
@@ -63,6 +63,7 @@
ALFE,title,a person's title,QString,title,Organization
ALFE,role,of a person in an organization,QString,role,Organization
ALFE,organization,,QString,organization,Organization
+ALFE,department,,QString,department,Organization
ALFE,note,,QString,note
--- trunk/KDE/kdepimlibs/kabc/vcardtool.cpp #702316:702317
@@ -238,8 +238,12 @@
card.addLine( noteLine );
// ORG
- VCardLine orgLine( "ORG", (*addrIt).organization() );
- if ( version == VCard::v2_1 && needsEncoding( (*addrIt).organization() ) ) {
+ QStringList organization;
+ organization.append( ( *addrIt ).organization().replace( ';', "\\;" ) );
+ if ( !( *addrIt ).department().isEmpty() )
+ organization.append( ( *addrIt ).department().replace( ';', "\\;" ) );
+ VCardLine orgLine( "ORG", organization.join( ";" ) );
+ if ( version == VCard::v2_1 && needsEncoding( organization.join( ";" ) ) ) {
orgLine.addParameter( "charset", "UTF-8" );
orgLine.addParameter( "encoding", "QUOTED-PRINTABLE" );
}
@@ -529,9 +533,13 @@
// ORGANIZATION
else if ( identifier == "org" ) {
- addr.setOrganization( (*lineIt).value().toString() );
+ const QStringList orgParts = splitString( semicolonSep, (*lineIt).value().toString() );
+ if ( orgParts.count() > 0 )
+ addr.setOrganization( orgParts[ 0 ] );
+ if ( orgParts.count() > 1 )
+ addr.setDepartment( orgParts[ 1 ] );
}
-
+
// PHOTO
else if ( identifier == "photo" ) {
addr.setPhoto( parsePicture( *lineIt ) );
Thanks a lot for quick reaction :) SVN commit 702333 by bvirlet:
Fix (thank you Christian).
CCBUG: 115219
M +13 -13 ldifconverter.cpp
--- branches/KDE/3.5/kdelibs/kabc/ldifconverter.cpp #702332:702333
@@ -143,7 +143,7 @@
ldif_out( t, "organizationname", addr.organization() );
// Compatibility with older kabc versions.
- if ( addr.department().isEmpty() )
+ if ( !addr.department().isEmpty() )
ldif_out( t, "department", addr.department() );
else
ldif_out( t, "department", addr.custom("KADDRESSBOOK", "X-Department") );
@@ -179,7 +179,7 @@
QByteArray data;
Addressee a;
Address homeAddr, workAddr;
-
+
data.setRawData( latinstr, latinstrlen );
ldif.setLDIF( data );
if (!dt.isValid())
@@ -187,7 +187,7 @@
a.setRevision(dt);
homeAddr = Address( Address::Home );
workAddr = Address( Address::Work );
-
+
do {
ret = ldif.nextItem();
switch ( ret ) {
@@ -199,7 +199,7 @@
}
case LDIF::EndEntry:
// if the new address is not empty, append it
- if ( !a.formattedName().isEmpty() || !a.name().isEmpty() ||
+ if ( !a.formattedName().isEmpty() || !a.name().isEmpty() ||
!a.familyName().isEmpty() ) {
if ( !homeAddr.isEmpty() )
a.insertAddress( homeAddr );
@@ -213,10 +213,10 @@
workAddr = Address( Address::Work );
break;
case LDIF::MoreData: {
- if ( endldif )
+ if ( endldif )
end = true;
else {
- ldif.endLDIF();
+ ldif.endLDIF();
endldif = true;
break;
}
@@ -227,7 +227,7 @@
} while ( !end );
data.resetRawData( latinstr, latinstrlen );
-
+
return true;
}
@@ -254,7 +254,7 @@
return true;
}
- if ( fieldname == QString::fromLatin1( "xmozillanickname") ||
+ if ( fieldname == QString::fromLatin1( "xmozillanickname") ||
fieldname == QString::fromLatin1( "nickname") ) {
a.setNickName( value );
return true;
@@ -291,7 +291,7 @@
return true;
}
- if ( fieldname == QString::fromLatin1( "o" ) ||
+ if ( fieldname == QString::fromLatin1( "o" ) ||
fieldname == QString::fromLatin1( "organization" ) || // Exchange
fieldname == QString::fromLatin1( "organizationname" ) ) { // Exchange
a.setOrganization( value );
@@ -325,7 +325,7 @@
// TODO: change this with KDE 4
}
- if ( fieldname == QString::fromLatin1( "homephone" ) ) {
+ if ( fieldname == QString::fromLatin1( "homephone" ) ) {
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Home ) );
return true;
}
@@ -486,7 +486,7 @@
}
}
- if ( fieldname == QString::fromLatin1( "objectclass" ) ) // ignore
+ if ( fieldname == QString::fromLatin1( "objectclass" ) ) // ignore
return true;
kdWarning() << QString("LDIFConverter: Unknown field for '%1': '%2=%3'\n")
@@ -531,7 +531,7 @@
if (formatStr.find(':') == -1)
formatStr.append(": %1\n");
- // check if base64-encoding is needed
+ // check if base64-encoding is needed
bool printable = true;
unsigned int i, len;
len = value.length();
@@ -545,7 +545,7 @@
if (printable) // always encode if we find special chars...
printable = (value.find('\n') == -1);
- if (!printable && allowEncode) {
+ if (!printable && allowEncode) {
// encode to base64
value = KCodecs::base64Encode( value.utf8() );
int p = formatStr.find(':');
The development of the old KAddressBook will be discontinued for KDE 4.4. Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product. |