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) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/qtopiaformat.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-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,76 +1,76 @@ /* This file is part of libkcal. Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qdatetime.h> #include <qstring.h> -#include <qptrlist.h> +#include <q3ptrlist.h> #include <qregexp.h> #include <qclipboard.h> #include <qfile.h> -#include <qtextstream.h> +#include <q3textstream.h> #include <qxml.h> #include <kdebug.h> #include <klocale.h> #include "calendar.h" #include "calendarlocal.h" #include "qtopiaformat.h" using namespace KCal; class QtopiaParser : public QXmlDefaultHandler { public: QtopiaParser( Calendar *calendar ) : mCalendar( calendar ) { oldCategories = 0; } bool startElement( const QString &, const QString &, const QString & qName, const QXmlAttributes &attributes ) { if ( qName == "event" ) { Event *event = new Event; QString uid = "Qtopia" + attributes.value( "uid" ); // event->setUid( uid ); event->setSummary( attributes.value( "description" ) ); event->setLocation( attributes.value( "location" ) ); event->setDescription( attributes.value( "note" ) ); event->setDtStart( toDateTime( attributes.value( "start" ) ) ); event->setDtEnd( toDateTime( attributes.value( "end" ) ) ); if ( attributes.value( "type" ) == "AllDay" ) { event->setFloats( true ); } else { event->setFloats( false ); } QString rtype = attributes.value( "rtype" ); if ( !rtype.isEmpty() ) { QDate startDate = event->dtStart().date(); QString freqStr = attributes.value( "rfreq" ); int freq = freqStr.toInt(); QString hasEndDateStr = attributes.value( "rhasenddate" ); bool hasEndDate = hasEndDateStr == "1"; @@ -264,70 +264,70 @@ class QtopiaParser : public QXmlDefaultHandler if ( it == mCategoriesMap.end() ) return id; else return *it; } static void setCategory( const QString &id, const QString &name ) { mCategoriesMap.insert( id, name ); } static QMap<QString,QString> mCategoriesMap; }; QMap<QString,QString> QtopiaParser::mCategoriesMap; QtopiaFormat::QtopiaFormat() { mCategories = 0; } QtopiaFormat::~QtopiaFormat() { } #include <qdom.h> bool QtopiaFormat::load( Calendar *calendar, const QString &fileName ) { clearException(); // qDebug("load QtopiaFormat: %s ",fileName.latin1() ); QtopiaParser handler( calendar ); handler.setCategoriesList( mCategories ); QFile xmlFile( fileName ); QXmlInputSource source( xmlFile ); QXmlSimpleReader reader; reader.setContentHandler( &handler ); return reader.parse( source ); } bool QtopiaFormat::save( Calendar *calendar, const QString &fileName ) { clearException(); QString text = toString( calendar ); if ( text.isNull() ) return false; // TODO: write backup file QFile file( fileName ); - if (!file.open( IO_WriteOnly ) ) { + if (!file.open( QIODevice::WriteOnly ) ) { setException(new ErrorFormat(ErrorFormat::SaveError, i18n("Could not open file '%1'").arg(fileName))); return false; } - QTextStream ts( &file ); + Q3TextStream ts( &file ); ts << text; file.close(); return true; } bool QtopiaFormat::fromString( Calendar *, const QString & ) { return false; } QString QtopiaFormat::toString( Calendar * ) { return QString::null; } |