summaryrefslogtreecommitdiff
authorerik <erik>2007-01-11 22:29:59 (UTC)
committer erik <erik>2007-01-11 22:29:59 (UTC)
commitc0145131ff669a911d51cd0a2b5d3471bf150eb0 (patch) (unidiff)
tree6350f62cbb85618dccc5523ff5607a9b703c6b95
parenta42e428100b27bd7ee2d191abbe231edfbd61e00 (diff)
downloadopie-c0145131ff669a911d51cd0a2b5d3471bf150eb0.zip
opie-c0145131ff669a911d51cd0a2b5d3471bf150eb0.tar.gz
opie-c0145131ff669a911d51cd0a2b5d3471bf150eb0.tar.bz2
I missed a bad override signature. This fixes that. There should be no
class inheritance function mismatches at this point.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/holiday/national/nationalcfg.cpp2
-rw-r--r--core/pim/datebook/holiday/national/nationalcfg.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/datebook/holiday/national/nationalcfg.cpp b/core/pim/datebook/holiday/national/nationalcfg.cpp
index 33e9db3..5e8ec29 100644
--- a/core/pim/datebook/holiday/national/nationalcfg.cpp
+++ b/core/pim/datebook/holiday/national/nationalcfg.cpp
@@ -87,285 +87,285 @@ bool NHcfg::error(const QXmlParseException& e)
87 87
88 tmp.sprintf("%d: error: %s\n", e.lineNumber(), 88 tmp.sprintf("%d: error: %s\n", e.lineNumber(),
89 (const char*) e.message().utf8()); 89 (const char*) e.message().utf8());
90 90
91 err += tmp; 91 err += tmp;
92 92
93 return true; 93 return true;
94} 94}
95 95
96bool NHcfg::fatalError(const QXmlParseException& e) 96bool NHcfg::fatalError(const QXmlParseException& e)
97{ 97{
98 QString tmp; 98 QString tmp;
99 99
100 tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(), 100 tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(),
101 (const char*) e.message().utf8()); 101 (const char*) e.message().utf8());
102 102
103 err += tmp; 103 err += tmp;
104 104
105 return false; 105 return false;
106} 106}
107 107
108bool NHcfg::startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr) 108bool NHcfg::startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr)
109{ 109{
110 bool ret = false; 110 bool ret = false;
111 if (name==_key_doc) { 111 if (name==_key_doc) {
112 stage = 1; 112 stage = 1;
113 return true; 113 return true;
114 } 114 }
115 if (stage == 0) { 115 if (stage == 0) {
116 err = "This is not a national holiday config file"; 116 err = "This is not a national holiday config file";
117 return false; 117 return false;
118 } 118 }
119 if (name==_key_desc) { 119 if (name==_key_desc) {
120 stage = 2; 120 stage = 2;
121 ret = setName(attr); 121 ret = setName(attr);
122 return ret; 122 return ret;
123 } 123 }
124 if (stage<2) {return false;} 124 if (stage<2) {return false;}
125 if (name==_key_list) {stage=3;return true;} 125 if (name==_key_list) {stage=3;return true;}
126 126
127 if (stage<3) {return false;} 127 if (stage<3) {return false;}
128 128
129 if (name==_key_entry) { 129 if (name==_key_entry) {
130 ++level; 130 ++level;
131 ++counter; 131 ++counter;
132 m_currentEntry = NHentry(); 132 m_currentEntry = NHentry();
133 // odebug << "Level == " << level << oendl; 133 // odebug << "Level == " << level << oendl;
134 } 134 }
135 if (name==_key_calc) { 135 if (name==_key_calc) {
136 ++level; 136 ++level;
137// odebug << "Level == " << level << oendl; 137// odebug << "Level == " << level << oendl;
138 return true; 138 return true;
139 } 139 }
140 if (level == 1) { 140 if (level == 1) {
141 return parsevalue(name,attr); 141 return parsevalue(name,attr);
142 } else if (level >= 2) { 142 } else if (level >= 2) {
143 return parseCalc(name,attr); 143 return parseCalc(name,attr);
144 } 144 }
145} 145}
146 146
147bool NHcfg::setName(const QXmlAttributes&attr) 147bool NHcfg::setName(const QXmlAttributes&attr)
148{ 148{
149 int nindx = attr.index("value"); 149 int nindx = attr.index("value");
150 if (nindx==-1) { 150 if (nindx==-1) {
151 return false; 151 return false;
152 } 152 }
153 _contentname = attr.value(nindx); 153 _contentname = attr.value(nindx);
154 return true; 154 return true;
155} 155}
156 156
157bool NHcfg::parsevalue(const QString&name,const QXmlAttributes&attr) 157bool NHcfg::parsevalue(const QString&name,const QXmlAttributes&attr)
158{ 158{
159 if (name != _key_entry && name != _key_calc) {err = QString("Not a valid entry (%1)").arg(name); return false;} 159 if (name != _key_entry && name != _key_calc) {err = QString("Not a valid entry (%1)").arg(name); return false;}
160 160
161 int nindex = attr.index(_content_name); 161 int nindex = attr.index(_content_name);
162 int dindex = attr.index(_content_date); 162 int dindex = attr.index(_content_date);
163 int tindex = attr.index(_content_type); 163 int tindex = attr.index(_content_type);
164 164
165 if (nindex == -1) { 165 if (nindex == -1) {
166 err = QString("Listentry %1 is invalid (name missing)").arg(counter); 166 err = QString("Listentry %1 is invalid (name missing)").arg(counter);
167 return false; 167 return false;
168 } 168 }
169 m_currentEntry.setName(attr.value(nindex)); 169 m_currentEntry.setName(attr.value(nindex));
170 170
171 if (tindex != -1 && attr.value(tindex)==_content_float) { 171 if (tindex != -1 && attr.value(tindex)==_content_float) {
172 m_currentEntry.setType(NHentry::floating); 172 m_currentEntry.setType(NHentry::floating);
173 return true; 173 return true;
174 } 174 }
175 175
176 if (dindex == -1) { 176 if (dindex == -1) {
177 err = QString("Listentry %1 is invalid ").arg(counter);return false; 177 err = QString("Listentry %1 is invalid ").arg(counter);return false;
178 } 178 }
179 179
180 QString txt = attr.value(nindex); 180 QString txt = attr.value(nindex);
181 QString dstring = attr.value(dindex); 181 QString dstring = attr.value(dindex);
182 QStringList e = QStringList::split("-",dstring); 182 QStringList e = QStringList::split("-",dstring);
183 if (e.count()!=2){err=QString("Datestring %1 is invalid (entry %2)").arg(dstring).arg(counter);return false;} 183 if (e.count()!=2){err=QString("Datestring %1 is invalid (entry %2)").arg(dstring).arg(counter);return false;}
184 QDate d(0,e[0].toInt(),e[1].toInt()); 184 QDate d(0,e[0].toInt(),e[1].toInt());
185 m_currentEntry.setDate(d); 185 m_currentEntry.setDate(d);
186 return true; 186 return true;
187} 187}
188 188
189bool NHcfg::parseCalc(const QString&name,const QXmlAttributes&attr) 189bool NHcfg::parseCalc(const QString&name,const QXmlAttributes&attr)
190{ 190{
191 ++level; 191 ++level;
192 int vindex = attr.index(_content_value); 192 int vindex = attr.index(_content_value);
193 if (vindex == -1) { 193 if (vindex == -1) {
194 err = QString("Value for element %1 on entry %2 is missing").arg(name).arg(counter); 194 err = QString("Value for element %1 on entry %2 is missing").arg(name).arg(counter);
195 return false; 195 return false;
196 } 196 }
197 int what_c =0; 197 int what_c =0;
198 QString what = name.lower(); 198 QString what = name.lower();
199 QString value; 199 QString value;
200 if (what == _content_date) { 200 if (what == _content_date) {
201 what_c = 1; 201 what_c = 1;
202 } else if (what == _content_weekd) { 202 } else if (what == _content_weekd) {
203 what_c = 2; 203 what_c = 2;
204 } else if (what == _content_offset) { 204 } else if (what == _content_offset) {
205 what_c = 3; 205 what_c = 3;
206 } else if (what == _content_dayofmonth) { 206 } else if (what == _content_dayofmonth) {
207 what_c = 4; 207 what_c = 4;
208 } else if (what == _content_datedep) { 208 } else if (what == _content_datedep) {
209 what_c = 5; 209 what_c = 5;
210 } else if (what == _content_month) { 210 } else if (what == _content_month) {
211 what_c = 6; 211 what_c = 6;
212 } 212 }
213 if (what_c == 0) { 213 if (what_c == 0) {
214 err = QString("Unknown element %1 on entry %2").arg(name).arg(counter); 214 err = QString("Unknown element %1 on entry %2").arg(name).arg(counter);
215 return false; 215 return false;
216 } 216 }
217 value = attr.value(vindex).lower(); 217 value = attr.value(vindex).lower();
218 QStringList e; 218 QStringList e;
219 QDate d; 219 QDate d;
220 bool dotformat = false; 220 bool dotformat = false;
221 switch (what_c) { 221 switch (what_c) {
222 case 1: 222 case 1:
223 if (value != "easter") { 223 if (value != "easter") {
224 e = QStringList::split("-",value); 224 e = QStringList::split("-",value);
225 if (e.count()!=2) { 225 if (e.count()!=2) {
226 e = QStringList::split(".",value); 226 e = QStringList::split(".",value);
227 dotformat = true; 227 dotformat = true;
228 } 228 }
229 if (e.count()!=2){err=QString("Datestring %1 is invalid (entry %2)").arg(value).arg(counter);return false;} 229 if (e.count()!=2){err=QString("Datestring %1 is invalid (entry %2)").arg(value).arg(counter);return false;}
230 if (!dotformat) { 230 if (!dotformat) {
231 d=QDate(0,e[0].toInt(),e[1].toInt()); 231 d=QDate(0,e[0].toInt(),e[1].toInt());
232 } else { 232 } else {
233 d=QDate(0,e[1].toInt(),e[0].toInt()); 233 d=QDate(0,e[1].toInt(),e[0].toInt());
234 } 234 }
235 } else { 235 } else {
236 d=QDate(9999,1,1); 236 d=QDate(9999,1,1);
237 } 237 }
238 m_currentEntry.setDate(d); 238 m_currentEntry.setDate(d);
239 break; 239 break;
240 case 2: 240 case 2:
241 m_currentEntry.setWeekday(value); 241 m_currentEntry.setWeekday(value);
242 break; 242 break;
243 case 3: 243 case 3:
244 m_currentEntry.setOffet(value.toInt()); 244 m_currentEntry.setOffet(value.toInt());
245 break; 245 break;
246 case 4: 246 case 4:
247 m_currentEntry.setDayofmonth(value); 247 m_currentEntry.setDayofmonth(value);
248 break; 248 break;
249 case 5: 249 case 5:
250 m_currentEntry.setDaydep(value); 250 m_currentEntry.setDaydep(value);
251 break; 251 break;
252 case 6: 252 case 6:
253 m_currentEntry.setMonth(value); 253 m_currentEntry.setMonth(value);
254 break; 254 break;
255 } 255 }
256 return true; 256 return true;
257} 257}
258 258
259bool NHcfg::endElement(const QString&, const QString&,const QString& name) 259bool NHcfg::endElement(const QString&, const QString&,const QString& name)
260{ 260{
261// odebug << "End element: " << name << oendl; 261// odebug << "End element: " << name << oendl;
262 if (name==_key_entry) { 262 if (name==_key_entry) {
263 if (m_currentEntry.type()==NHentry::fix) { 263 if (m_currentEntry.type()==NHentry::fix) {
264 currentFixList.append(m_currentEntry); 264 currentFixList.append(m_currentEntry);
265 } else { 265 } else {
266 currentFloatList.append(m_currentEntry); 266 currentFloatList.append(m_currentEntry);
267// odebug << "Floatlist count " << currentFloatList.count() << oendl; 267// odebug << "Floatlist count " << currentFloatList.count() << oendl;
268 } 268 }
269 } else if (name==_key_calc) { 269 } else if (name==_key_calc) {
270 270
271 } 271 }
272 if (stage>=3) { 272 if (stage>=3) {
273 --level; 273 --level;
274 } 274 }
275// odebug << "Level == " << level << oendl; 275// odebug << "Level == " << level << oendl;
276 return true; 276 return true;
277} 277}
278 278
279QString NHcfg::errorString() const 279QString NHcfg::errorString()
280{ 280{
281 return err; 281 return err;
282} 282}
283 283
284NHentry::NHentry() 284NHentry::NHentry()
285 :m_Type(fix) 285 :m_Type(fix)
286{ 286{
287 m_Offset=0; 287 m_Offset=0;
288} 288}
289 289
290NHentry::~NHentry() 290NHentry::~NHentry()
291{} 291{}
292 292
293void NHentry::setName(const QString&aName) 293void NHentry::setName(const QString&aName)
294{ 294{
295 m_Name = aName; 295 m_Name = aName;
296} 296}
297 297
298const QString&NHentry::name()const 298const QString&NHentry::name()const
299{ 299{
300 return m_Name; 300 return m_Name;
301} 301}
302 302
303void NHentry::setType(NHentry::entry_type aType) 303void NHentry::setType(NHentry::entry_type aType)
304{ 304{
305 m_Type = aType; 305 m_Type = aType;
306} 306}
307 307
308NHentry::entry_type NHentry::type()const 308NHentry::entry_type NHentry::type()const
309{ 309{
310 return m_Type; 310 return m_Type;
311} 311}
312 312
313void NHentry::setDate(const QDate&aDate) 313void NHentry::setDate(const QDate&aDate)
314{ 314{
315 m_Date = aDate; 315 m_Date = aDate;
316} 316}
317 317
318const QDate&NHentry::date()const 318const QDate&NHentry::date()const
319{ 319{
320 return m_Date; 320 return m_Date;
321} 321}
322 322
323void NHentry::setWeekday(const QString&aDay) 323void NHentry::setWeekday(const QString&aDay)
324{ 324{
325 m_Weekday = aDay; 325 m_Weekday = aDay;
326} 326}
327 327
328const QString&NHentry::weekday()const 328const QString&NHentry::weekday()const
329{ 329{
330 return m_Weekday; 330 return m_Weekday;
331} 331}
332 332
333void NHentry::setDayofmonth(const QString&aDay) 333void NHentry::setDayofmonth(const QString&aDay)
334{ 334{
335 m_Dayofmonth = aDay; 335 m_Dayofmonth = aDay;
336} 336}
337 337
338const QString&NHentry::dayofmonth()const 338const QString&NHentry::dayofmonth()const
339{ 339{
340 return m_Dayofmonth; 340 return m_Dayofmonth;
341} 341}
342 342
343void NHentry::setDaydep(const QString&dep) 343void NHentry::setDaydep(const QString&dep)
344{ 344{
345 m_Depth = dep; 345 m_Depth = dep;
346} 346}
347 347
348const QString&NHentry::daydep()const 348const QString&NHentry::daydep()const
349{ 349{
350 return m_Depth; 350 return m_Depth;
351} 351}
352 352
353void NHentry::setMonth(const QString&month) 353void NHentry::setMonth(const QString&month)
354{ 354{
355 m_Month = month; 355 m_Month = month;
356} 356}
357 357
358const QString&NHentry::month()const 358const QString&NHentry::month()const
359{ 359{
360 return m_Month; 360 return m_Month;
361} 361}
362 362
363void NHentry::setOffet(int aOffset) 363void NHentry::setOffet(int aOffset)
364{ 364{
365 m_Offset = aOffset; 365 m_Offset = aOffset;
366} 366}
367 367
368const int NHentry::offset()const 368const int NHentry::offset()const
369{ 369{
370 return m_Offset; 370 return m_Offset;
371} 371}
diff --git a/core/pim/datebook/holiday/national/nationalcfg.h b/core/pim/datebook/holiday/national/nationalcfg.h
index 2aedd95..28e1fdd 100644
--- a/core/pim/datebook/holiday/national/nationalcfg.h
+++ b/core/pim/datebook/holiday/national/nationalcfg.h
@@ -1,75 +1,75 @@
1#ifndef _NATIONAL_CFG_H 1#ifndef _NATIONAL_CFG_H
2#define _NATIONAL_CFG_H 2#define _NATIONAL_CFG_H
3 3
4#include <qxml.h> 4#include <qxml.h>
5#include <qstringlist.h> 5#include <qstringlist.h>
6#include <qvaluelist.h> 6#include <qvaluelist.h>
7#include <qmap.h> 7#include <qmap.h>
8#include <qdatetime.h> 8#include <qdatetime.h>
9 9
10typedef QMap<QDate,QStringList> tholidaylist; 10typedef QMap<QDate,QStringList> tholidaylist;
11 11
12class NHentry 12class NHentry
13{ 13{
14public: 14public:
15 enum entry_type{fix,floating}; 15 enum entry_type{fix,floating};
16 NHentry(); 16 NHentry();
17 virtual ~NHentry(); 17 virtual ~NHentry();
18 18
19 void setName(const QString&); 19 void setName(const QString&);
20 const QString&name()const; 20 const QString&name()const;
21 void setType(entry_type); 21 void setType(entry_type);
22 entry_type type()const; 22 entry_type type()const;
23 void setDate(const QDate&); 23 void setDate(const QDate&);
24 const QDate&date()const; 24 const QDate&date()const;
25 void setWeekday(const QString&); 25 void setWeekday(const QString&);
26 const QString&weekday()const; 26 const QString&weekday()const;
27 void setDayofmonth(const QString&); 27 void setDayofmonth(const QString&);
28 const QString&dayofmonth()const; 28 const QString&dayofmonth()const;
29 void setDaydep(const QString&); 29 void setDaydep(const QString&);
30 const QString&daydep()const; 30 const QString&daydep()const;
31 void setMonth(const QString&); 31 void setMonth(const QString&);
32 const QString&month()const; 32 const QString&month()const;
33 void setOffet(int); 33 void setOffet(int);
34 const int offset()const; 34 const int offset()const;
35 35
36protected: 36protected:
37 entry_type m_Type; 37 entry_type m_Type;
38 QString m_Name,m_Weekday,m_Dayofmonth,m_Depth,m_Month; 38 QString m_Name,m_Weekday,m_Dayofmonth,m_Depth,m_Month;
39 QDate m_Date; 39 QDate m_Date;
40 int m_Offset; 40 int m_Offset;
41}; 41};
42 42
43typedef QValueList<NHentry> tentrylist; 43typedef QValueList<NHentry> tentrylist;
44 44
45class NHcfg:public QXmlDefaultHandler 45class NHcfg:public QXmlDefaultHandler
46{ 46{
47public: 47public:
48 NHcfg(); 48 NHcfg();
49 virtual ~NHcfg(); 49 virtual ~NHcfg();
50 50
51 bool load(const QString&); 51 bool load(const QString&);
52 const tentrylist&fixDates()const; 52 const tentrylist&fixDates()const;
53 const tentrylist&floatingDates()const; 53 const tentrylist&floatingDates()const;
54 54
55 virtual bool warning(const QXmlParseException& e); 55 virtual bool warning(const QXmlParseException& e);
56 virtual bool error(const QXmlParseException& e); 56 virtual bool error(const QXmlParseException& e);
57 virtual bool fatalError(const QXmlParseException& e); 57 virtual bool fatalError(const QXmlParseException& e);
58 virtual bool startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr); 58 virtual bool startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr);
59 virtual bool endElement(const QString&, const QString&,const QString& name); 59 virtual bool endElement(const QString&, const QString&,const QString& name);
60 virtual QString errorString()const; 60 virtual QString errorString();
61 61
62protected: 62protected:
63 QString err,_contentname; 63 QString err,_contentname;
64 QString _path; 64 QString _path;
65 65
66 NHentry m_currentEntry; 66 NHentry m_currentEntry;
67 67
68 bool setName(const QXmlAttributes&); 68 bool setName(const QXmlAttributes&);
69 bool parsevalue(const QString&,const QXmlAttributes&); 69 bool parsevalue(const QString&,const QXmlAttributes&);
70 bool parseCalc(const QString&,const QXmlAttributes&); 70 bool parseCalc(const QString&,const QXmlAttributes&);
71 int stage,counter,level; 71 int stage,counter,level;
72 tentrylist currentFloatList,currentFixList; 72 tentrylist currentFloatList,currentFixList;
73}; 73};
74 74
75#endif 75#endif