summaryrefslogtreecommitdiffabout
path: root/kabc/vcard21parser.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/vcard21parser.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kabc/vcard21parser.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/vcard21parser.cpp40
1 files changed, 23 insertions, 17 deletions
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp
index 60d02b8..e24a9dc 100644
--- a/kabc/vcard21parser.cpp
+++ b/kabc/vcard21parser.cpp
@@ -28,4 +28,6 @@ $Id$
#include <qmap.h>
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kmdcodec.h>
@@ -46,5 +48,5 @@ bool VCardLineX::isValid() const
// This is long but it makes it a bit faster (and saves me from using
// a tree which is probably the ideal situation, but a bit memory heavy)
- switch( name[0] ) {
+ switch( name[0].unicode() ) {
case 'a':
if ( name == VCARD_ADR && qualified &&
@@ -270,5 +272,5 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
//set the addressee's phone numbers
- for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
+ for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_TEL ) {
int type = 0;
@@ -309,5 +311,5 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
addressee.makePhoneNumbersOLcompatible();
//set the addressee's addresses
- for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
+ for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_ADR ) {
int type = 0;
@@ -328,5 +330,8 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
type |= Address::Pref;
}
- addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) );
+ QStringList tmp;
+ for(Q3ValueList<QString>::const_iterator ii=(*i).parameters.begin();ii!=(*i).parameters.end();++ii)
+ tmp.push_back(*ii);
+ addressee.insertAddress( readAddressFromQStringList( tmp, type ) );
}
}
@@ -409,8 +414,8 @@ VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err )
int _state = VC_STATE_BEGIN;
- QValueList<VCardLineX> *_vcdata;
- QValueList<QString> lines;
+ Q3ValueList<VCardLineX> *_vcdata;
+ QStringList lines;
- _vcdata = new QValueList<VCardLineX>;
+ _vcdata = new Q3ValueList<VCardLineX>;
lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc );
@@ -502,6 +507,6 @@ VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err )
_vcl.parameters = QStringList::split( ';', value, true );
if ( qp ) { // decode the quoted printable
- for ( QStringList::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z )
- *z = KCodecs::quotedPrintableDecode( (*z).latin1() );
+ for ( QLinkedList<QString>::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z )
+ *z = KCodecs::quotedPrintableDecode( (Q3CString)(*z).latin1() );
}
}
@@ -544,5 +549,5 @@ VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err )
}
-VCard21ParserImpl::VCard21ParserImpl(QValueList<VCardLineX> *_vcd) : _vcdata(_vcd)
+VCard21ParserImpl::VCard21ParserImpl(Q3ValueList<VCardLineX> *_vcd) : _vcdata(_vcd)
{
}
@@ -555,5 +560,5 @@ QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifie
const QString lowqualifier = qualifier.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) {
if ((*i).parameters.count() > 0)
@@ -571,5 +576,5 @@ QString VCard21ParserImpl::getValue(const QString& name)
const QString lowname = name.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && !(*i).qualified) {
if ((*i).parameters.count() > 0)
@@ -585,7 +590,8 @@ QStringList VCard21ParserImpl::getValues(const QString& name)
{
const QString lowname = name.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
- if ((*i).name == lowname && !(*i).qualified)
- return (*i).parameters;
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ if ((*i).name == lowname && !(*i).qualified) {
+ return QStringList( (*i).parameters );
+ }
}
// failed.
@@ -597,7 +603,7 @@ QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qua
const QString lowname = name.lower();
const QString lowqualifier = qualifier.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier))
- return (*i).parameters;
+ return QStringList( (*i).parameters );
}
// failed.