QXmpp: QXmppDataForm.h Source File

QXmpp Version:0.7.5

- Main Page
- Modules
- Classes
- Files

- File List

All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppDataForm.h
1 /*
2 * Copyright (C) 2008-2012 The QXmpp developers
3 *
4 * Author:
5 * Jeremy Lainé
6 *
7 * Source:
8 * http://code.google.com/p/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24 #ifndef QXMPPDATAFORM_H
25 #define QXMPPDATAFORM_H
26
27 #include <QPair>
28 #include <QVariant>
29
30 #include "QXmppStanza.h"
31
32 class QXmppDataFormPrivate;
33 class QXmppDataFormFieldPrivate;
34 class QXmppDataFormMediaPrivate;
35
39
40 class QXMPP_EXPORT QXmppDataForm
41 {
42 public:
46
47 class QXMPP_EXPORT Media
48 {
49 public:
50 Media();
51 Media(const QXmppDataForm::Media &other);
52 ~Media();
53
54 QXmppDataForm::Media& operator=(const QXmppDataForm::Media &other);
55
56 int height() const;
57 void setHeight(int height);
58
59 int width() const;
60 void setWidth(int width);
61
62 QList<QPair<QString, QString> > uris() const;
63 void setUris(const QList<QPair<QString, QString> > &uris);
64
65 bool isNull() const;
66
67 private:
68 QSharedDataPointer<QXmppDataFormMediaPrivate> d;
69 };
70
74
75 class QXMPP_EXPORT Field
76 {
77 public:
79 enum Type
80 {
81 BooleanField,
82 FixedField,
83 HiddenField,
84 JidMultiField,
85 JidSingleField,
86 ListMultiField,
87 ListSingleField,
88 TextMultiField,
89 TextPrivateField,
90 TextSingleField,
91 };
92
93 Field(QXmppDataForm::Field::Type type = QXmppDataForm::Field::TextSingleField);
94 Field(const QXmppDataForm::Field &other);
95 ~Field();
96
97 QXmppDataForm::Field& operator=(const QXmppDataForm::Field &other);
98
99 QString description() const;
100 void setDescription(const QString &description);
101
102 QString key() const;
103 void setKey(const QString &key);
104
105 QString label() const;
106 void setLabel(const QString &label);
107
108 Media media() const;
109 void setMedia(const Media &media);
110
111 QList<QPair<QString, QString> > options() const;
112 void setOptions(const QList<QPair<QString, QString> > &options);
113
114 bool isRequired() const;
115 void setRequired(bool required);
116
117 QXmppDataForm::Field::Type type() const;
118 void setType(QXmppDataForm::Field::Type type);
119
120 QVariant value() const;
121 void setValue(const QVariant &value);
122
123 private:
124 QSharedDataPointer<QXmppDataFormFieldPrivate> d;
125 };
126
128 enum Type
129 {
130 None,
131 Form,
132
133 Submit,
134
135 Cancel,
136
137 Result,
138
139
140 };
141
142 QXmppDataForm(QXmppDataForm::Type type = QXmppDataForm::None);
143 QXmppDataForm(const QXmppDataForm &other);
144 ~QXmppDataForm();
145
146 QXmppDataForm& operator=(const QXmppDataForm &other);
147
148 QString instructions() const;
149 void setInstructions(const QString &instructions);
150
151 QList<Field> fields() const;
152 QList<Field> &fields();
153 void setFields(const QList<QXmppDataForm::Field> &fields);
154
155 QString title() const;
156 void setTitle(const QString &title);
157
158 QXmppDataForm::Type type() const;
159 void setType(QXmppDataForm::Type type);
160
161 bool isNull() const;
162
164 void parse(const QDomElement &element);
165 void toXml(QXmlStreamWriter *writer) const;
167
168 private:
169 QSharedDataPointer<QXmppDataFormPrivate> d;
170 };
171
172 #endif