summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/otodoaccessvcal.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessvcal.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index 6415952..e364ee2 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -1,31 +1,61 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qfile.h> 29#include <qfile.h>
2 30
3#include <qtopia/private/vobject_p.h> 31#include <qtopia/private/vobject_p.h>
4#include <qtopia/timeconversion.h> 32#include <qtopia/timeconversion.h>
5#include <qtopia/private/qfiledirect_p.h> 33#include <qtopia/private/qfiledirect_p.h>
6 34
7#include "otodoaccessvcal.h" 35#include <opie2/otodoaccessvcal.h>
36
37using namespace Opie;
8 38
9namespace { 39namespace {
10 static OTodo eventByVObj( VObject *obj ){ 40 static OTodo eventByVObj( VObject *obj ){
11 OTodo event; 41 OTodo event;
12 VObject *ob; 42 VObject *ob;
13 QCString name; 43 QCString name;
14 // no uid, attendees, ... and no fun 44 // no uid, attendees, ... and no fun
15 // description 45 // description
16 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ 46 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){
17 name = vObjectStringZValue( ob ); 47 name = vObjectStringZValue( ob );
18#if 0 48#if 0
19 event.setDescription( name ); 49 event.setDescription( name );
20#else 50#else
21 event.setSummary( name ); 51 event.setSummary( name );
22#endif 52#endif
23 } 53 }
24 // summary 54 // summary
25 if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { 55 if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) {
26 name = vObjectStringZValue( ob ); 56 name = vObjectStringZValue( ob );
27#if 0 57#if 0
28 event.setSummary( name ); 58 event.setSummary( name );
29#else 59#else
30 event.setDescription( name ); 60 event.setDescription( name );
31#endif 61#endif
@@ -86,48 +116,49 @@ namespace {
86 116
87 // There seems a misrepresentation between summary in otodoevent 117 // There seems a misrepresentation between summary in otodoevent
88 // and summary in vcard. 118 // and summary in vcard.
89 // The same with description.. 119 // The same with description..
90 // Description is summary and vice versa.. Argh.. (eilers) 120 // Description is summary and vice versa.. Argh.. (eilers)
91 121
92 122
93 addPropValue( task, VCDescriptionProp, 123 addPropValue( task, VCDescriptionProp,
94 event.description().local8Bit() ); 124 event.description().local8Bit() );
95 125
96 addPropValue( task, VCSummaryProp, 126 addPropValue( task, VCSummaryProp,
97 event.summary().local8Bit() ); 127 event.summary().local8Bit() );
98 128
99#else 129#else
100 addPropValue( task, VCDescriptionProp, 130 addPropValue( task, VCDescriptionProp,
101 event.summary().local8Bit() ); 131 event.summary().local8Bit() );
102 132
103 addPropValue( task, VCSummaryProp, 133 addPropValue( task, VCSummaryProp,
104 event.description().local8Bit() ); 134 event.description().local8Bit() );
105#endif 135#endif
106 return task; 136 return task;
107}; 137};
108} 138}
109 139
140namespace Opie {
110OTodoAccessVCal::OTodoAccessVCal( const QString& path ) 141OTodoAccessVCal::OTodoAccessVCal( const QString& path )
111 : m_dirty(false), m_file( path ) 142 : m_dirty(false), m_file( path )
112{ 143{
113} 144}
114OTodoAccessVCal::~OTodoAccessVCal() { 145OTodoAccessVCal::~OTodoAccessVCal() {
115} 146}
116bool OTodoAccessVCal::load() { 147bool OTodoAccessVCal::load() {
117 m_map.clear(); 148 m_map.clear();
118 m_dirty = false; 149 m_dirty = false;
119 150
120 VObject* vcal = 0l; 151 VObject* vcal = 0l;
121 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 152 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
122 if (!vcal ) 153 if (!vcal )
123 return false; 154 return false;
124 155
125 // Iterate over the list 156 // Iterate over the list
126 VObjectIterator it; 157 VObjectIterator it;
127 VObject* vobj; 158 VObject* vobj;
128 159
129 initPropIterator(&it, vcal); 160 initPropIterator(&it, vcal);
130 161
131 while( moreIteration( &it ) ) { 162 while( moreIteration( &it ) ) {
132 vobj = ::nextVObject( &it ); 163 vobj = ::nextVObject( &it );
133 QCString name = ::vObjectName( vobj ); 164 QCString name = ::vObjectName( vobj );
@@ -226,24 +257,26 @@ QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
226QArray<int> OTodoAccessVCal::overDue() { 257QArray<int> OTodoAccessVCal::overDue() {
227 QArray<int> ar(0); 258 QArray<int> ar(0);
228 return ar; 259 return ar;
229} 260}
230QBitArray OTodoAccessVCal::supports()const { 261QBitArray OTodoAccessVCal::supports()const {
231 static QBitArray ar = sup(); 262 static QBitArray ar = sup();
232 263
233 return ar; 264 return ar;
234} 265}
235QBitArray OTodoAccessVCal::sup() { 266QBitArray OTodoAccessVCal::sup() {
236 QBitArray ar ( OTodo::CompletedDate +1 ); 267 QBitArray ar ( OTodo::CompletedDate +1 );
237 ar.fill( true ); 268 ar.fill( true );
238 269
239 ar[OTodo::CrossReference] = false; 270 ar[OTodo::CrossReference] = false;
240 ar[OTodo::State ] = false; 271 ar[OTodo::State ] = false;
241 ar[OTodo::Reminders] = false; 272 ar[OTodo::Reminders] = false;
242 ar[OTodo::Notifiers] = false; 273 ar[OTodo::Notifiers] = false;
243 ar[OTodo::Maintainer] = false; 274 ar[OTodo::Maintainer] = false;
244 ar[OTodo::Progress] = false; 275 ar[OTodo::Progress] = false;
245 ar[OTodo::Alarms ] = false; 276 ar[OTodo::Alarms ] = false;
246 ar[OTodo::Recurrence] = false; 277 ar[OTodo::Recurrence] = false;
247 278
248 return ar; 279 return ar;
249} 280}
281
282}