-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 15 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 17 | ||||
-rw-r--r-- | libopie2/opiepim/private/vobject_p.h | 408 |
3 files changed, 428 insertions, 12 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index b569f8b..ffa6a7d 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -1,204 +1,209 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | /* | 29 | /* |
30 | * VCard Backend for the OPIE-Contact Database. | 30 | * VCard Backend for the OPIE-Contact Database. |
31 | */ | 31 | */ |
32 | #include <opie2/ocontactaccessbackend_vcard.h> | ||
33 | #include "../../../../library/backend/vobject_p.h" | ||
34 | #include "../../../../library/backend/qfiledirect_p.h" | ||
35 | 32 | ||
33 | |||
34 | #include "vobject_p.h" | ||
35 | |||
36 | /* OPIE */ | ||
37 | #include <opie2/ocontactaccessbackend_vcard.h> | ||
36 | #include <qpe/timeconversion.h> | 38 | #include <qpe/timeconversion.h> |
37 | 39 | ||
40 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! | ||
41 | #define protected public | ||
38 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #undef protected | ||
39 | 44 | ||
40 | namespace Opie { | 45 | namespace Opie { |
41 | 46 | ||
42 | OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): | 47 | OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): |
43 | m_dirty( false ), | 48 | m_dirty( false ), |
44 | m_file( filename ) | 49 | m_file( filename ) |
45 | { | 50 | { |
46 | load(); | 51 | load(); |
47 | } | 52 | } |
48 | 53 | ||
49 | 54 | ||
50 | bool OPimContactAccessBackend_VCard::load () | 55 | bool OPimContactAccessBackend_VCard::load () |
51 | { | 56 | { |
52 | m_map.clear(); | 57 | m_map.clear(); |
53 | m_dirty = false; | 58 | m_dirty = false; |
54 | 59 | ||
55 | VObject* obj = 0l; | 60 | VObject* obj = 0l; |
56 | 61 | ||
57 | if ( QFile::exists(m_file) ){ | 62 | if ( QFile::exists(m_file) ){ |
58 | obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); | 63 | obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); |
59 | if ( !obj ) | 64 | if ( !obj ) |
60 | return false; | 65 | return false; |
61 | }else{ | 66 | }else{ |
62 | qWarning("File \"%s\" not found !", m_file.latin1() ); | 67 | qWarning("File \"%s\" not found !", m_file.latin1() ); |
63 | return false; | 68 | return false; |
64 | } | 69 | } |
65 | 70 | ||
66 | while ( obj ) { | 71 | while ( obj ) { |
67 | OPimContact con = parseVObject( obj ); | 72 | OPimContact con = parseVObject( obj ); |
68 | /* | 73 | /* |
69 | * if uid is 0 assign a new one | 74 | * if uid is 0 assign a new one |
70 | * this at least happens on | 75 | * this at least happens on |
71 | * Nokia6210 | 76 | * Nokia6210 |
72 | */ | 77 | */ |
73 | if ( con.uid() == 0 ){ | 78 | if ( con.uid() == 0 ){ |
74 | con.setUid( 1 ); | 79 | con.setUid( 1 ); |
75 | qWarning("assigned new uid %d",con.uid() ); | 80 | qWarning("assigned new uid %d",con.uid() ); |
76 | } | 81 | } |
77 | 82 | ||
78 | m_map.insert( con.uid(), con ); | 83 | m_map.insert( con.uid(), con ); |
79 | 84 | ||
80 | VObject *t = obj; | 85 | VObject *t = obj; |
81 | obj = nextVObjectInList(obj); | 86 | obj = nextVObjectInList(obj); |
82 | cleanVObject( t ); | 87 | cleanVObject( t ); |
83 | } | 88 | } |
84 | 89 | ||
85 | return true; | 90 | return true; |
86 | 91 | ||
87 | } | 92 | } |
88 | bool OPimContactAccessBackend_VCard::reload() | 93 | bool OPimContactAccessBackend_VCard::reload() |
89 | { | 94 | { |
90 | return load(); | 95 | return load(); |
91 | } | 96 | } |
92 | bool OPimContactAccessBackend_VCard::save() | 97 | bool OPimContactAccessBackend_VCard::save() |
93 | { | 98 | { |
94 | if (!m_dirty ) | 99 | if (!m_dirty ) |
95 | return true; | 100 | return true; |
96 | 101 | ||
97 | QFileDirect file( m_file ); | 102 | QFile file( m_file ); |
98 | if (!file.open(IO_WriteOnly ) ) | 103 | if (!file.open(IO_WriteOnly ) ) |
99 | return false; | 104 | return false; |
100 | 105 | ||
101 | VObject *obj; | 106 | VObject *obj; |
102 | obj = newVObject( VCCalProp ); | 107 | obj = newVObject( VCCalProp ); |
103 | addPropValue( obj, VCVersionProp, "1.0" ); | 108 | addPropValue( obj, VCVersionProp, "1.0" ); |
104 | 109 | ||
105 | VObject *vo; | 110 | VObject *vo; |
106 | for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ | 111 | for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ |
107 | vo = createVObject( *it ); | 112 | vo = createVObject( *it ); |
108 | writeVObject( file.directHandle() , vo ); | 113 | writeVObject( file.fh, vo ); //FIXME: HACK!!! |
109 | cleanVObject( vo ); | 114 | cleanVObject( vo ); |
110 | } | 115 | } |
111 | cleanStrTbl(); | 116 | cleanStrTbl(); |
112 | deleteVObject( obj ); | 117 | deleteVObject( obj ); |
113 | 118 | ||
114 | m_dirty = false; | 119 | m_dirty = false; |
115 | return true; | 120 | return true; |
116 | 121 | ||
117 | 122 | ||
118 | } | 123 | } |
119 | void OPimContactAccessBackend_VCard::clear () | 124 | void OPimContactAccessBackend_VCard::clear () |
120 | { | 125 | { |
121 | m_map.clear(); | 126 | m_map.clear(); |
122 | m_dirty = true; // ??? sure ? (se) | 127 | m_dirty = true; // ??? sure ? (se) |
123 | } | 128 | } |
124 | 129 | ||
125 | bool OPimContactAccessBackend_VCard::add ( const OPimContact& newcontact ) | 130 | bool OPimContactAccessBackend_VCard::add ( const OPimContact& newcontact ) |
126 | { | 131 | { |
127 | m_map.insert( newcontact.uid(), newcontact ); | 132 | m_map.insert( newcontact.uid(), newcontact ); |
128 | m_dirty = true; | 133 | m_dirty = true; |
129 | return true; | 134 | return true; |
130 | } | 135 | } |
131 | 136 | ||
132 | bool OPimContactAccessBackend_VCard::remove ( int uid ) | 137 | bool OPimContactAccessBackend_VCard::remove ( int uid ) |
133 | { | 138 | { |
134 | m_map.remove( uid ); | 139 | m_map.remove( uid ); |
135 | m_dirty = true; | 140 | m_dirty = true; |
136 | return true; | 141 | return true; |
137 | } | 142 | } |
138 | 143 | ||
139 | bool OPimContactAccessBackend_VCard::replace ( const OPimContact &contact ) | 144 | bool OPimContactAccessBackend_VCard::replace ( const OPimContact &contact ) |
140 | { | 145 | { |
141 | m_map.replace( contact.uid(), contact ); | 146 | m_map.replace( contact.uid(), contact ); |
142 | m_dirty = true; | 147 | m_dirty = true; |
143 | return true; | 148 | return true; |
144 | } | 149 | } |
145 | 150 | ||
146 | OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const | 151 | OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const |
147 | { | 152 | { |
148 | return m_map[uid]; | 153 | return m_map[uid]; |
149 | } | 154 | } |
150 | 155 | ||
151 | QArray<int> OPimContactAccessBackend_VCard::allRecords() const | 156 | QArray<int> OPimContactAccessBackend_VCard::allRecords() const |
152 | { | 157 | { |
153 | QArray<int> ar( m_map.count() ); | 158 | QArray<int> ar( m_map.count() ); |
154 | QMap<int, OPimContact>::ConstIterator it; | 159 | QMap<int, OPimContact>::ConstIterator it; |
155 | int i = 0; | 160 | int i = 0; |
156 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { | 161 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { |
157 | ar[i] = it.key(); | 162 | ar[i] = it.key(); |
158 | i++; | 163 | i++; |
159 | } | 164 | } |
160 | return ar; | 165 | return ar; |
161 | } | 166 | } |
162 | 167 | ||
163 | // Not implemented | 168 | // Not implemented |
164 | QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& ) | 169 | QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& ) |
165 | { | 170 | { |
166 | QArray<int> ar(0); | 171 | QArray<int> ar(0); |
167 | return ar; | 172 | return ar; |
168 | } | 173 | } |
169 | 174 | ||
170 | // Not implemented | 175 | // Not implemented |
171 | QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const | 176 | QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const |
172 | { | 177 | { |
173 | QArray<int> ar(0); | 178 | QArray<int> ar(0); |
174 | return ar; | 179 | return ar; |
175 | } | 180 | } |
176 | 181 | ||
177 | const uint OPimContactAccessBackend_VCard::querySettings() | 182 | const uint OPimContactAccessBackend_VCard::querySettings() |
178 | { | 183 | { |
179 | return 0; // No search possible | 184 | return 0; // No search possible |
180 | } | 185 | } |
181 | 186 | ||
182 | bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const | 187 | bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const |
183 | { | 188 | { |
184 | return false; // No search possible, therefore all settings invalid ;) | 189 | return false; // No search possible, therefore all settings invalid ;) |
185 | } | 190 | } |
186 | 191 | ||
187 | bool OPimContactAccessBackend_VCard::wasChangedExternally() | 192 | bool OPimContactAccessBackend_VCard::wasChangedExternally() |
188 | { | 193 | { |
189 | return false; // Don't expect concurrent access | 194 | return false; // Don't expect concurrent access |
190 | } | 195 | } |
191 | 196 | ||
192 | // Not implemented | 197 | // Not implemented |
193 | QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) | 198 | QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) |
194 | { | 199 | { |
195 | QArray<int> ar(0); | 200 | QArray<int> ar(0); |
196 | return ar; | 201 | return ar; |
197 | } | 202 | } |
198 | 203 | ||
199 | // *** Private stuff *** | 204 | // *** Private stuff *** |
200 | 205 | ||
201 | 206 | ||
202 | OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | 207 | OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) |
203 | { | 208 | { |
204 | OPimContact c; | 209 | OPimContact c; |
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index 0a1baf9..03d4479 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp | |||
@@ -1,282 +1,285 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | 3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #include <qfile.h> | ||
30 | |||
31 | #include <qtopia/private/vobject_p.h> | ||
32 | #include <qtopia/timeconversion.h> | ||
33 | #include <qtopia/private/qfiledirect_p.h> | ||
34 | 29 | ||
30 | /* OPIE */ | ||
31 | #include "vobject_p.h" | ||
32 | #include <qpe/timeconversion.h> | ||
35 | #include <opie2/otodoaccessvcal.h> | 33 | #include <opie2/otodoaccessvcal.h> |
36 | 34 | ||
35 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! | ||
36 | #define protected public | ||
37 | #include <qfile.h> | ||
38 | #undef protected | ||
39 | |||
37 | using namespace Opie; | 40 | using namespace Opie; |
38 | 41 | ||
39 | namespace { | 42 | namespace { |
40 | static OPimTodo eventByVObj( VObject *obj ){ | 43 | static OPimTodo eventByVObj( VObject *obj ){ |
41 | OPimTodo event; | 44 | OPimTodo event; |
42 | VObject *ob; | 45 | VObject *ob; |
43 | QCString name; | 46 | QCString name; |
44 | // no uid, attendees, ... and no fun | 47 | // no uid, attendees, ... and no fun |
45 | // description | 48 | // description |
46 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ | 49 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ |
47 | name = vObjectStringZValue( ob ); | 50 | name = vObjectStringZValue( ob ); |
48 | #if 0 | 51 | #if 0 |
49 | event.setDescription( name ); | 52 | event.setDescription( name ); |
50 | #else | 53 | #else |
51 | event.setSummary( name ); | 54 | event.setSummary( name ); |
52 | #endif | 55 | #endif |
53 | } | 56 | } |
54 | // summary | 57 | // summary |
55 | if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { | 58 | if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { |
56 | name = vObjectStringZValue( ob ); | 59 | name = vObjectStringZValue( ob ); |
57 | #if 0 | 60 | #if 0 |
58 | event.setSummary( name ); | 61 | event.setSummary( name ); |
59 | #else | 62 | #else |
60 | event.setDescription( name ); | 63 | event.setDescription( name ); |
61 | #endif | 64 | #endif |
62 | } | 65 | } |
63 | // completed | 66 | // completed |
64 | if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ | 67 | if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ |
65 | name = vObjectStringZValue( ob ); | 68 | name = vObjectStringZValue( ob ); |
66 | if( name == "COMPLETED" ){ | 69 | if( name == "COMPLETED" ){ |
67 | event.setCompleted( true ); | 70 | event.setCompleted( true ); |
68 | }else{ | 71 | }else{ |
69 | event.setCompleted( false ); | 72 | event.setCompleted( false ); |
70 | } | 73 | } |
71 | }else | 74 | }else |
72 | event.setCompleted( false ); | 75 | event.setCompleted( false ); |
73 | // priority | 76 | // priority |
74 | if ((ob = isAPropertyOf(obj, VCPriorityProp))) { | 77 | if ((ob = isAPropertyOf(obj, VCPriorityProp))) { |
75 | name = vObjectStringZValue( ob ); | 78 | name = vObjectStringZValue( ob ); |
76 | bool ok; | 79 | bool ok; |
77 | event.setPriority(name.toInt(&ok) ); | 80 | event.setPriority(name.toInt(&ok) ); |
78 | } | 81 | } |
79 | //due date | 82 | //due date |
80 | if((ob = isAPropertyOf(obj, VCDueProp)) ){ | 83 | if((ob = isAPropertyOf(obj, VCDueProp)) ){ |
81 | event.setHasDueDate( true ); | 84 | event.setHasDueDate( true ); |
82 | name = vObjectStringZValue( ob ); | 85 | name = vObjectStringZValue( ob ); |
83 | event.setDueDate( TimeConversion::fromISO8601( name).date() ); | 86 | event.setDueDate( TimeConversion::fromISO8601( name).date() ); |
84 | } | 87 | } |
85 | // categories | 88 | // categories |
86 | if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ | 89 | if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ |
87 | name = vObjectStringZValue( ob ); | 90 | name = vObjectStringZValue( ob ); |
88 | qWarning("Categories:%s", name.data() ); | 91 | qWarning("Categories:%s", name.data() ); |
89 | } | 92 | } |
90 | 93 | ||
91 | event.setUid( 1 ); | 94 | event.setUid( 1 ); |
92 | return event; | 95 | return event; |
93 | }; | 96 | }; |
94 | static VObject *vobjByEvent( const OPimTodo &event ) { | 97 | static VObject *vobjByEvent( const OPimTodo &event ) { |
95 | VObject *task = newVObject( VCTodoProp ); | 98 | VObject *task = newVObject( VCTodoProp ); |
96 | if( task == 0 ) | 99 | if( task == 0 ) |
97 | return 0l; | 100 | return 0l; |
98 | 101 | ||
99 | if( event.hasDueDate() ) { | 102 | if( event.hasDueDate() ) { |
100 | QTime time(0, 0, 0); | 103 | QTime time(0, 0, 0); |
101 | QDateTime date(event.dueDate(), time ); | 104 | QDateTime date(event.dueDate(), time ); |
102 | addPropValue( task, VCDueProp, | 105 | addPropValue( task, VCDueProp, |
103 | TimeConversion::toISO8601( date ) ); | 106 | TimeConversion::toISO8601( date ) ); |
104 | } | 107 | } |
105 | 108 | ||
106 | if( event.isCompleted() ) | 109 | if( event.isCompleted() ) |
107 | addPropValue( task, VCStatusProp, "COMPLETED"); | 110 | addPropValue( task, VCStatusProp, "COMPLETED"); |
108 | 111 | ||
109 | QString string = QString::number(event.priority() ); | 112 | QString string = QString::number(event.priority() ); |
110 | addPropValue( task, VCPriorityProp, string.local8Bit() ); | 113 | addPropValue( task, VCPriorityProp, string.local8Bit() ); |
111 | 114 | ||
112 | addPropValue( task, VCCategoriesProp, | 115 | addPropValue( task, VCCategoriesProp, |
113 | event.idsToString( event.categories() ).local8Bit() ); | 116 | event.idsToString( event.categories() ).local8Bit() ); |
114 | 117 | ||
115 | #if 0 | 118 | #if 0 |
116 | 119 | ||
117 | // There seems a misrepresentation between summary in otodoevent | 120 | // There seems a misrepresentation between summary in otodoevent |
118 | // and summary in vcard. | 121 | // and summary in vcard. |
119 | // The same with description.. | 122 | // The same with description.. |
120 | // Description is summary and vice versa.. Argh.. (eilers) | 123 | // Description is summary and vice versa.. Argh.. (eilers) |
121 | 124 | ||
122 | 125 | ||
123 | addPropValue( task, VCDescriptionProp, | 126 | addPropValue( task, VCDescriptionProp, |
124 | event.description().local8Bit() ); | 127 | event.description().local8Bit() ); |
125 | 128 | ||
126 | addPropValue( task, VCSummaryProp, | 129 | addPropValue( task, VCSummaryProp, |
127 | event.summary().local8Bit() ); | 130 | event.summary().local8Bit() ); |
128 | 131 | ||
129 | #else | 132 | #else |
130 | addPropValue( task, VCDescriptionProp, | 133 | addPropValue( task, VCDescriptionProp, |
131 | event.summary().local8Bit() ); | 134 | event.summary().local8Bit() ); |
132 | 135 | ||
133 | addPropValue( task, VCSummaryProp, | 136 | addPropValue( task, VCSummaryProp, |
134 | event.description().local8Bit() ); | 137 | event.description().local8Bit() ); |
135 | #endif | 138 | #endif |
136 | return task; | 139 | return task; |
137 | }; | 140 | }; |
138 | } | 141 | } |
139 | 142 | ||
140 | namespace Opie { | 143 | namespace Opie { |
141 | OPimTodoAccessVCal::OPimTodoAccessVCal( const QString& path ) | 144 | OPimTodoAccessVCal::OPimTodoAccessVCal( const QString& path ) |
142 | : m_dirty(false), m_file( path ) | 145 | : m_dirty(false), m_file( path ) |
143 | { | 146 | { |
144 | } | 147 | } |
145 | OPimTodoAccessVCal::~OPimTodoAccessVCal() { | 148 | OPimTodoAccessVCal::~OPimTodoAccessVCal() { |
146 | } | 149 | } |
147 | bool OPimTodoAccessVCal::load() { | 150 | bool OPimTodoAccessVCal::load() { |
148 | m_map.clear(); | 151 | m_map.clear(); |
149 | m_dirty = false; | 152 | m_dirty = false; |
150 | 153 | ||
151 | VObject* vcal = 0l; | 154 | VObject* vcal = 0l; |
152 | vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); | 155 | vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); |
153 | if (!vcal ) | 156 | if (!vcal ) |
154 | return false; | 157 | return false; |
155 | 158 | ||
156 | // Iterate over the list | 159 | // Iterate over the list |
157 | VObjectIterator it; | 160 | VObjectIterator it; |
158 | VObject* vobj; | 161 | VObject* vobj; |
159 | 162 | ||
160 | initPropIterator(&it, vcal); | 163 | initPropIterator(&it, vcal); |
161 | 164 | ||
162 | while( moreIteration( &it ) ) { | 165 | while( moreIteration( &it ) ) { |
163 | vobj = ::nextVObject( &it ); | 166 | vobj = ::nextVObject( &it ); |
164 | QCString name = ::vObjectName( vobj ); | 167 | QCString name = ::vObjectName( vobj ); |
165 | if( name == VCTodoProp ){ | 168 | if( name == VCTodoProp ){ |
166 | OPimTodo to = eventByVObj( vobj ); | 169 | OPimTodo to = eventByVObj( vobj ); |
167 | m_map.insert( to.uid(), to ); | 170 | m_map.insert( to.uid(), to ); |
168 | } | 171 | } |
169 | } | 172 | } |
170 | 173 | ||
171 | // Should I do a delete vcal? | 174 | // Should I do a delete vcal? |
172 | 175 | ||
173 | return true; | 176 | return true; |
174 | } | 177 | } |
175 | bool OPimTodoAccessVCal::reload() { | 178 | bool OPimTodoAccessVCal::reload() { |
176 | return load(); | 179 | return load(); |
177 | } | 180 | } |
178 | bool OPimTodoAccessVCal::save() { | 181 | bool OPimTodoAccessVCal::save() { |
179 | if (!m_dirty ) | 182 | if (!m_dirty ) |
180 | return true; | 183 | return true; |
181 | 184 | ||
182 | QFileDirect file( m_file ); | 185 | QFile file( m_file ); |
183 | if (!file.open(IO_WriteOnly ) ) | 186 | if (!file.open(IO_WriteOnly ) ) |
184 | return false; | 187 | return false; |
185 | 188 | ||
186 | VObject *obj; | 189 | VObject *obj; |
187 | obj = newVObject( VCCalProp ); | 190 | obj = newVObject( VCCalProp ); |
188 | addPropValue( obj, VCVersionProp, "1.0" ); | 191 | addPropValue( obj, VCVersionProp, "1.0" ); |
189 | VObject *vo; | 192 | VObject *vo; |
190 | for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ | 193 | for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ |
191 | vo = vobjByEvent( it.data() ); | 194 | vo = vobjByEvent( it.data() ); |
192 | addVObjectProp(obj, vo ); | 195 | addVObjectProp(obj, vo ); |
193 | } | 196 | } |
194 | writeVObject( file.directHandle(), obj ); | 197 | writeVObject( file.fh, obj ); //FIXME: HACK!!! |
195 | cleanVObject( obj ); | 198 | cleanVObject( obj ); |
196 | cleanStrTbl(); | 199 | cleanStrTbl(); |
197 | 200 | ||
198 | m_dirty = false; | 201 | m_dirty = false; |
199 | return true; | 202 | return true; |
200 | } | 203 | } |
201 | void OPimTodoAccessVCal::clear() { | 204 | void OPimTodoAccessVCal::clear() { |
202 | m_map.clear(); | 205 | m_map.clear(); |
203 | m_dirty = true; | 206 | m_dirty = true; |
204 | } | 207 | } |
205 | bool OPimTodoAccessVCal::add( const OPimTodo& to ) { | 208 | bool OPimTodoAccessVCal::add( const OPimTodo& to ) { |
206 | m_map.insert( to.uid(), to ); | 209 | m_map.insert( to.uid(), to ); |
207 | m_dirty = true; | 210 | m_dirty = true; |
208 | return true; | 211 | return true; |
209 | } | 212 | } |
210 | bool OPimTodoAccessVCal::remove( int uid ) { | 213 | bool OPimTodoAccessVCal::remove( int uid ) { |
211 | m_map.remove( uid ); | 214 | m_map.remove( uid ); |
212 | m_dirty = true; | 215 | m_dirty = true; |
213 | return true; | 216 | return true; |
214 | } | 217 | } |
215 | void OPimTodoAccessVCal::removeAllCompleted() { | 218 | void OPimTodoAccessVCal::removeAllCompleted() { |
216 | for ( QMap<int, OPimTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) { | 219 | for ( QMap<int, OPimTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) { |
217 | if ( (*it).isCompleted() ) | 220 | if ( (*it).isCompleted() ) |
218 | m_map.remove( it ); | 221 | m_map.remove( it ); |
219 | } | 222 | } |
220 | } | 223 | } |
221 | bool OPimTodoAccessVCal::replace( const OPimTodo& to ) { | 224 | bool OPimTodoAccessVCal::replace( const OPimTodo& to ) { |
222 | m_map.replace( to.uid(), to ); | 225 | m_map.replace( to.uid(), to ); |
223 | m_dirty = true; | 226 | m_dirty = true; |
224 | return true; | 227 | return true; |
225 | } | 228 | } |
226 | OPimTodo OPimTodoAccessVCal::find(int uid )const { | 229 | OPimTodo OPimTodoAccessVCal::find(int uid )const { |
227 | return m_map[uid]; | 230 | return m_map[uid]; |
228 | } | 231 | } |
229 | QArray<int> OPimTodoAccessVCal::sorted( bool, int, int, int ) { | 232 | QArray<int> OPimTodoAccessVCal::sorted( bool, int, int, int ) { |
230 | QArray<int> ar(0); | 233 | QArray<int> ar(0); |
231 | return ar; | 234 | return ar; |
232 | } | 235 | } |
233 | QArray<int> OPimTodoAccessVCal::allRecords()const { | 236 | QArray<int> OPimTodoAccessVCal::allRecords()const { |
234 | QArray<int> ar( m_map.count() ); | 237 | QArray<int> ar( m_map.count() ); |
235 | QMap<int, OPimTodo>::ConstIterator it; | 238 | QMap<int, OPimTodo>::ConstIterator it; |
236 | int i = 0; | 239 | int i = 0; |
237 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { | 240 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { |
238 | ar[i] = it.key(); | 241 | ar[i] = it.key(); |
239 | i++; | 242 | i++; |
240 | } | 243 | } |
241 | return ar; | 244 | return ar; |
242 | } | 245 | } |
243 | QArray<int> OPimTodoAccessVCal::matchRegexp(const QRegExp& /* r */)const { | 246 | QArray<int> OPimTodoAccessVCal::matchRegexp(const QRegExp& /* r */)const { |
244 | QArray<int> ar(0); | 247 | QArray<int> ar(0); |
245 | return ar; | 248 | return ar; |
246 | } | 249 | } |
247 | QArray<int> OPimTodoAccessVCal::queryByExample( const OPimTodo&, int, const QDateTime& ) { | 250 | QArray<int> OPimTodoAccessVCal::queryByExample( const OPimTodo&, int, const QDateTime& ) { |
248 | QArray<int> ar(0); | 251 | QArray<int> ar(0); |
249 | return ar; | 252 | return ar; |
250 | } | 253 | } |
251 | QArray<int> OPimTodoAccessVCal::effectiveToDos( const QDate& , | 254 | QArray<int> OPimTodoAccessVCal::effectiveToDos( const QDate& , |
252 | const QDate& , | 255 | const QDate& , |
253 | bool ) { | 256 | bool ) { |
254 | QArray<int> ar(0); | 257 | QArray<int> ar(0); |
255 | return ar; | 258 | return ar; |
256 | } | 259 | } |
257 | QArray<int> OPimTodoAccessVCal::overDue() { | 260 | QArray<int> OPimTodoAccessVCal::overDue() { |
258 | QArray<int> ar(0); | 261 | QArray<int> ar(0); |
259 | return ar; | 262 | return ar; |
260 | } | 263 | } |
261 | QBitArray OPimTodoAccessVCal::supports()const { | 264 | QBitArray OPimTodoAccessVCal::supports()const { |
262 | static QBitArray ar = sup(); | 265 | static QBitArray ar = sup(); |
263 | 266 | ||
264 | return ar; | 267 | return ar; |
265 | } | 268 | } |
266 | QBitArray OPimTodoAccessVCal::sup() { | 269 | QBitArray OPimTodoAccessVCal::sup() { |
267 | QBitArray ar ( OPimTodo::CompletedDate +1 ); | 270 | QBitArray ar ( OPimTodo::CompletedDate +1 ); |
268 | ar.fill( true ); | 271 | ar.fill( true ); |
269 | 272 | ||
270 | ar[OPimTodo::CrossReference] = false; | 273 | ar[OPimTodo::CrossReference] = false; |
271 | ar[OPimTodo::State ] = false; | 274 | ar[OPimTodo::State ] = false; |
272 | ar[OPimTodo::Reminders] = false; | 275 | ar[OPimTodo::Reminders] = false; |
273 | ar[OPimTodo::Notifiers] = false; | 276 | ar[OPimTodo::Notifiers] = false; |
274 | ar[OPimTodo::Maintainer] = false; | 277 | ar[OPimTodo::Maintainer] = false; |
275 | ar[OPimTodo::Progress] = false; | 278 | ar[OPimTodo::Progress] = false; |
276 | ar[OPimTodo::Alarms ] = false; | 279 | ar[OPimTodo::Alarms ] = false; |
277 | ar[OPimTodo::Recurrence] = false; | 280 | ar[OPimTodo::Recurrence] = false; |
278 | 281 | ||
279 | return ar; | 282 | return ar; |
280 | } | 283 | } |
281 | 284 | ||
282 | } | 285 | } |
diff --git a/libopie2/opiepim/private/vobject_p.h b/libopie2/opiepim/private/vobject_p.h new file mode 100644 index 0000000..3c9d0d3 --- a/dev/null +++ b/libopie2/opiepim/private/vobject_p.h | |||
@@ -0,0 +1,408 @@ | |||
1 | /*************************************************************************** | ||
2 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International | ||
3 | Business Machines Corporation and Siemens Rolm Communications Inc. | ||
4 | |||
5 | For purposes of this license notice, the term Licensors shall mean, | ||
6 | collectively, Apple Computer, Inc., AT&T Corp., International | ||
7 | Business Machines Corporation and Siemens Rolm Communications Inc. | ||
8 | The term Licensor shall mean any of the Licensors. | ||
9 | |||
10 | Subject to acceptance of the following conditions, permission is hereby | ||
11 | granted by Licensors without the need for written agreement and without | ||
12 | license or royalty fees, to use, copy, modify and distribute this | ||
13 | software for any purpose. | ||
14 | |||
15 | The above copyright notice and the following four paragraphs must be | ||
16 | reproduced in all copies of this software and any software including | ||
17 | this software. | ||
18 | |||
19 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE | ||
20 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR | ||
21 | MODIFICATIONS. | ||
22 | |||
23 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, | ||
24 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT | ||
25 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
26 | DAMAGE. | ||
27 | |||
28 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, | ||
29 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE | ||
30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
31 | PURPOSE. | ||
32 | |||
33 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or | ||
34 | disclosure by the government are subject to restrictions set forth in | ||
35 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | ||
36 | |||
37 | ***************************************************************************/ | ||
38 | |||
39 | /* | ||
40 | |||
41 | The vCard/vCalendar C interface is implemented in the set | ||
42 | of files as follows: | ||
43 | |||
44 | vcc.y, yacc source, and vcc.c, the yacc output you will use | ||
45 | implements the core parser | ||
46 | |||
47 | vobject.c implements an API that insulates the caller from | ||
48 | the parser and changes in the vCard/vCalendar BNF | ||
49 | |||
50 | port.h defines compilation environment dependent stuff | ||
51 | |||
52 | vcc.h and vobject.h are header files for their .c counterparts | ||
53 | |||
54 | vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions | ||
55 | which you may find useful. | ||
56 | |||
57 | test.c is a standalone test driver that exercises some of | ||
58 | the features of the APIs provided. Invoke test.exe on a | ||
59 | VCARD/VCALENDAR input text file and you will see the pretty | ||
60 | print output of the internal representation (this pretty print | ||
61 | output should give you a good idea of how the internal | ||
62 | representation looks like -- there is one such output in the | ||
63 | following too). Also, a file with the .out suffix is generated | ||
64 | to show that the internal representation can be written back | ||
65 | in the original text format. | ||
66 | |||
67 | For more information on this API see the readme.txt file | ||
68 | which accompanied this distribution. | ||
69 | |||
70 | Also visit: | ||
71 | |||
72 | http://www.versit.com | ||
73 | http://www.ralden.com | ||
74 | |||
75 | */ | ||
76 | |||
77 | // No tr() anywhere in this file | ||
78 | |||
79 | |||
80 | #ifndef __VOBJECT_H__ | ||
81 | #define __VOBJECT_H__ 1 | ||
82 | |||
83 | #include <qstring.h> | ||
84 | |||
85 | #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard" | ||
86 | #define vCalendarClipboardFormat"+//ISBN 1-887687-00-9::versit::PDI//vCalendar" | ||
87 | |||
88 | /* The above strings vCardClipboardFormat and vCalendarClipboardFormat | ||
89 | are globally unique IDs which can be used to generate clipboard format | ||
90 | ID's as per the requirements of a specific platform. For example, in | ||
91 | Windows they are used as the parameter in a call to RegisterClipboardFormat. | ||
92 | For example: | ||
93 | |||
94 | CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat); | ||
95 | |||
96 | */ | ||
97 | |||
98 | #define vCardMimeType "text/x-vCard" | ||
99 | #define vCalendarMimeType"text/x-vCalendar" | ||
100 | |||
101 | #undef DLLEXPORT | ||
102 | #include <qtopia/global.h> | ||
103 | #if defined(QTOPIA_MAKEDLL) | ||
104 | #define DLLEXPORT(t) __declspec(dllexport) t | ||
105 | #elif defined(QTOPIA_DLL) | ||
106 | #define DLLEXPORT(t) __declspec(dllimport) t | ||
107 | #else | ||
108 | #define DLLEXPORT(t) t | ||
109 | #endif | ||
110 | |||
111 | #ifndef FALSE | ||
112 | #define FALSE0 | ||
113 | #endif | ||
114 | #ifndef TRUE | ||
115 | #define TRUE1 | ||
116 | #endif | ||
117 | |||
118 | #include <stdlib.h> | ||
119 | #include <stdio.h> | ||
120 | |||
121 | |||
122 | #define VC7bitProp "7BIT" | ||
123 | #define VC8bitProp "8BIT" | ||
124 | #define VCAAlarmProp "AALARM" | ||
125 | #define VCAdditionalNamesProp"ADDN" | ||
126 | #define VCAdrProp "ADR" | ||
127 | #define VCAgentProp "AGENT" | ||
128 | #define VCAIFFProp "AIFF" | ||
129 | #define VCAOLProp "AOL" | ||
130 | #define VCAppleLinkProp "APPLELINK" | ||
131 | #define VCAttachProp "ATTACH" | ||
132 | #define VCAttendeeProp "ATTENDEE" | ||
133 | #define VCATTMailProp "ATTMAIL" | ||
134 | #define VCAudioContentProp "AUDIOCONTENT" | ||
135 | #define VCAVIProp "AVI" | ||
136 | #define VCBase64Prop "BASE64" | ||
137 | #define VCBBSProp "BBS" | ||
138 | #define VCBirthDateProp "BDAY" | ||
139 | #define VCBMPProp "BMP" | ||
140 | #define VCBodyProp "BODY" | ||
141 | #define VCBusinessRoleProp "ROLE" | ||
142 | #define VCCalProp "VCALENDAR" | ||
143 | #define VCCaptionProp "CAP" | ||
144 | #define VCCardProp "VCARD" | ||
145 | #define VCCarProp "CAR" | ||
146 | #define VCCategoriesProp "CATEGORIES" | ||
147 | #define VCCellularProp "CELL" | ||
148 | #define VCCGMProp "CGM" | ||
149 | #define VCCharSetProp "CHARSET" | ||
150 | #define VCCIDProp "CID" | ||
151 | #define VCCISProp "CIS" | ||
152 | #define VCCityProp "L" | ||
153 | #define VCClassProp "CLASS" | ||
154 | #define VCCommentProp "NOTE" | ||
155 | #define VCCompletedProp "COMPLETED" | ||
156 | #define VCContentIDProp "CONTENT-ID" | ||
157 | #define VCCountryNameProp "C" | ||
158 | #define VCDAlarmProp "DALARM" | ||
159 | #define VCDataSizeProp "DATASIZE" | ||
160 | #define VCDayLightProp "DAYLIGHT" | ||
161 | #define VCDCreatedProp "DCREATED" | ||
162 | #define VCDeliveryLabelProp "LABEL" | ||
163 | #define VCDescriptionProp "DESCRIPTION" | ||
164 | #define VCDIBProp "DIB" | ||
165 | #define VCDisplayStringProp "DISPLAYSTRING" | ||
166 | #define VCDomesticProp "DOM" | ||
167 | #define VCDTendProp "DTEND" | ||
168 | #define VCDTstartProp "DTSTART" | ||
169 | #define VCDueProp "DUE" | ||
170 | #define VCEmailAddressProp "EMAIL" | ||
171 | #define VCEncodingProp "ENCODING" | ||
172 | #define VCEndProp "END" | ||
173 | #define VCEventProp "VEVENT" | ||
174 | #define VCEWorldProp "EWORLD" | ||
175 | #define VCExNumProp "EXNUM" | ||
176 | #define VCExpDateProp "EXDATE" | ||
177 | #define VCExpectProp "EXPECT" | ||
178 | #define VCExtAddressProp "EXT ADD" | ||
179 | #define VCFamilyNameProp "F" | ||
180 | #define VCFaxProp "FAX" | ||
181 | #define VCFullNameProp "FN" | ||
182 | #define VCGeoProp "GEO" | ||
183 | #define VCGeoLocationProp "GEO" | ||
184 | #define VCGIFProp "GIF" | ||
185 | #define VCGivenNameProp "G" | ||
186 | #define VCGroupingProp "Grouping" | ||
187 | #define VCHomeProp "HOME" | ||
188 | #define VCIBMMailProp "IBMMail" | ||
189 | #define VCInlineProp "INLINE" | ||
190 | #define VCInternationalProp "INTL" | ||
191 | #define VCInternetProp "INTERNET" | ||
192 | #define VCISDNProp "ISDN" | ||
193 | #define VCJPEGProp "JPEG" | ||
194 | #define VCLanguageProp "LANG" | ||
195 | #define VCLastModifiedProp "LAST-MODIFIED" | ||
196 | #define VCLastRevisedProp "REV" | ||
197 | #define VCLocationProp "LOCATION" | ||
198 | #define VCLogoProp "LOGO" | ||
199 | #define VCMailerProp "MAILER" | ||
200 | #define VCMAlarmProp "MALARM" | ||
201 | #define VCMCIMailProp "MCIMAIL" | ||
202 | #define VCMessageProp "MSG" | ||
203 | #define VCMETProp "MET" | ||
204 | #define VCModemProp "MODEM" | ||
205 | #define VCMPEG2Prop "MPEG2" | ||
206 | #define VCMPEGProp "MPEG" | ||
207 | #define VCMSNProp "MSN" | ||
208 | #define VCNamePrefixesProp "NPRE" | ||
209 | #define VCNameProp "N" | ||
210 | #define VCNameSuffixesProp "NSUF" | ||
211 | #define VCNoteProp "NOTE" | ||
212 | #define VCOrgNameProp "ORGNAME" | ||
213 | #define VCOrgProp "ORG" | ||
214 | #define VCOrgUnit2Prop "OUN2" | ||
215 | #define VCOrgUnit3Prop "OUN3" | ||
216 | #define VCOrgUnit4Prop "OUN4" | ||
217 | #define VCOrgUnitProp "OUN" | ||
218 | #define VCPagerProp "PAGER" | ||
219 | #define VCPAlarmProp "PALARM" | ||
220 | #define VCParcelProp "PARCEL" | ||
221 | #define VCPartProp "PART" | ||
222 | #define VCPCMProp "PCM" | ||
223 | #define VCPDFProp "PDF" | ||
224 | #define VCPGPProp "PGP" | ||
225 | #define VCPhotoProp "PHOTO" | ||
226 | #define VCPICTProp "PICT" | ||
227 | #define VCPMBProp "PMB" | ||
228 | #define VCPostalBoxProp "BOX" | ||
229 | #define VCPostalCodeProp "PC" | ||
230 | #define VCPostalProp "POSTAL" | ||
231 | #define VCPowerShareProp "POWERSHARE" | ||
232 | #define VCPreferredProp "PREF" | ||
233 | #define VCPriorityProp "PRIORITY" | ||
234 | #define VCProcedureNameProp "PROCEDURENAME" | ||
235 | #define VCProdIdProp "PRODID" | ||
236 | #define VCProdigyProp "PRODIGY" | ||
237 | #define VCPronunciationProp "SOUND" | ||
238 | #define VCPSProp "PS" | ||
239 | #define VCPublicKeyProp "KEY" | ||
240 | #define VCQPProp "QP" | ||
241 | #define VCQuickTimeProp "QTIME" | ||
242 | #define VCQuotedPrintableProp"QUOTED-PRINTABLE" | ||
243 | #define VCRDateProp "RDATE" | ||
244 | #define VCRegionProp "R" | ||
245 | #define VCRelatedToProp "RELATED-TO" | ||
246 | #define VCRepeatCountProp "REPEATCOUNT" | ||
247 | #define VCResourcesProp "RESOURCES" | ||
248 | #define VCRNumProp "RNUM" | ||
249 | #define VCRoleProp "ROLE" | ||
250 | #define VCRRuleProp "RRULE" | ||
251 | #define VCRSVPProp "RSVP" | ||
252 | #define VCRunTimeProp "RUNTIME" | ||
253 | #define VCSequenceProp "SEQUENCE" | ||
254 | #define VCSnoozeTimeProp "SNOOZETIME" | ||
255 | #define VCStartProp "START" | ||
256 | #define VCStatusProp "STATUS" | ||
257 | #define VCStreetAddressProp "STREET" | ||
258 | #define VCSubTypeProp "SUBTYPE" | ||
259 | #define VCSummaryProp "SUMMARY" | ||
260 | #define VCTelephoneProp "TEL" | ||
261 | #define VCTIFFProp "TIFF" | ||
262 | #define VCTimeZoneProp "TZ" | ||
263 | #define VCTitleProp "TITLE" | ||
264 | #define VCTLXProp "TLX" | ||
265 | #define VCTodoProp "VTODO" | ||
266 | #define VCTranspProp "TRANSP" | ||
267 | #define VCUniqueStringProp "UID" | ||
268 | #define VCURLProp "URL" | ||
269 | #define VCURLValueProp "URLVAL" | ||
270 | #define VCValueProp "VALUE" | ||
271 | #define VCVersionProp "VERSION" | ||
272 | #define VCVideoProp "VIDEO" | ||
273 | #define VCVoiceProp "VOICE" | ||
274 | #define VCWAVEProp "WAVE" | ||
275 | #define VCWMFProp "WMF" | ||
276 | #define VCWorkProp "WORK" | ||
277 | #define VCX400Prop "X400" | ||
278 | #define VCX509Prop "X509" | ||
279 | #define VCXRuleProp "XRULE" | ||
280 | |||
281 | |||
282 | typedef struct VObject VObject; | ||
283 | |||
284 | typedef struct VObjectIterator { | ||
285 | VObject* start; | ||
286 | VObject* next; | ||
287 | } VObjectIterator; | ||
288 | |||
289 | extern DLLEXPORT(VObject*) newVObject(const char *id); | ||
290 | extern DLLEXPORT(void) deleteVObject(VObject *p); | ||
291 | extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); | ||
292 | extern DLLEXPORT(void) deleteStr(const char *p); | ||
293 | extern DLLEXPORT(void) unUseStr(const char *s); | ||
294 | |||
295 | extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); | ||
296 | extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); | ||
297 | extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); | ||
298 | extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); | ||
299 | extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); | ||
300 | extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); | ||
301 | extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); | ||
302 | extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); | ||
303 | |||
304 | extern DLLEXPORT(const char*) vObjectName(VObject *o); | ||
305 | extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); | ||
306 | extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); | ||
307 | extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); | ||
308 | extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); | ||
309 | extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); | ||
310 | extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); | ||
311 | |||
312 | extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); | ||
313 | extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); | ||
314 | extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); | ||
315 | extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); | ||
316 | extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); | ||
317 | extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); | ||
318 | extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); | ||
319 | extern DLLEXPORT(void) addList(VObject **o, VObject *p); | ||
320 | |||
321 | extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); | ||
322 | |||
323 | extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); | ||
324 | extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); | ||
325 | extern DLLEXPORT(int) moreIteration(VObjectIterator *i); | ||
326 | extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); | ||
327 | |||
328 | extern DLLEXPORT(const char*) lookupStr(const char *s); | ||
329 | extern DLLEXPORT(void) cleanStrTbl(); | ||
330 | |||
331 | extern DLLEXPORT(void) cleanVObject(VObject *o); | ||
332 | extern DLLEXPORT(void) cleanVObjects(VObject *list); | ||
333 | |||
334 | extern DLLEXPORT(const char*) lookupProp(const char* str); | ||
335 | extern DLLEXPORT(const char*) lookupProp_(const char* str); | ||
336 | |||
337 | extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); | ||
338 | extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); | ||
339 | |||
340 | extern DLLEXPORT(int) vObjectValueType(VObject *o); | ||
341 | |||
342 | /* return type of vObjectValueType: */ | ||
343 | #define VCVT_NOVALUE0 | ||
344 | /* if the VObject has no value associated with it. */ | ||
345 | #define VCVT_STRINGZ1 | ||
346 | /* if the VObject has value set by setVObjectStringZValue. */ | ||
347 | #define VCVT_UINT 2 | ||
348 | /* if the VObject has value set by setVObjectIntegerValue. */ | ||
349 | #define VCVT_ULONG 3 | ||
350 | /* if the VObject has value set by setVObjectLongValue. */ | ||
351 | #define VCVT_RAW 4 | ||
352 | /* if the VObject has value set by setVObjectAnyValue. */ | ||
353 | #define VCVT_VOBJECT5 | ||
354 | /* if the VObject has value set by setVObjectVObjectValue. */ | ||
355 | |||
356 | extern DLLEXPORT(const char**) fieldedProp; | ||
357 | |||
358 | /*************************************************** | ||
359 | * The methods below are implemented in vcc.c (generated from vcc.y ) | ||
360 | ***************************************************/ | ||
361 | |||
362 | /* NOTE regarding printVObject and writeVObject | ||
363 | |||
364 | The functions below are not exported from the DLL because they | ||
365 | take a FILE* as a parameter, which cannot be passed across a DLL | ||
366 | interface (at least that is my experience). Instead you can use | ||
367 | their companion functions which take file names or pointers | ||
368 | to memory. However, if you are linking this code into | ||
369 | your build directly then you may find them a more convenient API | ||
370 | and you can go ahead and use them. If you try to use them with | ||
371 | the DLL LIB you will get a link error. | ||
372 | */ | ||
373 | extern DLLEXPORT(void) writeVObject(FILE *fp, VObject *o); | ||
374 | |||
375 | |||
376 | |||
377 | typedef void (*MimeErrorHandler)(char *); | ||
378 | |||
379 | extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); | ||
380 | |||
381 | extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); | ||
382 | extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); | ||
383 | |||
384 | |||
385 | /* NOTE regarding Parse_MIME_FromFile | ||
386 | The function above, Parse_MIME_FromFile, comes in two flavors, | ||
387 | neither of which is exported from the DLL. Each version takes | ||
388 | a CFile or FILE* as a parameter, neither of which can be | ||
389 | passed across a DLL interface (at least that is my experience). | ||
390 | If you are linking this code into your build directly then | ||
391 | you may find them a more convenient API that the other flavors | ||
392 | that take a file name. If you use them with the DLL LIB you | ||
393 | will get a link error. | ||
394 | */ | ||
395 | |||
396 | |||
397 | #if INCLUDEMFC | ||
398 | extern DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file); | ||
399 | #else | ||
400 | extern DLLEXPORT(VObject*) Parse_MIME_FromFile(FILE *file); | ||
401 | #endif | ||
402 | |||
403 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); | ||
404 | |||
405 | |||
406 | #endif /* __VOBJECT_H__ */ | ||
407 | |||
408 | |||