summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-28 03:24:50 (UTC)
committer zautrix <zautrix>2005-10-28 03:24:50 (UTC)
commitf83a59cf4f9d0cff4111b6f5c88e88e6dc96e79e (patch) (side-by-side diff)
tree969e6cf85499e3b1dcaa4dc24c972b65c906cfa9
parentcbda16d4966c7483d20d1b6b5a64c8af367ea732 (diff)
downloadkdepimpi-f83a59cf4f9d0cff4111b6f5c88e88e6dc96e79e.zip
kdepimpi-f83a59cf4f9d0cff4111b6f5c88e88e6dc96e79e.tar.gz
kdepimpi-f83a59cf4f9d0cff4111b6f5c88e88e6dc96e79e.tar.bz2
many new bugs...
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt24
-rw-r--r--kabc/addressee.cpp74
-rw-r--r--kabc/addressee.h2
-rw-r--r--kabc/field.cpp10
-rw-r--r--kabc/phonenumber.cpp110
-rw-r--r--kabc/phonenumber.h5
-rw-r--r--kabc/vcard21parser.cpp12
-rw-r--r--kabc/vcardformatimpl.cpp4
-rw-r--r--kabc/vcardparser/vcardtool.cpp2
9 files changed, 209 insertions, 34 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index 8dd0a52..62e567e 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -101,33 +101,33 @@
{ "Note:","Notiz:" },
{ "&Notes","&Notizen" },
{ "Use geo data","Benutze geo Daten" },
{ "Latitude:","Breitengrad:" },
{ "Longitude:","Längengrad:" },
{ "Edit Geo Data...","Edit geo Daten..." },
{ "Keys:","Schlüssel:" },
{ "Add","Hinzu" },
{ "Remove","Entf." },
{ "Export","Exportiere" },
{ "&Misc","Verschiedenes" },
{ "Photo","Foto" },
{ "Store as URL","Speichere als URL" },
{ "Logo","Logo" },
{ "&Images","B&ilder" },
{ "Home","Privat" },
-{ "Work","Geschäft" },
+{ "Work","Arbeit" },
{ "Mobile","Handy" },
{ "Fax","Fax" },
{ "Contact Editor","Bearbeite Kontakt" },
{ "&Mail...","&Mail..." },
{ "&Print...","Drucken..." },
{ "&Save","&Speichern" },
{ "&New Contact...","&Neuer Kontakt..." },
{ "Mail &vCard...","Mail &vCard..." },
{ "Selected to phone","Auswahl zum Telefon" },
{ "Beam selected v&Card(s)","Beame ausgewählte v&Card(s)" },
{ "&Beam personal vCard","Beame persönliche vCard" },
{ "&Edit Contact...","Bearbeite Kontakt..." },
{ "&Exit","B&eenden" },
{ "&Copy","Kopieren" },
{ "Cu&t","Ausschneiden" },
{ "&Paste","Einfügen" },
@@ -289,36 +289,36 @@
{ "Honorific Suffixes","Namenssuffix" },
{ "Nick Name","Spitzname" },
{ "Birthday","Geburtstag" },
{ "Home Address Street","Privat Adresse Strasse" },
{ "Home Address Locality","Privat Adresse Stadt" },
{ "Home Address Region","Privat Adresse Bundesland" },
{ "Home Address Postal Code","Privat Adresse PLZ" },
{ "Home Address Country","Privat Adresse Land" },
{ "Home Address Label","Privat Adresse Label" },
{ "Business Address Street","Büro Adresse Strasse" },
{ "Business Address Locality","Büro Adresse Stadt" },
{ "Business Address Region","Büro Adresse Bundesland" },
{ "Business Address Postal Code","Büro Adresse PLZ" },
{ "Business Address Country","Büro Adresse Land" },
{ "Business Address Label","Büro Adresse Label" },
{ "Home Phone","Privat Telefon" },
-{ "Business Phone","Büro Telefon" },
+{ "Business Phone","Arbeit Telefon" },
{ "Mobile Phone","Handy" },
{ "Home Fax","Privat Fax" },
-{ "Business Fax","Büro Fax" },
+{ "Business Fax","Arbeit Fax" },
{ "Car Phone","Autotelefon" },
{ "ISDN","ISDN" },
{ "Pager","Pager" },
{ "Mail Client","Mail Klient" },
{ "Title","Titel" },
{ "Role","Rolle" },
{ "Note","Notiz" },
{ "URL","URL" },
{ "Resource","Resource" },
{ "SIP","SIP" },
{ "Default Filter","Default Filter" },
{ "The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime.","#The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime." },
{ "No default filter","Kein default Filter" },
{ "Use last active filter","Nutze letzen aktiven Filter" },
{ "Use filter:","Nutze Filter:" },
{ "Look & Feel","Look & Feel" },
@@ -739,34 +739,34 @@
{ "Receiving synced file...","Gesyncte Daten erhalten..." },
{ "Received %1 bytes","%1 Bytes erhalten" },
{ "Writing file to disk...","Speichere Datei..." },
{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
{ "Synchronize!","Synchronisiere!" },
{ "High clock skew!","Großer Uhrzeitunterschied!" },
{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
{ "Change search field enable jump bar","Ändere Suchfeld um Jumpbar anzuzeigen" },
{ "Search with '*' prefix (wildcard)","Suche mit '*' Prefix (Wildcard)" },
{ "Shrink searchfield in portrait view","Verkleinere Suchfeld im Portraitmodus" },
{ "Edit new contact","Bearbeite neuen Kontakt" },
{ "Edit ","Bearbeite " },
{ "No contact changed!","Kein Kontakt verändert" },
{ "%1 contacts changed!","%1 Kontakte geändert!" },
-{ "Mobile (home)","Handy (Arbeit)" },
-{ "Mobile (work)","Handy (Privat)" },
+{ "Mobile (home)","Handy (Privat)" },
+{ "Mobile (work)","Handy (Arbeit)" },
{ "Def.Formatted Name","Def. Format. Name" },
{ "Colors","Farben" },
{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
{ "Backup enabled","Backup angeschaltet" },
{ "Use standard backup dir","Standard Backupverzeichnis" },
{ "Number of Backups:","Anzahl der Backups" },
{ "Make backup every ","Mache ein Backup alle " },
{ " days"," Tage" },
{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
{ "Backup Failed!","Backup Problem!" },
{ "Try again now","Versuche jetzt nochmal" },
{ "Try again later","Versuche später nochmal" },
{ "Try again tomorrow","Versuche morgen nochmal" },
{ "Disable backup","Schalte Backup ab" },
{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
@@ -802,25 +802,31 @@
{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
{ "Writing back file ...","Schreibe Datei zurück..." },
{ "Sending back file ...","Sende Datei zurück..." },
{ "Eeek, there I am ticklish!","Huch, da bin ich kitzlig!" },
{ "Save using LOCAL storage","Speichere nutze LOCAL Pfad" },
{ "...and %1 more\ncontact(s) selected","...und noch %1 Kontakte\n mehr ausgewählt" },
{ "Do you really\nwant to delete the\nsetected contact(s)?\n\n","Möchten Sie wirklich\ndie ausgewählten\nKontakte löschen?\n\n" },
{ "%1 contacts\nsuccessfully\nimported.","%1 Kontakte\nerfolgreich\nimportiert." },
{ "Import this contact?","Importiere diesen Kontakt?" },
{ "Import all!","Importiere alle!" },
{ "Loading addressbook data ... please wait","Lade Adressbuchdaten ... bitte warten" },
{ "Import Format","Import Format" },
{ "Select import format!\nDefault and standard is Utf8.\nLatin1 may be the right\nfor some West Europian languages.","Wähle Import Format!\nDefault und Standard ist Utf8.\nLatin1 kann das richtige für\nWesteuropäische Sprachen sein." },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
+{ "Home2","Privat2" },
+{ "Work2","Arbeit2" },
+{ "Fax (Work)","Fax (Arbeit)" },
+{ "Fax (Home)","Fax (Privat)" },
+{ "Assistent","Sekretär(in)" },
+{ "Company","Firma" },
+{ "Mobile2 (Work)","Handy2 (Arbeit)" },
+{ "Callback","Rückruf" },
+{ "Fax (Other)","Fax (Anderes)" },
+{ "Primary","Bevorzugt" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" }, \ No newline at end of file
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 7e1e414..661bdf6 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -573,33 +573,85 @@ void Addressee::simplifyAddresses()
}
for( it = list.begin(); it != list.end(); ++it ) {
removeAddress( (*it) );
}
}
// removes all emails but the first
// needed by phone sync
void Addressee::simplifyEmails()
{
if ( mData->emails.count() == 0 ) return ;
QString email = mData->emails.first();
detach();
mData->emails.clear();
mData->emails.append( email );
}
+void Addressee::makePhoneNumbersOLcompatible()
+{
+ KABC::PhoneNumber::List::Iterator phoneIter;
+ KABC::PhoneNumber::List::Iterator phoneIter2;
+ for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
+ ++phoneIter ) {
+ ( *phoneIter ).makeCompat();
+ }
+ int hasHome = hasPhoneNumberType( PhoneNumber::Home | PhoneNumber::Pref );
+ int hasHome2 = hasPhoneNumberType( PhoneNumber::Home );
+ int hasWork = hasPhoneNumberType( PhoneNumber::Work | PhoneNumber::Pref );
+ int hasWork2 = hasPhoneNumberType( PhoneNumber::Work );
+ int hasCell = hasPhoneNumberType( PhoneNumber::Cell );
+ int hasCell2 = hasPhoneNumberType( PhoneNumber::Car );
+ for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
+ ++phoneIter ) {
+ if ( (*phoneIter).type() == PhoneNumber::Home && ! hasHome ) {
+ (*phoneIter).setType( PhoneNumber::Home | PhoneNumber::Pref );
+ ++hasHome;
+ if ( hasHome2 ) --hasHome2;
+ } else if ( ( (*phoneIter).type() == PhoneNumber::Home | PhoneNumber::Pref) && hasHome>1 && !hasHome2 ) {
+ (*phoneIter).setType( PhoneNumber::Home );
+ --hasHome;
+ ++hasHome2;
+ } else if ( (*phoneIter).type() == PhoneNumber::Work && ! hasWork ) {
+ (*phoneIter).setType( PhoneNumber::Work | PhoneNumber::Pref );
+ ++hasWork;
+ if ( hasWork2 ) --hasWork2;
+ } else if ( ( (*phoneIter).type() == PhoneNumber::Work | PhoneNumber::Pref) && hasWork > 1 && ! hasWork2 ) {
+ (*phoneIter).setType( PhoneNumber::Work );
+ --hasWork;
+ ++hasWork2;
+ } else if ( (*phoneIter).type() == PhoneNumber::Cell && hasCell > 1 && !hasCell2) {
+ (*phoneIter).setType( PhoneNumber::Car );
+ ++hasCell2;
+ --hasCell;
+ } else if ( (*phoneIter).type() == PhoneNumber::Car && hasCell2 > 1 && !hasCell) {
+ (*phoneIter).setType( PhoneNumber::Cell );
+ ++hasCell;
+ --hasCell2;
+ } else{
+ phoneIter2 = phoneIter;
+ ++phoneIter2;
+ for ( ; phoneIter2 != mData->phoneNumbers.end();
+ ++phoneIter2 ) {
+ if ( (*phoneIter2).type() == (*phoneIter).type() ) {
+ (*phoneIter2).setType( PhoneNumber::Voice );
+ }
+ }
+ }
+ }
+}
void Addressee::simplifyPhoneNumbers()
{
int max = 4;
int inList = mData->phoneNumbers.count();
KABC::PhoneNumber::List removeNumbers;
KABC::PhoneNumber::List::Iterator phoneIter;
if ( inList > max ) {
// delete non-preferred numbers
for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
++phoneIter ) {
if ( inList > max ) {
if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) {
removeNumbers.append( ( *phoneIter ) );
--inList;
}
} else
@@ -984,65 +1036,65 @@ QString Addressee::businessAddressCountryLabel()
QString Addressee::businessAddressLabelLabel()
{
return i18n("Business Address Label");
}
QString Addressee::homePhoneLabel()
{
return i18n("Home Phone");
}
QString Addressee::businessPhoneLabel()
{
- return i18n("Business Phone");
+ return i18n("Work Phone");
}
QString Addressee::mobilePhoneLabel()
{
return i18n("Mobile Phone");
}
QString Addressee::mobileWorkPhoneLabel()
{
- return i18n("Mobile (work)");
+ return i18n("Mobile2 (work)");
}
QString Addressee::mobileHomePhoneLabel()
{
- return i18n("Mobile (home)");
+ return i18n("Mobile");
}
QString Addressee::homeFaxLabel()
{
- return i18n("Home Fax");
+ return i18n("Fax (Home)");
}
QString Addressee::businessFaxLabel()
{
- return i18n("Business Fax");
+ return i18n("Fax (Work)");
}
QString Addressee::carPhoneLabel()
{
- return i18n("Car Phone");
+ return i18n("Mobile2 (work)");
}
QString Addressee::isdnLabel()
{
return i18n("ISDN");
}
QString Addressee::pagerLabel()
{
return i18n("Pager");
}
QString Addressee::sipLabel()
{
@@ -1639,32 +1691,42 @@ PhoneNumber Addressee::phoneNumber( int type ) const
if ( matchBinaryPatternP( (*it).type(), type ) ) {
if ( (*it).type() & PhoneNumber::Pref )
return (*it);
else if ( phoneNumber.number().isEmpty() )
phoneNumber = (*it);
}
}
return phoneNumber;
}
PhoneNumber::List Addressee::phoneNumbers() const
{
return mData->phoneNumbers;
}
+int Addressee::hasPhoneNumberType( int type )
+{
+ int retval = 0;
+ PhoneNumber::List::ConstIterator it;
+ for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
+ if ( (*it).type() == type )
+ ++retval;
+ }
+ return retval;
+}
PhoneNumber::List Addressee::phoneNumbers( int type ) const
{
PhoneNumber::List list;
PhoneNumber::List::ConstIterator it;
for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
if ( matchBinaryPattern( (*it).type(), type ) ) {
list.append( *it );
}
}
return list;
}
PhoneNumber Addressee::findPhoneNumber( const QString &id ) const
{
PhoneNumber::List::ConstIterator it;
diff --git a/kabc/addressee.h b/kabc/addressee.h
index d1c07cb..0c488eb 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -109,32 +109,34 @@ class Addressee
void removeID(const QString &);
void computeCsum(const QString &dev);
ulong getCsum4List( const QStringList & attList);
/**
Return, if the address book entry is empty.
*/
bool isEmpty() const;
void setExternalUID( const QString &id );
const QString externalUID() const;
void setOriginalExternalUID( const QString &id );
QString originalExternalUID() const;
void mergeContact( const Addressee& ad, bool isSubSet );
void simplifyEmails();
void simplifyAddresses();
void simplifyPhoneNumbers();
void simplifyPhoneNumberTypes();
+ void makePhoneNumbersOLcompatible();
+ int hasPhoneNumberType( int type );
bool removeVoice();
bool containsAdr(const Addressee& addr );
/**
Set unique identifier.
*/
void setUid( const QString &uid );
/**
Return unique identifier.
*/
const QString uid() const;
/**
Return translated label for uid field.
*/
static QString uidLabel();
diff --git a/kabc/field.cpp b/kabc/field.cpp
index fd51026..20885de 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -276,53 +276,53 @@ QString Field::value( const KABC::Addressee &a )
// QString _oldFormat = KGlobal::locale()->dateFormat();
// KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate
QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate);
// KGlobal::locale()->setDateFormat(_oldFormat);
return dt;
}
else
return QString::null;
case FieldImpl::Url:
return a.url().prettyURL();
//US
case FieldImpl::Resource:
return a.resource()->resourceName();
case FieldImpl::Category:
return a.categories().join(",");
case FieldImpl::HomePhone:
- return a.phoneNumber( PhoneNumber::Home ).number();
+ return a.phoneNumber( PhoneNumber::Home| PhoneNumber::Pref ).number();
case FieldImpl::BusinessPhone:
- return a.phoneNumber( PhoneNumber::Work ).number();
+ return a.phoneNumber( PhoneNumber::Work| PhoneNumber::Pref ).number();
case FieldImpl::MobilePhone:
return a.phoneNumber( PhoneNumber::Cell ).number();
case FieldImpl::MobileWorkPhone:
- return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number();
+ return a.phoneNumber( PhoneNumber::Car ).number();
case FieldImpl::MobileHomePhone:
- return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).number();
+ return a.phoneNumber( PhoneNumber::Cell ).number();
case FieldImpl::HomeFax:
return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number();
case FieldImpl::BusinessFax:
return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number();
case FieldImpl::CarPhone:
return a.phoneNumber( PhoneNumber::Car ).number();
case FieldImpl::Isdn:
return a.phoneNumber( PhoneNumber::Isdn ).number();
case FieldImpl::Pager:
return a.phoneNumber( PhoneNumber::Pager ).number();
case FieldImpl::Sip:
- return a.phoneNumber( PhoneNumber::Sip ).number();
+ return a.phoneNumber( PhoneNumber::Pcs | PhoneNumber::Pref ).number();
case FieldImpl::HomeAddressStreet:
return a.address( Address::Home ).street();
case FieldImpl::HomeAddressLocality:
return a.address( Address::Home ).locality();
case FieldImpl::HomeAddressRegion:
return a.address( Address::Home ).region();
case FieldImpl::HomeAddressPostalCode:
return a.address( Address::Home ).postalCode();
case FieldImpl::HomeAddressCountry:
return a.address( Address::Home ).country();
case FieldImpl::BusinessAddressStreet:
return a.address( Address::Work ).street();
case FieldImpl::BusinessAddressLocality:
return a.address( Address::Work ).locality();
case FieldImpl::BusinessAddressRegion:
return a.address( Address::Work ).region();
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 4c6231d..0d46ba7 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -52,33 +52,88 @@ void PhoneNumber::init()
{
mId = KApplication::randomString( 8 );
}
bool PhoneNumber::operator==( const PhoneNumber &p ) const
{
if ( mNumber != p.mNumber ) return false;
if ( mType != p.mType ) return false;
return true;
}
bool PhoneNumber::operator!=( const PhoneNumber &p ) const
{
return !( p == *this );
}
+void PhoneNumber::makeCompat()
+{
+ mType = getCompatType( mType );
+}
+int PhoneNumber::getCompatType( int type )
+{
+ if ((type & Cell) == Cell) {
+ if ((type & Work) == Work)
+ return Car;
+ return Cell;
+ }
+ if ((type & Home) == Home) {
+ if ((type & Pref) == Pref)
+ return (Home | Pref);
+ if ((type & Fax) == Fax)
+ return (Home | Fax);
+ return (Home);
+ }
+ if ((type & Work) == Work) {
+ if ((type & Pref) == Pref)
+ return (Work| Pref);
+ if ((type & Fax) == Fax)
+ return (Fax |Work);
+ if ((type & Msg) == Msg) {
+ if ((type & Voice) == Voice)
+ return ( Msg | Voice |Work);
+ return ( Msg | Work);
+ }
+ return Work;
+ }
+ if ((type & Pcs) == Pcs) {
+ if ((type & Pref) == Pref)
+ return Pcs | Pref;
+ return Pcs;
+ }
+ if ((type & Car) == Car)
+ return Car;
+ if ((type & Pager) == Pager)
+ return Pager;
+ if ((type & Isdn) == Isdn)
+ return Isdn;
+ if ((type & Video) == Video)
+ return Video;
+
+ if ((type & Msg) == Msg)
+ return Msg;
+ if ((type & Fax) == Fax)
+ return Fax;
+
+ if ((type & Pref) == Pref)
+ return Pref;
+
+ return Voice;
+
+}
bool PhoneNumber::simplifyNumber()
{
QString Number;
int i;
Number = mNumber.stripWhiteSpace ();
mNumber = "";
for ( i = 0; i < Number.length(); ++i) {
if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' )
mNumber += Number.at(i);
}
return ( mNumber.length() > 0 );
}
// make cellphone compatible
void PhoneNumber::simplifyType()
{
if ( mType & Fax ) mType = Fax;
@@ -150,44 +205,96 @@ QString PhoneNumber::typeLabel() const
}
}
return label;
}
QString PhoneNumber::label() const
{
return typeLabel( type() );
}
PhoneNumber::TypeList PhoneNumber::typeList()
{
TypeList list;
list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
- << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip;
+ << Bbs << Modem << Car << Isdn << Pcs << Pager;
return list;
}
QString PhoneNumber::label( int type )
{
return typeLabel( type );
}
QString PhoneNumber::typeLabel( int type )
{
+ if ((type & Cell) == Cell)
+ return i18n("Mobile");
+ if ((type & Home) == Home) {
+ if ((type & Pref) == Pref)
+ return i18n("Home");
+ if ((type & Fax) == Fax)
+ return i18n("Fax (Home)");
+ return i18n("Home2");
+ }
+
+ if ((type & Work) == Work) {
+ if ((type & Pref) == Pref)
+ return i18n("Work");
+ if ((type & Fax) == Fax)
+ return i18n("Fax (Work)");
+ if ((type & Msg) == Msg) {
+ if ((type & Voice) == Voice)
+ return i18n("Assistent");
+ return i18n("Company");
+ }
+ return i18n("Work2");
+ }
+ if ((type & Pcs) == Pcs) {
+ if ((type & Pref) == Pref)
+ return i18n("SIP");
+ return i18n("VoIP");
+ }
+ if ((type & Car) == Car)
+ return i18n("Mobile2 (Work)");
+ if ((type & Pager) == Pager)
+ return i18n("Pager");
+ if ((type & Isdn) == Isdn)
+ return i18n("ISDN");
+ if ((type & Video) == Video)
+ return i18n("Video");
+
+ if ((type & Msg) == Msg)
+ return i18n("Callback");
+ if ((type & Fax) == Fax)
+ return i18n("Fax (Other)");
+
+ if ((type & Pref) == Pref)
+ return i18n("Primary");
+
+
+ return i18n("Other");
+
+
+#if 0
+
+
+
QString typeString;
if ((type & Cell) == Cell)
typeString += i18n("Mobile") +" ";
if ((type & Home) == Home)
typeString += i18n("Home")+" ";
else if ((type & Work) == Work)
typeString += i18n("Work")+" ";
if ((type & Sip) == Sip)
typeString += i18n("SIP")+" ";
if ((type & Car) == Car)
typeString += i18n("Car")+" ";
if ((type & Fax) == Fax)
@@ -207,29 +314,30 @@ QString PhoneNumber::typeLabel( int type )
else if ((type & Pager) == Pager)
typeString += i18n("Pager");
// add the prefered flag
/*
if ((type & Pref) == Pref)
typeString += i18n("(p)");
*/
//if we still have no match, return "other"
if (typeString.isEmpty()) {
if ((type & Voice) == Voice)
return i18n("Voice");
else
return i18n("Other");
}
return typeString.stripWhiteSpace();
+#endif
}
QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone )
{
return s << phone.mId << phone.mType << phone.mNumber;
}
QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone )
{
s >> phone.mId >> phone.mType >> phone.mNumber;
return s;
}
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h
index 2d4d3e0..b9d6a17 100644
--- a/kabc/phonenumber.h
+++ b/kabc/phonenumber.h
@@ -51,37 +51,36 @@ class PhoneNumber
/**
@li @p Home - Home number
@li @p Work - Office number
@li @p Msg - Messaging
@li @p Pref - Preferred number
@li @p Voice - Voice
@li @p Fax - Fax machine
@li @p Cell - Cell phone
@li @p Video - Video phone
@li @p Bbs - Mailbox
@li @p Modem - Modem
@li @p Car - Car phone
@li @p Isdn - ISDN connection
@li @p Pcs - Personal Communication Service
@li @p Pager - Pager
- @li @p SIP - VoIP
*/
enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32,
Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024,
- Isdn = 2048, Pcs = 4096, Pager = 8192, Sip = 16384 };
+ Isdn = 2048, Pcs = 4096, Pager = 8192 };
/**
Create an empty phone number object.
*/
PhoneNumber();
/**
Create a phonenumber object.
@param number Number
@param type Type as defined in enum. Multiple types can be
specified by combining them by a logical or.
*/
PhoneNumber( const QString &number, int type = Home );
/**
@@ -138,32 +137,34 @@ class PhoneNumber
Returns a list of all available types
*/
static TypeList typeList();
/**
Returns the translated label for phone number type.
*/
static QString typeLabel( int type );
/**
Returns the translated label for phone number type.
@obsolete
*/
static QString label( int type );
bool simplifyNumber();
void simplifyType();
+ void makeCompat();
+ int getCompatType( int type );
private:
void init();
QString mId;
int mType;
QString mNumber;
};
QDataStream &operator<<( QDataStream &, const PhoneNumber & );
QDataStream &operator>>( QDataStream &, PhoneNumber & );
}
#endif
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp
index 277de22..60d02b8 100644
--- a/kabc/vcard21parser.cpp
+++ b/kabc/vcard21parser.cpp
@@ -157,34 +157,33 @@ bool VCardLineX::isValid() const
case 't':
if ( name == VCARD_TEL && qualified &&
(qualifiers.contains(VCARD_TEL_HOME) ||
qualifiers.contains(VCARD_TEL_WORK) ||
qualifiers.contains(VCARD_TEL_PREF) ||
qualifiers.contains(VCARD_TEL_VOICE) ||
qualifiers.contains(VCARD_TEL_FAX) ||
qualifiers.contains(VCARD_TEL_MSG) ||
qualifiers.contains(VCARD_TEL_CELL) ||
qualifiers.contains(VCARD_TEL_PAGER) ||
qualifiers.contains(VCARD_TEL_BBS) ||
qualifiers.contains(VCARD_TEL_MODEM) ||
qualifiers.contains(VCARD_TEL_CAR) ||
qualifiers.contains(VCARD_TEL_ISDN) ||
qualifiers.contains(VCARD_TEL_VIDEO) ||
- qualifiers.contains(VCARD_TEL_PCS) ||
- qualifiers.contains(VCARD_TEL_SIP)
+ qualifiers.contains(VCARD_TEL_PCS)
) )
return true;
if ( name == VCARD_TZ )
return true;
if ( name == VCARD_TITLE )
return true;
break;
case 'u':
if ( name == VCARD_URL )
return true;
if ( name == VCARD_UID )
return true;
break;
case 'v':
@@ -267,61 +266,60 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
//set the addressee's birthday
tmpStr = mVCard->getValue(VCARD_BDAY);
addressee.setBirthday(VCardStringToDate(tmpStr));
//set the addressee's phone numbers
for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_TEL ) {
int type = 0;
if ( (*i).qualified ) {
if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) )
type |= PhoneNumber::Home;
if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) )
type |= PhoneNumber::Work;
if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) )
type |= PhoneNumber::Pref;
- // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
- // type |= PhoneNumber::Voice;
+ if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
+ type |= PhoneNumber::Voice;
if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) )
type |= PhoneNumber::Fax;
if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) )
type |= PhoneNumber::Msg;
if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) )
type |= PhoneNumber::Cell;
if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) )
type |= PhoneNumber::Pager;
if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) )
type |= PhoneNumber::Bbs;
if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) )
type |= PhoneNumber::Modem;
if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) )
type |= PhoneNumber::Car;
if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) )
type |= PhoneNumber::Isdn;
if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) )
type |= PhoneNumber::Video;
if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) )
type |= PhoneNumber::Pcs;
- if ( (*i).qualifiers.contains( VCARD_TEL_SIP ) )
- type |= PhoneNumber::Sip;
+
}
addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) );
}
}
-
+ addressee.makePhoneNumbersOLcompatible();
//set the addressee's addresses
for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_ADR ) {
int type = 0;
if ( (*i).qualified ) {
if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) )
type |= Address::Dom;
if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) )
type |= Address::Intl;
if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) )
type |= Address::Postal;
if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) )
type |= Address::Parcel;
if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) )
type |= Address::Home;
if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) )
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index ec5ed80..26fd4f0 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -268,33 +268,33 @@ bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
break;
}
}
for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
EntityType type = cl->entityType();
if ( type == EntityLabel ) {
int type = readAddressParam( cl );
Address address = addressee.address( type );
if ( address.isEmpty() )
address.setType( type );
address.setLabel( QString::fromUtf8( cl->value()->asString() ) );
addressee.insertAddress( address );
}
}
-
+ addressee.makePhoneNumbersOLcompatible();
return true;
}
void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern )
{
//US ContentLine cl;
//US QString value;
addTextValue( v, EntityName, addressee.name() );
addTextValue( v, EntityUID, addressee.uid() );
addTextValue( v, EntityFullName, addressee.formattedName() );
QStringList emails = addressee.emails();
QStringList::ConstIterator it4;
for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) {
addTextValue( v, EntityEmail, *it4 );
@@ -582,66 +582,64 @@ void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p )
ParamList params;
if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) );
if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) );
if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) );
if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) );
if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) );
if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) );
if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) );
if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) );
if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) );
if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) );
if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) );
if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) );
if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) );
if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) );
- if( p.type() & PhoneNumber::Sip ) params.append( new Param( "TYPE", "sip" ) );
cl.setParamList( params );
v->add(cl);
}
PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
{
PhoneNumber p;
TelValue *value = (TelValue *)cl->value();
p.setNumber( QString::fromUtf8( value->asString() ) );
int type = 0;
ParamList params = cl->paramList();
ParamListIterator it( params );
QCString tmpStr;
for( ; it.current(); ++it ) {
if ( (*it)->name() == "TYPE" ) {
tmpStr = (*it)->value().lower();
if ( tmpStr == "home" ) type |= PhoneNumber::Home;
else if ( tmpStr == "work" ) type |= PhoneNumber::Work;
else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg;
else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref;
else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice;
else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax;
else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell;
else if ( tmpStr == "video" ) type |= PhoneNumber::Video;
else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs;
else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem;
else if ( tmpStr == "car" ) type |= PhoneNumber::Car;
else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn;
else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs;
else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager;
- else if ( tmpStr == "sip" ) type |= PhoneNumber::Sip;
}
}
p.setType( type );
return p;
}
QString VCardFormatImpl::readTextValue( ContentLine *cl )
{
VCARD::Value *value = cl->value();
if ( value ) {
return QString::fromUtf8( value->asString() );
} else {
kdDebug(5700) << "No value: " << cl->asString() << endl;
qDebug("No value: %s", (const char*)(cl->asString()));
return QString::null;
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp
index c3d92b6..204326e 100644
--- a/kabc/vcardparser/vcardtool.cpp
+++ b/kabc/vcardparser/vcardtool.cpp
@@ -563,33 +563,33 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
// UID
else if ( identifier == "uid" )
addr.setUid( (*lineIt).valueString() );
// URL
else if ( identifier == "url" )
addr.setUrl( KURL( (*lineIt).valueString() ) );
// X-
else if ( identifier.startsWith( "x-" ) ) {
const QString key = (*lineIt).identifier().mid( 2 );
int dash = key.find( "-" );
addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() );
}
}
}
-
+ addr.makePhoneNumbersOLcompatible();
addrList.append( addr );
}
return addrList;
}
QDateTime VCardTool::parseDateTime( const QString &str )
{
QDateTime dateTime;
if ( str.find( '-' ) == -1 ) { // is base format (yyyymmdd)
dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 4, 2 ).toInt(),
str.mid( 6, 2 ).toInt() ) );
if ( str.find( 'T' ) ) // has time information yyyymmddThh:mm:ss
dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(),