summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-04-08 22:05:03 (UTC)
committer zautrix <zautrix>2005-04-08 22:05:03 (UTC)
commit9667e6f2589d5b2080cca928814f382761f8dda6 (patch) (side-by-side diff)
tree438bcb5c041de0804284cf457cbc97a367dadf37 /kabc
parentc0f1d38e29ee0d0a1d1dcb5bda08089923926b41 (diff)
downloadkdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.zip
kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.tar.gz
kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.tar.bz2
utf8 kapi import fix
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcardparser/vcard.cpp2
-rw-r--r--kabc/vcardparser/vcardline.cpp14
-rw-r--r--kabc/vcardparser/vcardline.h7
-rw-r--r--kabc/vcardparser/vcardparser.cpp8
-rw-r--r--kabc/vcardparser/vcardtool.cpp86
5 files changed, 61 insertions, 56 deletions
diff --git a/kabc/vcardparser/vcard.cpp b/kabc/vcardparser/vcard.cpp
index 24fd498..bc9f208 100644
--- a/kabc/vcardparser/vcard.cpp
+++ b/kabc/vcardparser/vcard.cpp
@@ -113,3 +113,3 @@ VCard::Version VCard::version() const
VCardLine line = ( *versionEntry )[ 0 ];
- if ( line.value() == "2.1" )
+ if ( line.valueString() == "2.1" )
return v2_1;
diff --git a/kabc/vcardparser/vcardline.cpp b/kabc/vcardparser/vcardline.cpp
index 0972a35..8df2d32 100644
--- a/kabc/vcardparser/vcardline.cpp
+++ b/kabc/vcardparser/vcardline.cpp
@@ -84,8 +84,12 @@ QString VCardLine::identifier() const
-void VCardLine::setValue( const QString& value )
+void VCardLine::setValueString( const QString& value )
{
- mValue.duplicate( value.data(), value.length() );
+ setValueCString( value.utf8() );
+}
+void VCardLine::setValueCString( const QCString& value )
+{
+ mValue.duplicate( value.data(), value.length() );
}
-void VCardLine::setValue( const QByteArray& value )
+void VCardLine::setValueBytes( const QByteArray& value )
{
@@ -94,5 +98,5 @@ void VCardLine::setValue( const QByteArray& value )
-QVariant VCardLine::value() const
+QString VCardLine::valueString() const
{
- return QVariant( QCString( mValue.data(), mValue.size()+1 ) );
+ return QString::fromUtf8( mValue.data(), mValue.size() );
}
diff --git a/kabc/vcardparser/vcardline.h b/kabc/vcardparser/vcardline.h
index 6e74b38..8dc9322 100644
--- a/kabc/vcardparser/vcardline.h
+++ b/kabc/vcardparser/vcardline.h
@@ -60,4 +60,5 @@ class VCardLine
*/
- void setValue( const QString& value );
- void setValue( const QByteArray& value );
+ void setValueString( const QString& value );
+ void setValueCString( const QCString& value );
+ void setValueBytes( const QByteArray& value );
@@ -66,3 +67,3 @@ class VCardLine
*/
- QVariant value() const;
+ QString valueString() const;
QByteArray valueBytes() const;
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp
index 7fae011..11622a0 100644
--- a/kabc/vcardparser/vcardparser.cpp
+++ b/kabc/vcardparser/vcardparser.cpp
@@ -128,3 +128,3 @@ VCard::List VCardParser::parseVCards( const QString& text )
// } else
- vCardLine.setValue( output );
+ vCardLine.setValueBytes( output );
//PP our vcards are *supposed* to be in UTF-8
@@ -133,3 +133,3 @@ VCard::List VCardParser::parseVCards( const QString& text )
} else
- vCardLine.setValue( value.replace( QRegExp("\\\\n"), "\n" ) );
+ vCardLine.setValueString( value.replace( QRegExp("\\\\n"), "\n" ) );
@@ -190,3 +190,3 @@ QString VCardParser::createVCards( const VCard::List& list )
for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) {
- if ( !(*lineIt).value().asString().isEmpty() ) {
+ if ( !(*lineIt).valueString().isEmpty() ) {
if ( (*lineIt).hasGroup() )
@@ -223,3 +223,3 @@ QString VCardParser::createVCards( const VCard::List& list )
} else
- textLine.append( ":" + (*lineIt).value().asString().replace( QRegExp("\n"), "\\n" ) );
+ textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) );
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp
index 0cf72c0..c3d92b6 100644
--- a/kabc/vcardparser/vcardtool.cpp
+++ b/kabc/vcardparser/vcardtool.cpp
@@ -369,3 +369,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
Address address;
- const QStringList addrParts = splitString( semicolonSep, (*lineIt).value().asString() );
+ const QStringList addrParts = splitString( semicolonSep, (*lineIt).valueString() );
if ( addrParts.count() > 0 )
@@ -401,3 +401,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "bday" )
- addr.setBirthday( parseDateTime( (*lineIt).value().asString() ) );
+ addr.setBirthday( parseDateTime( (*lineIt).valueString() ) );
@@ -405,3 +405,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "categories" ) {
- const QStringList categories = splitString( commaSep, (*lineIt).value().asString() );
+ const QStringList categories = splitString( commaSep, (*lineIt).valueString() );
addr.setCategories( categories );
@@ -416,3 +416,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
const QStringList types = (*lineIt).parameters( "type" );
- addr.insertEmail( (*lineIt).value().asString(), types.findIndex( "PREF" ) != -1 );
+ addr.insertEmail( (*lineIt).valueString(), types.findIndex( "PREF" ) != -1 );
}
@@ -421,3 +421,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "fn" )
- addr.setFormattedName( (*lineIt).value().asString() );
+ addr.setFormattedName( (*lineIt).valueString() );
@@ -427,3 +427,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
- const QStringList geoParts = QStringList::split( ';', (*lineIt).value().asString(), true );
+ const QStringList geoParts = QStringList::split( ';', (*lineIt).valueString(), true );
geo.setLatitude( geoParts[ 0 ].toFloat() );
@@ -451,3 +451,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
if ( (*it).type() == type ) {
- (*it).setLabel( (*lineIt).value().asString() );
+ (*it).setLabel( (*lineIt).valueString() );
addr.insertAddress( *it );
@@ -460,3 +460,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
KABC::Address address( type );
- address.setLabel( (*lineIt).value().asString() );
+ address.setLabel( (*lineIt).valueString() );
addr.insertAddress( address );
@@ -471,3 +471,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "mailer" )
- addr.setMailer( (*lineIt).value().asString() );
+ addr.setMailer( (*lineIt).valueString() );
@@ -475,3 +475,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "n" ) {
- const QStringList nameParts = splitString( semicolonSep, (*lineIt).value().asString() );
+ const QStringList nameParts = splitString( semicolonSep, (*lineIt).valueString() );
if ( nameParts.count() > 0 )
@@ -490,3 +490,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "name" )
- addr.setName( (*lineIt).value().asString() );
+ addr.setName( (*lineIt).valueString() );
@@ -494,3 +494,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "nickname" )
- addr.setNickName( (*lineIt).value().asString() );
+ addr.setNickName( (*lineIt).valueString() );
@@ -498,3 +498,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "note" )
- addr.setNote( (*lineIt).value().asString() );
+ addr.setNote( (*lineIt).valueString() );
@@ -502,3 +502,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "org" )
- addr.setOrganization( (*lineIt).value().asString() );
+ addr.setOrganization( (*lineIt).valueString() );
@@ -510,3 +510,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "prodid" )
- addr.setProductId( (*lineIt).value().asString() );
+ addr.setProductId( (*lineIt).valueString() );
@@ -514,3 +514,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "rev" )
- addr.setRevision( parseDateTime( (*lineIt).value().asString() ) );
+ addr.setRevision( parseDateTime( (*lineIt).valueString() ) );
@@ -518,3 +518,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "role" )
- addr.setRole( (*lineIt).value().asString() );
+ addr.setRole( (*lineIt).valueString() );
@@ -522,3 +522,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "sort-string" )
- addr.setSortString( (*lineIt).value().asString() );
+ addr.setSortString( (*lineIt).valueString() );
@@ -531,3 +531,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
PhoneNumber phone;
- phone.setNumber( (*lineIt).value().asString() );
+ phone.setNumber( (*lineIt).valueString() );
@@ -546,3 +546,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "title" )
- addr.setTitle( (*lineIt).value().asString() );
+ addr.setTitle( (*lineIt).valueString() );
@@ -551,3 +551,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
TimeZone tz;
- const QString date = (*lineIt).value().asString();
+ const QString date = (*lineIt).valueString();
@@ -564,3 +564,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "uid" )
- addr.setUid( (*lineIt).value().asString() );
+ addr.setUid( (*lineIt).valueString() );
@@ -568,3 +568,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
else if ( identifier == "url" )
- addr.setUrl( KURL( (*lineIt).value().asString() ) );
+ addr.setUrl( KURL( (*lineIt).valueString() ) );
@@ -574,3 +574,3 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
int dash = key.find( "-" );
- addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).value().asString() );
+ addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() );
}
@@ -638,3 +638,3 @@ Picture VCardTool::parsePicture( const VCardLine &line )
if ( line.parameter( "value" ).lower() == "uri" )
- pic.setUrl( line.value().asString() );
+ pic.setUrl( line.valueString() );
}
@@ -657,3 +657,3 @@ VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pi
s << pic.data();
- line.setValue( input );
+ line.setValueBytes( input );
line.addParameter( "encoding", "b" );
@@ -663,3 +663,3 @@ VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pi
QByteArray ba;
- line.setValue( pic.url() );
+ line.setValueString( pic.url() );
line.addParameter( "value", "URI" );
@@ -679,3 +679,3 @@ Sound VCardTool::parseSound( const VCardLine &line )
if ( line.parameter( "value" ).lower() == "uri" )
- snd.setUrl( line.value().asString() );
+ snd.setUrl( line.valueString() );
}
@@ -696,3 +696,3 @@ VCardLine VCardTool::createSound( const Sound &snd )
if ( !snd.data().isEmpty() ) {
- line.setValue( snd.data() );
+ line.setValueBytes( snd.data() );
line.addParameter( "encoding", "b" );
@@ -701,3 +701,3 @@ VCardLine VCardTool::createSound( const Sound &snd )
} else if ( !snd.url().isEmpty() ) {
- line.setValue( snd.url() );
+ line.setValueString( snd.url() );
line.addParameter( "value", "URI" );
@@ -716,3 +716,3 @@ Key VCardTool::parseKey( const VCardLine &line )
else
- key.setTextData( line.value().asString() );
+ key.setTextData( line.valueString() );
@@ -738,3 +738,3 @@ VCardLine VCardTool::createKey( const Key &key )
if ( !key.binaryData().isEmpty() ) {
- line.setValue( key.binaryData() );
+ line.setValueBytes( key.binaryData() );
line.addParameter( "encoding", "b" );
@@ -742,3 +742,3 @@ VCardLine VCardTool::createKey( const Key &key )
} else if ( !key.textData().isEmpty() )
- line.setValue( key.textData() );
+ line.setValueString( key.textData() );
@@ -758,7 +758,7 @@ Secrecy VCardTool::parseSecrecy( const VCardLine &line )
- if ( line.value().asString().lower() == "public" )
+ if ( line.valueString().lower() == "public" )
secrecy.setType( Secrecy::Public );
- if ( line.value().asString().lower() == "private" )
+ if ( line.valueString().lower() == "private" )
secrecy.setType( Secrecy::Private );
- if ( line.value().asString().lower() == "confidential" )
+ if ( line.valueString().lower() == "confidential" )
secrecy.setType( Secrecy::Confidential );
@@ -775,7 +775,7 @@ VCardLine VCardTool::createSecrecy( const Secrecy &secrecy )
if ( type == Secrecy::Public )
- line.setValue( "PUBLIC" );
+ line.setValueString( "PUBLIC" );
else if ( type == Secrecy::Private )
- line.setValue( "PRIVATE" );
+ line.setValueString( "PRIVATE" );
else if ( type == Secrecy::Confidential )
- line.setValue( "CONFIDENTIAL" );
+ line.setValueString( "CONFIDENTIAL" );
@@ -791,5 +791,5 @@ Agent VCardTool::parseAgent( const VCardLine &line )
if ( line.parameter( "value" ).lower() == "uri" )
- agent.setUrl( line.value().asString() );
+ agent.setUrl( line.valueString() );
} else {
- QString str = line.value().asString();
+ QString str = line.valueString();
str.replace( QRegExp("\\\\n"), "\r\n" );
@@ -825,6 +825,6 @@ VCardLine VCardTool::createAgent( VCard::Version version, const Agent &agent )
str.replace( QRegExp(","), "\\," );
- line.setValue( str );
+ line.setValueString( str );
}
} else if ( !agent.url().isEmpty() ) {
- line.setValue( agent.url() );
+ line.setValueString( agent.url() );
line.addParameter( "value", "URI" );