Merge lp:~rpadovani/reminders-app/1317565 into lp:reminders-app

Proposed by Riccardo Padovani
Status: Merged
Approved by: Michael Zanetti
Approved revision: 149
Merged at revision: 148
Proposed branch: lp:~rpadovani/reminders-app/1317565
Merge into: lp:reminders-app
Diff against target: 53 lines (+21/-0)
3 files modified
src/app/qml/ui/SearchNotesPage.qml (+12/-0)
src/plugin/Evernote/notesstore.cpp (+8/-0)
src/plugin/Evernote/notesstore.h (+1/-0)
To merge this branch: bzr merge lp:~rpadovani/reminders-app/1317565
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+220193@code.launchpad.net

Commit message

Clear a previous search result when you do a new search.

Description of the change

Clear a previous search result when you do a new search.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

looks good. For consistency with the rest of the API I'd like you to rename it to clearSearchResults() instead of clearFoundNotes(). Also, clearFoundNotes sounds a bit like it would clear the found notes, doesn't it? :)

===

8 + tools: ToolbarItems {
9 + back: ToolbarButton {
10 + iconName: 'back'
11 + text: i18n.tr("Back")
12 +
13 + onTriggered: {
14 + pagestack.pop()
15 + NotesStore.clearFoundNotes();
16 + }
17 + }
18 + }

Instead of overriding the back button, may be just call clearSearchResults() in Component.onDestruction?

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

36 + emit dataChanged(index(0), index(m_notes.count()), QVector<int>() << RoleIsSearchResult);

Shouldn't the second arg be this?

index(m_notes.count() -1)

if we have 2 entries, you would call changed on items 0 - 2, which in total makes 3, while you should be calling 0 - 1, which is two items only.

review: Needs Fixing
lp:~rpadovani/reminders-app/1317565 updated
148. By Riccardo Padovani

Changed function name

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
lp:~rpadovani/reminders-app/1317565 updated
149. By Riccardo Padovani

Changed dataChanged call

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/ui/SearchNotesPage.qml'
2--- src/app/qml/ui/SearchNotesPage.qml 2014-02-18 09:36:38 +0000
3+++ src/app/qml/ui/SearchNotesPage.qml 2014-05-20 09:29:30 +0000
4@@ -27,6 +27,18 @@
5
6 signal noteSelected(var note)
7
8+ tools: ToolbarItems {
9+ back: ToolbarButton {
10+ iconName: 'back'
11+ text: i18n.tr("Back")
12+
13+ onTriggered: {
14+ pagestack.pop()
15+ NotesStore.clearSearchResults();
16+ }
17+ }
18+ }
19+
20 Column {
21 anchors { fill: parent; topMargin: units.gu(2); bottomMargin: units.gu(2) }
22 spacing: units.gu(2)
23
24=== modified file 'src/plugin/Evernote/notesstore.cpp'
25--- src/plugin/Evernote/notesstore.cpp 2014-05-09 09:02:54 +0000
26+++ src/plugin/Evernote/notesstore.cpp 2014-05-20 09:29:30 +0000
27@@ -484,6 +484,14 @@
28 EvernoteConnection::instance()->enqueue(job);
29 }
30
31+void NotesStore::clearSearchResults()
32+{
33+ foreach (Note *note, m_notes) {
34+ note->setIsSearchResult(false);
35+ }
36+ emit dataChanged(index(0), index(m_notes.count()-1), QVector<int>() << RoleIsSearchResult);
37+}
38+
39 void NotesStore::deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)
40 {
41 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
42
43=== modified file 'src/plugin/Evernote/notesstore.h'
44--- src/plugin/Evernote/notesstore.h 2014-05-09 09:02:54 +0000
45+++ src/plugin/Evernote/notesstore.h 2014-05-20 09:29:30 +0000
46@@ -95,6 +95,7 @@
47 Q_INVOKABLE void saveNote(const QString &guid);
48 Q_INVOKABLE void deleteNote(const QString &guid);
49 Q_INVOKABLE void findNotes(const QString &searchWords);
50+ Q_INVOKABLE void clearSearchResults();
51
52 QList<Notebook*> notebooks() const;
53 Q_INVOKABLE Notebook* notebook(const QString &guid);

Subscribers

People subscribed via source and target branches