30 #include <libaccounts-glib/ag-service.h>
32 #if QT_VERSION < QT_VERSION_CHECK(5 ,0 ,0)
33 #define QStringLiteral QString::fromUtf8
56 if (m_service != 0 && mode == AddReference)
57 ag_service_ref(m_service);
74 m_service(other.m_service),
78 ag_service_ref(m_service);
83 if (m_service == other.m_service)
return *
this;
85 ag_service_unref(m_service);
86 m_service = other.m_service;
88 ag_service_ref(m_service);
95 ag_service_unref(m_service);
110 return m_service != 0;
120 if (Q_UNLIKELY(!
isValid()))
return QString();
121 return UTF8(ag_service_get_name(m_service));
130 return UTF8(ag_service_get_display_name(m_service));
139 return ASCII(ag_service_get_service_type(m_service));
147 return ASCII(ag_service_get_i18n_domain(m_service));
156 return UTF8(ag_service_get_provider(m_service));
165 return ASCII(ag_service_get_icon_name(m_service));
177 return ag_service_has_tag(m_service, tag.toUtf8().constData());
190 m_tags =
new QSet<QString>;
191 GList *list = ag_service_get_tags(m_service);
193 while (iter != NULL) {
194 m_tags->insert(UTF8(reinterpret_cast<const gchar *> (iter->data)));
195 iter = g_list_next(iter);
209 ag_service_get_file_contents(m_service, &data, NULL);
215 if (!doc.setContent(QByteArray(data),
true,
216 &errorStr, &errorLine, &errorColumn))
218 QString message(QStringLiteral(
"Parse error reading account service file "
219 "at line %1, column %2:\n%3"));
220 message = message.arg(errorLine).arg(errorColumn).arg(errorStr);
221 qWarning() << __PRETTY_FUNCTION__ << message;
226 AgService *Service::service()
const
bool isValid() const
Check whether this object represents a Service.
QSet< QString > tags() const
Return all tags of the service as a set.
const QDomDocument domDocument() const
Get the contents of the service XML file.
Representation of an account service.
QString serviceType() const
Get the service type ID of the service.
bool hasTag(const QString &tag) const
Check if this service has a tag.
Service()
Construct an invalid service.
QString trCatalog() const
QString iconName() const
Get the icon name for this service.
QString displayName() const
Get the display name of the service, untranslated.
QString name() const
Get the name of the service.
QString provider() const
Get the provider ID of the service.