Fix typo
[kdepim.git] / ktimetracker / plannerparser.h
blob62ca0c85873f052c278daa9a22a8c48c2ddb9715
1 /*
2 * Copyright (C) 2004 by Thorsten Staerk <dev@staerk.de>
3 * 2007 the ktimetracker developers
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the
17 * Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor
19 * Boston, MA 02110-1301 USA.
23 #ifndef PLANNERPARSER_H
24 #define PLANNERPARSER_H
26 /**
27 this class is here to import tasks from a planner project file to ktimetracker.
28 the import shall not be limited to ktimetracker (kPlaTo sends greetings)
29 it imports planner's top-level-tasks on the same level-depth as currentItem.
30 if there is no currentItem, planner's top-level-tasks will become top-level-tasks in ktimetracker.
31 it imports as well the level-depth of each task, as its name, as its percent-complete.
32 test cases:
33 - deleting all tasks away, then import!
34 - having started with an empty ics, import!
35 - with currentItem being a top-level-task, import!
36 - with currentItem being a subtask, import!
38 @author Thorsten Staerk
41 #include <QtXml/QtXml>
43 #include "timetrackerstorage.h"
45 class Task;
46 class TaskView;
48 class PlannerParser : public QXmlDefaultHandler
50 public:
52 /** Stores the active TaskView in this parser. Returns error code (not always, hopefully) */
53 explicit PlannerParser(TaskView * tv);
55 /** given by the framework from qxml. Called when parsing the xml-document starts. */
56 bool startDocument();
58 /** given by the framework from qxml. Called when the reader occurs an open tag (e.g. \<b\> ) */
59 bool startElement( const QString&, const QString&, const QString& qName, const QXmlAttributes& att );
61 /** given by the framework from qxml. Called when the reader occurs a closed tag (e.g. \</b\> )*/
62 bool endElement( const QString&, const QString&, const QString& qName);
64 private:
65 bool withInTasks; // within <tasks> ?
66 TaskView *_taskView;
67 Task *task;
68 Task *parentTask;
69 int level; // level=1: task is top-level-task
73 #endif