From a08aff328d4393031d5ba7d622c2b05705a89d73 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Wed, 04 Jul 2007 11:23:42 +0000 Subject: initial public commit of qt4 port --- (limited to 'kabc/vcardformatimpl.cpp') diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index 580c28b..2417874 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -28,6 +28,9 @@ $Id$ #include #include #include +//Added by qt3to4: +#include +#include #include #include @@ -54,7 +57,7 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) kdDebug(5700) << "VCardFormat::load()" << endl; QByteArray fdata = file->readAll(); - QCString data(fdata.data(), fdata.size()+1); + Q3CString data(fdata.data(), fdata.size()+1); VCardEntity e( data ); @@ -75,7 +78,7 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) { - QCString data(file->readAll().data(), file->size()+1); + Q3CString data(file->readAll().data(), file->size()+1); VCardEntity e( data ); VCardListIterator it( e.cardList() ); @@ -108,7 +111,7 @@ void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) vcardlist.append( v ); vcards.setCardList( vcardlist ); - QCString vcardData = vcards.asString(); + Q3CString vcardData = vcards.asString(); file->writeBlock( (const char*)vcardData, vcardData.length() ); } @@ -129,11 +132,11 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) { - QPtrList contentLines = v->contentLineList(); + Q3PtrList contentLines = v->contentLineList(); ContentLine *cl; for( cl = contentLines.first(); cl; cl = contentLines.next() ) { - QCString n = cl->name(); + Q3CString n = cl->name(); if ( n.left( 2 ) == "X-" ) { n = n.mid( 2 ); int posDash = n.find( "-" ); @@ -219,7 +222,7 @@ bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) break; case EntityBirthday: - addressee.setBirthday( readDateValue( cl ) ); + addressee.setBirthday( (QDateTime) readDateValue( cl ) ); break; case EntityRevision: @@ -530,7 +533,7 @@ int VCardFormatImpl::readAddressParam( ContentLine *cl ) int type = 0; ParamList params = cl->paramList(); ParamListIterator it( params ); - QCString tmpStr; + Q3CString tmpStr; for( ; it.current(); ++it ) { if ( (*it)->name().upper() == "TYPE" ) { tmpStr = (*it)->value().lower(); @@ -609,7 +612,7 @@ PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) int type = 0; ParamList params = cl->paramList(); ParamListIterator it( params ); - QCString tmpStr; + Q3CString tmpStr; for( ; it.current(); ++it ) { if ( (*it)->name() == "TYPE" ) { tmpStr = (*it)->value().lower(); @@ -870,7 +873,7 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty QImage img = pic.data(); if ( intern ) { // only for vCard export we really write the data inline QByteArray data; - QDataStream s( data, IO_WriteOnly ); + QDataStream s( &data, QIODevice::WriteOnly ); s.setVersion( 4 ); // to produce valid png files s << img; cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); @@ -959,7 +962,7 @@ void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, co cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); } else { // save sound in cache QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); - if ( file.open( IO_WriteOnly ) ) { + if ( file.open( QIODevice::WriteOnly ) ) { file.writeBlock( data ); } cl.setValue( new TextValue( "" ) ); @@ -991,7 +994,7 @@ Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee & QByteArray data; if ( v->asString() == "" ) { // no sound inline stored => sound is in cache QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); - if ( file.open( IO_ReadOnly ) ) { + if ( file.open( QIODevice::ReadOnly ) ) { data = file.readAll(); file.close(); } -- cgit v0.9.0.2