libquentier  0.4.0
The library for rich desktop clients of Evernote service
Notebook.h
1 /*
2  * Copyright 2016 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier 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.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_TYPES_NOTEBOOK_H
20 #define LIB_QUENTIER_TYPES_NOTEBOOK_H
21 
22 #include "IFavoritableDataElement.h"
23 
24 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
25 #include <qt5qevercloud/QEverCloud.h>
26 #else
27 #include <qt4qevercloud/QEverCloud.h>
28 #endif
29 
30 #include <QSharedDataPointer>
31 
32 namespace quentier {
33 
34 QT_FORWARD_DECLARE_CLASS(SharedNotebook)
35 QT_FORWARD_DECLARE_CLASS(User)
36 QT_FORWARD_DECLARE_CLASS(NotebookData)
37 
38 class QUENTIER_EXPORT Notebook: public IFavoritableDataElement
39 {
40 public:
41  QN_DECLARE_LOCAL_UID
42  QN_DECLARE_DIRTY
43  QN_DECLARE_LOCAL
44  QN_DECLARE_FAVORITED
45 
46 public:
47  explicit Notebook();
48  Notebook(const Notebook & other);
49  Notebook(Notebook && other);
50  Notebook & operator=(const Notebook & other);
51  Notebook & operator=(Notebook && other);
52 
53  explicit Notebook(const qevercloud::Notebook & other);
54  explicit Notebook(qevercloud::Notebook && other);
55  Notebook & operator=(const qevercloud::Notebook & other);
56  Notebook & operator=(qevercloud::Notebook && other);
57 
58  virtual ~Notebook();
59 
60  bool operator==(const Notebook & other) const;
61  bool operator!=(const Notebook & other) const;
62 
63  const qevercloud::Notebook & qevercloudNotebook() const;
64  qevercloud::Notebook & qevercloudNotebook();
65 
66  virtual void clear() Q_DECL_OVERRIDE;
67 
68  static bool validateName(const QString & name, ErrorString * pErrorDescription = Q_NULLPTR);
69 
70  virtual bool hasGuid() const Q_DECL_OVERRIDE;
71  virtual const QString & guid() const Q_DECL_OVERRIDE;
72  virtual void setGuid(const QString & guid) Q_DECL_OVERRIDE;
73 
74  virtual bool hasUpdateSequenceNumber() const Q_DECL_OVERRIDE;
75  virtual qint32 updateSequenceNumber() const Q_DECL_OVERRIDE;
76  virtual void setUpdateSequenceNumber(const qint32 usn) Q_DECL_OVERRIDE;
77 
78  virtual bool checkParameters(ErrorString & errorDescription) const Q_DECL_OVERRIDE;
79 
80  bool hasName() const;
81  const QString & name() const;
82  void setName(const QString & name);
83 
84  bool isDefaultNotebook() const;
85  void setDefaultNotebook(const bool defaultNotebook);
86 
87  bool hasLinkedNotebookGuid() const;
88  const QString & linkedNotebookGuid() const;
89  void setLinkedNotebookGuid(const QString & linkedNotebookGuid);
90 
91  bool hasCreationTimestamp() const;
92  qint64 creationTimestamp() const;
93  void setCreationTimestamp(const qint64 timestamp);
94 
95  bool hasModificationTimestamp() const;
96  qint64 modificationTimestamp() const;
97  void setModificationTimestamp(const qint64 timestamp);
98 
99  bool hasPublishingUri() const;
100  const QString & publishingUri() const;
101  void setPublishingUri(const QString & uri);
102 
103  bool hasPublishingOrder() const;
104  qint8 publishingOrder() const;
105  void setPublishingOrder(const qint8 order);
106 
107  bool hasPublishingAscending() const;
108  bool isPublishingAscending() const;
109  void setPublishingAscending(const bool ascending);
110 
111  bool hasPublishingPublicDescription() const;
112  const QString & publishingPublicDescription() const;
113  void setPublishingPublicDescription(const QString & publishingPublicDescription);
114 
115  bool hasPublished() const;
116  bool isPublished() const;
117  void setPublished(const bool published);
118 
119  bool hasStack() const;
120  const QString & stack() const;
121  void setStack(const QString & stack);
122 
123  bool hasSharedNotebooks();
124  QList<SharedNotebook> sharedNotebooks() const;
125  void setSharedNotebooks(QList<qevercloud::SharedNotebook> sharedNotebooks);
126  void setSharedNotebooks(QList<SharedNotebook> && notebooks);
127  void addSharedNotebook(const SharedNotebook & sharedNotebook);
128  void removeSharedNotebook(const SharedNotebook & sharedNotebook);
129 
130  bool hasBusinessNotebookDescription() const;
131  const QString & businessNotebookDescription() const;
132  void setBusinessNotebookDescription(const QString & businessNotebookDescription);
133 
134  bool hasBusinessNotebookPrivilegeLevel() const;
135  qint8 businessNotebookPrivilegeLevel() const;
136  void setBusinessNotebookPrivilegeLevel(const qint8 privilegeLevel);
137 
138  bool hasBusinessNotebookRecommended() const;
139  bool isBusinessNotebookRecommended() const;
140  void setBusinessNotebookRecommended(const bool recommended);
141 
142  bool hasContact() const;
143  const User contact() const;
144  void setContact(const User & contact);
145 
146  bool isLastUsed() const;
147  void setLastUsed(const bool lastUsed);
148 
149  // Restrictions
150  bool canReadNotes() const;
151  void setCanReadNotes(const bool canReadNotes);
152 
153  bool canCreateNotes() const;
154  void setCanCreateNotes(const bool canCreateNotes);
155 
156  bool canUpdateNotes() const;
157  void setCanUpdateNotes(const bool canUpdateNotes);
158 
159  bool canExpungeNotes() const;
160  void setCanExpungeNotes(const bool canExpungeNotes);
161 
162  bool canShareNotes() const;
163  void setCanShareNotes(const bool canShareNotes);
164 
165  bool canEmailNotes() const;
166  void setCanEmailNotes(const bool canEmailNotes);
167 
168  bool canSendMessageToRecipients() const;
169  void setCanSendMessageToRecipients(const bool canSendMessageToRecipients);
170 
171  bool canUpdateNotebook() const;
172  void setCanUpdateNotebook(const bool canUpdateNotebook);
173 
174  bool canExpungeNotebook() const;
175  void setCanExpungeNotebook(const bool canExpungeNotebook);
176 
177  bool canSetDefaultNotebook() const;
178  void setCanSetDefaultNotebook(const bool canSetDefaultNotebook);
179 
180  bool canSetNotebookStack() const;
181  void setCanSetNotebookStack(const bool canSetNotebookStack);
182 
183  bool canPublishToPublic() const;
184  void setCanPublishToPublic(const bool canPublishToPublic);
185 
186  bool canPublishToBusinessLibrary() const;
187  void setCanPublishToBusinessLibrary(const bool canPublishToBusinessLibrary);
188 
189  bool canCreateTags() const;
190  void setCanCreateTags(const bool canCreateTags);
191 
192  bool canUpdateTags() const;
193  void setCanUpdateTags(const bool canUpdateTags);
194 
195  bool canExpungeTags() const;
196  void setCanExpungeTags(const bool canExpungeTags);
197 
198  bool canSetParentTag() const;
199  void setCanSetParentTag(const bool canSetParentTag);
200 
201  bool canCreateSharedNotebooks() const;
202  void setCanCreateSharedNotebooks(const bool canCreateSharedNotebooks);
203 
204  bool canShareNotesWithBusiness() const;
205  void setCanShareNotesWithBusiness(const bool canShareNotesWithBusiness);
206 
207  bool canRenameNotebook() const;
208  void setCanRenameNotebook(const bool canRenameNotebook);
209 
210  bool hasUpdateWhichSharedNotebookRestrictions() const;
211  qint8 updateWhichSharedNotebookRestrictions() const;
212  void setUpdateWhichSharedNotebookRestrictions(const qint8 which);
213 
214  bool hasExpungeWhichSharedNotebookRestrictions() const;
215  qint8 expungeWhichSharedNotebookRestrictions() const;
216  void setExpungeWhichSharedNotebookRestrictions(const qint8 which);
217 
218  bool hasRestrictions() const;
219  const qevercloud::NotebookRestrictions & restrictions() const;
220  void setNotebookRestrictions(qevercloud::NotebookRestrictions && restrictions);
221 
222  // Recipient settings
223 
224  bool hasRecipientReminderNotifyEmail() const;
225  bool recipientReminderNotifyEmail() const;
226  void setRecipientReminderNotifyEmail(const bool notifyEmail);
227 
228  bool hasRecipientReminderNotifyInApp() const;
229  bool recipientReminderNotifyInApp() const;
230  void setRecipientReminderNotifyInApp(const bool notifyInApp);
231 
232  bool hasRecipientInMyList() const;
233  bool recipientInMyList() const;
234  void setRecipientInMyList(const bool inMyList);
235 
236  bool hasRecipientStack() const;
237  const QString & recipientStack() const;
238  void setRecipientStack(const QString & recipientString);
239 
240  bool hasRecipientSettings() const;
241  const qevercloud::NotebookRecipientSettings & recipientSettings() const;
242  void setNotebookRecipientSettings(qevercloud::NotebookRecipientSettings && settings);
243 
244  virtual QTextStream & print(QTextStream & strm) const Q_DECL_OVERRIDE;
245 
246 private:
247  QSharedDataPointer<NotebookData> d;
248 };
249 
250 } // namespace quentier
251 
252 Q_DECLARE_METATYPE(quentier::Notebook)
253 
254 #endif // LIB_QUENTIER_TYPES_NOTEBOOK_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:38
Definition: SharedNotebook.h:36
Definition: Notebook.h:38
Definition: User.h:37
Definition: IFavoritableDataElement.h:31