~rpadovani/reminders-app/1385429

« back to all changes in this revision

Viewing changes to src/plugin/Evernote/notesstore.h

  • Committer: Tarmac
  • Author(s): Michael Zanetti
  • Date: 2014-10-11 16:31:17 UTC
  • mfrom: (266.2.6 reminders-app-tags)
  • Revision ID: tarmac-20141011163117-k34jgx6jk5zizxpw
Add support for tags. Fixes: https://bugs.launchpad.net/bugs/1379747.

Approved by Riccardo Padovani, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
class Notebook;
43
43
class Note;
 
44
class Tag;
44
45
 
45
46
using namespace apache::thrift::transport;
46
47
 
72
73
        RolePlaintextContent,
73
74
        RoleTagline,
74
75
        RoleResourceUrls,
75
 
        RoleReminderSorting
 
76
        RoleReminderSorting,
 
77
        RoleTagGuids
76
78
    };
77
79
 
78
80
    ~NotesStore();
80
82
 
81
83
    bool loading() const;
82
84
    bool notebooksLoading() const;
 
85
    bool tagsLoading() const;
83
86
 
84
87
    QString error() const;
85
88
    QString notebooksError() const;
 
89
    QString tagsError() const;
86
90
 
87
91
    int count() const;
88
92
 
107
111
    Q_INVOKABLE void saveNotebook(const QString &guid);
108
112
    Q_INVOKABLE void expungeNotebook(const QString &guid);
109
113
 
 
114
    QList<Tag*> tags() const;
 
115
    Q_INVOKABLE Tag* tag(const QString &guid);
 
116
    Q_INVOKABLE void createTag(const QString &name);
 
117
    Q_INVOKABLE void saveTag(const QString &guid);
 
118
    Q_INVOKABLE void tagNote(const QString &noteGuid, const QString &tagGuid);
 
119
    Q_INVOKABLE void untagNote(const QString &noteGuid, const QString &tagGuid);
 
120
 
110
121
public slots:
111
122
    void refreshNotes(const QString &filterNotebookGuid = QString());
112
123
    void refreshNoteContent(const QString &guid, bool withResourceContent = false);
113
124
    void refreshNotebooks();
 
125
    void refreshTags();
114
126
 
115
127
signals:
116
128
    void tokenChanged();
117
129
    void loadingChanged();
118
130
    void notebooksLoadingChanged();
 
131
    void tagsLoadingChanged();
119
132
    void errorChanged();
120
133
    void notebooksErrorChanged();
 
134
    void tagsErrorChanged();
121
135
    void countChanged();
122
136
 
123
137
    void noteCreated(const QString &guid, const QString &notebookGuid);
129
143
    void notebookChanged(const QString &guid);
130
144
    void notebookRemoved(const QString &guid);
131
145
 
 
146
    void tagAdded(const QString &guid);
 
147
    void tagChanged(const QString &guid);
 
148
    void tagRemoved(const QString &guid);
 
149
 
132
150
private slots:
133
151
    void fetchNotesJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::NotesMetadataList &results);
134
152
    void fetchNotebooksJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const std::vector<evernote::edam::Notebook> &results);
139
157
    void deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid);
140
158
    void createNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result);
141
159
    void expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid);
 
160
    void fetchTagsJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const std::vector<evernote::edam::Tag> &results);
 
161
    void createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Tag &result);
 
162
    void saveTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage);
142
163
 
143
164
    void emitDataChanged();
144
165
private:
147
168
 
148
169
    bool m_loading;
149
170
    bool m_notebooksLoading;
 
171
    bool m_tagsLoading;
150
172
 
151
173
    QString m_error;
152
174
    QString m_notebooksError;
 
175
    QString m_tagsError;
153
176
 
154
177
    QList<Note*> m_notes;
155
178
    QList<Notebook*> m_notebooks;
 
179
    QList<Tag*> m_tags;
156
180
 
157
 
    // Keep hashes for faster lookups as we always identify notes via guid
 
181
    // Keep hashes for faster lookups as we always identify things via guid
158
182
    QHash<QString, Note*> m_notesHash;
159
183
    QHash<QString, Notebook*> m_notebooksHash;
 
184
    QHash<QString, Tag*> m_tagsHash;
160
185
};
161
186
 
162
187
#endif // NOTESSTORE_H