~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/xml/xmldocument.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Alessandro Ghersi, Harald Sitter
  • Date: 2009-06-27 04:40:05 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627044005-4y2vm9xz7rvmzi4p
Tags: 4:4.2.95svn20090701-0ubuntu1
[ Alessandro Ghersi ]
* New upstream release
  - Bump build-deps
* Remove akonadi-kde and libmaildir4 packages
  - remove akonadi-kde.install and libmaildir4.install
  - remove libmaildir4 from debian/rules
  - remove akonadi-kde and libmaildir4 from depends
  - remove akonadi-kde and libmaildir4 from installgen
* Update kdepim-dev.install
* Update kpilot.install
* Add akonadi-kde and libmaildir4 transitional packages

[ Harald Sitter ]
* KAddressbook replaces Kontact << 4.2.85 (LP: #378373)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2009 Volker Krause <vkrause@kde.org>
 
3
 
 
4
    This library is free software; you can redistribute it and/or modify it
 
5
    under the terms of the GNU Library General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or (at your
 
7
    option) any later version.
 
8
 
 
9
    This library is distributed in the hope that it will be useful, but WITHOUT
 
10
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 
12
    License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Library General Public License
 
15
    along with this library; see the file COPYING.LIB.  If not, write to the
 
16
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
    02110-1301, USA.
 
18
*/
 
19
 
 
20
#ifndef AKONADI_XMLDOCUMENT_H
 
21
#define AKONADI_XMLDOCUMENT_H
 
22
 
 
23
#include "akonadi-xml_export.h"
 
24
 
 
25
#include <akonadi/collection.h>
 
26
#include <akonadi/item.h>
 
27
 
 
28
#include <QtXml/QDomDocument>
 
29
 
 
30
namespace Akonadi {
 
31
 
 
32
class XmlDocumentPrivate;
 
33
 
 
34
/**
 
35
  Represents a document of the KNUT XML serialization format for Akonadi objects.
 
36
*/
 
37
class AKONADI_XML_EXPORT XmlDocument
 
38
{
 
39
  public:
 
40
    /**
 
41
      Creates an empty document.
 
42
    */
 
43
    XmlDocument();
 
44
 
 
45
    /**
 
46
      Creates a new XmlDocument object and calls loadFile().
 
47
 
 
48
      @see loadFile()
 
49
    */
 
50
    XmlDocument( const QString &fileName );
 
51
    ~XmlDocument();
 
52
 
 
53
    /**
 
54
      Parses the given XML file and validates it.
 
55
      In case of an error, isValid() will return @c false and
 
56
      lastError() will return an error message.
 
57
 
 
58
       @see isValid(), lastError()
 
59
    */
 
60
    bool loadFile( const QString &fileName );
 
61
 
 
62
    /**
 
63
      Writes the current document into the given file.
 
64
    */
 
65
    bool writeToFile( const QString &fileName ) const;
 
66
 
 
67
    /**
 
68
      Returns true if the document could be parsed successfully.
 
69
      @see lastError()
 
70
    */
 
71
    bool isValid() const;
 
72
 
 
73
    /**
 
74
      Returns the last error occurred during file loading/parsing.
 
75
      Empty if isValid() returns @c true.
 
76
      @see isValid()
 
77
    */
 
78
    QString lastError() const;
 
79
 
 
80
    /**
 
81
      Returns the DOM document for this XML document.
 
82
    */
 
83
    QDomDocument& document() const;
 
84
 
 
85
    /**
 
86
      Returns the DOM element representing the collection with the given remote id
 
87
    */
 
88
    QDomElement collectionElementByRemoteId( const QString &rid ) const;
 
89
 
 
90
    /**
 
91
      Returns the DOM element representing the item with the given remote id
 
92
    */
 
93
    QDomElement itemElementByRemoteId( const QString &rid ) const;
 
94
 
 
95
    /**
 
96
      Returns the collection with the given remote id.
 
97
    */
 
98
    Collection collectionByRemoteId( const QString &rid ) const;
 
99
 
 
100
    /**
 
101
      Returns the item with the given remote id.
 
102
    */
 
103
    Item itemByRemoteId( const QString& rid, bool includePayload = true ) const;
 
104
 
 
105
    /**
 
106
      Returns the collections defined in this document.
 
107
    */
 
108
    Collection::List collections() const;
 
109
 
 
110
    /**
 
111
      Returns immediate child collections of the specified parent collection.
 
112
    */
 
113
    Collection::List childCollections( const QString &parentCollectionRid ) const;
 
114
 
 
115
    /**
 
116
      Returns the items in the given collection.
 
117
    */
 
118
    Item::List items( const Collection& collection, bool includePayload = true ) const;
 
119
 
 
120
  private:
 
121
    XmlDocumentPrivate * const d;
 
122
};
 
123
 
 
124
}
 
125
 
 
126
#endif