From 0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7 Mon Sep 17 00:00:00 2001 From: zecke Date: Fri, 21 Feb 2003 16:52:49 +0000 Subject: -Remove old Todo classes they're deprecated and today I already using the new API -Guard against self assignment in OTodo -Add test apps for OPIM -Opiefied Event classes -Added TimeZone handling and pinning of TimeZones to OEvent -Adjust ORecur and the widget to better timezone behaviour --- (limited to 'libopie/todovcalresource.cpp') diff --git a/libopie/todovcalresource.cpp b/libopie/todovcalresource.cpp deleted file mode 100644 index 1df5aff..0000000 --- a/libopie/todovcalresource.cpp +++ b/dev/null @@ -1,158 +0,0 @@ -/* -               =. This file is part of the OPIE Project -             .=l. Copyright (c) 2002 Holger Freyther -           .>+-= the use of vobject was inspired by libkcal - _;:,     .>    :=|. This library is free software; you can -.> <`_,   >  .   <= redistribute it and/or modify it under -:`=1 )Y*s>-.--   : the terms of the GNU Library General Public -.="- .-=="i,     .._ License as published by the Free Software - - .   .-<_>     .<> Foundation; either version 2 of the License, -     ._= =}       : or (at your option) any later version. -    .%`+i>       _;_. -    .i_,=:_.      -`: 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 -#include -#include -#include - -#include "../library/backend/vobject_p.h" -#include "../library/timeconversion.h" -#include "../library/backend/qfiledirect_p.h" - -static VObject *vobjByEvent( const ToDoEvent &event ) -{ - VObject *task = newVObject( VCTodoProp ); - if( task == 0 ) - return 0l; - if( event.hasDate() ) - addPropValue( task, VCDueProp, TimeConversion::toISO8601( event.date() ) ); - - if( event.isCompleted() ) - addPropValue( task, VCStatusProp, "COMPLETED"); - - QString string = QString::number(event.priority() ); - addPropValue( task, VCPriorityProp, string.local8Bit() ); - addPropValue( task, VCCategoriesProp, event.allCategories().join(";").local8Bit() ); - addPropValue( task, VCDescriptionProp, event.description().local8Bit() ); - addPropValue( task, VCSummaryProp, event.summary().left(15).local8Bit() ); - return task; -}; - -static ToDoEvent eventByVObj( VObject *obj ){ - ToDoEvent event; - VObject *ob; - QCString name; - // no uid, attendees, ... and no fun - // description - if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ - name = vObjectStringZValue( ob ); - event.setDescription( name ); - } - // summary - if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { - name = vObjectStringZValue( ob ); - event.setSummary( name ); - } - // completed - if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ - name = vObjectStringZValue( ob ); - if( name == "COMPLETED" ){ - event.setCompleted( true ); - }else{ - event.setCompleted( false ); - } - }else - event.setCompleted( false ); - // priority - if ((ob = isAPropertyOf(obj, VCPriorityProp))) { - name = vObjectStringZValue( ob ); - bool ok; - event.setPriority(name.toInt(&ok) ); - } - //due date - if((ob = isAPropertyOf(obj, VCDueProp)) ){ - event.setHasDate( true ); - name = vObjectStringZValue( ob ); - event.setDate( TimeConversion::fromISO8601( name).date() ); - } - // categories - if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ - name = vObjectStringZValue( ob ); - qWarning("Categories:%s", name.data() ); - } - - return event; -}; - - -QValueList ToDoVCalResource::load(const QString &file) -{ - QValueList events; - VObject *vcal = 0l; - vcal = Parse_MIME_FromFileName( (char *)file.utf8().data() ); // from vobject - if(!vcal ) - return events; - // start parsing - - VObjectIterator it; - VObject *vobj; - initPropIterator(&it, vcal); - - while( moreIteration( &it ) ) { - vobj = ::nextVObject( &it ); - QCString name = ::vObjectName( vobj ); - //QCString objVal = ::vObjectStringZValue( vobj ); - // let's find out the type - if( name == VCTodoProp ){ - events.append( eventByVObj( vobj ) ); - - } // parse the value - } - return events; -} -bool ToDoVCalResource::save(const QString &fileName, const QValueList&list ) -{ - QFileDirect file ( fileName ); - if(!file.open(IO_WriteOnly ) ) - return false; - // obj - VObject *obj; - obj = newVObject( VCCalProp ); - addPropValue( obj, VCVersionProp, "1.0" ); - VObject *vo; - for(QValueList::ConstIterator it = list.begin(); it != list.end(); ++it ){ - vo = vobjByEvent( (*it) ); - addVObjectProp(obj, vo ); - } - writeVObject( file.directHandle(), obj ); - cleanVObject( obj ); - cleanStrTbl(); - - return true; -} - - - - - - - - - - -- cgit v0.9.0.2