diff --git a/libguh/types/paramtype.cpp b/libguh/types/paramtype.cpp index 595c0f74..9a88f94e 100644 --- a/libguh/types/paramtype.cpp +++ b/libguh/types/paramtype.cpp @@ -86,6 +86,16 @@ void ParamType::setLimits(const QVariant &min, const QVariant &max) m_maxValue = max; } +QList ParamType::allowedValues() const +{ + return m_allowedValues; +} + +void ParamType::setAllowedValues(const QList allowedValues) +{ + m_allowedValues = allowedValues; +} + QDebug operator<<(QDebug dbg, const ParamType ¶mType) { dbg.nospace() << "ParamType(Name: " << paramType.name() diff --git a/libguh/types/paramtype.h b/libguh/types/paramtype.h index bf7811a2..bf361b59 100644 --- a/libguh/types/paramtype.h +++ b/libguh/types/paramtype.h @@ -45,12 +45,16 @@ public: QPair limits() const; void setLimits(const QVariant &min, const QVariant &max); + QList allowedValues() const; + void setAllowedValues(const QList allowedValues); + private: QString m_name; QVariant::Type m_type; QVariant m_defaultValue; QVariant m_minValue; QVariant m_maxValue; + QVariantList m_allowedValues; }; QDebug operator<<(QDebug dbg, const ParamType ¶mType); diff --git a/plugins/deviceplugins/mailnotification/devicepluginmailnotification.cpp b/plugins/deviceplugins/mailnotification/devicepluginmailnotification.cpp index 755d2c0f..a99ac977 100644 --- a/plugins/deviceplugins/mailnotification/devicepluginmailnotification.cpp +++ b/plugins/deviceplugins/mailnotification/devicepluginmailnotification.cpp @@ -322,6 +322,7 @@ QList DevicePluginMailNotification::supportedDevices() const customMailParams.append(portCustomParam); ParamType authCustomParam("auth", QVariant::String); + authCustomParam.setAllowedValues(QVariantList() << "PLAIN" << "LOGIN"); customMailParams.append(authCustomParam); deviceClassCustomMail.setActions(mailActions); diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp index 4056a7a2..9a95bb40 100644 --- a/server/jsonrpc/jsontypes.cpp +++ b/server/jsonrpc/jsontypes.cpp @@ -69,6 +69,7 @@ void JsonTypes::init() s_paramType.insert("o:defaultValue", "variant"); s_paramType.insert("o:minValue", "variant"); s_paramType.insert("o:maxValue", "variant"); + s_paramType.insert("o:allowedValues", QVariantList() << "variant"); // Param s_param.insert("name", "string"); @@ -332,6 +333,9 @@ QVariantMap JsonTypes::packParamType(const ParamType ¶mType) if (paramType.maxValue().isValid()) { variantMap.insert("maxValue", paramType.maxValue()); } + if (!paramType.allowedValues().isEmpty()) { + variantMap.insert("allowedValues", paramType.allowedValues()); + } return variantMap; }