27 #include "service-type.h"
30 #include <libaccounts-glib/ag-service-type.h>
32 using namespace Accounts;
49 m_serviceType(serviceType),
52 if (m_serviceType !=
nullptr && mode == AddReference)
53 ag_service_type_ref(m_serviceType);
60 m_serviceType(nullptr),
70 m_serviceType(other.m_serviceType),
73 if (m_serviceType !=
nullptr)
74 ag_service_type_ref(m_serviceType);
79 if (m_serviceType == other.m_serviceType)
return *
this;
80 if (m_serviceType !=
nullptr)
81 ag_service_type_unref(m_serviceType);
82 m_serviceType = other.m_serviceType;
83 if (m_serviceType !=
nullptr)
84 ag_service_type_ref(m_serviceType);
88 ServiceType::~ServiceType()
90 if (m_serviceType !=
nullptr) {
91 ag_service_type_unref(m_serviceType);
92 m_serviceType =
nullptr;
94 if (m_tags !=
nullptr) {
106 return m_serviceType !=
nullptr;
114 if (Q_UNLIKELY(!
isValid()))
return QString();
115 return UTF8(ag_service_type_get_name(m_serviceType));
123 return UTF8(ag_service_type_get_description(m_serviceType));
139 id = ag_service_type_get_display_name(m_serviceType);
153 return ASCII(ag_service_type_get_i18n_domain(m_serviceType));
161 return ASCII(ag_service_type_get_icon_name(m_serviceType));
173 return ag_service_type_has_tag(m_serviceType, tag.toUtf8().constData());
186 m_tags =
new QSet<QString>;
187 GList *list = ag_service_type_get_tags(m_serviceType);
189 while (iter != NULL) {
190 m_tags->insert(UTF8(
reinterpret_cast<const gchar *
> (iter->data)));
191 iter = g_list_next(iter);
205 ag_service_type_get_file_contents(m_serviceType, &data, &len);
211 if (!doc.setContent(QByteArray(data, len),
true,
212 &errorStr, &errorLine, &errorColumn)) {
213 QString message(QStringLiteral(
"Parse error reading serviceType file "
214 "at line %1, column %2:\n%3"));
215 message = message.arg(errorLine).arg(errorColumn).arg(errorStr);
216 qWarning() << __PRETTY_FUNCTION__ << message;