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 != 0 && mode == AddReference)
53 ag_service_type_ref(m_serviceType);
70 m_serviceType(other.m_serviceType),
73 if (m_serviceType != 0)
74 ag_service_type_ref(m_serviceType);
79 if (m_serviceType == other.m_serviceType)
return *
this;
80 if (m_serviceType != 0)
81 ag_service_type_unref(m_serviceType);
82 m_serviceType = other.m_serviceType;
83 if (m_serviceType != 0)
84 ag_service_type_ref(m_serviceType);
88 ServiceType::~ServiceType()
90 if (m_serviceType != 0) {
91 ag_service_type_unref(m_serviceType);
106 return m_serviceType != 0;
114 if (Q_UNLIKELY(!
isValid()))
return QString();
115 return UTF8(ag_service_type_get_name(m_serviceType));
131 id = ag_service_type_get_display_name(m_serviceType);
145 return ASCII(ag_service_type_get_i18n_domain(m_serviceType));
153 return ASCII(ag_service_type_get_icon_name(m_serviceType));
165 return ag_service_type_has_tag(m_serviceType, tag.toUtf8().constData());
178 m_tags =
new QSet<QString>;
179 GList *list = ag_service_type_get_tags(m_serviceType);
181 while (iter != NULL) {
182 m_tags->insert(UTF8(
reinterpret_cast<const gchar *
> (iter->data)));
183 iter = g_list_next(iter);
197 ag_service_type_get_file_contents(m_serviceType, &data, &len);
203 if (!doc.setContent(QByteArray(data, len),
true,
204 &errorStr, &errorLine, &errorColumn)) {
205 QString message(QStringLiteral(
"Parse error reading serviceType file "
206 "at line %1, column %2:\n%3"));
207 message = message.arg(errorLine).arg(errorColumn).arg(errorStr);
208 qWarning() << __PRETTY_FUNCTION__ << message;