1/* Copyright 2016 Software Freedom Conservancy Inc.
2 *
3 * This software is licensed under the GNU Lesser General Public License
4 * (version 2.1 or later).  See the COPYING file in this distribution.
5 */
6
7public abstract class Geary.FolderProperties : BaseObject {
8    public const string PROP_NAME_EMAIL_TOTAL = "email-total";
9    public const string PROP_NAME_EMAIL_UNREAD = "email-unread";
10    public const string PROP_NAME_HAS_CHILDREN = "has-children";
11    public const string PROP_NAME_SUPPORTS_CHILDREN = "supports-children";
12    public const string PROP_NAME_IS_OPENABLE = "is-openable";
13    public const string PROP_NAME_IS_LOCAL_ONLY = "is-local-only";
14    public const string PROP_NAME_IS_VIRTUAL = "is-virtual";
15
16    /**
17     * The total count of email in the {@link Folder}.
18     */
19    public int email_total { get; protected set; }
20
21    /**
22     * The total count of unread email in the {@link Folder}.
23     */
24    public int email_unread { get; protected set; }
25
26    /**
27     * Returns a {@link Trillian} indicating if this {@link Folder} has children.
28     *
29     * has_children == {@link Trillian.TRUE} implies {@link supports_children} == Trilian.TRUE.
30     */
31    public Trillian has_children { get; protected set; }
32
33    /**
34     * Returns a {@link Trillian} indicating if this {@link Folder} can parent new children
35     * {@link Folder}s.
36     *
37     * This does ''not'' mean creating a sub-folder is guaranteed to succeed.
38     */
39    public Trillian supports_children { get; protected set; }
40
41    /**
42     * Returns a {@link Trillian} indicating if {@link Folder.open_async} can succeed remotely.
43     */
44    public Trillian is_openable { get; protected set; }
45
46    /**
47     * Returns true if the {@link Folder} is local-only, that is, has no remote folder backing
48     * it.
49     *
50     * Note that this doesn't mean there's no network aspect to the Folder.  For example, an Outbox
51     * may present itself as a Folder but the network backing (SMTP) has nothing that resembles
52     * a Folder interface.
53     */
54    public bool is_local_only { get; private set; }
55
56    /**
57     * Returns true if the {@link Folder} is virtual, that is, it is either generated by some
58     * external criteria and/or is aggregating the content of other Folders.
59     *
60     * In general, virtual folders cannot be the destination Folder for operations like move and
61     * copy.
62     */
63    public bool is_virtual { get; private set; }
64
65    /**
66     * True if the {@link Folder} offers the {@link FolderSupport.Create} interface but is
67     * guaranteed not to return a {@link EmailIdentifier}, even if
68     * {@link FolderSupport.Create.create_email_async} succeeds.
69     *
70     * This is for IMAP servers that don't support UIDPLUS.  Most servers support UIDPLUS, so this
71     * will usually be false.
72     */
73    public bool create_never_returns_id { get; protected set; }
74
75    protected FolderProperties(int email_total, int email_unread, Trillian has_children,
76        Trillian supports_children, Trillian is_openable, bool is_local_only, bool is_virtual,
77        bool create_never_returns_id) {
78        this.email_total = email_total;
79        this.email_unread = email_unread;
80        this.has_children = has_children;
81        this.supports_children = supports_children;
82        this.is_openable = is_openable;
83        this.is_local_only = is_local_only;
84        this.is_virtual = is_virtual;
85        this.create_never_returns_id = create_never_returns_id;
86    }
87}
88
89