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 * Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
20 * Philip Withnall <philip@tecnocode.co.uk>
27 * Object representing a note that can have some parameters associated with it.
29 * See {@link Folks.AbstractFieldDetails} for details on common parameter names
34 public class Folks.NoteFieldDetails : AbstractFieldDetails<string>
40 public override string id
42 get { return this._id; }
43 set { this._id = (value != null ? value : ""); }
47 * The UID of the note (if any).
49 [Deprecated (since = "0.6.5", replacement = "AbstractFieldDetails.id")]
52 get { return this.id; }
53 set { this.id = value; }
57 * Create a new NoteFieldDetails.
59 * @param value the value of the field, which should be a non-empty free-form
60 * UTF-8 string as entered by the user
61 * @param parameters initial parameters. See
62 * {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to a
63 * empty map of parameters.
65 * @return a new NoteFieldDetails
69 public NoteFieldDetails (string value,
70 MultiMap<string, string>? parameters = null,
75 warning ("Empty note passed to NoteFieldDetails.");
80 parameters: parameters);
88 public override bool equal (AbstractFieldDetails<string> that)
90 return base.equal (that);
98 public override uint hash ()
100 return (this.value.hash () + this.id.hash ());
105 * This interface represents the list of notes associated
106 * to a {@link Persona} and {@link Individual}.
110 public interface Folks.NoteDetails : Object
113 * The notes about the contact.
117 public abstract Set<NoteFieldDetails> notes { get; set; }
120 * Change the contact's notes.
122 * It's preferred to call this rather than setting {@link NoteDetails.notes}
123 * directly, as this method gives error notification and will only return once
124 * the notes have been written to the relevant backing store (or the
125 * operation's failed).
127 * @param notes the set of notes
128 * @throws PropertyError if setting the notes failed
131 public virtual async void change_notes (Set<NoteFieldDetails> notes)
134 /* Default implementation. */
135 throw new PropertyError.NOT_WRITEABLE (
136 _("Notes are not writeable on this contact."));