diff --git a/docs/sources/metainfo/component.xml b/docs/sources/metainfo/component.xml index e95d1158..602c4c50 100644 --- a/docs/sources/metainfo/component.xml +++ b/docs/sources/metainfo/component.xml @@ -281,6 +281,19 @@ + + + contact + + + URLs of this type should allow the user to contact the developer. + + + This could be an email address (mailto link), a webpage (e.g. an online + form or a page describing how to contact the developer) or some other valid URL. + + + diff --git a/qt/component.cpp b/qt/component.cpp index 6bd9f173..07ef3ceb 100644 --- a/qt/component.cpp +++ b/qt/component.cpp @@ -123,12 +123,16 @@ Component::UrlKind Component::stringToUrlKind(const QString& urlKindString) { if (urlKindString == QLatin1String("donation")) { return UrlKindDonation; } + if (urlKindString == QLatin1String("contact")) { + return UrlKindContact; + } return UrlKindUnknown; } typedef QHash UrlKindMap; Q_GLOBAL_STATIC_WITH_ARGS(UrlKindMap, urlKindMap, ({ { Component::UrlKindBugtracker, QLatin1String("bugtracker") }, + { Component::UrlKindContact, QLatin1String("contact") }, { Component::UrlKindDonation, QLatin1String("donation") }, { Component::UrlKindFaq, QLatin1String("faq") }, { Component::UrlKindHelp, QLatin1String("help") }, diff --git a/qt/component.h b/qt/component.h index 5ef9edc1..2ced4ccd 100644 --- a/qt/component.h +++ b/qt/component.h @@ -79,6 +79,7 @@ Q_GADGET UrlKindUnknown, UrlKindHomepage, UrlKindBugtracker, + UrlKindConact, UrlKindFaq, UrlKindHelp, UrlKindDonation, diff --git a/src/as-enums.c b/src/as-enums.c index 8ed82b55..a49ad3ff 100644 --- a/src/as-enums.c +++ b/src/as-enums.c @@ -49,6 +49,8 @@ as_url_kind_to_string (AsUrlKind url_kind) return "donation"; if (url_kind == AS_URL_KIND_TRANSLATE) return "translate"; + if (url_kind == AS_URL_KIND_CONTACT) + return "contact"; return "unknown"; } @@ -75,6 +77,8 @@ as_url_kind_from_string (const gchar *url_kind) return AS_URL_KIND_DONATION; if (g_strcmp0 (url_kind, "translate") == 0) return AS_URL_KIND_TRANSLATE; + if (g_strcmp0 (url_kind, "contact") == 0) + return AS_URL_KIND_CONTACT; return AS_URL_KIND_UNKNOWN; } diff --git a/src/as-enums.h b/src/as-enums.h index 915601c9..69943d0e 100644 --- a/src/as-enums.h +++ b/src/as-enums.h @@ -44,6 +44,7 @@ G_BEGIN_DECLS * @AS_URL_KIND_HELP: Help manual * @AS_URL_KIND_DONATION: Page with information about how to donate to the project * @AS_URL_KIND_TRANSLATE: Page with instructions on how to translate the project / submit translations. + * @AS_URL_KIND_CONTACT: Contact the developers * * The URL type. **/ @@ -55,6 +56,7 @@ typedef enum { AS_URL_KIND_HELP, AS_URL_KIND_DONATION, AS_URL_KIND_TRANSLATE, + AS_URL_KIND_CONTACT, /*< private >*/ AS_URL_KIND_LAST } AsUrlKind; diff --git a/tests/test-xmldata.c b/tests/test-xmldata.c index 9295f2b6..3e252e0c 100644 --- a/tests/test-xmldata.c +++ b/tests/test-xmldata.c @@ -506,6 +506,7 @@ test_xml_read_url (void) " https://example.org\n" " https://example.org/faq\n" " https://example.org/donate\n" + " https://example.org/contact\n" "\n"; cpt = as_xml_test_read_data (xmldata_languages, AS_FORMAT_STYLE_METAINFO); @@ -514,6 +515,7 @@ test_xml_read_url (void) g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_HOMEPAGE), ==, "https://example.org"); g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_FAQ), ==, "https://example.org/faq"); g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_DONATION), ==, "https://example.org/donate"); + g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_CONTACT), ==, "https://example.org/contact"); } /** diff --git a/tests/test-yamldata.c b/tests/test-yamldata.c index d0994bc1..22b5b794 100644 --- a/tests/test-yamldata.c +++ b/tests/test-yamldata.c @@ -482,7 +482,8 @@ test_yaml_read_url (void) "Url:\n" " homepage: https://example.org\n" " faq: https://example.org/faq\n" - " donation: https://example.org/donate\n"; + " donation: https://example.org/donate\n" + " contact: https://example.org/contact\n"; cpt = as_yaml_test_read_data (yamldata_urls, NULL); g_assert_cmpstr (as_component_get_id (cpt), ==, "org.example.Test"); @@ -490,6 +491,7 @@ test_yaml_read_url (void) g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_HOMEPAGE), ==, "https://example.org"); g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_FAQ), ==, "https://example.org/faq"); g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_DONATION), ==, "https://example.org/donate"); + g_assert_cmpstr (as_component_get_url (cpt, AS_URL_KIND_CONTACT), ==, "https://example.org/contact"); } /**