Merge lp:~mzanetti/reminders-app/enable-deleting-notebooks-and-tags into lp:reminders-app
- enable-deleting-notebooks-and-tags
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Riccardo Padovani |
Approved revision: | 453 |
Merged at revision: | 451 |
Proposed branch: | lp:~mzanetti/reminders-app/enable-deleting-notebooks-and-tags |
Merge into: | lp:reminders-app |
Diff against target: |
761 lines (+303/-38) 16 files modified
src/app/qml/components/NotebooksDelegate.qml (+1/-0) src/app/qml/components/TagsDelegate.qml (+1/-0) src/app/qml/reminders.qml (+2/-1) src/libqtevernote/CMakeLists.txt (+1/-0) src/libqtevernote/jobs/expungetagjob.cpp (+52/-0) src/libqtevernote/jobs/expungetagjob.h (+46/-0) src/libqtevernote/notebook.cpp (+17/-0) src/libqtevernote/notebook.h (+5/-0) src/libqtevernote/notebooks.cpp (+11/-0) src/libqtevernote/notebooks.h (+3/-1) src/libqtevernote/notesstore.cpp (+127/-35) src/libqtevernote/notesstore.h (+1/-0) src/libqtevernote/tag.cpp (+17/-0) src/libqtevernote/tag.h (+5/-0) src/libqtevernote/tags.cpp (+11/-0) src/libqtevernote/tags.h (+3/-1) |
To merge this branch: | bzr merge lp:~mzanetti/reminders-app/enable-deleting-notebooks-and-tags |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Riccardo Padovani | Approve | ||
Review via email: mp+261774@code.launchpad.net |
Commit message
Enable deleting notebooks and tags on Evernote
Description of the change
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Riccardo Padovani (rpadovani) wrote : | # |
There are a lot of warnings due your changes: http://
Also, there is a strange warning in qml when you delete a tag which has notes attached: it says
`Sync: Save tag job finished, but tag can't be found any more`
This is really a minor issue, but as console output doesn't make any sense
- 452. By Michael Zanetti
-
fix networkingstatus check
- 453. By Michael Zanetti
-
fix warnings, drop unneeded save call before deleting
Michael Zanetti (mzanetti) wrote : | # |
> There are a lot of warnings due your changes:
> http://
>
> Also, there is a strange warning in qml when you delete a tag which has notes
> attached: it says
>
> `Sync: Save tag job finished, but tag can't be found any more`
>
> This is really a minor issue, but as console output doesn't make any sense
All fixed. thanks a lot
Riccardo Padovani (rpadovani) wrote : | # |
Tested deeply, looks all good to me now, thanks!
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:453
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'src/app/qml/components/NotebooksDelegate.qml' | |||
2 | --- src/app/qml/components/NotebooksDelegate.qml 2015-03-15 20:00:21 +0000 | |||
3 | +++ src/app/qml/components/NotebooksDelegate.qml 2015-06-11 21:38:48 +0000 | |||
4 | @@ -89,6 +89,7 @@ | |||
5 | 89 | color: root.notebookColor | 89 | color: root.notebookColor |
6 | 90 | fontSize: "large" | 90 | fontSize: "large" |
7 | 91 | Layout.fillWidth: true | 91 | Layout.fillWidth: true |
8 | 92 | font.strikeout: model.deleted | ||
9 | 92 | } | 93 | } |
10 | 93 | 94 | ||
11 | 94 | Label { | 95 | Label { |
12 | 95 | 96 | ||
13 | === modified file 'src/app/qml/components/TagsDelegate.qml' | |||
14 | --- src/app/qml/components/TagsDelegate.qml 2015-03-15 20:00:21 +0000 | |||
15 | +++ src/app/qml/components/TagsDelegate.qml 2015-06-11 21:38:48 +0000 | |||
16 | @@ -80,6 +80,7 @@ | |||
17 | 80 | text: model.name | 80 | text: model.name |
18 | 81 | fontSize: "large" | 81 | fontSize: "large" |
19 | 82 | Layout.fillWidth: true | 82 | Layout.fillWidth: true |
20 | 83 | font.strikeout: model.deleted | ||
21 | 83 | } | 84 | } |
22 | 84 | } | 85 | } |
23 | 85 | 86 | ||
24 | 86 | 87 | ||
25 | === modified file 'src/app/qml/reminders.qml' | |||
26 | --- src/app/qml/reminders.qml 2015-06-01 09:56:30 +0000 | |||
27 | +++ src/app/qml/reminders.qml 2015-06-11 21:38:48 +0000 | |||
28 | @@ -383,7 +383,8 @@ | |||
29 | 383 | onAuthenticated: { | 383 | onAuthenticated: { |
30 | 384 | EvernoteConnection.token = reply.AccessToken; | 384 | EvernoteConnection.token = reply.AccessToken; |
31 | 385 | print("token is:", EvernoteConnection.token) | 385 | print("token is:", EvernoteConnection.token) |
33 | 386 | if (NetworkingStatus.online) { | 386 | print("NetworkingStatus.online:", NetworkingStatus.Online) |
34 | 387 | if (NetworkingStatus.Online) { | ||
35 | 387 | EvernoteConnection.connectToEvernote(); | 388 | EvernoteConnection.connectToEvernote(); |
36 | 388 | } | 389 | } |
37 | 389 | } | 390 | } |
38 | 390 | 391 | ||
39 | === modified file 'src/libqtevernote/CMakeLists.txt' | |||
40 | --- src/libqtevernote/CMakeLists.txt 2015-03-06 00:42:42 +0000 | |||
41 | +++ src/libqtevernote/CMakeLists.txt 2015-06-11 21:38:48 +0000 | |||
42 | @@ -32,6 +32,7 @@ | |||
43 | 32 | jobs/fetchtagsjob.cpp | 32 | jobs/fetchtagsjob.cpp |
44 | 33 | jobs/createtagjob.cpp | 33 | jobs/createtagjob.cpp |
45 | 34 | jobs/savetagjob.cpp | 34 | jobs/savetagjob.cpp |
46 | 35 | jobs/expungetagjob.cpp | ||
47 | 35 | resourceimageprovider.cpp | 36 | resourceimageprovider.cpp |
48 | 36 | utils/enmldocument.cpp | 37 | utils/enmldocument.cpp |
49 | 37 | utils/organizeradapter.cpp | 38 | utils/organizeradapter.cpp |
50 | 38 | 39 | ||
51 | === added file 'src/libqtevernote/jobs/expungetagjob.cpp' | |||
52 | --- src/libqtevernote/jobs/expungetagjob.cpp 1970-01-01 00:00:00 +0000 | |||
53 | +++ src/libqtevernote/jobs/expungetagjob.cpp 2015-06-11 21:38:48 +0000 | |||
54 | @@ -0,0 +1,52 @@ | |||
55 | 1 | /* | ||
56 | 2 | * Copyright: 2015 Canonical, Ltd | ||
57 | 3 | * | ||
58 | 4 | * This file is part of reminders | ||
59 | 5 | * | ||
60 | 6 | * reminders is free software: you can redistribute it and/or modify | ||
61 | 7 | * it under the terms of the GNU General Public License as published by | ||
62 | 8 | * the Free Software Foundation; version 3. | ||
63 | 9 | * | ||
64 | 10 | * reminders is distributed in the hope that it will be useful, | ||
65 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
66 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
67 | 13 | * GNU General Public License for more details. | ||
68 | 14 | * | ||
69 | 15 | * You should have received a copy of the GNU General Public License | ||
70 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
71 | 17 | * | ||
72 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
73 | 19 | */ | ||
74 | 20 | |||
75 | 21 | #include "expungetagjob.h" | ||
76 | 22 | |||
77 | 23 | ExpungeTagJob::ExpungeTagJob(const QString &guid, QObject *parent) : | ||
78 | 24 | NotesStoreJob(parent), | ||
79 | 25 | m_guid(guid) | ||
80 | 26 | { | ||
81 | 27 | } | ||
82 | 28 | |||
83 | 29 | bool ExpungeTagJob::operator==(const EvernoteJob *other) const | ||
84 | 30 | { | ||
85 | 31 | const ExpungeTagJob *otherJob = qobject_cast<const ExpungeTagJob*>(other); | ||
86 | 32 | if (!otherJob) { | ||
87 | 33 | return false; | ||
88 | 34 | } | ||
89 | 35 | return this->m_guid == otherJob->m_guid; | ||
90 | 36 | } | ||
91 | 37 | |||
92 | 38 | void ExpungeTagJob::attachToDuplicate(const EvernoteJob *other) | ||
93 | 39 | { | ||
94 | 40 | const ExpungeTagJob *otherJob = static_cast<const ExpungeTagJob*>(other); | ||
95 | 41 | connect(otherJob, &ExpungeTagJob::jobDone, this, &ExpungeTagJob::jobDone); | ||
96 | 42 | } | ||
97 | 43 | |||
98 | 44 | void ExpungeTagJob::startJob() | ||
99 | 45 | { | ||
100 | 46 | client()->expungeTag(token().toStdString(), m_guid.toStdString()); | ||
101 | 47 | } | ||
102 | 48 | |||
103 | 49 | void ExpungeTagJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage) | ||
104 | 50 | { | ||
105 | 51 | emit jobDone(errorCode, errorMessage, m_guid); | ||
106 | 52 | } | ||
107 | 0 | 53 | ||
108 | === added file 'src/libqtevernote/jobs/expungetagjob.h' | |||
109 | --- src/libqtevernote/jobs/expungetagjob.h 1970-01-01 00:00:00 +0000 | |||
110 | +++ src/libqtevernote/jobs/expungetagjob.h 2015-06-11 21:38:48 +0000 | |||
111 | @@ -0,0 +1,46 @@ | |||
112 | 1 | /* | ||
113 | 2 | * Copyright: 2015 Canonical, Ltd | ||
114 | 3 | * | ||
115 | 4 | * This file is part of reminders | ||
116 | 5 | * | ||
117 | 6 | * reminders is free software: you can redistribute it and/or modify | ||
118 | 7 | * it under the terms of the GNU General Public License as published by | ||
119 | 8 | * the Free Software Foundation; version 3. | ||
120 | 9 | * | ||
121 | 10 | * reminders is distributed in the hope that it will be useful, | ||
122 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
123 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
124 | 13 | * GNU General Public License for more details. | ||
125 | 14 | * | ||
126 | 15 | * You should have received a copy of the GNU General Public License | ||
127 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
128 | 17 | * | ||
129 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
130 | 19 | */ | ||
131 | 20 | |||
132 | 21 | #ifndef EXPUNGETAGJOB_H | ||
133 | 22 | #define EXPUNGETAGJOB_H | ||
134 | 23 | |||
135 | 24 | #include "notesstorejob.h" | ||
136 | 25 | |||
137 | 26 | class ExpungeTagJob : public NotesStoreJob | ||
138 | 27 | { | ||
139 | 28 | Q_OBJECT | ||
140 | 29 | public: | ||
141 | 30 | explicit ExpungeTagJob(const QString &guid, QObject *parent = 0); | ||
142 | 31 | |||
143 | 32 | virtual bool operator==(const EvernoteJob *other) const override; | ||
144 | 33 | virtual void attachToDuplicate(const EvernoteJob *other) override; | ||
145 | 34 | |||
146 | 35 | signals: | ||
147 | 36 | void jobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid); | ||
148 | 37 | |||
149 | 38 | private slots: | ||
150 | 39 | void startJob(); | ||
151 | 40 | void emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage); | ||
152 | 41 | |||
153 | 42 | private: | ||
154 | 43 | QString m_guid; | ||
155 | 44 | }; | ||
156 | 45 | |||
157 | 46 | #endif // EXPUNGETAGJOB_H | ||
158 | 0 | 47 | ||
159 | === modified file 'src/libqtevernote/notebook.cpp' | |||
160 | --- src/libqtevernote/notebook.cpp 2015-03-06 00:47:45 +0000 | |||
161 | +++ src/libqtevernote/notebook.cpp 2015-06-11 21:38:48 +0000 | |||
162 | @@ -33,6 +33,7 @@ | |||
163 | 33 | m_guid(guid), | 33 | m_guid(guid), |
164 | 34 | m_published(false), | 34 | m_published(false), |
165 | 35 | m_isDefaultNotebook(false), | 35 | m_isDefaultNotebook(false), |
166 | 36 | m_deleted(false), | ||
167 | 36 | m_loading(false), | 37 | m_loading(false), |
168 | 37 | m_syncError(false) | 38 | m_syncError(false) |
169 | 38 | { | 39 | { |
170 | @@ -44,6 +45,7 @@ | |||
171 | 44 | m_lastSyncedSequenceNumber = infoFile.value("lastSyncedSequenceNumber", 0).toUInt(); | 45 | m_lastSyncedSequenceNumber = infoFile.value("lastSyncedSequenceNumber", 0).toUInt(); |
172 | 45 | m_isDefaultNotebook = infoFile.value("isDefaultNotebook", false).toBool(); | 46 | m_isDefaultNotebook = infoFile.value("isDefaultNotebook", false).toBool(); |
173 | 46 | m_synced = m_lastSyncedSequenceNumber == m_updateSequenceNumber; | 47 | m_synced = m_lastSyncedSequenceNumber == m_updateSequenceNumber; |
174 | 48 | m_deleted = infoFile.value("deleted", false).toBool(); | ||
175 | 47 | 49 | ||
176 | 48 | foreach (Note *note, NotesStore::instance()->notes()) { | 50 | foreach (Note *note, NotesStore::instance()->notes()) { |
177 | 49 | if (note->notebookGuid() == m_guid) { | 51 | if (note->notebookGuid() == m_guid) { |
178 | @@ -155,6 +157,7 @@ | |||
179 | 155 | notebook->setName(m_name); | 157 | notebook->setName(m_name); |
180 | 156 | notebook->setLastUpdated(m_lastUpdated); | 158 | notebook->setLastUpdated(m_lastUpdated); |
181 | 157 | notebook->setPublished(m_published); | 159 | notebook->setPublished(m_published); |
182 | 160 | notebook->setDeleted(m_deleted); | ||
183 | 158 | 161 | ||
184 | 159 | return notebook; | 162 | return notebook; |
185 | 160 | } | 163 | } |
186 | @@ -232,6 +235,7 @@ | |||
187 | 232 | infoFile.value("lastUpdated", m_lastUpdated); | 235 | infoFile.value("lastUpdated", m_lastUpdated); |
188 | 233 | infoFile.setValue("lastSyncedSequenceNumber", m_lastSyncedSequenceNumber); | 236 | infoFile.setValue("lastSyncedSequenceNumber", m_lastSyncedSequenceNumber); |
189 | 234 | infoFile.setValue("isDefaultNotebook", m_isDefaultNotebook); | 237 | infoFile.setValue("isDefaultNotebook", m_isDefaultNotebook); |
190 | 238 | infoFile.setValue("deleted", m_deleted); | ||
191 | 235 | } | 239 | } |
192 | 236 | 240 | ||
193 | 237 | void Notebook::deleteInfoFile() | 241 | void Notebook::deleteInfoFile() |
194 | @@ -257,6 +261,11 @@ | |||
195 | 257 | return m_syncError; | 261 | return m_syncError; |
196 | 258 | } | 262 | } |
197 | 259 | 263 | ||
198 | 264 | bool Notebook::deleted() const | ||
199 | 265 | { | ||
200 | 266 | return m_deleted; | ||
201 | 267 | } | ||
202 | 268 | |||
203 | 260 | qint32 Notebook::updateSequenceNumber() const | 269 | qint32 Notebook::updateSequenceNumber() const |
204 | 261 | { | 270 | { |
205 | 262 | return m_updateSequenceNumber; | 271 | return m_updateSequenceNumber; |
206 | @@ -287,6 +296,14 @@ | |||
207 | 287 | } | 296 | } |
208 | 288 | } | 297 | } |
209 | 289 | 298 | ||
210 | 299 | void Notebook::setDeleted(bool deleted) | ||
211 | 300 | { | ||
212 | 301 | if (m_deleted != deleted) { | ||
213 | 302 | m_deleted = deleted; | ||
214 | 303 | emit deletedChanged(); | ||
215 | 304 | } | ||
216 | 305 | } | ||
217 | 306 | |||
218 | 290 | void Notebook::setLoading(bool loading) | 307 | void Notebook::setLoading(bool loading) |
219 | 291 | { | 308 | { |
220 | 292 | if (m_loading != loading) { | 309 | if (m_loading != loading) { |
221 | 293 | 310 | ||
222 | === modified file 'src/libqtevernote/notebook.h' | |||
223 | --- src/libqtevernote/notebook.h 2015-03-04 20:30:55 +0000 | |||
224 | +++ src/libqtevernote/notebook.h 2015-06-11 21:38:48 +0000 | |||
225 | @@ -37,6 +37,7 @@ | |||
226 | 37 | Q_PROPERTY(QDateTime lastUpdated READ lastUpdated NOTIFY lastUpdatedChanged) | 37 | Q_PROPERTY(QDateTime lastUpdated READ lastUpdated NOTIFY lastUpdatedChanged) |
227 | 38 | Q_PROPERTY(QString lastUpdatedString READ lastUpdatedString NOTIFY lastUpdatedChanged) | 38 | Q_PROPERTY(QString lastUpdatedString READ lastUpdatedString NOTIFY lastUpdatedChanged) |
228 | 39 | Q_PROPERTY(bool isDefaultNotebook READ isDefaultNotebook WRITE setIsDefaultNotebook NOTIFY isDefaultNotebookChanged) | 39 | Q_PROPERTY(bool isDefaultNotebook READ isDefaultNotebook WRITE setIsDefaultNotebook NOTIFY isDefaultNotebookChanged) |
229 | 40 | Q_PROPERTY(bool deleted READ deleted NOTIFY deletedChanged) | ||
230 | 40 | // Don't forget to update clone() if you add new properties | 41 | // Don't forget to update clone() if you add new properties |
231 | 41 | 42 | ||
232 | 42 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged) | 43 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged) |
233 | @@ -71,6 +72,7 @@ | |||
234 | 71 | bool loading() const; | 72 | bool loading() const; |
235 | 72 | bool synced() const; | 73 | bool synced() const; |
236 | 73 | bool syncError() const; | 74 | bool syncError() const; |
237 | 75 | bool deleted() const; | ||
238 | 74 | 76 | ||
239 | 75 | Notebook *clone(); | 77 | Notebook *clone(); |
240 | 76 | 78 | ||
241 | @@ -87,6 +89,7 @@ | |||
242 | 87 | void syncedChanged(); | 89 | void syncedChanged(); |
243 | 88 | void syncErrorChanged(); | 90 | void syncErrorChanged(); |
244 | 89 | void isDefaultNotebookChanged(); | 91 | void isDefaultNotebookChanged(); |
245 | 92 | void deletedChanged(); | ||
246 | 90 | 93 | ||
247 | 91 | private slots: | 94 | private slots: |
248 | 92 | void noteAdded(const QString ¬eGuid, const QString ¬ebookGuid); | 95 | void noteAdded(const QString ¬eGuid, const QString ¬ebookGuid); |
249 | @@ -101,6 +104,7 @@ | |||
250 | 101 | void setSyncError(bool syncError); | 104 | void setSyncError(bool syncError); |
251 | 102 | void setUpdateSequenceNumber(qint32 updateSequenceNumber); | 105 | void setUpdateSequenceNumber(qint32 updateSequenceNumber); |
252 | 103 | void setLastSyncedSequenceNumber(qint32 lastSyncedSequenceNumber); | 106 | void setLastSyncedSequenceNumber(qint32 lastSyncedSequenceNumber); |
253 | 107 | void setDeleted(bool deleted); | ||
254 | 104 | 108 | ||
255 | 105 | void syncToInfoFile(); | 109 | void syncToInfoFile(); |
256 | 106 | void deleteInfoFile(); | 110 | void deleteInfoFile(); |
257 | @@ -114,6 +118,7 @@ | |||
258 | 114 | QDateTime m_lastUpdated; | 118 | QDateTime m_lastUpdated; |
259 | 115 | bool m_isDefaultNotebook; | 119 | bool m_isDefaultNotebook; |
260 | 116 | QList<QString> m_notesList; | 120 | QList<QString> m_notesList; |
261 | 121 | bool m_deleted; | ||
262 | 117 | 122 | ||
263 | 118 | QString m_infoFile; | 123 | QString m_infoFile; |
264 | 119 | 124 | ||
265 | 120 | 125 | ||
266 | === modified file 'src/libqtevernote/notebooks.cpp' | |||
267 | --- src/libqtevernote/notebooks.cpp 2015-03-06 00:47:45 +0000 | |||
268 | +++ src/libqtevernote/notebooks.cpp 2015-06-11 21:38:48 +0000 | |||
269 | @@ -70,6 +70,8 @@ | |||
270 | 70 | return notebook->syncError(); | 70 | return notebook->syncError(); |
271 | 71 | case RoleIsDefaultNotebook: | 71 | case RoleIsDefaultNotebook: |
272 | 72 | return notebook->isDefaultNotebook(); | 72 | return notebook->isDefaultNotebook(); |
273 | 73 | case RoleDeleted: | ||
274 | 74 | return notebook->deleted(); | ||
275 | 73 | } | 75 | } |
276 | 74 | return QVariant(); | 76 | return QVariant(); |
277 | 75 | } | 77 | } |
278 | @@ -94,6 +96,7 @@ | |||
279 | 94 | roles.insert(RoleSynced, "synced"); | 96 | roles.insert(RoleSynced, "synced"); |
280 | 95 | roles.insert(RoleSyncError, "syncError"); | 97 | roles.insert(RoleSyncError, "syncError"); |
281 | 96 | roles.insert(RoleIsDefaultNotebook, "isDefaultNotebook"); | 98 | roles.insert(RoleIsDefaultNotebook, "isDefaultNotebook"); |
282 | 99 | roles.insert(RoleDeleted, "deleted"); | ||
283 | 97 | return roles; | 100 | return roles; |
284 | 98 | } | 101 | } |
285 | 99 | 102 | ||
286 | @@ -121,6 +124,7 @@ | |||
287 | 121 | connect(notebook, &Notebook::loadingChanged, this, &Notebooks::notebookLoadingChanged); | 124 | connect(notebook, &Notebook::loadingChanged, this, &Notebooks::notebookLoadingChanged); |
288 | 122 | connect(notebook, &Notebook::syncErrorChanged, this, &Notebooks::syncErrorChanged); | 125 | connect(notebook, &Notebook::syncErrorChanged, this, &Notebooks::syncErrorChanged); |
289 | 123 | connect(notebook, &Notebook::isDefaultNotebookChanged, this, &Notebooks::isDefaultNotebookChanged); | 126 | connect(notebook, &Notebook::isDefaultNotebookChanged, this, &Notebooks::isDefaultNotebookChanged); |
290 | 127 | connect(notebook, &Notebook::deletedChanged, this, &Notebooks::deletedChanged); | ||
291 | 124 | 128 | ||
292 | 125 | beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); | 129 | beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); |
293 | 126 | m_list.append(guid); | 130 | m_list.append(guid); |
294 | @@ -150,6 +154,13 @@ | |||
295 | 150 | emit dataChanged(idx, idx, QVector<int>() << RoleIsDefaultNotebook); | 154 | emit dataChanged(idx, idx, QVector<int>() << RoleIsDefaultNotebook); |
296 | 151 | } | 155 | } |
297 | 152 | 156 | ||
298 | 157 | void Notebooks::deletedChanged() | ||
299 | 158 | { | ||
300 | 159 | Notebook *notebook = static_cast<Notebook*>(sender()); | ||
301 | 160 | QModelIndex idx = index(m_list.indexOf(notebook->guid())); | ||
302 | 161 | emit dataChanged(idx, idx, QVector<int>() << RoleDeleted); | ||
303 | 162 | } | ||
304 | 163 | |||
305 | 153 | void Notebooks::nameChanged() | 164 | void Notebooks::nameChanged() |
306 | 154 | { | 165 | { |
307 | 155 | Notebook *notebook = static_cast<Notebook*>(sender()); | 166 | Notebook *notebook = static_cast<Notebook*>(sender()); |
308 | 156 | 167 | ||
309 | === modified file 'src/libqtevernote/notebooks.h' | |||
310 | --- src/libqtevernote/notebooks.h 2015-03-04 00:23:45 +0000 | |||
311 | +++ src/libqtevernote/notebooks.h 2015-06-11 21:38:48 +0000 | |||
312 | @@ -42,7 +42,8 @@ | |||
313 | 42 | RoleLoading, | 42 | RoleLoading, |
314 | 43 | RoleSynced, | 43 | RoleSynced, |
315 | 44 | RoleSyncError, | 44 | RoleSyncError, |
317 | 45 | RoleIsDefaultNotebook | 45 | RoleIsDefaultNotebook, |
318 | 46 | RoleDeleted | ||
319 | 46 | }; | 47 | }; |
320 | 47 | explicit Notebooks(QObject *parent = 0); | 48 | explicit Notebooks(QObject *parent = 0); |
321 | 48 | 49 | ||
322 | @@ -76,6 +77,7 @@ | |||
323 | 76 | void notebookLoadingChanged(); | 77 | void notebookLoadingChanged(); |
324 | 77 | void syncErrorChanged(); | 78 | void syncErrorChanged(); |
325 | 78 | void isDefaultNotebookChanged(); | 79 | void isDefaultNotebookChanged(); |
326 | 80 | void deletedChanged(); | ||
327 | 79 | 81 | ||
328 | 80 | private: | 82 | private: |
329 | 81 | QList<QString> m_list; | 83 | QList<QString> m_list; |
330 | 82 | 84 | ||
331 | === modified file 'src/libqtevernote/notesstore.cpp' | |||
332 | --- src/libqtevernote/notesstore.cpp 2015-03-30 19:01:49 +0000 | |||
333 | +++ src/libqtevernote/notesstore.cpp 2015-06-11 21:38:48 +0000 | |||
334 | @@ -41,6 +41,7 @@ | |||
335 | 41 | #include "jobs/fetchtagsjob.h" | 41 | #include "jobs/fetchtagsjob.h" |
336 | 42 | #include "jobs/createtagjob.h" | 42 | #include "jobs/createtagjob.h" |
337 | 43 | #include "jobs/savetagjob.h" | 43 | #include "jobs/savetagjob.h" |
338 | 44 | #include "jobs/expungetagjob.h" | ||
339 | 44 | 45 | ||
340 | 45 | #include "libintl.h" | 46 | #include "libintl.h" |
341 | 46 | 47 | ||
342 | @@ -404,12 +405,17 @@ | |||
343 | 404 | 405 | ||
344 | 405 | void NotesStore::expungeNotebook(const QString &guid) | 406 | void NotesStore::expungeNotebook(const QString &guid) |
345 | 406 | { | 407 | { |
346 | 408 | #ifdef NO_EXPUNGE_NOTEBOOKS | ||
347 | 409 | // This snipped can be used if the app is compiled with a restricted api key | ||
348 | 410 | // that can't expunge notebooks on Evernote. Compile with | ||
349 | 411 | // cmake -DNO_EXPUNGE_NOTEBOOKS=1 | ||
350 | 407 | if (m_username != "@local") { | 412 | if (m_username != "@local") { |
351 | 408 | qCWarning(dcNotesStore) << "Account managed by Evernote. Cannot delete notebooks."; | 413 | qCWarning(dcNotesStore) << "Account managed by Evernote. Cannot delete notebooks."; |
352 | 409 | m_errorQueue.append(QString(gettext("This account is managed by Evernote. Use the Evernote website to delete notebooks."))); | 414 | m_errorQueue.append(QString(gettext("This account is managed by Evernote. Use the Evernote website to delete notebooks."))); |
353 | 410 | emit errorChanged(); | 415 | emit errorChanged(); |
354 | 411 | return; | 416 | return; |
355 | 412 | } | 417 | } |
356 | 418 | #endif | ||
357 | 413 | 419 | ||
358 | 414 | Notebook* notebook = m_notebooksHash.value(guid); | 420 | Notebook* notebook = m_notebooksHash.value(guid); |
359 | 415 | if (!notebook) { | 421 | if (!notebook) { |
360 | @@ -453,17 +459,32 @@ | |||
361 | 453 | } | 459 | } |
362 | 454 | } | 460 | } |
363 | 455 | 461 | ||
375 | 456 | m_notebooks.removeAll(notebook); | 462 | if (notebook->lastSyncedSequenceNumber() == 0) { |
376 | 457 | m_notebooksHash.remove(notebook->guid()); | 463 | emit notebookRemoved(notebook->guid()); |
377 | 458 | emit notebookRemoved(notebook->guid()); | 464 | m_notebooks.removeAll(notebook); |
378 | 459 | 465 | m_notebooksHash.remove(notebook->guid()); | |
379 | 460 | QSettings settings(m_cacheFile, QSettings::IniFormat); | 466 | emit notebookRemoved(notebook->guid()); |
380 | 461 | settings.beginGroup("notebooks"); | 467 | |
381 | 462 | settings.remove(notebook->guid()); | 468 | QSettings settings(m_cacheFile, QSettings::IniFormat); |
382 | 463 | settings.endGroup(); | 469 | settings.beginGroup("notebooks"); |
383 | 464 | 470 | settings.remove(notebook->guid()); | |
384 | 465 | notebook->deleteInfoFile(); | 471 | settings.endGroup(); |
385 | 466 | notebook->deleteLater(); | 472 | |
386 | 473 | notebook->deleteInfoFile(); | ||
387 | 474 | notebook->deleteLater(); | ||
388 | 475 | } else { | ||
389 | 476 | qCDebug(dcNotesStore) << "Setting notebook to deleted:" << notebook->guid(); | ||
390 | 477 | notebook->setDeleted(true); | ||
391 | 478 | notebook->setUpdateSequenceNumber(notebook->updateSequenceNumber()+1); | ||
392 | 479 | emit notebookChanged(notebook->guid()); | ||
393 | 480 | syncToCacheFile(notebook); | ||
394 | 481 | |||
395 | 482 | if (EvernoteConnection::instance()->isConnected()) { | ||
396 | 483 | ExpungeNotebookJob *job = new ExpungeNotebookJob(guid, this); | ||
397 | 484 | connect(job, &ExpungeNotebookJob::jobDone, this, &NotesStore::expungeNotebookJobDone); | ||
398 | 485 | EvernoteConnection::instance()->enqueue(job); | ||
399 | 486 | } | ||
400 | 487 | } | ||
401 | 467 | } | 488 | } |
402 | 468 | 489 | ||
403 | 469 | QList<Tag *> NotesStore::tags() const | 490 | QList<Tag *> NotesStore::tags() const |
404 | @@ -560,6 +581,33 @@ | |||
405 | 560 | syncToCacheFile(tag); | 581 | syncToCacheFile(tag); |
406 | 561 | } | 582 | } |
407 | 562 | 583 | ||
408 | 584 | void NotesStore::expungeTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid) | ||
409 | 585 | { | ||
410 | 586 | handleUserError(errorCode); | ||
411 | 587 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | ||
412 | 588 | qCWarning(dcSync) << "Error expunging tag:" << errorMessage; | ||
413 | 589 | return; | ||
414 | 590 | } | ||
415 | 591 | |||
416 | 592 | if (!m_tagsHash.contains(guid)) { | ||
417 | 593 | qCWarning(dcSync) << "Received a response for a expungeTag call, but can't find tag around any more."; | ||
418 | 594 | return; | ||
419 | 595 | } | ||
420 | 596 | |||
421 | 597 | emit tagRemoved(guid); | ||
422 | 598 | Tag *tag = m_tagsHash.take(guid); | ||
423 | 599 | m_tags.removeAll(tag); | ||
424 | 600 | |||
425 | 601 | QSettings cacheFile(m_cacheFile, QSettings::IniFormat); | ||
426 | 602 | cacheFile.beginGroup("tags"); | ||
427 | 603 | cacheFile.remove(guid); | ||
428 | 604 | cacheFile.endGroup(); | ||
429 | 605 | tag->syncToInfoFile(); | ||
430 | 606 | |||
431 | 607 | tag->deleteInfoFile(); | ||
432 | 608 | tag->deleteLater(); | ||
433 | 609 | } | ||
434 | 610 | |||
435 | 563 | void NotesStore::tagNote(const QString ¬eGuid, const QString &tagGuid) | 611 | void NotesStore::tagNote(const QString ¬eGuid, const QString &tagGuid) |
436 | 564 | { | 612 | { |
437 | 565 | Note *note = m_notesHash.value(noteGuid); | 613 | Note *note = m_notesHash.value(noteGuid); |
438 | @@ -1030,14 +1078,19 @@ | |||
439 | 1030 | syncToCacheFile(notebook); | 1078 | syncToCacheFile(notebook); |
440 | 1031 | } | 1079 | } |
441 | 1032 | } else { | 1080 | } else { |
442 | 1033 | // Local notebook changed. See if we can push our changes | ||
443 | 1034 | if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) { | 1081 | if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) { |
450 | 1035 | qCDebug(dcNotesStore) << "Local Notebook changed. Uploading changes to Evernote:" << notebook->guid(); | 1082 | // Local notebook changed. See if we can push our changes |
451 | 1036 | SaveNotebookJob *job = new SaveNotebookJob(notebook); | 1083 | if (notebook->deleted()) { |
452 | 1037 | connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone); | 1084 | qCDebug(dcNotesStore) << "Local notebook has been deleted. Deleting from server"; |
453 | 1038 | EvernoteConnection::instance()->enqueue(job); | 1085 | expungeNotebook(notebook->guid()); |
454 | 1039 | notebook->setLoading(true); | 1086 | } else { |
455 | 1040 | emit notebookChanged(notebook->guid()); | 1087 | qCDebug(dcNotesStore) << "Local Notebook changed. Uploading changes to Evernote:" << notebook->guid(); |
456 | 1088 | SaveNotebookJob *job = new SaveNotebookJob(notebook); | ||
457 | 1089 | connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone); | ||
458 | 1090 | EvernoteConnection::instance()->enqueue(job); | ||
459 | 1091 | notebook->setLoading(true); | ||
460 | 1092 | emit notebookChanged(notebook->guid()); | ||
461 | 1093 | } | ||
462 | 1041 | } else { | 1094 | } else { |
463 | 1042 | qCWarning(dcNotesStore) << "Sync conflict in notebook:" << notebook->name(); | 1095 | qCWarning(dcNotesStore) << "Sync conflict in notebook:" << notebook->name(); |
464 | 1043 | qCWarning(dcNotesStore) << "Resolving of sync conflicts is not implemented yet."; | 1096 | qCWarning(dcNotesStore) << "Resolving of sync conflicts is not implemented yet."; |
465 | @@ -1134,11 +1187,16 @@ | |||
466 | 1134 | } else { | 1187 | } else { |
467 | 1135 | // local tag changed. See if we can sync it to the server | 1188 | // local tag changed. See if we can sync it to the server |
468 | 1136 | if (result.updateSequenceNum == tag->lastSyncedSequenceNumber()) { | 1189 | if (result.updateSequenceNum == tag->lastSyncedSequenceNumber()) { |
474 | 1137 | SaveTagJob *job = new SaveTagJob(tag); | 1190 | if (tag->deleted()) { |
475 | 1138 | connect(job, &SaveTagJob::jobDone, this, &NotesStore::saveTagJobDone); | 1191 | qCDebug(dcNotesStore) << "Tag has been deleted locally"; |
476 | 1139 | EvernoteConnection::instance()->enqueue(job); | 1192 | expungeTag(tag->guid()); |
477 | 1140 | tag->setLoading(true); | 1193 | } else { |
478 | 1141 | emit tagChanged(tag->guid()); | 1194 | SaveTagJob *job = new SaveTagJob(tag); |
479 | 1195 | connect(job, &SaveTagJob::jobDone, this, &NotesStore::saveTagJobDone); | ||
480 | 1196 | EvernoteConnection::instance()->enqueue(job); | ||
481 | 1197 | tag->setLoading(true); | ||
482 | 1198 | emit tagChanged(tag->guid()); | ||
483 | 1199 | } | ||
484 | 1142 | } else { | 1200 | } else { |
485 | 1143 | qCWarning(dcSync) << "CONFLICT in tag" << tag->name(); | 1201 | qCWarning(dcSync) << "CONFLICT in tag" << tag->name(); |
486 | 1144 | tag->setSyncError(true); | 1202 | tag->setSyncError(true); |
487 | @@ -1473,9 +1531,22 @@ | |||
488 | 1473 | qCWarning(dcSync) << "Error expunging notebook:" << errorMessage; | 1531 | qCWarning(dcSync) << "Error expunging notebook:" << errorMessage; |
489 | 1474 | return; | 1532 | return; |
490 | 1475 | } | 1533 | } |
491 | 1534 | |||
492 | 1535 | if (!m_notebooksHash.contains(guid)) { | ||
493 | 1536 | qCWarning(dcSync) << "Received a response for a expungeNotebook call, but can't find notebook around any more."; | ||
494 | 1537 | return; | ||
495 | 1538 | } | ||
496 | 1539 | |||
497 | 1476 | emit notebookRemoved(guid); | 1540 | emit notebookRemoved(guid); |
498 | 1477 | Notebook *notebook = m_notebooksHash.take(guid); | 1541 | Notebook *notebook = m_notebooksHash.take(guid); |
499 | 1478 | m_notebooks.removeAll(notebook); | 1542 | m_notebooks.removeAll(notebook); |
500 | 1543 | |||
501 | 1544 | QSettings settings(m_cacheFile, QSettings::IniFormat); | ||
502 | 1545 | settings.beginGroup("notebooks"); | ||
503 | 1546 | settings.remove(notebook->guid()); | ||
504 | 1547 | settings.endGroup(); | ||
505 | 1548 | |||
506 | 1549 | notebook->deleteInfoFile(); | ||
507 | 1479 | notebook->deleteLater(); | 1550 | notebook->deleteLater(); |
508 | 1480 | } | 1551 | } |
509 | 1481 | 1552 | ||
510 | @@ -1712,12 +1783,18 @@ | |||
511 | 1712 | 1783 | ||
512 | 1713 | void NotesStore::expungeTag(const QString &guid) | 1784 | void NotesStore::expungeTag(const QString &guid) |
513 | 1714 | { | 1785 | { |
514 | 1786 | #ifdef NO_EXPUNGE_TAGS | ||
515 | 1787 | // This snipped can be used if the app is compiled with a restricted api key | ||
516 | 1788 | // that can't expunge tags on Evernote. Compile with | ||
517 | 1789 | // cmake -DNO_EXPUNGE_TAGS=1 | ||
518 | 1790 | |||
519 | 1715 | if (m_username != "@local") { | 1791 | if (m_username != "@local") { |
520 | 1716 | qCWarning(dcNotesStore) << "This account is managed by Evernote. Cannot delete tags."; | 1792 | qCWarning(dcNotesStore) << "This account is managed by Evernote. Cannot delete tags."; |
521 | 1717 | m_errorQueue.append(gettext("This account is managed by Evernote. Please use the Evernote website to delete tags.")); | 1793 | m_errorQueue.append(gettext("This account is managed by Evernote. Please use the Evernote website to delete tags.")); |
522 | 1718 | emit errorChanged(); | 1794 | emit errorChanged(); |
523 | 1719 | return; | 1795 | return; |
524 | 1720 | } | 1796 | } |
525 | 1797 | #endif | ||
526 | 1721 | 1798 | ||
527 | 1722 | Tag *tag = m_tagsHash.value(guid); | 1799 | Tag *tag = m_tagsHash.value(guid); |
528 | 1723 | if (!tag) { | 1800 | if (!tag) { |
529 | @@ -1730,23 +1807,38 @@ | |||
530 | 1730 | Note *note = m_notesHash.value(noteGuid); | 1807 | Note *note = m_notesHash.value(noteGuid); |
531 | 1731 | if (!note) { | 1808 | if (!note) { |
532 | 1732 | qCWarning(dcNotesStore) << "Tag holds note" << noteGuid << "which hasn't been found in Notes Store"; | 1809 | qCWarning(dcNotesStore) << "Tag holds note" << noteGuid << "which hasn't been found in Notes Store"; |
533 | 1810 | Q_ASSERT(false); | ||
534 | 1733 | continue; | 1811 | continue; |
535 | 1734 | } | 1812 | } |
536 | 1735 | untagNote(noteGuid, guid); | 1813 | untagNote(noteGuid, guid); |
537 | 1736 | } | 1814 | } |
538 | 1737 | 1815 | ||
551 | 1738 | emit tagRemoved(guid); | 1816 | if (tag->lastSyncedSequenceNumber() == 0) { |
552 | 1739 | m_tagsHash.remove(guid); | 1817 | emit tagRemoved(guid); |
553 | 1740 | m_tags.removeAll(tag); | 1818 | m_tagsHash.remove(guid); |
554 | 1741 | 1819 | m_tags.removeAll(tag); | |
555 | 1742 | QSettings cacheFile(m_cacheFile, QSettings::IniFormat); | 1820 | |
556 | 1743 | cacheFile.beginGroup("tags"); | 1821 | QSettings cacheFile(m_cacheFile, QSettings::IniFormat); |
557 | 1744 | cacheFile.remove(guid); | 1822 | cacheFile.beginGroup("tags"); |
558 | 1745 | cacheFile.endGroup(); | 1823 | cacheFile.remove(guid); |
559 | 1746 | tag->syncToInfoFile(); | 1824 | cacheFile.endGroup(); |
560 | 1747 | 1825 | tag->syncToInfoFile(); | |
561 | 1748 | tag->deleteInfoFile(); | 1826 | |
562 | 1749 | tag->deleteLater(); | 1827 | tag->deleteInfoFile(); |
563 | 1828 | tag->deleteLater(); | ||
564 | 1829 | } else { | ||
565 | 1830 | qCDebug(dcNotesStore) << "Setting tag to deleted:" << tag->guid(); | ||
566 | 1831 | tag->setDeleted(true); | ||
567 | 1832 | tag->setUpdateSequenceNumber(tag->updateSequenceNumber()+1); | ||
568 | 1833 | emit tagChanged(tag->guid()); | ||
569 | 1834 | syncToCacheFile(tag); | ||
570 | 1835 | |||
571 | 1836 | if (EvernoteConnection::instance()->isConnected()) { | ||
572 | 1837 | ExpungeTagJob *job = new ExpungeTagJob(guid, this); | ||
573 | 1838 | connect(job, &ExpungeTagJob::jobDone, this, &NotesStore::expungeTagJobDone); | ||
574 | 1839 | EvernoteConnection::instance()->enqueue(job); | ||
575 | 1840 | } | ||
576 | 1841 | } | ||
577 | 1750 | } | 1842 | } |
578 | 1751 | 1843 | ||
579 | 1752 | void NotesStore::resolveConflict(const QString ¬eGuid, NotesStore::ConflictResolveMode mode) | 1844 | void NotesStore::resolveConflict(const QString ¬eGuid, NotesStore::ConflictResolveMode mode) |
580 | 1753 | 1845 | ||
581 | === modified file 'src/libqtevernote/notesstore.h' | |||
582 | --- src/libqtevernote/notesstore.h 2015-03-15 20:00:21 +0000 | |||
583 | +++ src/libqtevernote/notesstore.h 2015-06-11 21:38:48 +0000 | |||
584 | @@ -197,6 +197,7 @@ | |||
585 | 197 | void fetchTagsJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const std::vector<evernote::edam::Tag> &results); | 197 | void fetchTagsJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const std::vector<evernote::edam::Tag> &results); |
586 | 198 | void createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result); | 198 | void createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result); |
587 | 199 | void saveTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Tag &result); | 199 | void saveTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Tag &result); |
588 | 200 | void expungeTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid); | ||
589 | 200 | 201 | ||
590 | 201 | void syncToCacheFile(Note *note); | 202 | void syncToCacheFile(Note *note); |
591 | 202 | void deleteFromCacheFile(Note* note); | 203 | void deleteFromCacheFile(Note* note); |
592 | 203 | 204 | ||
593 | === modified file 'src/libqtevernote/tag.cpp' | |||
594 | --- src/libqtevernote/tag.cpp 2015-03-04 20:30:55 +0000 | |||
595 | +++ src/libqtevernote/tag.cpp 2015-06-11 21:38:48 +0000 | |||
596 | @@ -29,12 +29,14 @@ | |||
597 | 29 | QObject(parent), | 29 | QObject(parent), |
598 | 30 | m_updateSequenceNumber(updateSequenceNumber), | 30 | m_updateSequenceNumber(updateSequenceNumber), |
599 | 31 | m_guid(guid), | 31 | m_guid(guid), |
600 | 32 | m_deleted(false), | ||
601 | 32 | m_loading(false), | 33 | m_loading(false), |
602 | 33 | m_syncError(false) | 34 | m_syncError(false) |
603 | 34 | { | 35 | { |
604 | 35 | setGuid(guid); | 36 | setGuid(guid); |
605 | 36 | QSettings infoFile(m_infoFile, QSettings::IniFormat); | 37 | QSettings infoFile(m_infoFile, QSettings::IniFormat); |
606 | 37 | m_name = infoFile.value("name").toString(); | 38 | m_name = infoFile.value("name").toString(); |
607 | 39 | m_deleted = infoFile.value("deleted").toBool(); | ||
608 | 38 | m_lastSyncedSequenceNumber = infoFile.value("lastSyncedSequenceNumber", 0).toUInt(); | 40 | m_lastSyncedSequenceNumber = infoFile.value("lastSyncedSequenceNumber", 0).toUInt(); |
609 | 39 | m_synced = m_lastSyncedSequenceNumber == m_updateSequenceNumber; | 41 | m_synced = m_lastSyncedSequenceNumber == m_updateSequenceNumber; |
610 | 40 | 42 | ||
611 | @@ -129,6 +131,7 @@ | |||
612 | 129 | { | 131 | { |
613 | 130 | Tag *tag = new Tag(m_guid, m_updateSequenceNumber); | 132 | Tag *tag = new Tag(m_guid, m_updateSequenceNumber); |
614 | 131 | tag->setName(m_name); | 133 | tag->setName(m_name); |
615 | 134 | tag->setDeleted(m_deleted); | ||
616 | 132 | return tag; | 135 | return tag; |
617 | 133 | } | 136 | } |
618 | 134 | 137 | ||
619 | @@ -178,6 +181,7 @@ | |||
620 | 178 | { | 181 | { |
621 | 179 | QSettings infoFile(m_infoFile, QSettings::IniFormat); | 182 | QSettings infoFile(m_infoFile, QSettings::IniFormat); |
622 | 180 | infoFile.setValue("name", m_name); | 183 | infoFile.setValue("name", m_name); |
623 | 184 | infoFile.setValue("deleted", m_deleted); | ||
624 | 181 | infoFile.setValue("lastSyncedSequenceNumber", m_lastSyncedSequenceNumber); | 185 | infoFile.setValue("lastSyncedSequenceNumber", m_lastSyncedSequenceNumber); |
625 | 182 | } | 186 | } |
626 | 183 | 187 | ||
627 | @@ -212,6 +216,11 @@ | |||
628 | 212 | return m_syncError; | 216 | return m_syncError; |
629 | 213 | } | 217 | } |
630 | 214 | 218 | ||
631 | 219 | bool Tag::deleted() const | ||
632 | 220 | { | ||
633 | 221 | return m_deleted; | ||
634 | 222 | } | ||
635 | 223 | |||
636 | 215 | void Tag::setSyncError(bool syncError) | 224 | void Tag::setSyncError(bool syncError) |
637 | 216 | { | 225 | { |
638 | 217 | if (m_syncError != syncError) { | 226 | if (m_syncError != syncError) { |
639 | @@ -220,6 +229,14 @@ | |||
640 | 220 | } | 229 | } |
641 | 221 | } | 230 | } |
642 | 222 | 231 | ||
643 | 232 | void Tag::setDeleted(bool deleted) | ||
644 | 233 | { | ||
645 | 234 | if (m_deleted != deleted) { | ||
646 | 235 | m_deleted = deleted; | ||
647 | 236 | emit deletedChanged(); | ||
648 | 237 | } | ||
649 | 238 | } | ||
650 | 239 | |||
651 | 223 | 240 | ||
652 | 224 | QString Tag::noteAt(int index) const | 241 | QString Tag::noteAt(int index) const |
653 | 225 | { | 242 | { |
654 | 226 | 243 | ||
655 | === modified file 'src/libqtevernote/tag.h' | |||
656 | --- src/libqtevernote/tag.h 2015-03-06 00:42:42 +0000 | |||
657 | +++ src/libqtevernote/tag.h 2015-06-11 21:38:48 +0000 | |||
658 | @@ -38,6 +38,7 @@ | |||
659 | 38 | Q_PROPERTY(QString guid READ guid NOTIFY guidChanged) | 38 | Q_PROPERTY(QString guid READ guid NOTIFY guidChanged) |
660 | 39 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) | 39 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
661 | 40 | Q_PROPERTY(int noteCount READ noteCount NOTIFY noteCountChanged) | 40 | Q_PROPERTY(int noteCount READ noteCount NOTIFY noteCountChanged) |
662 | 41 | Q_PROPERTY(bool deleted READ deleted NOTIFY deletedChanged) | ||
663 | 41 | // Don't forget to update clone() if you add new properties | 42 | // Don't forget to update clone() if you add new properties |
664 | 42 | 43 | ||
665 | 43 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged) | 44 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged) |
666 | @@ -65,6 +66,7 @@ | |||
667 | 65 | bool loading() const; | 66 | bool loading() const; |
668 | 66 | bool synced() const; | 67 | bool synced() const; |
669 | 67 | bool syncError() const; | 68 | bool syncError() const; |
670 | 69 | bool deleted() const; | ||
671 | 68 | 70 | ||
672 | 69 | Tag *clone(); | 71 | Tag *clone(); |
673 | 70 | 72 | ||
674 | @@ -75,6 +77,7 @@ | |||
675 | 75 | void loadingChanged(); | 77 | void loadingChanged(); |
676 | 76 | void syncedChanged(); | 78 | void syncedChanged(); |
677 | 77 | void syncErrorChanged(); | 79 | void syncErrorChanged(); |
678 | 80 | void deletedChanged(); | ||
679 | 78 | 81 | ||
680 | 79 | private slots: | 82 | private slots: |
681 | 80 | void noteAdded(const QString ¬eGuid, const QString ¬ebookGuid); | 83 | void noteAdded(const QString ¬eGuid, const QString ¬ebookGuid); |
682 | @@ -88,12 +91,14 @@ | |||
683 | 88 | void setLastSyncedSequenceNumber(qint32 lastSyncedSequenceNumber); | 91 | void setLastSyncedSequenceNumber(qint32 lastSyncedSequenceNumber); |
684 | 89 | void setLoading(bool loading); | 92 | void setLoading(bool loading); |
685 | 90 | void setSyncError(bool syncError); | 93 | void setSyncError(bool syncError); |
686 | 94 | void setDeleted(bool deleted); | ||
687 | 91 | 95 | ||
688 | 92 | private: | 96 | private: |
689 | 93 | qint32 m_updateSequenceNumber; | 97 | qint32 m_updateSequenceNumber; |
690 | 94 | qint32 m_lastSyncedSequenceNumber; | 98 | qint32 m_lastSyncedSequenceNumber; |
691 | 95 | QString m_guid; | 99 | QString m_guid; |
692 | 96 | QString m_name; | 100 | QString m_name; |
693 | 101 | bool m_deleted; | ||
694 | 97 | 102 | ||
695 | 98 | QList<QString> m_notesList; | 103 | QList<QString> m_notesList; |
696 | 99 | 104 | ||
697 | 100 | 105 | ||
698 | === modified file 'src/libqtevernote/tags.cpp' | |||
699 | --- src/libqtevernote/tags.cpp 2015-03-06 00:47:45 +0000 | |||
700 | +++ src/libqtevernote/tags.cpp 2015-06-11 21:38:48 +0000 | |||
701 | @@ -61,6 +61,8 @@ | |||
702 | 61 | return tag->synced(); | 61 | return tag->synced(); |
703 | 62 | case RoleSyncError: | 62 | case RoleSyncError: |
704 | 63 | return tag->syncError(); | 63 | return tag->syncError(); |
705 | 64 | case RoleDeleted: | ||
706 | 65 | return tag->deleted(); | ||
707 | 64 | } | 66 | } |
708 | 65 | return QVariant(); | 67 | return QVariant(); |
709 | 66 | } | 68 | } |
710 | @@ -80,6 +82,7 @@ | |||
711 | 80 | roles.insert(RoleLoading, "loading"); | 82 | roles.insert(RoleLoading, "loading"); |
712 | 81 | roles.insert(RoleSynced, "synced"); | 83 | roles.insert(RoleSynced, "synced"); |
713 | 82 | roles.insert(RoleSyncError, "syncError"); | 84 | roles.insert(RoleSyncError, "syncError"); |
714 | 85 | roles.insert(RoleDeleted, "deleted"); | ||
715 | 83 | return roles; | 86 | return roles; |
716 | 84 | } | 87 | } |
717 | 85 | 88 | ||
718 | @@ -104,6 +107,7 @@ | |||
719 | 104 | connect(tag, &Tag::loadingChanged, this, &Tags::tagLoadingChanged); | 107 | connect(tag, &Tag::loadingChanged, this, &Tags::tagLoadingChanged); |
720 | 105 | connect(tag, &Tag::syncedChanged, this, &Tags::syncedChanged); | 108 | connect(tag, &Tag::syncedChanged, this, &Tags::syncedChanged); |
721 | 106 | connect(tag, &Tag::syncErrorChanged, this, &Tags::syncErrorChanged); | 109 | connect(tag, &Tag::syncErrorChanged, this, &Tags::syncErrorChanged); |
722 | 110 | connect(tag, &Tag::deletedChanged, this, &Tags::deletedChanged); | ||
723 | 107 | 111 | ||
724 | 108 | beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); | 112 | beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); |
725 | 109 | m_list.append(guid); | 113 | m_list.append(guid); |
726 | @@ -128,6 +132,13 @@ | |||
727 | 128 | } | 132 | } |
728 | 129 | } | 133 | } |
729 | 130 | 134 | ||
730 | 135 | void Tags::deletedChanged() | ||
731 | 136 | { | ||
732 | 137 | Tag *tag = static_cast<Tag*>(sender()); | ||
733 | 138 | int idx = m_list.indexOf(tag->guid()); | ||
734 | 139 | emit dataChanged(index(idx), index(idx), QVector<int>() << RoleDeleted); | ||
735 | 140 | } | ||
736 | 141 | |||
737 | 131 | void Tags::nameChanged() | 142 | void Tags::nameChanged() |
738 | 132 | { | 143 | { |
739 | 133 | Tag *tag = static_cast<Tag*>(sender()); | 144 | Tag *tag = static_cast<Tag*>(sender()); |
740 | 134 | 145 | ||
741 | === modified file 'src/libqtevernote/tags.h' | |||
742 | --- src/libqtevernote/tags.h 2015-03-04 00:23:45 +0000 | |||
743 | +++ src/libqtevernote/tags.h 2015-06-11 21:38:48 +0000 | |||
744 | @@ -38,7 +38,8 @@ | |||
745 | 38 | RoleNoteCount, | 38 | RoleNoteCount, |
746 | 39 | RoleLoading, | 39 | RoleLoading, |
747 | 40 | RoleSynced, | 40 | RoleSynced, |
749 | 41 | RoleSyncError | 41 | RoleSyncError, |
750 | 42 | RoleDeleted | ||
751 | 42 | }; | 43 | }; |
752 | 43 | explicit Tags(QObject *parent = 0); | 44 | explicit Tags(QObject *parent = 0); |
753 | 44 | 45 | ||
754 | @@ -62,6 +63,7 @@ | |||
755 | 62 | void tagAdded(const QString &guid); | 63 | void tagAdded(const QString &guid); |
756 | 63 | void tagRemoved(const QString &guid); | 64 | void tagRemoved(const QString &guid); |
757 | 64 | void tagGuidChanged(const QString &oldGuid, const QString &newGuid); | 65 | void tagGuidChanged(const QString &oldGuid, const QString &newGuid); |
758 | 66 | void deletedChanged(); | ||
759 | 65 | 67 | ||
760 | 66 | void nameChanged(); | 68 | void nameChanged(); |
761 | 67 | void noteCountChanged(); | 69 | void noteCountChanged(); |
PASSED: Continuous integration, rev:451 91.189. 93.70:8080/ job/reminders- app-ci/ 753/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 2908 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 2908/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/reminders- app-utopic- amd64-ci/ 355 91.189. 93.70:8080/ job/reminders- app-vivid- amd64-ci/ 175
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/reminders- app-ci/ 753/rebuild
http://