SVN_SILENT made messages (.desktop file)
[kdepim.git] / kjots / knowitimporter.h
blobc0e9a19490c3a922787f8c02d56854741549eee1
1 /*
2 * This file is part of KJots
4 * Copyright 2008 Stephen Kelly <steveire@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
22 #ifndef KNOWITIMPORTER_H
23 #define KNOWITIMPORTER_H
25 class QDomElement;
27 #include <QHash>
28 #include <QDomDocument>
30 class KUrl;
32 struct KnowItNote
34 QString title;
35 int depth;
36 QString content;
37 int id; // Only used to determine parent /child relationships. This is not the KJots Page or Book id.
38 int parent;
40 QList< QPair< QString, QString > > links;
45 /**
46 Class for importing KNowIt notes. KNowIt is not longer maintained.
47 @since 4.2
49 class KnowItImporter
51 public:
52 KnowItImporter();
54 /**
55 Create a KJotsBook from the knowit file at @p url.
57 void importFromUrl( const KUrl& url );
59 private:
60 /**
61 Builds several trees with roots at m_notes.
62 @param url The url of the knowit file.
64 void buildNoteTree( const KUrl& url );
66 /**
67 Add a representation of note @p n to m_domDoc. If @p n has child notes, it will create a book, otherwise a page.
69 QDomElement addNote( const KnowItNote& n );
71 /**
72 Build a domDocument from the notes rooted at m_notes.
74 void buildDomDocument();
77 QList<KnowItNote> m_notes; // Top level notes.
78 QList<KnowItNote> m_lastNoteAtLevel;
79 QDomDocument m_domDoc;
80 QHash <int, KnowItNote> m_noteHash;
81 QHash <int, QList< int > > m_childNotes;
84 #endif