Diffstat (limited to 'kabc/plugins/qtopia/resourceqtopia.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 79ddaea..a36eb8f 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp | |||
@@ -22,25 +22,25 @@ | |||
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #ifndef _WIN32_ | 29 | #ifndef _WIN32_ |
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #endif | 31 | #endif |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <q3textstream.h> |
35 | #include <qfileinfo.h> | 35 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | //US #include <qtimer.h> | 37 | //US #include <qtimer.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | //US #include <ksavefile.h> | 43 | //US #include <ksavefile.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
46 | 46 | ||
@@ -147,25 +147,25 @@ void ResourceQtopia::doClose() | |||
147 | 147 | ||
148 | 148 | ||
149 | // it seems so, that deletion of access deletes backend as well | 149 | // it seems so, that deletion of access deletes backend as well |
150 | //delete backend; | 150 | //delete backend; |
151 | 151 | ||
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | 154 | ||
155 | bool ResourceQtopia::load() | 155 | bool ResourceQtopia::load() |
156 | { | 156 | { |
157 | 157 | ||
158 | QFile file( fileName() ); | 158 | QFile file( fileName() ); |
159 | if ( !file.open(IO_ReadOnly ) ) { | 159 | if ( !file.open(QIODevice::ReadOnly ) ) { |
160 | return false; | 160 | return false; |
161 | } | 161 | } |
162 | 162 | ||
163 | QDomDocument doc("mydocument" ); | 163 | QDomDocument doc("mydocument" ); |
164 | if ( !doc.setContent( &file ) ) { | 164 | if ( !doc.setContent( &file ) ) { |
165 | file.close(); | 165 | file.close(); |
166 | return false; | 166 | return false; |
167 | } | 167 | } |
168 | bool res; | 168 | bool res; |
169 | QDomElement docElem = doc.documentElement( ); | 169 | QDomElement docElem = doc.documentElement( ); |
170 | QDomNode n = docElem.firstChild(); | 170 | QDomNode n = docElem.firstChild(); |
171 | while ( !n.isNull() ) { | 171 | while ( !n.isNull() ) { |
@@ -194,30 +194,30 @@ bool ResourceQtopia::load() | |||
194 | } | 194 | } |
195 | return true; | 195 | return true; |
196 | } | 196 | } |
197 | 197 | ||
198 | bool ResourceQtopia::save( Ticket *ticket ) | 198 | bool ResourceQtopia::save( Ticket *ticket ) |
199 | { | 199 | { |
200 | #ifdef _USE_DIRWATCH_ | 200 | #ifdef _USE_DIRWATCH_ |
201 | mDirWatch.stopScan(); | 201 | mDirWatch.stopScan(); |
202 | #endif | 202 | #endif |
203 | KABC::AddressBook::Iterator it; | 203 | KABC::AddressBook::Iterator it; |
204 | bool res; | 204 | bool res; |
205 | QFile file( fileName() ); | 205 | QFile file( fileName() ); |
206 | if (!file.open( IO_WriteOnly ) ) { | 206 | if (!file.open( QIODevice::WriteOnly ) ) { |
207 | return false; | 207 | return false; |
208 | } | 208 | } |
209 | QTextStream ts( &file ); | 209 | Q3TextStream ts( &file ); |
210 | QTextStream *stream = &ts; | 210 | Q3TextStream *stream = &ts; |
211 | stream->setEncoding( QTextStream::UnicodeUTF8 ); | 211 | stream->setEncoding( Q3TextStream::UnicodeUTF8 ); |
212 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; | 212 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; |
213 | *stream << " <Groups>" << endl; | 213 | *stream << " <Groups>" << endl; |
214 | *stream << " </Groups>" << endl; | 214 | *stream << " </Groups>" << endl; |
215 | *stream << " <Contacts> " << endl; | 215 | *stream << " <Contacts> " << endl; |
216 | // for all entries | 216 | // for all entries |
217 | KABC::Addressee ab; | 217 | KABC::Addressee ab; |
218 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { | 218 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { |
219 | KABC::Addressee addressee = (*it); | 219 | KABC::Addressee addressee = (*it); |
220 | res = mConverter->addresseeToQtopia( addressee, stream ); | 220 | res = mConverter->addresseeToQtopia( addressee, stream ); |
221 | if (!res == true) | 221 | if (!res == true) |
222 | { | 222 | { |
223 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); | 223 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); |
@@ -251,25 +251,25 @@ bool ResourceQtopia::lock( const QString &lockfileName ) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | QString lockUniqueName; | 253 | QString lockUniqueName; |
254 | lockUniqueName = fn + KApplication::randomString( 8 ); | 254 | lockUniqueName = fn + KApplication::randomString( 8 ); |
255 | 255 | ||
256 | url = lockUniqueName; | 256 | url = lockUniqueName; |
257 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 257 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
258 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 258 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
259 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 259 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
260 | 260 | ||
261 | // Create unique file | 261 | // Create unique file |
262 | QFile file( mLockUniqueName ); | 262 | QFile file( mLockUniqueName ); |
263 | file.open( IO_WriteOnly ); | 263 | file.open( QIODevice::WriteOnly ); |
264 | file.close(); | 264 | file.close(); |
265 | 265 | ||
266 | // Create lock file | 266 | // Create lock file |
267 | int result = 0; | 267 | int result = 0; |
268 | #ifndef _WIN32_ | 268 | #ifndef _WIN32_ |
269 | result = ::link( QFile::encodeName( mLockUniqueName ), | 269 | result = ::link( QFile::encodeName( mLockUniqueName ), |
270 | QFile::encodeName( lockName ) ); | 270 | QFile::encodeName( lockName ) ); |
271 | #endif | 271 | #endif |
272 | if ( result == 0 ) { | 272 | if ( result == 0 ) { |
273 | addressBook()->emitAddressBookLocked(); | 273 | addressBook()->emitAddressBookLocked(); |
274 | return true; | 274 | return true; |
275 | } | 275 | } |