summaryrefslogtreecommitdiffstats
path: root/kabc/ldifconverter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kabc/ldifconverter.cpp')
-rw-r--r--kabc/ldifconverter.cpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/kabc/ldifconverter.cpp b/kabc/ldifconverter.cpp
index 684f07bbd..6f875cffb 100644
--- a/kabc/ldifconverter.cpp
+++ b/kabc/ldifconverter.cpp
@@ -33,10 +33,10 @@
- physicaldeliveryofficename,
*/
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qregexp.h>
-#include <qtextstream.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqregexp.h>
+#include <tqtextstream.h>
#include <klocale.h>
#include <kdebug.h>
@@ -53,7 +53,7 @@ using namespace KABC;
/* generate LDIF stream */
-bool LDIFConverter::addresseeToLDIF( const AddresseeList &addrList, QString &str )
+bool LDIFConverter::addresseeToLDIF( const AddresseeList &addrList, TQString &str )
{
AddresseeList::ConstIterator it;
for ( it = addrList.begin(); it != addrList.end(); ++it ) {
@@ -64,29 +64,29 @@ bool LDIFConverter::addresseeToLDIF( const AddresseeList &addrList, QString &str
-static void ldif_out( QTextStream &t, QString formatStr, QString value )
+static void ldif_out( TQTextStream &t, TQString formatStr, TQString value )
{
if ( value.isEmpty() )
return;
- QCString txt = LDIF::assembleLine( formatStr, value, 72 );
+ TQCString txt = LDIF::assembleLine( formatStr, value, 72 );
// write the string
- t << QString::fromUtf8(txt) << "\n";
+ t << TQString::fromUtf8(txt) << "\n";
}
-bool LDIFConverter::addresseeToLDIF( const Addressee &addr, QString &str )
+bool LDIFConverter::addresseeToLDIF( const Addressee &addr, TQString &str )
{
if ( addr.isEmpty() )
return false;
- QTextStream t( str, IO_WriteOnly|IO_Append );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ TQTextStream t( str, IO_WriteOnly|IO_Append );
+ t.setEncoding( TQTextStream::UnicodeUTF8 );
const Address homeAddr = addr.address( Address::Home );
const Address workAddr = addr.address( Address::Work );
- ldif_out( t, "dn", QString( "cn=%1,mail=%2" )
+ ldif_out( t, "dn", TQString( "cn=%1,mail=%2" )
.arg( addr.formattedName().simplifyWhiteSpace() )
.arg( addr.preferredEmail() ) );
ldif_out( t, "givenname", addr.givenName() );
@@ -113,7 +113,7 @@ bool LDIFConverter::addresseeToLDIF( const Addressee &addr, QString &str )
ldif_out( t, "postalcode", workAddr.postalCode() );
ldif_out( t, "postofficebox", workAddr.postOfficeBox() );
- QStringList streets = QStringList::split( '\n', homeAddr.street() );
+ TQStringList streets = TQStringList::split( '\n', homeAddr.street() );
if ( streets.count() > 0 )
ldif_out( t, "homepostaladdress", streets[ 0 ] ); // Netscape 7
if ( streets.count() > 1 )
@@ -125,7 +125,7 @@ bool LDIFConverter::addresseeToLDIF( const Addressee &addr, QString &str )
ldif_out( t, "locality", workAddr.locality() );
ldif_out( t, "streetaddress", workAddr.street() ); // Netscape 4.x
- streets = QStringList::split( '\n', workAddr.street() );
+ streets = TQStringList::split( '\n', workAddr.street() );
if ( streets.count() > 0 )
ldif_out( t, "postaladdress", streets[ 0 ] );
if ( streets.count() > 1 )
@@ -166,7 +166,7 @@ bool LDIFConverter::addresseeToLDIF( const Addressee &addr, QString &str )
/* convert from LDIF stream */
-bool LDIFConverter::LDIFToAddressee( const QString &str, AddresseeList &addrList, QDateTime dt )
+bool LDIFConverter::LDIFToAddressee( const TQString &str, AddresseeList &addrList, TQDateTime dt )
{
if (str.isEmpty())
return true;
@@ -176,14 +176,14 @@ bool LDIFConverter::LDIFToAddressee( const QString &str, AddresseeList &addrList
LDIF::ParseVal ret;
const char *latinstr = str.latin1();
int latinstrlen = qstrlen( latinstr );
- QByteArray data;
+ TQByteArray data;
Addressee a;
Address homeAddr, workAddr;
data.setRawData( latinstr, latinstrlen );
ldif.setLDIF( data );
if (!dt.isValid())
- dt = QDateTime::currentDateTime();
+ dt = TQDateTime::currentDateTime();
a.setRevision(dt);
homeAddr = Address( Address::Home );
workAddr = Address( Address::Work );
@@ -192,8 +192,8 @@ bool LDIFConverter::LDIFToAddressee( const QString &str, AddresseeList &addrList
ret = ldif.nextItem();
switch ( ret ) {
case LDIF::Item: {
- QString fieldname = ldif.attr().lower();
- QString value = QString::fromUtf8( ldif.val(), ldif.val().size() );
+ TQString fieldname = ldif.attr().lower();
+ TQString value = TQString::fromUtf8( ldif.val(), ldif.val().size() );
evaluatePair( a, homeAddr, workAddr, fieldname, value );
break;
}
@@ -233,9 +233,9 @@ bool LDIFConverter::LDIFToAddressee( const QString &str, AddresseeList &addrList
bool LDIFConverter::evaluatePair( Addressee &a, Address &homeAddr,
Address &workAddr,
- QString &fieldname, QString &value )
+ TQString &fieldname, TQString &value )
{
- if ( fieldname == QString::fromLatin1( "dn" ) ) // ignore & return false!
+ if ( fieldname == TQString::fromLatin1( "dn" ) ) // ignore & return false!
return false;
if ( fieldname.startsWith("#") ) {
@@ -249,56 +249,56 @@ bool LDIFConverter::evaluatePair( Addressee &a, Address &homeAddr,
return true;
}
- if ( fieldname == QString::fromLatin1( "givenname" ) ) {
+ if ( fieldname == TQString::fromLatin1( "givenname" ) ) {
a.setGivenName( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "xmozillanickname") ||
- fieldname == QString::fromLatin1( "nickname") ) {
+ if ( fieldname == TQString::fromLatin1( "xmozillanickname") ||
+ fieldname == TQString::fromLatin1( "nickname") ) {
a.setNickName( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "sn" ) ) {
+ if ( fieldname == TQString::fromLatin1( "sn" ) ) {
a.setFamilyName( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "uid" ) ) {
+ if ( fieldname == TQString::fromLatin1( "uid" ) ) {
a.setUid( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mail" ) ||
- fieldname == QString::fromLatin1( "mozillasecondemail" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "mail" ) ||
+ fieldname == TQString::fromLatin1( "mozillasecondemail" ) ) { // mozilla
if ( a.emails().findIndex( value ) == -1 )
a.insertEmail( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "title" ) ) {
+ if ( fieldname == TQString::fromLatin1( "title" ) ) {
a.setTitle( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "vocation" ) ) {
+ if ( fieldname == TQString::fromLatin1( "vocation" ) ) {
a.setPrefix( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "cn" ) ) {
+ if ( fieldname == TQString::fromLatin1( "cn" ) ) {
a.setFormattedName( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "o" ) ||
- fieldname == QString::fromLatin1( "organization" ) || // Exchange
- fieldname == QString::fromLatin1( "organizationname" ) ) { // Exchange
+ if ( fieldname == TQString::fromLatin1( "o" ) ||
+ fieldname == TQString::fromLatin1( "organization" ) || // Exchange
+ fieldname == TQString::fromLatin1( "organizationname" ) ) { // Exchange
a.setOrganization( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "description" ) ) {
+ if ( fieldname == TQString::fromLatin1( "description" ) ) {
addComment:
if ( !a.note().isEmpty() )
a.setNote( a.note() + "\n" );
@@ -306,15 +306,15 @@ addComment:
return true;
}
- if ( fieldname == QString::fromLatin1( "custom1" ) ||
- fieldname == QString::fromLatin1( "custom2" ) ||
- fieldname == QString::fromLatin1( "custom3" ) ||
- fieldname == QString::fromLatin1( "custom4" ) ) {
+ if ( fieldname == TQString::fromLatin1( "custom1" ) ||
+ fieldname == TQString::fromLatin1( "custom2" ) ||
+ fieldname == TQString::fromLatin1( "custom3" ) ||
+ fieldname == TQString::fromLatin1( "custom4" ) ) {
goto addComment;
}
- if ( fieldname == QString::fromLatin1( "homeurl" ) ||
- fieldname == QString::fromLatin1( "workurl" ) ) {
+ if ( fieldname == TQString::fromLatin1( "homeurl" ) ||
+ fieldname == TQString::fromLatin1( "workurl" ) ) {
if (a.url().isEmpty()) {
a.setUrl( KURL( value ) );
return true;
@@ -325,144 +325,144 @@ addComment:
// TODO: change this with KDE 4
}
- if ( fieldname == QString::fromLatin1( "homephone" ) ) {
+ if ( fieldname == TQString::fromLatin1( "homephone" ) ) {
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Home ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "telephonenumber" ) ) {
+ if ( fieldname == TQString::fromLatin1( "telephonenumber" ) ) {
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Work ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "mobile" ) ) { // mozilla/Netscape 7
+ if ( fieldname == TQString::fromLatin1( "mobile" ) ) { // mozilla/Netscape 7
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Cell ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "cellphone" ) ) {
+ if ( fieldname == TQString::fromLatin1( "cellphone" ) ) {
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Cell ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "pager" ) || // mozilla
- fieldname == QString::fromLatin1( "pagerphone" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "pager" ) || // mozilla
+ fieldname == TQString::fromLatin1( "pagerphone" ) ) { // mozilla
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Pager ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "facsimiletelephonenumber" ) ) {
+ if ( fieldname == TQString::fromLatin1( "facsimiletelephonenumber" ) ) {
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Fax ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "xmozillaanyphone" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "xmozillaanyphone" ) ) { // mozilla
a.insertPhoneNumber( PhoneNumber( value, PhoneNumber::Work ) );
return true;
}
- if ( fieldname == QString::fromLatin1( "street" ) ||
- fieldname == QString::fromLatin1( "streethomeaddress" ) ) {
+ if ( fieldname == TQString::fromLatin1( "street" ) ||
+ fieldname == TQString::fromLatin1( "streethomeaddress" ) ) {
homeAddr.setStreet( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "postaladdress" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "postaladdress" ) ) { // mozilla
workAddr.setStreet( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mozillapostaladdress2" ) ) { // mozilla
- workAddr.setStreet( workAddr.street() + QString::fromLatin1( "\n" ) + value );
+ if ( fieldname == TQString::fromLatin1( "mozillapostaladdress2" ) ) { // mozilla
+ workAddr.setStreet( workAddr.street() + TQString::fromLatin1( "\n" ) + value );
return true;
}
- if ( fieldname == QString::fromLatin1( "postalcode" ) ) {
+ if ( fieldname == TQString::fromLatin1( "postalcode" ) ) {
workAddr.setPostalCode( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "postofficebox" ) ) {
+ if ( fieldname == TQString::fromLatin1( "postofficebox" ) ) {
workAddr.setPostOfficeBox( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "homepostaladdress" ) ) { // Netscape 7
+ if ( fieldname == TQString::fromLatin1( "homepostaladdress" ) ) { // Netscape 7
homeAddr.setStreet( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mozillahomepostaladdress2" ) ) { // mozilla
- homeAddr.setStreet( homeAddr.street() + QString::fromLatin1( "\n" ) + value );
+ if ( fieldname == TQString::fromLatin1( "mozillahomepostaladdress2" ) ) { // mozilla
+ homeAddr.setStreet( homeAddr.street() + TQString::fromLatin1( "\n" ) + value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mozillahomelocalityname" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "mozillahomelocalityname" ) ) { // mozilla
homeAddr.setLocality( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mozillahomestate" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "mozillahomestate" ) ) { // mozilla
homeAddr.setRegion( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mozillahomepostalcode" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "mozillahomepostalcode" ) ) { // mozilla
homeAddr.setPostalCode( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "mozillahomecountryname" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "mozillahomecountryname" ) ) { // mozilla
if ( value.length() <= 2 )
value = Address::ISOtoCountry(value);
homeAddr.setCountry( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "locality" ) ) {
+ if ( fieldname == TQString::fromLatin1( "locality" ) ) {
workAddr.setLocality( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "streetaddress" ) ) { // Netscape 4.x
+ if ( fieldname == TQString::fromLatin1( "streetaddress" ) ) { // Netscape 4.x
workAddr.setStreet( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "countryname" ) ||
- fieldname == QString::fromLatin1( "c" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "countryname" ) ||
+ fieldname == TQString::fromLatin1( "c" ) ) { // mozilla
if ( value.length() <= 2 )
value = Address::ISOtoCountry(value);
workAddr.setCountry( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "l" ) ) { // mozilla
+ if ( fieldname == TQString::fromLatin1( "l" ) ) { // mozilla
workAddr.setLocality( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "st" ) ) {
+ if ( fieldname == TQString::fromLatin1( "st" ) ) {
workAddr.setRegion( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "ou" ) ) {
+ if ( fieldname == TQString::fromLatin1( "ou" ) ) {
a.setRole( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "department" ) ) {
+ if ( fieldname == TQString::fromLatin1( "department" ) ) {
a.setDepartment( value );
return true;
}
- if ( fieldname == QString::fromLatin1( "member" ) ) {
+ if ( fieldname == TQString::fromLatin1( "member" ) ) {
// this is a mozilla list member (cn=xxx, mail=yyy)
- QStringList list( QStringList::split( ',', value ) );
- QString name, email;
+ TQStringList list( TQStringList::split( ',', value ) );
+ TQString name, email;
- QStringList::Iterator it;
+ TQStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( (*it).startsWith( "cn=" ) )
name = (*it).mid( 3 ).stripWhiteSpace();
@@ -476,20 +476,20 @@ addComment:
return true;
}
- if ( fieldname == QString::fromLatin1( "modifytimestamp" ) ) {
- if (value == QString::fromLatin1("0Z")) // ignore
+ if ( fieldname == TQString::fromLatin1( "modifytimestamp" ) ) {
+ if (value == TQString::fromLatin1("0Z")) // ignore
return true;
- QDateTime dt = VCardStringToDate( value );
+ TQDateTime dt = VCardStringToDate( value );
if ( dt.isValid() ) {
a.setRevision(dt);
return true;
}
}
- if ( fieldname == QString::fromLatin1( "objectclass" ) ) // ignore
+ if ( fieldname == TQString::fromLatin1( "objectclass" ) ) // ignore
return true;
- kdWarning() << QString("LDIFConverter: Unknown field for '%1': '%2=%3'\n")
+ kdWarning() << TQString("LDIFConverter: Unknown field for '%1': '%2=%3'\n")
.arg(a.formattedName()).arg(fieldname).arg(value);
return true;
@@ -499,33 +499,33 @@ addComment:
* in the LDIF class */
bool LDIFConverter::parseSingleLine( Addressee &a, Address &homeAddr,
- Address &workAddr, QString &line )
+ Address &workAddr, TQString &line )
{
if ( line.isEmpty() )
return true;
- QString fieldname, value;
- QByteArray val;
+ TQString fieldname, value;
+ TQByteArray val;
LDIF::splitLine( line.latin1(), fieldname, val );
- value = QString::fromUtf8( val.data(), val.size() );
+ value = TQString::fromUtf8( val.data(), val.size() );
return evaluatePair( a, homeAddr, workAddr, fieldname, value);
}
-bool LDIFConverter::splitLine( QString &line, QString &fieldname, QString &value)
+bool LDIFConverter::splitLine( TQString &line, TQString &fieldname, TQString &value)
{
- QByteArray val;
+ TQByteArray val;
bool ret = LDIF::splitLine( line.latin1(), fieldname, val );
- value = QString::fromUtf8( val.data(), val.size() );
+ value = TQString::fromUtf8( val.data(), val.size() );
return ret;
}
-QString LDIFConverter::makeLDIFfieldString( QString formatStr, QString value, bool allowEncode )
+TQString LDIFConverter::makeLDIFfieldString( TQString formatStr, TQString value, bool allowEncode )
{
if ( value.isEmpty() )
- return QString();
+ return TQString();
// append format if not given
if (formatStr.find(':') == -1)
@@ -554,7 +554,7 @@ QString LDIFConverter::makeLDIFfieldString( QString formatStr, QString value, bo
}
// generate the new string and split it to 72 chars/line
- QCString txt = (formatStr.arg(value)).utf8();
+ TQCString txt = (formatStr.arg(value)).utf8();
if (allowEncode) {
len = txt.length();
@@ -568,6 +568,6 @@ QString LDIFConverter::makeLDIFfieldString( QString formatStr, QString value, bo
}
}
- return QString::fromUtf8(txt);
+ return TQString::fromUtf8(txt);
}