1 /*
2  * This file is part of telepathy-accounts-kcm
3  *
4  * Copyright (C) 2009 Collabora Ltd. <info@collabora.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 #ifndef LIB_KCM_TELEPATHY_ACCOUNTS_PARAMETER_ITEM_H
22 #define LIB_KCM_TELEPATHY_ACCOUNTS_PARAMETER_ITEM_H
23 
24 #include <QObject>
25 #include <QVariant>
26 #include <QValidator>
27 
28 #include <TelepathyQt/ConnectionManager>
29 #include <TelepathyQt/Profile>
30 
31 
32 class ParameterItem : public QObject
33 {
34     Q_OBJECT
35     Q_DISABLE_COPY(ParameterItem)
36 
37 public:
38     ParameterItem(const Tp::ProtocolParameter &parameter,
39                   const Tp::Profile::Parameter &profileParameter,
40                   const QVariant &originalValue,
41                   QObject *parent = nullptr);
42     ~ParameterItem() override;
43 
44     QString name() const;
45     QString localizedName() const;
46     QVariant::Type type() const;
47     QVariant value() const;
48     bool isSecret() const;
49     bool isRequired() const;
50     bool isRequiredForRegistration() const;
51     /** Returns true if the item is from a profile and should _not_ be changed*/
52     bool isMandatory() const;
53     const Tp::ProtocolParameter parameter() const;
54     const Tp::Profile::Parameter profileParameter() const;
55     QValidator::State validity() const;
56 
57     void setValue(const QVariant &value);
58     void setValidity(QValidator::State validity);
59 
60 private:
61     Tp::ProtocolParameter m_parameter;
62     Tp::Profile::Parameter m_profileParameter;
63     const QVariant m_originalValue;
64     QVariant m_currentValue;
65     QString m_localizedName;
66     QValidator::State m_validity;
67 };
68 
69 
70 #endif // header guard
71 
72