author | zautrix <zautrix> | 2005-07-06 09:29:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 09:29:15 (UTC) |
commit | 38c8ca3f376451c072650fad8964adbbc513a105 (patch) (unidiff) | |
tree | b1d4f1cec8b208294a16ff0d88ef6f8d5812c887 /kabc | |
parent | 68016257abe13019610cb7bb230f8d754179abfb (diff) | |
download | kdepimpi-38c8ca3f376451c072650fad8964adbbc513a105.zip kdepimpi-38c8ca3f376451c072650fad8964adbbc513a105.tar.gz kdepimpi-38c8ca3f376451c072650fad8964adbbc513a105.tar.bz2 |
fixxxx
-rw-r--r-- | kabc/vcardformatimpl.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp | |||
@@ -24,12 +24,13 @@ Copyright (c) 2004 Ulf Schenk | |||
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qfile.h> | 28 | #include <qfile.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | ||
30 | 31 | ||
31 | #include <kdebug.h> | 32 | #include <kdebug.h> |
32 | #include <kmdcodec.h> | 33 | #include <kmdcodec.h> |
33 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
34 | #include <ktempfile.h> | 35 | #include <ktempfile.h> |
35 | 36 | ||
@@ -66,19 +67,18 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) | |||
66 | return true; | 67 | return true; |
67 | } | 68 | } |
68 | 69 | ||
69 | return false; | 70 | return false; |
70 | } | 71 | } |
71 | 72 | ||
73 | |||
74 | #include <kmessagebox.h> | ||
72 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 75 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
73 | { | 76 | { |
74 | kdDebug(5700) << "VCardFormat::loadAll()" << endl; | 77 | |
75 | 78 | QCString data(file->readAll().data(), file->size()+1); | |
76 | QByteArray fdata = file->readAll(); | ||
77 | QCString data(fdata.data(), fdata.size()+1); | ||
78 | |||
79 | VCardEntity e( data ); | 79 | VCardEntity e( data ); |
80 | 80 | ||
81 | VCardListIterator it( e.cardList() ); | 81 | VCardListIterator it( e.cardList() ); |
82 | 82 | ||
83 | for (; it.current(); ++it) { | 83 | for (; it.current(); ++it) { |
84 | //US VCard v(*it.current()); | 84 | //US VCard v(*it.current()); |
@@ -89,13 +89,12 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi | |||
89 | addressBook->insertAddressee( addressee ); | 89 | addressBook->insertAddressee( addressee ); |
90 | if (debug == true) | 90 | if (debug == true) |
91 | { | 91 | { |
92 | printf("address %s loaded successfully\n", addressee.formattedName().latin1()); | 92 | printf("address %s loaded successfully\n", addressee.formattedName().latin1()); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | |||
96 | return true; | 95 | return true; |
97 | } | 96 | } |
98 | 97 | ||
99 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) | 98 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) |
100 | { | 99 | { |
101 | VCardEntity vcards; | 100 | VCardEntity vcards; |
@@ -112,30 +111,23 @@ void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) | |||
112 | QCString vcardData = vcards.asString(); | 111 | QCString vcardData = vcards.asString(); |
113 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | 112 | file->writeBlock( (const char*)vcardData, vcardData.length() ); |
114 | } | 113 | } |
115 | 114 | ||
116 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 115 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
117 | { | 116 | { |
118 | VCardEntity vcards; | ||
119 | VCardList vcardlist; | ||
120 | vcardlist.setAutoDelete( true ); | ||
121 | 117 | ||
122 | AddressBook::Iterator it; | 118 | AddressBook::Iterator it; |
123 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 119 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
124 | if ( (*it).resource() == resource ) { | 120 | if ( (*it).resource() == resource ) { |
125 | VCard *v = new VCard; | 121 | save((*it),file); |
126 | saveAddressee( (*it), v, true ); | 122 | qApp->processEvents(); |
127 | (*it).setChanged( false ); | 123 | (*it).setChanged( false ); |
128 | vcardlist.append( v ); | ||
129 | } | 124 | } |
130 | } | 125 | } |
131 | 126 | // for memory usage status test only | |
132 | vcards.setCardList( vcardlist ); | 127 | // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); |
133 | |||
134 | QCString vcardData = vcards.asString(); | ||
135 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | ||
136 | } | 128 | } |
137 | 129 | ||
138 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) | 130 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) |
139 | { | 131 | { |
140 | QPtrList<ContentLine> contentLines = v->contentLineList(); | 132 | QPtrList<ContentLine> contentLines = v->contentLineList(); |
141 | ContentLine *cl; | 133 | ContentLine *cl; |