27 #include "service-type.h"
30 #include <libaccounts-glib/ag-service-type.h>
32 using namespace Accounts;
49 m_serviceType(serviceType),
53 if (m_serviceType != 0 && mode == AddReference)
54 ag_service_type_ref(m_serviceType);
71 m_serviceType(other.m_serviceType),
74 if (m_serviceType != 0)
75 ag_service_type_ref(m_serviceType);
80 if (m_serviceType == other.m_serviceType)
return *
this;
81 if (m_serviceType != 0)
82 ag_service_type_unref(m_serviceType);
83 m_serviceType = other.m_serviceType;
84 if (m_serviceType != 0)
85 ag_service_type_ref(m_serviceType);
89 ServiceType::~ServiceType()
92 if (m_serviceType != 0) {
93 ag_service_type_unref(m_serviceType);
108 return m_serviceType != 0;
116 return UTF8(ag_service_type_get_name(m_serviceType));
132 id = ag_service_type_get_display_name(m_serviceType);
146 return ASCII(ag_service_type_get_i18n_domain(m_serviceType));
154 return ASCII(ag_service_type_get_icon_name(m_serviceType));
166 return ag_service_type_has_tag(m_serviceType, tag.toUtf8().constData());
179 m_tags =
new QSet<QString>;
180 GList *list = ag_service_type_get_tags(m_serviceType);
182 while (iter != NULL) {
183 m_tags->insert(UTF8(reinterpret_cast<const gchar *> (iter->data)));
184 iter = g_list_next(iter);
198 ag_service_type_get_file_contents(m_serviceType, &data, &len);
204 if (!doc.setContent(QByteArray(data, len),
true,
205 &errorStr, &errorLine, &errorColumn)) {
206 QString message(ASCII(
"Parse error reading serviceType file "
207 "at line %1, column %2:\n%3"));
208 message.arg(errorLine).arg(errorColumn).arg(errorStr);
209 qWarning() << __PRETTY_FUNCTION__ << message;