summaryrefslogtreecommitdiffstats
path: root/libkcal/qtopiaformat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkcal/qtopiaformat.cpp')
-rw-r--r--libkcal/qtopiaformat.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/libkcal/qtopiaformat.cpp b/libkcal/qtopiaformat.cpp
index b7a7b3922..372c52308 100644
--- a/libkcal/qtopiaformat.cpp
+++ b/libkcal/qtopiaformat.cpp
@@ -19,14 +19,14 @@
Boston, MA 02110-1301, USA.
*/
-#include <qdatetime.h>
-#include <qstring.h>
-#include <qptrlist.h>
-#include <qregexp.h>
-#include <qclipboard.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qxml.h>
+#include <tqdatetime.h>
+#include <tqstring.h>
+#include <tqptrlist.h>
+#include <tqregexp.h>
+#include <tqclipboard.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqxml.h>
#include <kdebug.h>
#include <klocale.h>
@@ -43,12 +43,12 @@ class QtopiaParser : public QXmlDefaultHandler
public:
QtopiaParser( Calendar *calendar ) : mCalendar( calendar ) {}
- bool startElement( const QString &, const QString &, const QString & qName,
- const QXmlAttributes &attributes )
+ bool startElement( const TQString &, const TQString &, const TQString & qName,
+ const TQXmlAttributes &attributes )
{
if ( qName == "event" ) {
Event *event = new Event;
- QString uid = "Qtopia" + attributes.value( "uid" );
+ TQString uid = "Qtopia" + attributes.value( "uid" );
event->setUid( uid );
event->setSummary( attributes.value( "description" ) );
@@ -63,28 +63,28 @@ class QtopiaParser : public QXmlDefaultHandler
event->setFloats( false );
}
- QString rtype = attributes.value( "rtype" );
+ TQString rtype = attributes.value( "rtype" );
if ( !rtype.isEmpty() ) {
- QDate startDate = event->dtStart().date();
+ TQDate startDate = event->dtStart().date();
- QString freqStr = attributes.value( "rfreq" );
+ TQString freqStr = attributes.value( "rfreq" );
int freq = freqStr.toInt();
- QString hasEndDateStr = attributes.value( "rhasenddate" );
+ TQString hasEndDateStr = attributes.value( "rhasenddate" );
bool hasEndDate = hasEndDateStr == "1";
- QString endDateStr = attributes.value( "enddt" );
- QDate endDate = toDateTime( endDateStr ).date();
+ TQString endDateStr = attributes.value( "enddt" );
+ TQDate endDate = toDateTime( endDateStr ).date();
- QString weekDaysStr = attributes.value( "rweekdays" );
+ TQString weekDaysStr = attributes.value( "rweekdays" );
int weekDaysNum = weekDaysStr.toInt();
- QBitArray weekDays( 7 );
+ TQBitArray weekDays( 7 );
int i;
for( i = 1; i <= 7; ++i ) {
weekDays.setBit( i - 1, ( 2 << i ) & weekDaysNum );
}
- QString posStr = attributes.value( "rposition" );
+ TQString posStr = attributes.value( "rposition" );
int pos = posStr.toInt();
Recurrence *r = event->recurrence();
@@ -104,7 +104,7 @@ class QtopiaParser : public QXmlDefaultHandler
r->setMonthly( freq );
if ( hasEndDate )
r->setEndDate( endDate );
- QBitArray days( 7 );
+ TQBitArray days( 7 );
days.fill( false );
days.setBit( startDate.dayOfWeek() - 1 );
r->addMonthlyPos( pos, days );
@@ -115,10 +115,10 @@ class QtopiaParser : public QXmlDefaultHandler
}
}
- QString categoryList = attributes.value( "categories" );
+ TQString categoryList = attributes.value( "categories" );
event->setCategories( lookupCategories( categoryList ) );
- QString alarmStr = attributes.value( "alarm" );
+ TQString alarmStr = attributes.value( "alarm" );
if ( !alarmStr.isEmpty() ) {
kdDebug(5800) << "Alarm: " << alarmStr << endl;
Alarm *alarm = new Alarm( event );
@@ -136,13 +136,13 @@ class QtopiaParser : public QXmlDefaultHandler
} else if ( qName == "Task" ) {
Todo *todo = new Todo;
- QString uid = "Qtopia" + attributes.value( "Uid" );
+ TQString uid = "Qtopia" + attributes.value( "Uid" );
todo->setUid( uid );
- QString description = attributes.value( "Description" );
+ TQString description = attributes.value( "Description" );
int pos = description.find( '\n' );
if ( pos > 0 ) {
- QString summary = description.left( pos );
+ TQString summary = description.left( pos );
todo->setSummary( summary );
todo->setDescription( description );
} else {
@@ -153,19 +153,19 @@ class QtopiaParser : public QXmlDefaultHandler
// if ( priority == 0 ) priority = 3;
todo->setPriority( priority );
- QString categoryList = attributes.value( "Categories" );
+ TQString categoryList = attributes.value( "Categories" );
todo->setCategories( lookupCategories( categoryList ) );
- QString completedStr = attributes.value( "Completed" );
+ TQString completedStr = attributes.value( "Completed" );
if ( completedStr == "1" ) todo->setCompleted( true );
- QString hasDateStr = attributes.value( "HasDate" );
+ TQString hasDateStr = attributes.value( "HasDate" );
if ( hasDateStr == "1" ) {
int year = attributes.value( "DateYear" ).toInt();
int month = attributes.value( "DateMonth" ).toInt();
int day = attributes.value( "DateDay" ).toInt();
- todo->setDtDue( QDateTime( QDate( year, month, day ) ) );
+ todo->setDtDue( TQDateTime( TQDate( year, month, day ) ) );
todo->setHasDueDate( true );
}
@@ -174,42 +174,42 @@ class QtopiaParser : public QXmlDefaultHandler
mCalendar->addTodo( todo );
} else if ( qName == "Category" ) {
- QString id = attributes.value( "id" );
- QString name = attributes.value( "name" );
+ TQString id = attributes.value( "id" );
+ TQString name = attributes.value( "name" );
setCategory( id, name );
}
return true;
}
- bool warning ( const QXmlParseException &exception )
+ bool warning ( const TQXmlParseException &exception )
{
kdDebug(5800) << "WARNING" << endl;
printException( exception );
return true;
}
- bool error ( const QXmlParseException &exception )
+ bool error ( const TQXmlParseException &exception )
{
kdDebug(5800) << "ERROR" << endl;
printException( exception );
return false;
}
- bool fatalError ( const QXmlParseException &exception )
+ bool fatalError ( const TQXmlParseException &exception )
{
kdDebug(5800) << "FATALERROR" << endl;
printException( exception );
return false;
}
- QString errorString ()
+ TQString errorString ()
{
return "QtopiaParser: Error!";
}
protected:
- void printException( const QXmlParseException &exception )
+ void printException( const TQXmlParseException &exception )
{
kdError() << "XML Parse Error (line " << exception.lineNumber()
<< ", col " << exception.columnNumber() << "): "
@@ -218,19 +218,19 @@ class QtopiaParser : public QXmlDefaultHandler
<< exception.systemId() << "')" << endl;
}
- QDateTime toDateTime( const QString &value )
+ TQDateTime toDateTime( const TQString &value )
{
- QDateTime dt;
+ TQDateTime dt;
dt.setTime_t( value.toUInt() );
return dt;
}
- QStringList lookupCategories( const QString &categoryList )
+ TQStringList lookupCategories( const TQString &categoryList )
{
- QStringList categoryIds = QStringList::split( ";", categoryList );
- QStringList categories;
- QStringList::ConstIterator it;
+ TQStringList categoryIds = TQStringList::split( ";", categoryList );
+ TQStringList categories;
+ TQStringList::ConstIterator it;
for( it = categoryIds.begin(); it != categoryIds.end(); ++it ) {
categories.append( category( *it ) );
}
@@ -240,22 +240,22 @@ class QtopiaParser : public QXmlDefaultHandler
private:
Calendar *mCalendar;
- static QString category( const QString &id )
+ static TQString category( const TQString &id )
{
- QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id );
+ TQMap<TQString,TQString>::ConstIterator it = mCategoriesMap.find( id );
if ( it == mCategoriesMap.end() ) return id;
else return *it;
}
- static void setCategory( const QString &id, const QString &name )
+ static void setCategory( const TQString &id, const TQString &name )
{
mCategoriesMap.insert( id, name );
}
- static QMap<QString,QString> mCategoriesMap;
+ static TQMap<TQString,TQString> mCategoriesMap;
};
-QMap<QString,QString> QtopiaParser::mCategoriesMap;
+TQMap<TQString,TQString> QtopiaParser::mCategoriesMap;
QtopiaFormat::QtopiaFormat()
{
@@ -265,52 +265,52 @@ QtopiaFormat::~QtopiaFormat()
{
}
-bool QtopiaFormat::load( Calendar *calendar, const QString &fileName)
+bool QtopiaFormat::load( Calendar *calendar, const TQString &fileName)
{
kdDebug(5800) << "QtopiaFormat::load() " << fileName << endl;
clearException();
QtopiaParser handler( calendar );
- QFile xmlFile( fileName );
- QXmlInputSource source( xmlFile );
- QXmlSimpleReader reader;
+ TQFile xmlFile( fileName );
+ TQXmlInputSource source( xmlFile );
+ TQXmlSimpleReader reader;
reader.setContentHandler( &handler );
return reader.parse( source );
}
-bool QtopiaFormat::save( Calendar *calendar, const QString &fileName )
+bool QtopiaFormat::save( Calendar *calendar, const TQString &fileName )
{
kdDebug(5800) << "QtopiaFormat::save(): " << fileName << endl;
clearException();
- QString text = toString( calendar );
+ TQString text = toString( calendar );
if ( text.isNull() ) return false;
// TODO: write backup file
- QFile file( fileName );
+ TQFile file( fileName );
if (!file.open( IO_WriteOnly ) ) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("Could not open file '%1'").arg(fileName)));
return false;
}
- QTextStream ts( &file );
+ TQTextStream ts( &file );
ts << text;
file.close();
return true;
}
-bool QtopiaFormat::fromString( Calendar *, const QString & )
+bool QtopiaFormat::fromString( Calendar *, const TQString & )
{
kdDebug(5800) << "QtopiaFormat::fromString() not yet implemented." << endl;
return false;
}
-QString QtopiaFormat::toString( Calendar * )
+TQString QtopiaFormat::toString( Calendar * )
{
- return QString::null;
+ return TQString::null;
}