summaryrefslogtreecommitdiffabout
path: root/kabc/vcardformatimpl.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/vcardformatimpl.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kabc/vcardformatimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcardformatimpl.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index 580c28b..2417874 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -25,12 +25,15 @@ Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qfile.h>
#include <qregexp.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#include <kdebug.h>
#include <kmdcodec.h>
#include <kstandarddirs.h>
#include <ktempfile.h>
@@ -51,13 +54,13 @@ VCardFormatImpl::VCardFormatImpl()
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 );
VCardListIterator it( e.cardList() );
if ( it.current() ) {
@@ -72,13 +75,13 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
#include <kmessagebox.h>
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() );
for (; it.current(); ++it) {
//US VCard v(*it.current());
@@ -105,13 +108,13 @@ void VCardFormatImpl::save( const Addressee &addressee, QFile *file )
saveAddressee( addressee, v, false );
vcardlist.append( v );
vcards.setCardList( vcardlist );
- QCString vcardData = vcards.asString();
+ Q3CString vcardData = vcards.asString();
file->writeBlock( (const char*)vcardData, vcardData.length() );
}
void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file )
{
@@ -126,17 +129,17 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file
// for memory usage status test only
// KMessageBox::information ( 0, "Stoppppp", QString("Stop ") );
}
bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
{
- QPtrList<ContentLine> contentLines = v->contentLineList();
+ Q3PtrList<ContentLine> 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( "-" );
addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ),
QString::fromUtf8( n.mid( posDash + 1 ) ),
QString::fromUtf8( cl->value()->asString() ) );
@@ -216,13 +219,13 @@ bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
case EntityCategories:
addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) );
break;
case EntityBirthday:
- addressee.setBirthday( readDateValue( cl ) );
+ addressee.setBirthday( (QDateTime) readDateValue( cl ) );
break;
case EntityRevision:
addressee.setRevision( readDateTimeValue( cl ) );
break;
@@ -527,13 +530,13 @@ Address VCardFormatImpl::readAddressValue( ContentLine *cl )
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();
if ( tmpStr == "dom" ) type |= Address::Dom;
else if ( tmpStr == "intl" ) type |= Address::Intl;
else if ( tmpStr == "parcel" ) type |= Address::Parcel;
@@ -606,13 +609,13 @@ PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
TelValue *value = (TelValue *)cl->value();
p.setNumber( QString::fromUtf8( value->asString() ) );
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();
if ( tmpStr == "home" ) type |= PhoneNumber::Home;
else if ( tmpStr == "work" ) type |= PhoneNumber::Work;
else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg;
@@ -867,13 +870,13 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
ParamList params;
if ( pic.isIntern() ) {
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 ) ) );
params.append( new Param( "ENCODING", "b" ) );
if ( !pic.type().isEmpty() )
params.append( new Param( "TYPE", pic.type().utf8() ) );
@@ -956,13 +959,13 @@ void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, co
if ( sound.isIntern() ) {
QByteArray data = sound.data();
if ( intern ) { // only for vCard export we really write the data inline
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( "<dummy>" ) );
}
params.append( new Param( "ENCODING", "b" ) );
} else {
@@ -988,13 +991,13 @@ Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &
}
if ( isInline ) {
QByteArray data;
if ( v->asString() == "<dummy>" ) { // 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();
}
} else {
KCodecs::base64Decode( v->asString(), data );
}