2 * Copyright (C) 2011 Collabora Ltd.
3 * Copyright (C) 2011 Philip Withnall
5 * This library is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 2.1 of the License, or
8 * (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 * Marco Barisione <marco.barisione@collabora.co.uk>
20 * Travis Reitter <travis.reitter@collabora.co.uk>
21 * Philip Withnall <philip@tecnocode.co.uk>
28 * Object representing a URL that can have some parameters associated with it.
30 * See {@link Folks.AbstractFieldDetails} for details on common parameter names
35 public class Folks.UrlFieldDetails : AbstractFieldDetails<string>
38 * Parameter value for URLs for the contact's home page.
40 * Value for a parameter with name {@link AbstractFieldDetails.PARAM_TYPE}.
44 public static const string PARAM_TYPE_HOME_PAGE = "x-home-page";
47 * Parameter value for URLs for the contact's personal or professional blog.
49 * Value for a parameter with name {@link AbstractFieldDetails.PARAM_TYPE}.
53 public static const string PARAM_TYPE_BLOG = "x-blog";
56 * Parameter value for URLs for the contact's social networking profile.
58 * Value for a parameter with name {@link AbstractFieldDetails.PARAM_TYPE}.
62 public static const string PARAM_TYPE_PROFILE = "x-profile";
65 * Parameter value for URLs for the contact's personal or professional FTP
68 * Value for a parameter with name {@link AbstractFieldDetails.PARAM_TYPE}.
72 public static const string PARAM_TYPE_FTP = "x-ftp";
75 * Create a new UrlFieldDetails.
77 * @param value the value of the field, a non-empty URI
78 * @param parameters initial parameters. See
79 * {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to a
80 * empty map of parameters.
82 * @return a new UrlFieldDetails
86 public UrlFieldDetails (string value,
87 MultiMap<string, string>? parameters = null)
91 warning ("Empty URI passed to UrlFieldDetails.");
95 parameters: parameters);
103 public override bool equal (AbstractFieldDetails<string> that)
105 return base.equal (that);
113 public override uint hash ()
120 * Associates a list of URLs with a contact.
124 public interface Folks.UrlDetails : Object
127 * The websites of the contact.
129 * A list or websites associated to the contact.
133 public abstract Set<UrlFieldDetails> urls { get; set; }
136 * Change the contact's URLs.
138 * It's preferred to call this rather than setting {@link UrlDetails.urls}
139 * directly, as this method gives error notification and will only return once
140 * the URLs have been written to the relevant backing store (or the
141 * operation's failed).
143 * @param urls the set of URLs
144 * @throws PropertyError if setting the URLs failed
147 public virtual async void change_urls (Set<UrlFieldDetails> urls)
150 /* Default implementation. */
151 throw new PropertyError.NOT_WRITEABLE (
152 _("URLs are not writeable on this contact."));