-rw-r--r-- | libkcal/qtopiaformat.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libkcal/qtopiaformat.cpp b/libkcal/qtopiaformat.cpp index 0a4a031..2dfe1a4 100644 --- a/libkcal/qtopiaformat.cpp +++ b/libkcal/qtopiaformat.cpp | |||
@@ -1,60 +1,60 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qptrlist.h> | 24 | #include <q3ptrlist.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | #include <qclipboard.h> | 26 | #include <qclipboard.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qtextstream.h> | 28 | #include <q3textstream.h> |
29 | #include <qxml.h> | 29 | #include <qxml.h> |
30 | 30 | ||
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | #include "calendar.h" | 34 | #include "calendar.h" |
35 | #include "calendarlocal.h" | 35 | #include "calendarlocal.h" |
36 | 36 | ||
37 | #include "qtopiaformat.h" | 37 | #include "qtopiaformat.h" |
38 | 38 | ||
39 | using namespace KCal; | 39 | using namespace KCal; |
40 | 40 | ||
41 | class QtopiaParser : public QXmlDefaultHandler | 41 | class QtopiaParser : public QXmlDefaultHandler |
42 | { | 42 | { |
43 | public: | 43 | public: |
44 | QtopiaParser( Calendar *calendar ) : mCalendar( calendar ) { | 44 | QtopiaParser( Calendar *calendar ) : mCalendar( calendar ) { |
45 | oldCategories = 0; | 45 | oldCategories = 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | bool startElement( const QString &, const QString &, const QString & qName, | 48 | bool startElement( const QString &, const QString &, const QString & qName, |
49 | const QXmlAttributes &attributes ) | 49 | const QXmlAttributes &attributes ) |
50 | { | 50 | { |
51 | if ( qName == "event" ) { | 51 | if ( qName == "event" ) { |
52 | Event *event = new Event; | 52 | Event *event = new Event; |
53 | QString uid = "Qtopia" + attributes.value( "uid" ); | 53 | QString uid = "Qtopia" + attributes.value( "uid" ); |
54 | // event->setUid( uid ); | 54 | // event->setUid( uid ); |
55 | 55 | ||
56 | event->setSummary( attributes.value( "description" ) ); | 56 | event->setSummary( attributes.value( "description" ) ); |
57 | event->setLocation( attributes.value( "location" ) ); | 57 | event->setLocation( attributes.value( "location" ) ); |
58 | event->setDescription( attributes.value( "note" ) ); | 58 | event->setDescription( attributes.value( "note" ) ); |
59 | event->setDtStart( toDateTime( attributes.value( "start" ) ) ); | 59 | event->setDtStart( toDateTime( attributes.value( "start" ) ) ); |
60 | event->setDtEnd( toDateTime( attributes.value( "end" ) ) ); | 60 | event->setDtEnd( toDateTime( attributes.value( "end" ) ) ); |
@@ -280,54 +280,54 @@ QtopiaFormat::QtopiaFormat() | |||
280 | mCategories = 0; | 280 | mCategories = 0; |
281 | } | 281 | } |
282 | 282 | ||
283 | QtopiaFormat::~QtopiaFormat() | 283 | QtopiaFormat::~QtopiaFormat() |
284 | { | 284 | { |
285 | } | 285 | } |
286 | #include <qdom.h> | 286 | #include <qdom.h> |
287 | bool QtopiaFormat::load( Calendar *calendar, const QString &fileName ) | 287 | bool QtopiaFormat::load( Calendar *calendar, const QString &fileName ) |
288 | { | 288 | { |
289 | clearException(); | 289 | clearException(); |
290 | // qDebug("load QtopiaFormat: %s ",fileName.latin1() ); | 290 | // qDebug("load QtopiaFormat: %s ",fileName.latin1() ); |
291 | QtopiaParser handler( calendar ); | 291 | QtopiaParser handler( calendar ); |
292 | handler.setCategoriesList( mCategories ); | 292 | handler.setCategoriesList( mCategories ); |
293 | QFile xmlFile( fileName ); | 293 | QFile xmlFile( fileName ); |
294 | QXmlInputSource source( xmlFile ); | 294 | QXmlInputSource source( xmlFile ); |
295 | QXmlSimpleReader reader; | 295 | QXmlSimpleReader reader; |
296 | reader.setContentHandler( &handler ); | 296 | reader.setContentHandler( &handler ); |
297 | return reader.parse( source ); | 297 | return reader.parse( source ); |
298 | } | 298 | } |
299 | 299 | ||
300 | bool QtopiaFormat::save( Calendar *calendar, const QString &fileName ) | 300 | bool QtopiaFormat::save( Calendar *calendar, const QString &fileName ) |
301 | { | 301 | { |
302 | 302 | ||
303 | clearException(); | 303 | clearException(); |
304 | 304 | ||
305 | QString text = toString( calendar ); | 305 | QString text = toString( calendar ); |
306 | 306 | ||
307 | if ( text.isNull() ) return false; | 307 | if ( text.isNull() ) return false; |
308 | 308 | ||
309 | // TODO: write backup file | 309 | // TODO: write backup file |
310 | 310 | ||
311 | QFile file( fileName ); | 311 | QFile file( fileName ); |
312 | if (!file.open( IO_WriteOnly ) ) { | 312 | if (!file.open( QIODevice::WriteOnly ) ) { |
313 | setException(new ErrorFormat(ErrorFormat::SaveError, | 313 | setException(new ErrorFormat(ErrorFormat::SaveError, |
314 | i18n("Could not open file '%1'").arg(fileName))); | 314 | i18n("Could not open file '%1'").arg(fileName))); |
315 | return false; | 315 | return false; |
316 | } | 316 | } |
317 | QTextStream ts( &file ); | 317 | Q3TextStream ts( &file ); |
318 | ts << text; | 318 | ts << text; |
319 | file.close(); | 319 | file.close(); |
320 | 320 | ||
321 | return true; | 321 | return true; |
322 | } | 322 | } |
323 | 323 | ||
324 | bool QtopiaFormat::fromString( Calendar *, const QString & ) | 324 | bool QtopiaFormat::fromString( Calendar *, const QString & ) |
325 | { | 325 | { |
326 | 326 | ||
327 | return false; | 327 | return false; |
328 | } | 328 | } |
329 | 329 | ||
330 | QString QtopiaFormat::toString( Calendar * ) | 330 | QString QtopiaFormat::toString( Calendar * ) |
331 | { | 331 | { |
332 | return QString::null; | 332 | return QString::null; |
333 | } | 333 | } |