summaryrefslogtreecommitdiffabout
path: root/kabc/formats/vcardformatplugin2.cpp
Unidiff
Diffstat (limited to 'kabc/formats/vcardformatplugin2.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/formats/vcardformatplugin2.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/kabc/formats/vcardformatplugin2.cpp b/kabc/formats/vcardformatplugin2.cpp
index 41b0c9a..fbebe92 100644
--- a/kabc/formats/vcardformatplugin2.cpp
+++ b/kabc/formats/vcardformatplugin2.cpp
@@ -8,13 +8,13 @@ $Id$
8#include "vcardformatplugin2.h" 8#include "vcardformatplugin2.h"
9 9
10#include "address.h" 10#include "address.h"
11#include "addressee.h" 11#include "addressee.h"
12#include "vcardparser/vcardtool.h" 12#include "vcardparser/vcardtool.h"
13 13
14#include <qtextstream.h> 14#include <q3textstream.h>
15#include <qfile.h> 15#include <qfile.h>
16 16
17using namespace KABC; 17using namespace KABC;
18 18
19extern "C" 19extern "C"
20{ 20{
@@ -34,14 +34,14 @@ VCardFormatPlugin2::~VCardFormatPlugin2()
34 34
35bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file ) 35bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file )
36{ 36{
37 qDebug("VCardFormatPlugin2::load"); 37 qDebug("VCardFormatPlugin2::load");
38 QString data; 38 QString data;
39 39
40 QTextStream t( file ); 40 Q3TextStream t( file );
41 t.setEncoding( QTextStream::UnicodeUTF8 ); 41 t.setEncoding( Q3TextStream::UnicodeUTF8 );
42 data = t.read(); 42 data = t.read();
43 43
44 VCardTool tool; 44 VCardTool tool;
45 45
46 Addressee::List l = tool.parseVCards( data ); 46 Addressee::List l = tool.parseVCards( data );
47 47
@@ -55,14 +55,14 @@ bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file )
55 55
56bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) 56bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
57{ 57{
58 qDebug("VCardFormatPlugin2::loadAll"); 58 qDebug("VCardFormatPlugin2::loadAll");
59 QString data; 59 QString data;
60 60
61 QTextStream t( file ); 61 Q3TextStream t( file );
62 t.setEncoding( QTextStream::UnicodeUTF8 ); 62 t.setEncoding( Q3TextStream::UnicodeUTF8 );
63 data = t.read(); 63 data = t.read();
64 64
65 VCardTool tool; 65 VCardTool tool;
66 66
67 Addressee::List l = tool.parseVCards( data ); 67 Addressee::List l = tool.parseVCards( data );
68 68
@@ -83,14 +83,14 @@ void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file )
83 VCardTool tool; 83 VCardTool tool;
84 Addressee::List vcardlist; 84 Addressee::List vcardlist;
85 85
86 86
87 vcardlist.append( addressee ); 87 vcardlist.append( addressee );
88 88
89 QTextStream t( file ); 89 Q3TextStream t( file );
90 t.setEncoding( QTextStream::UnicodeUTF8 ); 90 t.setEncoding( Q3TextStream::UnicodeUTF8 );
91 t << tool.createVCards( vcardlist ); 91 t << tool.createVCards( vcardlist );
92} 92}
93 93
94void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) 94void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file )
95{ 95{
96 qDebug("VCardFormatPlugin2::saveAll"); 96 qDebug("VCardFormatPlugin2::saveAll");
@@ -102,22 +102,22 @@ void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *fi
102 if ( (*it).resource() == resource ) { 102 if ( (*it).resource() == resource ) {
103 (*it).setChanged( false ); 103 (*it).setChanged( false );
104 vcardlist.append( *it ); 104 vcardlist.append( *it );
105 } 105 }
106 } 106 }
107 107
108 QTextStream t( file ); 108 Q3TextStream t( file );
109 t.setEncoding( QTextStream::UnicodeUTF8 ); 109 t.setEncoding( Q3TextStream::UnicodeUTF8 );
110 t << tool.createVCards( vcardlist ); 110 t << tool.createVCards( vcardlist );
111} 111}
112 112
113bool VCardFormatPlugin2::checkFormat( QFile *file ) const 113bool VCardFormatPlugin2::checkFormat( QFile *file ) const
114{ 114{
115 QString line; 115 QString line;
116 116
117 file->readLine( line, 1024 ); 117 char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp;
118 line = line.stripWhiteSpace(); 118 line = line.stripWhiteSpace();
119 if ( line == "BEGIN:VCARD" ) 119 if ( line == "BEGIN:VCARD" )
120 return true; 120 return true;
121 else 121 else
122 return false; 122 return false;
123} 123}