diff options
Diffstat (limited to 'tderesources/kolab/tdeabc/contact.cpp')
-rw-r--r-- | tderesources/kolab/tdeabc/contact.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/tderesources/kolab/tdeabc/contact.cpp b/tderesources/kolab/tdeabc/contact.cpp index fec56ec6f..337dbe5c1 100644 --- a/tderesources/kolab/tdeabc/contact.cpp +++ b/tderesources/kolab/tdeabc/contact.cpp @@ -50,14 +50,14 @@ static const char* s_soundAttachmentName = "sound"; static const char* s_unhandledTagAppName = "KOLABUNHANDLED"; // no hyphens in appnames! // saving (addressee->xml) -Contact::Contact( const KABC::Addressee* addr ) +Contact::Contact( const TDEABC::Addressee* addr ) : mHasGeo( false ) { setFields( addr ); } // loading (xml->addressee) -Contact::Contact( const TQString& xml, KABC::ResourceKolab* resource, const TQString& subResource, TQ_UINT32 sernum ) +Contact::Contact( const TQString& xml, TDEABC::ResourceKolab* resource, const TQString& subResource, TQ_UINT32 sernum ) : mHasGeo( false ) { load( xml ); @@ -859,11 +859,11 @@ TQString Contact::saveXML() const return document.toString(); } -static TQString addressTypeToString( int /*KABC::Address::Type*/ type ) +static TQString addressTypeToString( int /*TDEABC::Address::Type*/ type ) { - if ( type & KABC::Address::Home ) + if ( type & TDEABC::Address::Home ) return "home"; - if ( type & KABC::Address::Work ) + if ( type & TDEABC::Address::Work ) return "business"; return "other"; } @@ -871,110 +871,110 @@ static TQString addressTypeToString( int /*KABC::Address::Type*/ type ) static int addressTypeFromString( const TQString& type ) { if ( type == "home" ) - return KABC::Address::Home; + return TDEABC::Address::Home; if ( type == "business" ) - return KABC::Address::Work; + return TDEABC::Address::Work; // well, this shows "other" in the editor, which is what we want... - return KABC::Address::Dom | KABC::Address::Intl | KABC::Address::Postal | KABC::Address::Parcel; + return TDEABC::Address::Dom | TDEABC::Address::Intl | TDEABC::Address::Postal | TDEABC::Address::Parcel; } -static TQStringList phoneTypeToString( int /*KABC::PhoneNumber::Types*/ type ) +static TQStringList phoneTypeToString( int /*TDEABC::PhoneNumber::Types*/ type ) { // KABC has a bitfield, i.e. the same phone number can be used for work and home // and fax and cellphone etc. etc. // So when saving we need to create as many tags as bits that were set. TQStringList types; - if ( type & KABC::PhoneNumber::Fax ) { - if ( type & KABC::PhoneNumber::Home ) + if ( type & TDEABC::PhoneNumber::Fax ) { + if ( type & TDEABC::PhoneNumber::Home ) types << "homefax"; - else // assume work -- if ( type & KABC::PhoneNumber::Work ) + else // assume work -- if ( type & TDEABC::PhoneNumber::Work ) types << "businessfax"; - type = type & ~KABC::PhoneNumber::Home; - type = type & ~KABC::PhoneNumber::Work; + type = type & ~TDEABC::PhoneNumber::Home; + type = type & ~TDEABC::PhoneNumber::Work; } // To support both "home1" and "home2", map Home+Pref to home2 - if ( ( type & KABC::PhoneNumber::Home ) && ( type & KABC::PhoneNumber::Pref ) ) + if ( ( type & TDEABC::PhoneNumber::Home ) && ( type & TDEABC::PhoneNumber::Pref ) ) { types << "home2"; - type = type & ~KABC::PhoneNumber::Home; - type = type & ~KABC::PhoneNumber::Pref; + type = type & ~TDEABC::PhoneNumber::Home; + type = type & ~TDEABC::PhoneNumber::Pref; } // To support both "business1" and "business2", map Work+Pref to business2 - if ( ( type & KABC::PhoneNumber::Work ) && ( type & KABC::PhoneNumber::Pref ) ) + if ( ( type & TDEABC::PhoneNumber::Work ) && ( type & TDEABC::PhoneNumber::Pref ) ) { types << "business2"; - type = type & ~KABC::PhoneNumber::Work; - type = type & ~KABC::PhoneNumber::Pref; + type = type & ~TDEABC::PhoneNumber::Work; + type = type & ~TDEABC::PhoneNumber::Pref; } - if ( type & KABC::PhoneNumber::Home ) + if ( type & TDEABC::PhoneNumber::Home ) types << "home1"; - if ( type & KABC::PhoneNumber::Msg ) // Msg==messaging + if ( type & TDEABC::PhoneNumber::Msg ) // Msg==messaging types << "company"; - if ( type & KABC::PhoneNumber::Work ) + if ( type & TDEABC::PhoneNumber::Work ) types << "business1"; - if ( type & KABC::PhoneNumber::Pref ) + if ( type & TDEABC::PhoneNumber::Pref ) types << "primary"; - if ( type & KABC::PhoneNumber::Voice ) + if ( type & TDEABC::PhoneNumber::Voice ) types << "callback"; // ## - if ( type & KABC::PhoneNumber::Cell ) + if ( type & TDEABC::PhoneNumber::Cell ) types << "mobile"; - if ( type & KABC::PhoneNumber::Video ) + if ( type & TDEABC::PhoneNumber::Video ) types << "radio"; // ## - if ( type & KABC::PhoneNumber::Bbs ) + if ( type & TDEABC::PhoneNumber::Bbs ) types << "ttytdd"; - if ( type & KABC::PhoneNumber::Modem ) + if ( type & TDEABC::PhoneNumber::Modem ) types << "telex"; // # - if ( type & KABC::PhoneNumber::Car ) + if ( type & TDEABC::PhoneNumber::Car ) types << "car"; - if ( type & KABC::PhoneNumber::Isdn ) + if ( type & TDEABC::PhoneNumber::Isdn ) types << "isdn"; - if ( type & KABC::PhoneNumber::Pcs ) + if ( type & TDEABC::PhoneNumber::Pcs ) types << "assistant"; // ## Assistant is e.g. secretary - if ( type & KABC::PhoneNumber::Pager ) + if ( type & TDEABC::PhoneNumber::Pager ) types << "pager"; return types; } -static int /*KABC::PhoneNumber::Types*/ phoneTypeFromString( const TQString& type ) +static int /*TDEABC::PhoneNumber::Types*/ phoneTypeFromString( const TQString& type ) { if ( type == "homefax" ) - return KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax; + return TDEABC::PhoneNumber::Home | TDEABC::PhoneNumber::Fax; if ( type == "businessfax" ) - return KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax; + return TDEABC::PhoneNumber::Work | TDEABC::PhoneNumber::Fax; if ( type == "business2" ) - return KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref; + return TDEABC::PhoneNumber::Work | TDEABC::PhoneNumber::Pref; if ( type == "business1" ) - return KABC::PhoneNumber::Work; + return TDEABC::PhoneNumber::Work; if ( type == "home2" ) - return KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref; + return TDEABC::PhoneNumber::Home | TDEABC::PhoneNumber::Pref; if ( type == "home1" ) - return KABC::PhoneNumber::Home; + return TDEABC::PhoneNumber::Home; if ( type == "company" ) - return KABC::PhoneNumber::Msg; + return TDEABC::PhoneNumber::Msg; if ( type == "primary" ) - return KABC::PhoneNumber::Pref; + return TDEABC::PhoneNumber::Pref; if ( type == "callback" ) - return KABC::PhoneNumber::Voice; + return TDEABC::PhoneNumber::Voice; if ( type == "mobile" ) - return KABC::PhoneNumber::Cell; + return TDEABC::PhoneNumber::Cell; if ( type == "radio" ) - return KABC::PhoneNumber::Video; + return TDEABC::PhoneNumber::Video; if ( type == "ttytdd" ) - return KABC::PhoneNumber::Bbs; + return TDEABC::PhoneNumber::Bbs; if ( type == "telex" ) - return KABC::PhoneNumber::Modem; + return TDEABC::PhoneNumber::Modem; if ( type == "car" ) - return KABC::PhoneNumber::Car; + return TDEABC::PhoneNumber::Car; if ( type == "isdn" ) - return KABC::PhoneNumber::Isdn; + return TDEABC::PhoneNumber::Isdn; if ( type == "assistant" ) - return KABC::PhoneNumber::Pcs; + return TDEABC::PhoneNumber::Pcs; if ( type == "pager" ) - return KABC::PhoneNumber::Pager; - return KABC::PhoneNumber::Home; // whatever + return TDEABC::PhoneNumber::Pager; + return TDEABC::PhoneNumber::Home; // whatever } static const char* s_knownCustomFields[] = { @@ -991,7 +991,7 @@ static const char* s_knownCustomFields[] = { }; // The saving is addressee -> Contact -> xml, this is the first part -void Contact::setFields( const KABC::Addressee* addressee ) +void Contact::setFields( const TDEABC::Addressee* addressee ) { KolabBase::setFields( addressee ); @@ -1000,7 +1000,7 @@ void Contact::setFields( const KABC::Addressee* addressee ) // Hopefully all resources are available during saving, so we can look up // in the addressbook to get name+email from the UID. KPIM::DistributionList distrList( *addressee ); - const KPIM::DistributionList::Entry::List entries = distrList.entries( KABC::StdAddressBook::self() ); + const KPIM::DistributionList::Entry::List entries = distrList.entries( TDEABC::StdAddressBook::self() ); KPIM::DistributionList::Entry::List::ConstIterator it = entries.begin(); for ( ; it != entries.end() ; ++it ) { Member m; @@ -1042,7 +1042,7 @@ void Contact::setFields( const KABC::Addressee* addressee ) const TQStringList emails = addressee->emails(); // Conversion problem here: - // KABC::Addressee has only one full name and N addresses, but the XML format + // TDEABC::Addressee has only one full name and N addresses, but the XML format // has N times (fullname+address). So we just copy the fullname over and ignore it on loading. for ( TQStringList::ConstIterator it = emails.begin(); it != emails.end(); ++it ) { Email email; @@ -1053,8 +1053,8 @@ void Contact::setFields( const KABC::Addressee* addressee ) // Now the real-world addresses TQString preferredAddress = "home"; - const KABC::Address::List addresses = addressee->addresses(); - for ( KABC::Address::List::ConstIterator it = addresses.begin() ; it != addresses.end(); ++it ) { + const TDEABC::Address::List addresses = addressee->addresses(); + for ( TDEABC::Address::List::ConstIterator it = addresses.begin() ; it != addresses.end(); ++it ) { Address address; address.kdeAddressType = (*it).type(); address.type = addressTypeToString( address.kdeAddressType ); @@ -1067,14 +1067,14 @@ void Contact::setFields( const KABC::Addressee* addressee ) // ## TODO not in the XML format: extended address info. // ## KDE-specific tags? Or hiding those fields? Or adding a warning? addAddress( address ); - if ( address.kdeAddressType & KABC::Address::Pref ) { + if ( address.kdeAddressType & TDEABC::Address::Pref ) { preferredAddress = address.type; // home, business or other } } setPreferredAddress( preferredAddress ); - const KABC::PhoneNumber::List phones = addressee->phoneNumbers(); - for ( KABC::PhoneNumber::List::ConstIterator it = phones.begin(); it != phones.end(); ++it ) { + const TDEABC::PhoneNumber::List phones = addressee->phoneNumbers(); + for ( TDEABC::PhoneNumber::List::ConstIterator it = phones.begin(); it != phones.end(); ++it ) { // Create a tag per phone type set in the bitfield TQStringList types = phoneTypeToString( (*it).type() ); for( TQStringList::Iterator typit = types.begin(); typit != types.end(); ++typit ) { @@ -1113,7 +1113,7 @@ void Contact::setFields( const KABC::Addressee* addressee ) knownCustoms << TQString::fromLatin1( *p ); TQStringList customs = addressee->customs(); for( TQStringList::Iterator it = customs.begin(); it != customs.end(); ++it ) { - // KABC::Addressee doesn't offer a real way to iterate over customs, other than splitting strings ourselves + // TDEABC::Addressee doesn't offer a real way to iterate over customs, other than splitting strings ourselves // The format is "app-name:value". int pos = (*it).find( '-' ); if ( pos == -1 ) continue; @@ -1150,7 +1150,7 @@ void Contact::setFields( const KABC::Addressee* addressee ) } // The loading is: xml -> Contact -> addressee, this is the second part -void Contact::saveTo( KABC::Addressee* addressee ) +void Contact::saveTo( TDEABC::Addressee* addressee ) { // TODO: This needs the same set of TODOs as the setFields method KolabBase::saveTo( addressee ); @@ -1206,19 +1206,19 @@ void Contact::saveTo( KABC::Addressee* addressee ) // We need to store both the original attachment name and the picture data into the addressee. // This is important, otherwise we would save the image under another attachment name w/o deleting the original one! if ( !mPicture.isNull() ) - addressee->setPhoto( KABC::Picture( mPicture ) ); + addressee->setPhoto( TDEABC::Picture( mPicture ) ); // Note that we must save the filename in all cases, so that removing the picture // actually deletes the attachment. addressee->insertCustom( "KOLAB", "PictureAttachmentName", mPictureAttachmentName ); if ( !mLogo.isNull() ) - addressee->setLogo( KABC::Picture( mLogo ) ); + addressee->setLogo( TDEABC::Picture( mLogo ) ); addressee->insertCustom( "KOLAB", "LogoAttachmentName", mLogoAttachmentName ); if ( !mSound.isNull() ) - addressee->setSound( KABC::Sound( mSound ) ); + addressee->setSound( TDEABC::Sound( mSound ) ); addressee->insertCustom( "KOLAB", "SoundAttachmentName", mSoundAttachmentName ); if ( mHasGeo ) - addressee->setGeo( KABC::Geo( mLatitude, mLongitude ) ); + addressee->setGeo( TDEABC::Geo( mLatitude, mLongitude ) ); TQStringList emailAddresses; for ( TQValueList<Email>::ConstIterator it = mEmails.begin(); it != mEmails.end(); ++it ) { @@ -1228,12 +1228,12 @@ void Contact::saveTo( KABC::Addressee* addressee ) addressee->setEmails( emailAddresses ); for ( TQValueList<Address>::ConstIterator it = mAddresses.begin(); it != mAddresses.end(); ++it ) { - KABC::Address address; + TDEABC::Address address; int type = (*it).kdeAddressType; if ( type == -1 ) { // no kde-specific type available type = addressTypeFromString( (*it).type ); if ( (*it).type == mPreferredAddress ) - type |= KABC::Address::Pref; + type |= TDEABC::Address::Pref; } address.setType( type ); address.setStreet( (*it).street ); @@ -1246,7 +1246,7 @@ void Contact::saveTo( KABC::Addressee* addressee ) } for ( TQValueList<PhoneNumber>::ConstIterator it = mPhoneNumbers.begin(); it != mPhoneNumbers.end(); ++it ) { - KABC::PhoneNumber number; + TDEABC::PhoneNumber number; number.setType( phoneTypeFromString( (*it).type ) ); number.setNumber( (*it).number ); addressee->insertPhoneNumber( number ); @@ -1259,7 +1259,7 @@ void Contact::saveTo( KABC::Addressee* addressee ) //kdDebug(5006) << addressee->customs() << endl; } -TQImage Contact::loadPictureFromKMail( const TQString& attachmentName, KABC::ResourceKolab* resource, const TQString& subResource, TQ_UINT32 sernum ) +TQImage Contact::loadPictureFromKMail( const TQString& attachmentName, TDEABC::ResourceKolab* resource, const TQString& subResource, TQ_UINT32 sernum ) { TQImage img; KURL url; @@ -1271,7 +1271,7 @@ TQImage Contact::loadPictureFromKMail( const TQString& attachmentName, KABC::Res return img; } -TQImage Contact::loadPictureFromAddressee( const KABC::Picture& picture ) +TQImage Contact::loadPictureFromAddressee( const TDEABC::Picture& picture ) { TQImage img; if ( !picture.isIntern() && !picture.url().isEmpty() ) { @@ -1285,7 +1285,7 @@ TQImage Contact::loadPictureFromAddressee( const KABC::Picture& picture ) return img; } -TQByteArray Kolab::Contact::loadDataFromKMail( const TQString& attachmentName, KABC::ResourceKolab* resource, const TQString& subResource, TQ_UINT32 sernum ) +TQByteArray Kolab::Contact::loadDataFromKMail( const TQString& attachmentName, TDEABC::ResourceKolab* resource, const TQString& subResource, TQ_UINT32 sernum ) { TQByteArray data; KURL url; @@ -1300,7 +1300,7 @@ TQByteArray Kolab::Contact::loadDataFromKMail( const TQString& attachmentName, K return data; } -TQByteArray Kolab::Contact::loadSoundFromAddressee( const KABC::Sound& sound ) +TQByteArray Kolab::Contact::loadSoundFromAddressee( const TDEABC::Sound& sound ) { TQByteArray data; if ( !sound.isIntern() && !sound.url().isEmpty() ) { |