Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessvcal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index 03d4479..14a325e 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp | |||
@@ -18,29 +18,33 @@ | |||
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 | /* OPIE */ | ||
31 | #include "vobject_p.h" | 30 | #include "vobject_p.h" |
32 | #include <qpe/timeconversion.h> | 31 | |
32 | /* OPIE */ | ||
33 | #include <opie2/otodoaccessvcal.h> | 33 | #include <opie2/otodoaccessvcal.h> |
34 | #include <opie2/odebug.h> | ||
34 | 35 | ||
36 | #include <qpe/timeconversion.h> | ||
37 | |||
38 | /* QT */ | ||
35 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! | 39 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! |
36 | #define protected public | 40 | #define protected public |
37 | #include <qfile.h> | 41 | #include <qfile.h> |
38 | #undef protected | 42 | #undef protected |
39 | 43 | ||
40 | using namespace Opie; | 44 | using namespace Opie; |
41 | 45 | ||
42 | namespace { | 46 | namespace { |
43 | static OPimTodo eventByVObj( VObject *obj ){ | 47 | static OPimTodo eventByVObj( VObject *obj ){ |
44 | OPimTodo event; | 48 | OPimTodo event; |
45 | VObject *ob; | 49 | VObject *ob; |
46 | QCString name; | 50 | QCString name; |
@@ -79,25 +83,25 @@ namespace { | |||
79 | bool ok; | 83 | bool ok; |
80 | event.setPriority(name.toInt(&ok) ); | 84 | event.setPriority(name.toInt(&ok) ); |
81 | } | 85 | } |
82 | //due date | 86 | //due date |
83 | if((ob = isAPropertyOf(obj, VCDueProp)) ){ | 87 | if((ob = isAPropertyOf(obj, VCDueProp)) ){ |
84 | event.setHasDueDate( true ); | 88 | event.setHasDueDate( true ); |
85 | name = vObjectStringZValue( ob ); | 89 | name = vObjectStringZValue( ob ); |
86 | event.setDueDate( TimeConversion::fromISO8601( name).date() ); | 90 | event.setDueDate( TimeConversion::fromISO8601( name).date() ); |
87 | } | 91 | } |
88 | // categories | 92 | // categories |
89 | if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ | 93 | if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ |
90 | name = vObjectStringZValue( ob ); | 94 | name = vObjectStringZValue( ob ); |
91 | qWarning("Categories:%s", name.data() ); | 95 | owarn << "Categories:" << name.data() << "" << oendl; |
92 | } | 96 | } |
93 | 97 | ||
94 | event.setUid( 1 ); | 98 | event.setUid( 1 ); |
95 | return event; | 99 | return event; |
96 | }; | 100 | }; |
97 | static VObject *vobjByEvent( const OPimTodo &event ) { | 101 | static VObject *vobjByEvent( const OPimTodo &event ) { |
98 | VObject *task = newVObject( VCTodoProp ); | 102 | VObject *task = newVObject( VCTodoProp ); |
99 | if( task == 0 ) | 103 | if( task == 0 ) |
100 | return 0l; | 104 | return 0l; |
101 | 105 | ||
102 | if( event.hasDueDate() ) { | 106 | if( event.hasDueDate() ) { |
103 | QTime time(0, 0, 0); | 107 | QTime time(0, 0, 0); |
@@ -108,43 +112,43 @@ namespace { | |||
108 | 112 | ||
109 | if( event.isCompleted() ) | 113 | if( event.isCompleted() ) |
110 | addPropValue( task, VCStatusProp, "COMPLETED"); | 114 | addPropValue( task, VCStatusProp, "COMPLETED"); |
111 | 115 | ||
112 | QString string = QString::number(event.priority() ); | 116 | QString string = QString::number(event.priority() ); |
113 | addPropValue( task, VCPriorityProp, string.local8Bit() ); | 117 | addPropValue( task, VCPriorityProp, string.local8Bit() ); |
114 | 118 | ||
115 | addPropValue( task, VCCategoriesProp, | 119 | addPropValue( task, VCCategoriesProp, |
116 | event.idsToString( event.categories() ).local8Bit() ); | 120 | event.idsToString( event.categories() ).local8Bit() ); |
117 | 121 | ||
118 | #if 0 | 122 | #if 0 |
119 | 123 | ||
120 | // There seems a misrepresentation between summary in otodoevent | 124 | // There seems a misrepresentation between summary in otodoevent |
121 | // and summary in vcard. | 125 | // and summary in vcard. |
122 | // The same with description.. | 126 | // The same with description.. |
123 | // Description is summary and vice versa.. Argh.. (eilers) | 127 | // Description is summary and vice versa.. Argh.. (eilers) |
124 | 128 | ||
125 | 129 | ||
126 | addPropValue( task, VCDescriptionProp, | 130 | addPropValue( task, VCDescriptionProp, |
127 | event.description().local8Bit() ); | 131 | event.description().local8Bit() ); |
128 | 132 | ||
129 | addPropValue( task, VCSummaryProp, | 133 | addPropValue( task, VCSummaryProp, |
130 | event.summary().local8Bit() ); | 134 | event.summary().local8Bit() ); |
131 | 135 | ||
132 | #else | 136 | #else |
133 | addPropValue( task, VCDescriptionProp, | 137 | addPropValue( task, VCDescriptionProp, |
134 | event.summary().local8Bit() ); | 138 | event.summary().local8Bit() ); |
135 | 139 | ||
136 | addPropValue( task, VCSummaryProp, | 140 | addPropValue( task, VCSummaryProp, |
137 | event.description().local8Bit() ); | 141 | event.description().local8Bit() ); |
138 | #endif | 142 | #endif |
139 | return task; | 143 | return task; |
140 | }; | 144 | }; |
141 | } | 145 | } |
142 | 146 | ||
143 | namespace Opie { | 147 | namespace Opie { |
144 | OPimTodoAccessVCal::OPimTodoAccessVCal( const QString& path ) | 148 | OPimTodoAccessVCal::OPimTodoAccessVCal( const QString& path ) |
145 | : m_dirty(false), m_file( path ) | 149 | : m_dirty(false), m_file( path ) |
146 | { | 150 | { |
147 | } | 151 | } |
148 | OPimTodoAccessVCal::~OPimTodoAccessVCal() { | 152 | OPimTodoAccessVCal::~OPimTodoAccessVCal() { |
149 | } | 153 | } |
150 | bool OPimTodoAccessVCal::load() { | 154 | bool OPimTodoAccessVCal::load() { |