r2033 - in trunk: kdelibs kdepim

bdubbs at linuxfromscratch.org bdubbs at linuxfromscratch.org
Fri Jan 2 22:32:34 PST 2009


Author: bdubbs
Date: 2009-01-02 23:32:34 -0700 (Fri, 02 Jan 2009)
New Revision: 2033

Added:
   trunk/kdelibs/kdelibs-3.5.10-charset-1.patch
   trunk/kdepim/kdepim-3.5.10-charset-1.patch
Log:
Add kde-3.5.10 patches to fix charset bug

Added: trunk/kdelibs/kdelibs-3.5.10-charset-1.patch
===================================================================
--- trunk/kdelibs/kdelibs-3.5.10-charset-1.patch	                        (rev 0)
+++ trunk/kdelibs/kdelibs-3.5.10-charset-1.patch	2009-01-03 06:32:34 UTC (rev 2033)
@@ -0,0 +1,553 @@
+Submitted By: Bruce Dubbs (bdubbs at linuxfromscratch dot org)
+Date: 2009-01-03
+Initial Package Version: 3.1.3
+Origin: Upstream via Thomas ???
+Description: Fix https://bugs.kde.org/show_bug.cgi?id=159795
+
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardconverter.cpp kdelibs-3.5.10/kabc/vcardconverter.cpp
+--- kdelibs-3.5.10-orig/kabc/vcardconverter.cpp	2005-10-10 17:05:53.000000000 +0200
++++ kdelibs-3.5.10/kabc/vcardconverter.cpp	2008-12-29 23:25:16.000000000 +0100
+@@ -51,6 +51,14 @@
+   return createVCards( list, version );
+ }
+ 
++QCString VCardConverter::createVCardRaw( const Addressee &addr, Version version )
++{
++  Addressee::List list;
++  list.append( addr );
++
++  return createVCardsRaw( list, version );
++}
++
+ QString VCardConverter::createVCards( Addressee::List list, Version version )
+ {
+   VCardTool tool;
+@@ -58,6 +66,13 @@
+   return tool.createVCards( list, ( version == v3_0 ? VCard::v3_0 : VCard::v2_1 ) );
+ }
+ 
++QCString VCardConverter::createVCardsRaw( Addressee::List list, Version version )
++{
++  VCardTool tool;
++
++  return tool.createVCardsRaw( list, ( version == v3_0 ? VCard::v3_0 : VCard::v2_1 ) );
++}
++
+ Addressee VCardConverter::parseVCard( const QString& vcard )
+ {
+   Addressee::List list = parseVCards( vcard );
+@@ -65,6 +80,13 @@
+   return list[ 0 ];
+ }
+ 
++Addressee VCardConverter::parseVCardRaw( const QCString& vcard )
++{
++  Addressee::List list = parseVCardsRaw( vcard );
++
++  return list[ 0 ];
++}
++
+ Addressee::List VCardConverter::parseVCards( const QString& vcard )
+ {
+   VCardTool tool;
+@@ -72,6 +94,13 @@
+   return tool.parseVCards( vcard );
+ }
+ 
++Addressee::List VCardConverter::parseVCardsRaw( const QCString& vcard )
++{
++  VCardTool tool;
++
++  return tool.parseVCardsRaw( vcard );
++}
++
+ // ---------------------------- deprecated stuff ---------------------------- //
+ 
+ bool VCardConverter::vCardToAddressee( const QString &str, Addressee &addr, Version version )
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardconverter.h kdelibs-3.5.10/kabc/vcardconverter.h
+--- kdelibs-3.5.10-orig/kabc/vcardconverter.h	2008-02-13 10:41:07.000000000 +0100
++++ kdelibs-3.5.10/kabc/vcardconverter.h	2008-12-29 23:25:16.000000000 +0100
+@@ -82,6 +82,7 @@
+       @param version The version of the generated vCard format
+      */
+     QString createVCard( const Addressee &addr, Version version = v3_0 );
++    QCString createVCardRaw( const Addressee &addr, Version version = v3_0 );
+ 
+     /**
+       Creates a string in vCard format which contains the given
+@@ -92,6 +93,7 @@
+      */
+     // FIXME: Add error handling
+     QString createVCards( Addressee::List list, Version version = v3_0 );
++    QCString createVCardsRaw( Addressee::List list, Version version = v3_0 );
+ 
+     // FIXME: Add "createVCards( AddressBook * )"
+ 
+@@ -99,12 +101,14 @@
+       Parses a string in vCard format and returns the first contact.
+      */
+     Addressee parseVCard( const QString& vcard );
++    Addressee parseVCardRaw( const QCString& vcard );
+ 
+     /**
+       Parses a string in vCard format and returns a list of contact objects.
+      */
+     // FIXME: Add error handling
+     Addressee::List parseVCards( const QString& vcard );
++    Addressee::List parseVCardsRaw( const QCString& vcard );
+ 
+     // FIXME: Add "bool parseVCards( AddressBook *, const QString &vcard )"
+ 
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardformatplugin.cpp kdelibs-3.5.10/kabc/vcardformatplugin.cpp
+--- kdelibs-3.5.10-orig/kabc/vcardformatplugin.cpp	2008-02-13 10:41:07.000000000 +0100
++++ kdelibs-3.5.10/kabc/vcardformatplugin.cpp	2008-12-29 23:25:16.000000000 +0100
+@@ -38,14 +38,11 @@
+ 
+ bool VCardFormatPlugin::load( Addressee &addressee, QFile *file )
+ {
+-  QString data;
+-
+-  QTextStream t( file );
+-  t.setEncoding( QTextStream::Latin1 );
+-  data = t.read();
++  const QByteArray rawData = file->readAll();
++  const QCString data( rawData.data(), rawData.size() );
+ 
+   VCardConverter converter;
+-  Addressee::List l = converter.parseVCards( data );
++  Addressee::List l = converter.parseVCardsRaw( data );
+ 
+   if ( ! l.first().isEmpty() ) {
+     addressee = l.first();
+@@ -57,15 +54,11 @@
+ 
+ bool VCardFormatPlugin::loadAll( AddressBook*, Resource *resource, QFile *file )
+ {
+-  QString data;
+-
+-  QTextStream t( file );
+-  t.setEncoding( QTextStream::Latin1 );
+-  data = t.read();
++  const QByteArray rawData = file->readAll();
++  const QCString data( rawData.data(), rawData.size() );
+ 
+   VCardConverter converter;
+-
+-  Addressee::List l = converter.parseVCards( data );
++  Addressee::List l = converter.parseVCardsRaw( data );
+ 
+   Addressee::List::iterator itr;
+   for ( itr = l.begin(); itr != l.end(); ++itr) {
+@@ -86,9 +79,8 @@
+ 
+   vcardlist.append( addressee );
+ 
+-  QTextStream t( file );
+-  t.setEncoding( QTextStream::UnicodeUTF8 );
+-  t << converter.createVCards( vcardlist );
++  const QCString data = converter.createVCardsRaw( vcardlist );
++  file->writeBlock( data, data.length() );
+ }
+ 
+ void VCardFormatPlugin::saveAll( AddressBook*, Resource *resource, QFile *file )
+@@ -102,9 +94,8 @@
+     vcardlist.append( *it );
+   }
+ 
+-  QTextStream t( file );
+-  t.setEncoding( QTextStream::UnicodeUTF8 );
+-  t << converter.createVCards( vcardlist );
++  const QCString data = converter.createVCardsRaw( vcardlist );
++  file->writeBlock( data, data.length() );
+ }
+ 
+ bool VCardFormatPlugin::checkFormat( QFile *file ) const
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardparser/vcardparser.cpp kdelibs-3.5.10/kabc/vcardparser/vcardparser.cpp
+--- kdelibs-3.5.10-orig/kabc/vcardparser/vcardparser.cpp	2008-02-13 10:41:07.000000000 +0100
++++ kdelibs-3.5.10/kabc/vcardparser/vcardparser.cpp	2008-12-29 23:25:16.000000000 +0100
+@@ -18,10 +18,13 @@
+     Boston, MA 02110-1301, USA.
+ */
+ 
++#include <qcstring.h>
+ #include <qregexp.h>
+ #include <qtextcodec.h>
++#include <qvaluelist.h>
+ 
+ #include <kmdcodec.h>
++#include <kdebug.h>
+ 
+ #include "vcardparser.h"
+ 
+@@ -29,25 +32,60 @@
+ 
+ using namespace KABC;
+ 
+-static QString backslash( "\\\\" );
+-static QString comma( "\\," );
+-static QString newline( "\\n" );
+-static QString cr( "\\r" );
++typedef QValueList<QCString> QCStringList;
+ 
+-static void addEscapes( QString &str )
++QValueList<QCString> splitCString( const QCString &str, char sep )
+ {
+-  str.replace( '\\', backslash );
+-  str.replace( ',', comma );
+-  str.replace( '\r', cr );
+-  str.replace( '\n', newline );
++    QValueList<QCString> list;
++    int start = 0;
++    int end;
++    while ((end = str.find(sep, start)) != -1) {
++        list.append(str.mid(start, end - start));
++        start = end + 1;
++    }
++    list.append(str.mid(start));
++
++    return list;
++}
++
++QValueList<QCString> splitCString( const QCString &str, const QRegExp &exp )
++{
++    QValueList<QCString> list;
++    int start = 0;
++    int end;
++    while ((end = str.find(exp, start)) != -1) {
++        list.append(str.mid(start, end - start));
++        start = end + 1;
++    }
++    list.append(str.mid(start));
++
++    return list;
++}
++
++bool cStringStartsWith( const QCString &str, const QCString &pattern )
++{
++  const int length = pattern.length();
++  if ( length == 0 )
++    return true;
++
++  const QCString part = str.left( length );
++  return (pattern == part);
+ }
+ 
+-static void removeEscapes( QString &str )
++static void addEscapes( QCString &str )
+ {
+-  str.replace( cr, "\\r" );
+-  str.replace( newline, "\n" );
+-  str.replace( comma, "," );
+-  str.replace( backslash, "\\" );
++  str.replace( '\\', "\\\\" );
++  str.replace( ',', "\\," );
++  str.replace( '\r', "\\r" );
++  str.replace( '\n', "\\n" );
++}
++
++static void removeEscapes( QCString &str )
++{
++  str.replace( "\\r", "\r" );
++  str.replace( "\\n", "\n" );
++  str.replace( "\\,", "," );
++  str.replace( "\\\\", "\\" );
+ }
+ 
+ VCardParser::VCardParser()
+@@ -60,24 +98,29 @@
+ 
+ VCard::List VCardParser::parseVCards( const QString& text )
+ {
++  return parseVCardsRaw( text.utf8() );
++}
++
++VCard::List VCardParser::parseVCardsRaw( const QCString& text )
++{
+   static QRegExp sep( "[\x0d\x0a]" );
+ 
+   VCard currentVCard;
+   VCard::List vCardList;
+-  QString currentLine;
++  QCString currentLine;
+ 
+-  const QStringList lines = QStringList::split( sep, text );
+-  QStringList::ConstIterator it;
++  const QCStringList lines = splitCString( text, sep );
++  QCStringList::ConstIterator it;
+ 
+   bool inVCard = false;
+-  QStringList::ConstIterator linesEnd( lines.end() );
++  QCStringList::ConstIterator linesEnd( lines.end() );
+   for ( it = lines.begin(); it != linesEnd; ++it ) {
+ 
+     if ( (*it).isEmpty() ) // empty line
+       continue;
+ 
+     if ( (*it)[ 0 ] == ' ' || (*it)[ 0 ] == '\t' ) { // folded line => append to previous
+-      currentLine += QString( *it ).remove( 0, 1 );
++      currentLine.append( (*it).mid( 1 ) );
+       continue;
+     } else {
+       if ( inVCard && !currentLine.isEmpty() ) { // now parse the line
+@@ -88,23 +131,23 @@
+         }
+ 
+         VCardLine vCardLine;
+-        const QString key = currentLine.left( colon ).stripWhiteSpace();
+-        QString value = currentLine.mid( colon + 1 );
++        const QCString key = currentLine.left( colon ).stripWhiteSpace();
++        QCString value = currentLine.mid( colon + 1 );
+ 
+-        QStringList params = QStringList::split( ';', key );
++        QCStringList params = splitCString( key, ';' );
+ 
+         // check for group
+         if ( params[0].find( '.' ) != -1 ) {
+-          const QStringList groupList = QStringList::split( '.', params[0] );
+-          vCardLine.setGroup( groupList[0] );
+-          vCardLine.setIdentifier( groupList[1] );
++          const QCStringList groupList = splitCString( params[0], '.' );
++          vCardLine.setGroup( QString::fromLatin1( groupList[0] ) );
++          vCardLine.setIdentifier( QString::fromLatin1( groupList[1] ) );
+         } else
+-          vCardLine.setIdentifier( params[0] );
++          vCardLine.setIdentifier( QString::fromLatin1( params[0] ) );
+ 
+         if ( params.count() > 1 ) { // find all parameters
+-          QStringList::ConstIterator paramIt = params.begin();
++          QCStringList::ConstIterator paramIt = params.begin();
+           for ( ++paramIt; paramIt != params.end(); ++paramIt ) {
+-            QStringList pair = QStringList::split( '=', *paramIt );
++            QCStringList pair = splitCString( *paramIt, '=' );
+             if ( pair.size() == 1 ) {
+               // correct the fucking 2.1 'standard'
+               if ( pair[0].lower() == "quoted-printable" ) {
+@@ -119,12 +162,12 @@
+             }
+             // This is pretty much a faster pair[1].contains( ',' )...
+             if ( pair[1].find( ',' ) != -1 ) { // parameter in type=x,y,z format
+-              const QStringList args = QStringList::split( ',', pair[ 1 ] );
+-              QStringList::ConstIterator argIt;
++              const QCStringList args = splitCString( pair[ 1 ], ',' );
++              QCStringList::ConstIterator argIt;
+               for ( argIt = args.begin(); argIt != args.end(); ++argIt )
+-                vCardLine.addParameter( pair[0].lower(), *argIt );
++                vCardLine.addParameter( QString::fromLatin1( pair[0].lower() ), QString::fromLatin1( *argIt ) );
+             } else
+-              vCardLine.addParameter( pair[0].lower(), pair[1] );
++              vCardLine.addParameter( QString::fromLatin1( pair[0].lower() ), QString::fromLatin1( pair[1] ) );
+           }
+         }
+ 
+@@ -133,10 +176,8 @@
+         QByteArray output;
+         bool wasBase64Encoded = false;
+ 
+-        params = vCardLine.parameterList();
+-        if ( params.findIndex( "encoding" ) != -1 ) { // have to decode the data
+-          QByteArray input;
+-          input = QCString(value.latin1());
++        if ( vCardLine.parameterList().findIndex( "encoding" ) != -1 ) { // have to decode the data
++          QByteArray input = value;
+           if ( vCardLine.parameter( "encoding" ).lower() == "b" ||
+                vCardLine.parameter( "encoding" ).lower() == "base64" ) {
+             KCodecs::base64Decode( input, output );
+@@ -148,14 +189,14 @@
+               value = value.remove( value.length() - 1, 1 ) + (*it);
+               ++it;
+             }
+-            input = QCString(value.latin1());
++            input = value;
+             KCodecs::quotedPrintableDecode( input, output );
+           }
+         } else {
+-          output = QCString(value.latin1());
++          output = value;
+         }
+ 
+-        if ( params.findIndex( "charset" ) != -1 ) { // have to convert the data
++        if ( vCardLine.parameterList().findIndex( "charset" ) != -1 ) { // have to convert the data
+           QTextCodec *codec =
+             QTextCodec::codecForName( vCardLine.parameter( "charset" ).latin1() );
+           if ( codec ) {
+@@ -173,17 +214,17 @@
+       }
+ 
+       // we do not save the start and end tag as vcardline
+-      if ( (*it).lower().startsWith( "begin:vcard" ) ) {
++      if ( cStringStartsWith( (*it).lower(), QCString( "begin:vcard" ) ) ) {
+         inVCard = true;
+-        currentLine.setLength( 0 );
++        currentLine = QCString();
+         currentVCard.clear(); // flush vcard
+         continue;
+       }
+ 
+-      if ( (*it).lower().startsWith( "end:vcard" ) ) {
++      if ( cStringStartsWith( (*it).lower(), QCString( "end:vcard" ) ) ) {
+         inVCard = false;
+         vCardList.append( currentVCard );
+-        currentLine.setLength( 0 );
++        currentLine = QCString();
+         currentVCard.clear(); // flush vcard
+         continue;
+       }
+@@ -197,8 +238,13 @@
+ 
+ QString VCardParser::createVCards( const VCard::List& list )
+ {
+-  QString text;
+-  QString textLine;
++  return QString::fromUtf8( createVCardsRaw( list ) );
++}
++
++QCString VCardParser::createVCardsRaw( const VCard::List& list )
++{
++  QCString text;
++  QCString textLine;
+   QString encodingType;
+   QStringList idents;
+   QStringList params;
+@@ -213,7 +259,7 @@
+ 
+   bool hasEncoding;
+ 
+-  text.reserve( list.size() * 300 ); // reserve memory to be more efficient
++//  text.reserve( list.size() * 300 ); // reserve memory to be more efficient
+ 
+   // iterate over the cards
+   VCard::List::ConstIterator listEnd( list.end() );
+@@ -228,9 +274,9 @@
+       for ( lineIt = lines.constBegin(); lineIt != lines.constEnd(); ++lineIt ) {
+         if ( !(*lineIt).value().asString().isEmpty() ) {
+           if ( (*lineIt).hasGroup() )
+-            textLine = (*lineIt).group() + "." + (*lineIt).identifier();
++            textLine = (*lineIt).group().latin1() + QCString( "." ) + (*lineIt).identifier().latin1();
+           else
+-            textLine = (*lineIt).identifier();
++            textLine = (*lineIt).identifier().latin1();
+ 
+           params = (*lineIt).parameterList();
+           hasEncoding = false;
+@@ -243,9 +289,9 @@
+ 
+               values = (*lineIt).parameters( *paramIt );
+               for ( valueIt = values.constBegin(); valueIt != values.constEnd(); ++valueIt ) {
+-                textLine.append( ";" + (*paramIt).upper() );
++                textLine.append( QCString( ";" ) + (*paramIt).upper().latin1() );
+                 if ( !(*valueIt).isEmpty() )
+-                  textLine.append( "=" + (*valueIt) );
++                  textLine.append( QCString( "=" ) + (*valueIt).latin1() );
+               }
+             }
+           }
+@@ -261,11 +307,11 @@
+               KCodecs::quotedPrintableEncode( input, output, false );
+             }
+ 
+-            QString value( output );
++            QCString value( output );
+             addEscapes( value );
+             textLine.append( ":" + value );
+           } else {
+-            QString value( (*lineIt).value().asString() );
++            QCString value( (*lineIt).value().toString().utf8() );
+             addEscapes( value );
+             textLine.append( ":" + value );
+           }
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardparser/vcardparser.h kdelibs-3.5.10/kabc/vcardparser/vcardparser.h
+--- kdelibs-3.5.10-orig/kabc/vcardparser/vcardparser.h	2005-10-10 17:05:53.000000000 +0200
++++ kdelibs-3.5.10/kabc/vcardparser/vcardparser.h	2008-12-29 23:25:16.000000000 +0100
+@@ -34,6 +34,9 @@
+     static VCard::List parseVCards( const QString& text );
+     static QString createVCards( const VCard::List& list );
+ 
++    static VCard::List parseVCardsRaw( const QCString& text );
++    static QCString createVCardsRaw( const VCard::List& list );
++
+   private:
+     class VCardParserPrivate;
+     VCardParserPrivate *d;
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardtool.cpp kdelibs-3.5.10/kabc/vcardtool.cpp
+--- kdelibs-3.5.10-orig/kabc/vcardtool.cpp	2007-10-08 11:52:06.000000000 +0200
++++ kdelibs-3.5.10/kabc/vcardtool.cpp	2008-12-29 23:25:16.000000000 +0100
+@@ -74,9 +74,22 @@
+ {
+ }
+ 
+-// TODO: make list a const&
++QCString VCardTool::createVCardsRaw( Addressee::List list, VCard::Version version )
++{
++  const VCard::List vCardList = createVCardsInternal( list, version );
++
++  return VCardParser::createVCardsRaw( vCardList );
++}
++
+ QString VCardTool::createVCards( Addressee::List list, VCard::Version version )
+ {
++  const VCard::List vCardList = createVCardsInternal( list, version );
++
++  return VCardParser::createVCards( vCardList );
++}
++
++KABC::VCard::List VCardTool::createVCardsInternal( Addressee::List list, VCard::Version version )
++{
+   VCard::List vCardList;
+ 
+   Addressee::List::ConstIterator addrIt;
+@@ -348,17 +361,30 @@
+     vCardList.append( card );
+   }
+ 
+-  return VCardParser::createVCards( vCardList );
++  return vCardList;
++}
++
++Addressee::List VCardTool::parseVCardsRaw( const QCString& vcard )
++{
++  const VCard::List vCardList = VCardParser::parseVCardsRaw( vcard );
++ 
++  return parseVCardsInternal( vCardList ); 
+ }
+ 
+ Addressee::List VCardTool::parseVCards( const QString& vcard )
+ {
++  const VCard::List vCardList = VCardParser::parseVCards( vcard );
++ 
++  return parseVCardsInternal( vCardList ); 
++}
++
++Addressee::List VCardTool::parseVCardsInternal( const VCard::List &vCardList )
++{
+   static const QChar semicolonSep( ';' );
+   static const QChar commaSep( ',' );
+   QString identifier;
+ 
+   Addressee::List addrList;
+-  const VCard::List vCardList = VCardParser::parseVCards( vcard );
+ 
+   VCard::List::ConstIterator cardIt;
+   VCard::List::ConstIterator listEnd( vCardList.end() );
+diff -Naur kdelibs-3.5.10-orig/kabc/vcardtool.h kdelibs-3.5.10/kabc/vcardtool.h
+--- kdelibs-3.5.10-orig/kabc/vcardtool.h	2005-10-10 17:05:53.000000000 +0200
++++ kdelibs-3.5.10/kabc/vcardtool.h	2008-12-29 23:25:16.000000000 +0100
+@@ -46,12 +46,19 @@
+      */
+     QString createVCards( Addressee::List list, VCard::Version version = VCard::v3_0 );
+ 
++    QCString createVCardsRaw( Addressee::List list, VCard::Version version = VCard::v3_0 );
++
+     /**
+       Parses the string and returns a list of addressee objects.
+      */
+     Addressee::List parseVCards( const QString& vcard );
+ 
++    Addressee::List parseVCardsRaw( const QCString& vcard );
++
+   private:
++    VCard::List createVCardsInternal( Addressee::List list, VCard::Version version );
++    Addressee::List parseVCardsInternal( const VCard::List &vCardList );
++
+     /**
+       Split a string and replaces escaped separators on the fly with
+       unescaped ones.

Added: trunk/kdepim/kdepim-3.5.10-charset-1.patch
===================================================================
--- trunk/kdepim/kdepim-3.5.10-charset-1.patch	                        (rev 0)
+++ trunk/kdepim/kdepim-3.5.10-charset-1.patch	2009-01-03 06:32:34 UTC (rev 2033)
@@ -0,0 +1,311 @@
+Submitted By: Bruce Dubbs (bdubbs at linuxfromscratch dot org)
+Date: 2009-01-03
+Initial Package Version: 3.1.3
+Origin: Upstream via Thomas ???
+Description: Fix https://bugs.kde.org/show_bug.cgi?id=159795
+
+diff -Naur kdepim-3.5.10-orig/kaddressbook/interfaces/core.h kdepim-3.5.10/kaddressbook/interfaces/core.h
+--- kdepim-3.5.10-orig/kaddressbook/interfaces/core.h	2008-02-13 10:39:42.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/interfaces/core.h	2008-12-29 23:19:28.000000000 +0100
+@@ -166,7 +166,7 @@
+     /**
+       DCOP METHOD: Imports the given vCard.
+      */
+-    virtual void importVCardFromData( const QString& vCard ) = 0;
++    virtual void importVCardFromData( const QCString& vCard ) = 0;
+ 
+     /**
+       DCOP METHOD: Opens contact editor to input a new contact.
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kabcore.cpp kdepim-3.5.10/kaddressbook/kabcore.cpp
+--- kdepim-3.5.10-orig/kaddressbook/kabcore.cpp	2008-08-19 20:15:52.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/kabcore.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -747,7 +747,7 @@
+   mXXPortManager->importVCard( url );
+ }
+ 
+-void KABCore::importVCardFromData( const QString &vCard )
++void KABCore::importVCardFromData( const QCString &vCard )
+ {
+   mXXPortManager->importVCardFromData( vCard );
+ }
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kabcore.h kdepim-3.5.10/kaddressbook/kabcore.h
+--- kdepim-3.5.10-orig/kaddressbook/kabcore.h	2008-08-19 20:15:52.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/kabcore.h	2008-12-29 23:19:28.000000000 +0100
+@@ -301,7 +301,7 @@
+     /**
+       DCOP METHOD: Imports the given vCard.
+      */
+-    virtual void importVCardFromData( const QString& vCard );
++    virtual void importVCardFromData( const QCString& vCard );
+ 
+     /**
+       DCOP METHOD: Opens contact editor to input a new contact.
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbookiface.h kdepim-3.5.10/kaddressbook/kaddressbookiface.h
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbookiface.h	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/kaddressbookiface.h	2008-12-29 23:19:28.000000000 +0100
+@@ -36,7 +36,7 @@
+   k_dcop:
+     virtual void addEmail( QString addr ) = 0;
+     virtual void importVCard( const KURL& url ) = 0;
+-    virtual void importVCardFromData( const QString& vCard ) = 0;
++    virtual void importVCardFromData( const QCString& vCard ) = 0;
+ 
+     virtual ASYNC showContactEditor( QString uid ) = 0;
+ 
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbookmain.cpp kdepim-3.5.10/kaddressbook/kaddressbookmain.cpp
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbookmain.cpp	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/kaddressbookmain.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -89,7 +89,7 @@
+   mCore->importVCard( url );
+ }
+ 
+-void KAddressBookMain::importVCardFromData( const QString& vCard )
++void KAddressBookMain::importVCardFromData( const QCString& vCard )
+ {
+   mCore->importVCardFromData( vCard );
+ }
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbookmain.h kdepim-3.5.10/kaddressbook/kaddressbookmain.h
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbookmain.h	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/kaddressbookmain.h	2008-12-29 23:19:28.000000000 +0100
+@@ -53,7 +53,7 @@
+   public slots:
+     virtual void addEmail( QString addr );
+     virtual void importVCard( const KURL& url );
+-    virtual void importVCardFromData( const QString& vCard );
++    virtual void importVCardFromData( const QCString& vCard );
+     virtual ASYNC showContactEditor( QString uid );
+     virtual void newContact();
+     virtual void newDistributionList();
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbook_part.cpp kdepim-3.5.10/kaddressbook/kaddressbook_part.cpp
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbook_part.cpp	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/kaddressbook_part.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -92,7 +92,7 @@
+   mCore->importVCard( url );
+ }
+ 
+-void KAddressbookPart::importVCardFromData( const QString& vCard )
++void KAddressbookPart::importVCardFromData( const QCString& vCard )
+ {
+   mCore->importVCardFromData( vCard );
+ }
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbook_part.h kdepim-3.5.10/kaddressbook/kaddressbook_part.h
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbook_part.h	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/kaddressbook_part.h	2008-12-29 23:19:28.000000000 +0100
+@@ -50,7 +50,7 @@
+   public slots:
+     virtual void addEmail( QString addr );
+     virtual void importVCard( const KURL& url );
+-    virtual void importVCardFromData( const QString& vCard );
++    virtual void importVCardFromData( const QCString& vCard );
+     virtual ASYNC showContactEditor( QString uid );
+     virtual void newContact();
+     virtual void newDistributionList();
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbookservice.cpp kdepim-3.5.10/kaddressbook/kaddressbookservice.cpp
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbookservice.cpp	2007-10-08 11:50:46.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/kaddressbookservice.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -30,7 +30,7 @@
+ {
+ }
+ 
+-void KAddressBookService::importVCardFromData( const QString& vCard )
++void KAddressBookService::importVCardFromData( const QCString& vCard )
+ {
+   mCore->importVCardFromData( vCard );
+ }
+diff -Naur kdepim-3.5.10-orig/kaddressbook/kaddressbookservice.h kdepim-3.5.10/kaddressbook/kaddressbookservice.h
+--- kdepim-3.5.10-orig/kaddressbook/kaddressbookservice.h	2007-10-08 11:50:46.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/kaddressbookservice.h	2008-12-29 23:19:28.000000000 +0100
+@@ -40,7 +40,7 @@
+ 
+       @param vCard The vCard in string representation.
+      */
+-    void importVCardFromData( const QString& vCard );
++    void importVCardFromData( const QCString& vCard );
+ 
+     /**
+       This method will add a vcard to the address book.
+diff -Naur kdepim-3.5.10-orig/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp kdepim-3.5.10/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp
+--- kdepim-3.5.10-orig/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -75,7 +75,9 @@
+   text.truncate(0);
+ 
+   // read the file
+-  QString contents = file.readAll();
++  const QByteArray data = file.readAll();
++  const QString contents( data );
++  const QCString contentsRaw( data.data(), data.size() );
+   file.close();
+ 
+   // convert the file contents to a KABC::Addressee address
+@@ -83,7 +85,7 @@
+   KABC::Addressee addr;
+   KABC::VCardConverter converter;
+ 
+-  addrList = converter.parseVCards( contents );
++  addrList = converter.parseVCardsRaw( contentsRaw );
+   if ( addrList.count() == 0 )
+     if ( !KABC::LDIFConverter::LDIFToAddressee( contents, addrList ) )
+ 	return false;
+diff -Naur kdepim-3.5.10-orig/kaddressbook/xxport/vcard_xxport.cpp kdepim-3.5.10/kaddressbook/xxport/vcard_xxport.cpp
+--- kdepim-3.5.10-orig/kaddressbook/xxport/vcard_xxport.cpp	2008-02-13 10:39:43.000000000 +0100
++++ kdepim-3.5.10/kaddressbook/xxport/vcard_xxport.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -118,9 +118,9 @@
+       return true;
+ 
+     if ( data == "v21" )
+-      ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v2_1 ) );
++      ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v2_1 ) );
+     else
+-      ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) );
++      ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v3_0 ) );
+   } else {
+     QString msg = i18n( "You have selected a list of contacts, shall they be "
+                         "exported to several files?" );
+@@ -151,9 +151,9 @@
+           tmpList.append( *it );
+ 
+           if ( data == "v21" )
+-            tmpOk = doExport( url, converter.createVCards( tmpList, KABC::VCardConverter::v2_1 ) );
++            tmpOk = doExport( url, converter.createVCardsRaw( tmpList, KABC::VCardConverter::v2_1 ) );
+           else
+-            tmpOk = doExport( url, converter.createVCards( tmpList, KABC::VCardConverter::v3_0 ) );
++            tmpOk = doExport( url, converter.createVCardsRaw( tmpList, KABC::VCardConverter::v3_0 ) );
+ 
+           ok = ok && tmpOk;
+         }
+@@ -166,9 +166,9 @@
+           return true;
+ 
+         if ( data == "v21" )
+-          ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v2_1 ) );
++          ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v2_1 ) );
+         else
+-          ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) );
++          ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v3_0 ) );
+       }
+     }
+   }
+@@ -206,7 +206,7 @@
+           QByteArray rawData = file.readAll();
+           file.close();
+           if ( rawData.size() > 0 )
+-            addrList += parseVCard( rawData );
++            addrList += parseVCard( QCString( rawData.data(), rawData.size() ) );
+ 
+           KIO::NetAccess::removeTempFile( fileName );
+         } else {
+@@ -243,22 +243,19 @@
+   return addrList;
+ }
+ 
+-KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const
++KABC::AddresseeList VCardXXPort::parseVCard( const QCString &data ) const
+ {
+   KABC::VCardConverter converter;
+ 
+-  return converter.parseVCards( data );
++  return converter.parseVCardsRaw( data );
+ }
+ 
+-bool VCardXXPort::doExport( const KURL &url, const QString &data )
++bool VCardXXPort::doExport( const KURL &url, const QCString &data )
+ {
+   KTempFile tmpFile;
+   tmpFile.setAutoDelete( true );
+ 
+-  QTextStream stream( tmpFile.file() );
+-  stream.setEncoding( QTextStream::UnicodeUTF8 );
+-
+-  stream << data;
++  tmpFile.file()->writeBlock( data, data.length() );
+   tmpFile.close();
+ 
+   return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() );
+diff -Naur kdepim-3.5.10-orig/kaddressbook/xxport/vcard_xxport.h kdepim-3.5.10/kaddressbook/xxport/vcard_xxport.h
+--- kdepim-3.5.10-orig/kaddressbook/xxport/vcard_xxport.h	2005-09-10 10:24:17.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/xxport/vcard_xxport.h	2008-12-29 23:19:28.000000000 +0100
+@@ -40,8 +40,8 @@
+     KABC::AddresseeList importContacts( const QString &data ) const;
+ 
+   private:
+-    KABC::AddresseeList parseVCard( const QString &data ) const;
+-    bool doExport( const KURL &url, const QString &data );
++    KABC::AddresseeList parseVCard( const QCString &data ) const;
++    bool doExport( const KURL &url, const QCString &data );
+     void addKey( KABC::Addressee &addr, KABC::Key::Types type );
+ 
+     KABC::AddresseeList filterContacts( const KABC::AddresseeList& );
+diff -Naur kdepim-3.5.10-orig/kaddressbook/xxportmanager.cpp kdepim-3.5.10/kaddressbook/xxportmanager.cpp
+--- kdepim-3.5.10-orig/kaddressbook/xxportmanager.cpp	2007-10-08 11:50:46.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/xxportmanager.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -39,7 +39,7 @@
+ #include "xxportmanager.h"
+ 
+ KURL XXPortManager::importURL = KURL();
+-QString XXPortManager::importData = QString::null;
++QCString XXPortManager::importData = QCString();
+ 
+ XXPortManager::XXPortManager( KAB::Core *core, QObject *parent, const char *name )
+   : QObject( parent, name ), mCore( core )
+@@ -66,11 +66,11 @@
+   importURL = KURL();
+ }
+ 
+-void XXPortManager::importVCardFromData( const QString &vCard )
++void XXPortManager::importVCardFromData( const QCString &vCard )
+ {
+   importData = vCard;
+   slotImport( "vcard", "<empty>" );
+-  importData = "";
++  importData = QCString();
+ }
+ 
+ void XXPortManager::slotImport( const QString &identifier, const QString &data )
+diff -Naur kdepim-3.5.10-orig/kaddressbook/xxportmanager.h kdepim-3.5.10/kaddressbook/xxportmanager.h
+--- kdepim-3.5.10-orig/kaddressbook/xxportmanager.h	2007-10-08 11:50:46.000000000 +0200
++++ kdepim-3.5.10/kaddressbook/xxportmanager.h	2008-12-29 23:19:28.000000000 +0100
+@@ -49,11 +49,11 @@
+     void saveSettings();
+ 
+     static KURL importURL;
+-    static QString importData;
++    static QCString importData;
+ 
+   public slots:
+     void importVCard( const KURL &url );
+-    void importVCardFromData( const QString &vCard );
++    void importVCardFromData( const QCString &vCard );
+ 
+   signals:
+     void modified();
+diff -Naur kdepim-3.5.10-orig/kfile-plugins/vcf/kfile_vcf.cpp kdepim-3.5.10/kfile-plugins/vcf/kfile_vcf.cpp
+--- kdepim-3.5.10-orig/kfile-plugins/vcf/kfile_vcf.cpp	2008-02-13 10:39:52.000000000 +0100
++++ kdepim-3.5.10/kfile-plugins/vcf/kfile_vcf.cpp	2008-12-29 23:19:28.000000000 +0100
+@@ -64,11 +64,12 @@
+ 
+     // even the vcard thumbnail QString::fromUtf8(buf_name));creator reads the full file ...
+     // The following is partly copied from there
+-    QString contents = file.readAll();
++    const QByteArray contents = file.readAll();
++    const QCString data( contents.data(), contents.size() );
+     file.close();
+ 
+     KABC::VCardConverter converter;
+-    KABC::Addressee addr = converter.parseVCard(contents);
++    KABC::Addressee addr = converter.parseVCard( data );
+ 
+     KFileMetaInfoGroup group = appendGroup(info, "Technical");
+ 
+diff -Naur kdepim-3.5.10-orig/libkdepim/interfaces/AddressBookServiceIface.h kdepim-3.5.10/libkdepim/interfaces/AddressBookServiceIface.h
+--- kdepim-3.5.10-orig/libkdepim/interfaces/AddressBookServiceIface.h	2007-10-08 11:50:47.000000000 +0200
++++ kdepim-3.5.10/libkdepim/interfaces/AddressBookServiceIface.h	2008-12-29 23:19:28.000000000 +0100
+@@ -43,7 +43,7 @@
+ 
+         @param vCard The vCard in string representation.
+        */
+-      virtual void importVCardFromData( const QString& vCard ) = 0;
++      virtual void importVCardFromData( const QCString& vCard ) = 0;
+ 
+       /**
+         This method will add a vcard to the address book.




More information about the patches mailing list