author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/formats | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/formats/binary/kabcformat_binaryE.pro | 2 | ||||
-rw-r--r-- | kabc/formats/vcardformatplugin2.cpp | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/kabc/formats/binary/kabcformat_binaryE.pro b/kabc/formats/binary/kabcformat_binaryE.pro index 2d9594d..c71197e 100644 --- a/kabc/formats/binary/kabcformat_binaryE.pro +++ b/kabc/formats/binary/kabcformat_binaryE.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabcformat_binary | 5 | TARGET = microkabcformat_binary |
6 | #INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat | 6 | #INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat |
7 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../qtcompat | 7 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../qtcompat |
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc | 9 | MOC_DIR = moc |
10 | DESTDIR = $(QPEDIR)/lib | 10 | DESTDIR = $(QPEDIR)/lib |
11 | LIBS += -lmicrokde -lmicrokabc | 11 | LIBS += -lxmicrokde -lxmicrokabc |
12 | LIBS += -L$(QPEDIR)/lib | 12 | LIBS += -L$(QPEDIR)/lib |
13 | DEFINES += KAB_EMBEDDED | 13 | DEFINES += KAB_EMBEDDED |
14 | 14 | ||
15 | INTERFACES = \ | 15 | INTERFACES = \ |
16 | 16 | ||
17 | HEADERS = \ | 17 | HEADERS = \ |
18 | binaryformat.h | 18 | binaryformat.h |
19 | 19 | ||
20 | SOURCES = \ | 20 | SOURCES = \ |
21 | binaryformat.cpp | 21 | binaryformat.cpp |
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 | |||
@@ -2,25 +2,25 @@ | |||
2 | Enhanced Version of the file for platform independent KDE tools. | 2 | Enhanced Version of the file for platform independent KDE tools. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | $Id$ | 5 | $Id$ |
6 | */ | 6 | */ |
7 | 7 | ||
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 | ||
17 | using namespace KABC; | 17 | using namespace KABC; |
18 | 18 | ||
19 | extern "C" | 19 | extern "C" |
20 | { | 20 | { |
21 | FormatPlugin *format() | 21 | FormatPlugin *format() |
22 | { | 22 | { |
23 | return new VCardFormatPlugin2(); | 23 | return new VCardFormatPlugin2(); |
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
@@ -28,47 +28,47 @@ VCardFormatPlugin2::VCardFormatPlugin2() | |||
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | VCardFormatPlugin2::~VCardFormatPlugin2() | 31 | VCardFormatPlugin2::~VCardFormatPlugin2() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file ) | 35 | bool 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 | ||
48 | if ( ! l.first().isEmpty() ) { | 48 | if ( ! l.first().isEmpty() ) { |
49 | addressee = l.first(); | 49 | addressee = l.first(); |
50 | return true; | 50 | return true; |
51 | } | 51 | } |
52 | 52 | ||
53 | return false; | 53 | return false; |
54 | } | 54 | } |
55 | 55 | ||
56 | bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 56 | bool 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 | ||
69 | Addressee::List::Iterator itr; | 69 | Addressee::List::Iterator itr; |
70 | 70 | ||
71 | for ( itr = l.begin(); itr != l.end(); ++itr) { | 71 | for ( itr = l.begin(); itr != l.end(); ++itr) { |
72 | Addressee addressee = *itr; | 72 | Addressee addressee = *itr; |
73 | addressee.setResource( resource ); | 73 | addressee.setResource( resource ); |
74 | addressBook->insertAddressee( addressee ); | 74 | addressBook->insertAddressee( addressee ); |
@@ -77,48 +77,48 @@ bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, | |||
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | 79 | ||
80 | void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file ) | 80 | void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file ) |
81 | { | 81 | { |
82 | qDebug("VCardFormatPlugin2::save"); | 82 | qDebug("VCardFormatPlugin2::save"); |
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 | ||
94 | void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 94 | void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
95 | { | 95 | { |
96 | qDebug("VCardFormatPlugin2::saveAll"); | 96 | qDebug("VCardFormatPlugin2::saveAll"); |
97 | VCardTool tool; | 97 | VCardTool tool; |
98 | Addressee::List vcardlist; | 98 | Addressee::List vcardlist; |
99 | 99 | ||
100 | AddressBook::Iterator it; | 100 | AddressBook::Iterator it; |
101 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 101 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
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 | ||
113 | bool VCardFormatPlugin2::checkFormat( QFile *file ) const | 113 | bool 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 | } |
124 | 124 | ||