Merge lp:~mzanetti/reminders-app/listitemwithactions into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 345
Merged at revision: 343
Proposed branch: lp:~mzanetti/reminders-app/listitemwithactions
Merge into: lp:reminders-app
Diff against target: 758 lines (+580/-45)
10 files modified
src/app/qml/components/ListItemWithActions.qml (+455/-0)
src/app/qml/components/ListItemWithActionsCheckBox.qml (+25/-0)
src/app/qml/components/NotesDelegate.qml (+39/-4)
src/app/qml/components/RemindersDelegate.qml (+30/-37)
src/app/qml/components/ubuntu_component_store.json (+6/-0)
src/app/qml/reminders.qml (+3/-1)
src/app/qml/ui/NotesPage.qml (+17/-1)
src/app/qml/ui/RemindersPage.qml (+2/-1)
src/libqtevernote/note.cpp (+1/-1)
src/libqtevernote/resourceimageprovider.cpp (+2/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/listitemwithactions
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+249585@code.launchpad.net

Commit message

use the awesome ListItemWithActions from the Ubuntu Component Store

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)
340. By Michael Zanetti

also allow editing tags from the listitemmenu

341. By Michael Zanetti

also use the listitemwithactions for the reminders page

342. By Michael Zanetti

drop commented code

343. By Michael Zanetti

allow editing the reminder from the listitem actions

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
344. By Michael Zanetti

fix reminders delegate background color

345. By Michael Zanetti

fix a bug in ListItemWithActions

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Awesome, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'src/app/qml/components/ListItemWithActions.qml'
2--- src/app/qml/components/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
3+++ src/app/qml/components/ListItemWithActions.qml 2015-02-13 01:03:14 +0000
4@@ -0,0 +1,455 @@
5+/*
6+ * Copyright (C) 2012-2014 Canonical, Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+import QtQuick 2.2
22+import Ubuntu.Components 1.1
23+
24+Item {
25+ id: root
26+
27+ property Action leftSideAction: null
28+ property list<Action> rightSideActions
29+ property double defaultHeight: units.gu(8)
30+ property bool locked: false
31+ property Action activeAction: null
32+ property var activeItem: null
33+ property bool triggerActionOnMouseRelease: false
34+ property color color: Theme.palette.normal.background
35+ property color selectedColor: "#E6E6E6"
36+ property bool selected: false
37+ property bool selectionMode: false
38+ property alias internalAnchors: mainContents.anchors
39+ default property alias contents: mainContents.children
40+
41+ readonly property double actionWidth: units.gu(4)
42+ readonly property double leftActionWidth: units.gu(10)
43+ readonly property double actionThreshold: actionWidth * 0.4
44+ readonly property double threshold: 0.4
45+ readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
46+ readonly property alias swipping: mainItemMoving.running
47+ readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping
48+
49+ /* internal */
50+ property var _visibleRightSideActions: filterVisibleActions(rightSideActions)
51+
52+ signal itemClicked(var mouse)
53+ signal itemPressAndHold(var mouse)
54+
55+ function returnToBoundsRTL(direction)
56+ {
57+ var actionFullWidth = actionWidth + units.gu(2)
58+
59+ // go back to normal state if swipping reverse
60+ if (direction === "LTR") {
61+ updatePosition(0)
62+ return
63+ } else if (!triggerActionOnMouseRelease) {
64+ updatePosition(-rightActionsView.width + units.gu(2))
65+ return
66+ }
67+
68+ var xOffset = Math.abs(main.x)
69+ var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
70+ var newX = 0
71+ if (index === _visibleRightSideActions.length) {
72+ newX = -(rightActionsView.width - units.gu(2))
73+ } else if (index >= 1) {
74+ newX = -(actionFullWidth * index)
75+ }
76+ updatePosition(newX)
77+ }
78+
79+ function returnToBoundsLTR(direction)
80+ {
81+ var finalX = leftActionWidth
82+ if ((direction === "RTL") || (main.x <= (finalX * root.threshold)))
83+ finalX = 0
84+ updatePosition(finalX)
85+ }
86+
87+ function returnToBounds(direction)
88+ {
89+ if (main.x < 0) {
90+ returnToBoundsRTL(direction)
91+ } else if (main.x > 0) {
92+ returnToBoundsLTR(direction)
93+ } else {
94+ updatePosition(0)
95+ }
96+ }
97+
98+ function contains(item, point, marginX)
99+ {
100+ var itemStartX = item.x - marginX
101+ var itemEndX = item.x + item.width + marginX
102+ return (point.x >= itemStartX) && (point.x <= itemEndX) &&
103+ (point.y >= item.y) && (point.y <= (item.y + item.height));
104+ }
105+
106+ function getActionAt(point)
107+ {
108+ if (contains(leftActionView, point, 0)) {
109+ return leftSideAction
110+ } else if (contains(rightActionsView, point, 0)) {
111+ var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
112+ for (var i = 0; i < rightActionsRepeater.count; i++) {
113+ var child = rightActionsRepeater.itemAt(i)
114+ if (contains(child, newPoint, units.gu(1))) {
115+ return i
116+ }
117+ }
118+ }
119+ return -1
120+ }
121+
122+ function updateActiveAction()
123+ {
124+ if (triggerActionOnMouseRelease &&
125+ (main.x <= -(root.actionWidth + units.gu(2))) &&
126+ (main.x > -(rightActionsView.width - units.gu(2)))) {
127+ var actionFullWidth = actionWidth + units.gu(2)
128+ var xOffset = Math.abs(main.x)
129+ var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
130+ index = index - 1
131+ if (index > -1) {
132+ root.activeItem = rightActionsRepeater.itemAt(index)
133+ root.activeAction = root._visibleRightSideActions[index]
134+ }
135+ } else {
136+ root.activeAction = null
137+ }
138+ }
139+
140+ function resetSwipe()
141+ {
142+ updatePosition(0)
143+ }
144+
145+ function filterVisibleActions(actions)
146+ {
147+ var visibleActions = []
148+ for(var i = 0; i < actions.length; i++) {
149+ var action = actions[i]
150+ if (action.visible) {
151+ visibleActions.push(action)
152+ }
153+ }
154+ return visibleActions
155+ }
156+
157+ function updatePosition(pos)
158+ {
159+ if (!root.triggerActionOnMouseRelease && (pos !== 0)) {
160+ mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight"
161+ } else {
162+ mouseArea.state = ""
163+ }
164+ main.x = pos
165+ }
166+
167+ states: [
168+ State {
169+ name: "select"
170+ when: selectionMode || selected
171+ PropertyChanges {
172+ target: selectionIcon
173+ source: Qt.resolvedUrl("ListItemWithActionsCheckBox.qml")
174+ anchors.leftMargin: units.gu(2)
175+ }
176+ PropertyChanges {
177+ target: root
178+ locked: true
179+ }
180+ PropertyChanges {
181+ target: main
182+ x: 0
183+ }
184+ }
185+ ]
186+
187+ height: defaultHeight
188+ clip: height !== defaultHeight
189+
190+ Rectangle {
191+ id: leftActionView
192+
193+ anchors {
194+ top: parent.top
195+ bottom: parent.bottom
196+ right: main.left
197+ }
198+ width: root.leftActionWidth + actionThreshold
199+ visible: leftSideAction
200+ color: UbuntuColors.red
201+
202+ Icon {
203+ anchors {
204+ centerIn: parent
205+ horizontalCenterOffset: actionThreshold / 2
206+ }
207+ name: leftSideAction && _showActions ? leftSideAction.iconName : ""
208+ color: Theme.palette.selected.field
209+ height: units.gu(3)
210+ width: units.gu(3)
211+ }
212+ }
213+
214+ Rectangle {
215+ id: rightActionsView
216+
217+ anchors {
218+ top: main.top
219+ left: main.right
220+ bottom: main.bottom
221+ }
222+ visible: _visibleRightSideActions.length > 0
223+ width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0
224+ color: "white"
225+ Row {
226+ anchors{
227+ top: parent.top
228+ left: parent.left
229+ leftMargin: units.gu(2)
230+ right: parent.right
231+ rightMargin: units.gu(2)
232+ bottom: parent.bottom
233+ }
234+ spacing: units.gu(2)
235+ Repeater {
236+ id: rightActionsRepeater
237+
238+ model: _showActions ? _visibleRightSideActions : []
239+ Item {
240+ property alias image: img
241+
242+ height: rightActionsView.height
243+ width: root.actionWidth
244+
245+ Icon {
246+ id: img
247+
248+ anchors.centerIn: parent
249+ width: units.gu(3)
250+ height: units.gu(3)
251+ name: modelData.iconName
252+ source: modelData.iconSource
253+ color: root.activeAction === modelData ? UbuntuColors.lightAubergine : UbuntuColors.lightGrey
254+ }
255+ }
256+ }
257+ }
258+ }
259+
260+
261+ Rectangle {
262+ id: main
263+ objectName: "mainItem"
264+
265+ anchors {
266+ top: parent.top
267+ bottom: parent.bottom
268+ }
269+
270+ width: parent.width
271+ color: root.selected ? root.selectedColor : root.color
272+
273+ Loader {
274+ id: selectionIcon
275+
276+ anchors {
277+ left: main.left
278+ verticalCenter: main.verticalCenter
279+ }
280+ width: (status === Loader.Ready) ? item.implicitWidth : 0
281+ visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
282+ Behavior on width {
283+ NumberAnimation {
284+ duration: UbuntuAnimation.SnapDuration
285+ }
286+ }
287+ }
288+
289+
290+ Item {
291+ id: mainContents
292+
293+ anchors {
294+ left: selectionIcon.right
295+// leftMargin: units.gu(2)
296+ top: parent.top
297+// topMargin: units.gu(1)
298+ right: parent.right
299+// rightMargin: units.gu(2)
300+ bottom: parent.bottom
301+// bottomMargin: units.gu(1)
302+ }
303+ }
304+
305+ Behavior on x {
306+ UbuntuNumberAnimation {
307+ id: mainItemMoving
308+
309+ easing.type: Easing.OutElastic
310+ duration: UbuntuAnimation.SlowDuration
311+ }
312+ }
313+ Behavior on color {
314+ ColorAnimation {}
315+ }
316+ }
317+
318+ SequentialAnimation {
319+ id: triggerAction
320+
321+ property var currentItem: root.activeItem ? root.activeItem.image : null
322+
323+ running: false
324+ ParallelAnimation {
325+ UbuntuNumberAnimation {
326+ target: triggerAction.currentItem
327+ property: "opacity"
328+ from: 1.0
329+ to: 0.0
330+ duration: UbuntuAnimation.SlowDuration
331+ easing {type: Easing.InOutBack; }
332+ }
333+ UbuntuNumberAnimation {
334+ target: triggerAction.currentItem
335+ properties: "width, height"
336+ from: units.gu(3)
337+ to: root.actionWidth
338+ duration: UbuntuAnimation.SlowDuration
339+ easing {type: Easing.InOutBack; }
340+ }
341+ }
342+ PropertyAction {
343+ target: triggerAction.currentItem
344+ properties: "width, height"
345+ value: units.gu(3)
346+ }
347+ PropertyAction {
348+ target: triggerAction.currentItem
349+ properties: "opacity"
350+ value: 1.0
351+ }
352+ ScriptAction {
353+ script: {
354+ root.activeAction.triggered(root)
355+ root.activeAction = null;
356+ mouseArea.state = ""
357+ }
358+ }
359+ PauseAnimation {
360+ duration: 500
361+ }
362+ UbuntuNumberAnimation {
363+ target: main
364+ property: "x"
365+ to: 0
366+ }
367+ }
368+
369+ MouseArea {
370+ id: mouseArea
371+
372+ property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0))
373+ property bool manual: false
374+ property string direction: "None"
375+ property real lastX: -1
376+
377+ anchors.fill: parent
378+ drag {
379+ target: locked ? null : main
380+ axis: Drag.XAxis
381+ minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
382+ maximumX: leftActionView.visible ? leftActionView.width : 0
383+ threshold: root.actionThreshold
384+ }
385+
386+ states: [
387+ State {
388+ name: "LeftToRight"
389+ PropertyChanges {
390+ target: mouseArea
391+ drag.maximumX: 0
392+ }
393+ },
394+ State {
395+ name: "RightToLeft"
396+ PropertyChanges {
397+ target: mouseArea
398+ drag.minimumX: 0
399+ }
400+ }
401+ ]
402+
403+ onMouseXChanged: {
404+ var offset = (lastX - mouseX)
405+ if (Math.abs(offset) <= root.actionThreshold) {
406+ return
407+ }
408+ lastX = mouseX
409+ direction = offset > 0 ? "RTL" : "LTR";
410+ }
411+
412+ onPressed: {
413+ lastX = mouse.x
414+ }
415+
416+ onReleased: {
417+ if (root.triggerActionOnMouseRelease && root.activeAction) {
418+ triggerAction.start()
419+ } else {
420+ root.returnToBounds(direction)
421+ root.activeAction = null
422+ }
423+ lastX = -1
424+ direction = "None"
425+ }
426+ onClicked: {
427+ if (main.x === 0) {
428+ root.itemClicked(mouse)
429+ } else if (main.x > 0) {
430+ var action = getActionAt(Qt.point(mouse.x, mouse.y))
431+ if (action && action !== -1) {
432+ action.triggered(root)
433+ }
434+ } else {
435+ var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
436+ if (actionIndex !== -1) {
437+ root.activeItem = rightActionsRepeater.itemAt(actionIndex)
438+ root.activeAction = root._visibleRightSideActions[actionIndex]
439+ triggerAction.start()
440+ return
441+ }
442+ }
443+ root.resetSwipe()
444+ }
445+
446+ onPositionChanged: {
447+ if (mouseArea.pressed) {
448+ updateActiveAction()
449+ }
450+ }
451+ onPressAndHold: {
452+ if (main.x === 0) {
453+ root.itemPressAndHold(mouse)
454+ }
455+ }
456+ z: -1
457+ }
458+}
459+
460
461=== added file 'src/app/qml/components/ListItemWithActionsCheckBox.qml'
462--- src/app/qml/components/ListItemWithActionsCheckBox.qml 1970-01-01 00:00:00 +0000
463+++ src/app/qml/components/ListItemWithActionsCheckBox.qml 2015-02-13 01:03:14 +0000
464@@ -0,0 +1,25 @@
465+/*
466+ * Copyright (C) 2012-2014 Canonical, Ltd.
467+ *
468+ * This program is free software; you can redistribute it and/or modify
469+ * it under the terms of the GNU General Public License as published by
470+ * the Free Software Foundation; version 3.
471+ *
472+ * This program is distributed in the hope that it will be useful,
473+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
474+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
475+ * GNU General Public License for more details.
476+ *
477+ * You should have received a copy of the GNU General Public License
478+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
479+ */
480+
481+import QtQuick 2.2
482+import Ubuntu.Components 1.1
483+
484+CheckBox {
485+ checked: root.selected
486+ width: implicitWidth
487+ // disable item mouse area to avoid conflicts with parent mouse area
488+ __mouseArea.enabled: false
489+}
490
491=== modified file 'src/app/qml/components/NotesDelegate.qml'
492--- src/app/qml/components/NotesDelegate.qml 2014-12-16 21:01:28 +0000
493+++ src/app/qml/components/NotesDelegate.qml 2015-02-13 01:03:14 +0000
494@@ -22,9 +22,10 @@
495 import Ubuntu.Components.ListItems 1.0
496 import Evernote 0.1
497
498-Empty {
499+ListItemWithActions {
500 id: root
501 height: units.gu(12)
502+ width: parent.width
503
504 property string title
505 property date creationDate
506@@ -39,10 +40,44 @@
507 property bool conflicting
508 property string notebookColor
509
510- showDivider: false;
511-
512+ signal deleteNote()
513+ signal editNote()
514+ signal editReminder()
515+ signal editTags()
516+
517+ leftSideAction: Action {
518+ iconName: "delete"
519+ text: i18n.tr("Delete")
520+ onTriggered: {
521+ root.deleteNote()
522+ }
523+ }
524+
525+ rightSideActions: [
526+ Action {
527+ iconName: "alarm-clock"
528+ text: i18n.tr("Reminder")
529+ onTriggered: {
530+ root.editReminder();
531+ }
532+ },
533+ Action {
534+ iconSource: "../images/tags.svg"
535+ text: i18n.tr("Tags")
536+ onTriggered: {
537+ root.editTags();
538+ }
539+ },
540+ Action {
541+ iconName: "edit"
542+ text: i18n.tr("Edit")
543+ onTriggered: {
544+ root.editNote();
545+ }
546+ }
547+ ]
548 ColumnLayout {
549- anchors { fill: parent; leftMargin: units.gu(1); rightMargin: units.gu(1) }
550+ anchors { fill: parent }
551 spacing: 0
552
553 Rectangle {
554
555=== modified file 'src/app/qml/components/RemindersDelegate.qml'
556--- src/app/qml/components/RemindersDelegate.qml 2014-12-14 21:28:11 +0000
557+++ src/app/qml/components/RemindersDelegate.qml 2015-02-13 01:03:14 +0000
558@@ -24,54 +24,47 @@
559 import Ubuntu.Components.Pickers 1.0
560 import Evernote 0.1
561
562-Base {
563+ListItemWithActions {
564 id: root
565 height: units.gu(10)
566 clip: true
567- removable: true
568-
569- backgroundIndicator: Row {
570- x: root.__contents.x > 0 ? root.__contents.x - width : 0
571- width: childrenRect.width
572- anchors.verticalCenter: parent.verticalCenter
573- spacing: units.gu(1)
574-
575- Icon {
576- height: units.gu(3)
577- width: height
578- anchors.verticalCenter: parent.verticalCenter
579- name: root.note.reminderDone ? "clear" : "select"
580- }
581-
582- Label {
583- id: confirmRemovalDialog
584- anchors.verticalCenter: parent.verticalCenter
585- text: root.note.reminderDone ? i18n.tr("Clear reminder") : i18n.tr("Mark as done")
586- }
587- }
588+ color: "transparent"
589
590 property var note
591
592+ leftSideAction: Action {
593+ text: i18n.tr("Clear reminder")
594+ iconName: "clear"
595+ onTriggered: {
596+ note.reminder = false;
597+ NotesStore.saveNote(note.guid)
598+ }
599+ }
600+
601+ rightSideActions: [
602+ Action {
603+ iconSource: root.note.reminderDone ? "image://theme/select" : "../images/unchecked.svg"
604+ text: root.note.reminderDone ? i18n.tr("Mark as undone") : i18n.tr("Mark as done")
605+ onTriggered: {
606+ note.reminderDone = !root.note.reminderDone;
607+ NotesStore.saveNote(note.guid)
608+ }
609+ },
610+ Action {
611+ iconName: "alarm-clock"
612+ text: i18n.tr("Edit reminder")
613+ onTriggered: {
614+ pageStack.push(Qt.resolvedUrl("../ui/SetReminderPage.qml"), { note: root.note });
615+ }
616+ }
617+ ]
618+
619 Behavior on height {
620 UbuntuNumberAnimation {}
621 }
622
623- onItemRemoved: {
624- // Revert "removal"
625- root.cancelItemRemoval();
626- root.height = units.gu(10)
627- print("marking reminder as", !note.reminderDone, " done for note", note.title);
628- if (!note.reminderDone) {
629- note.reminderDone = true;
630- } else {
631- note.reminder = false;
632- }
633-
634- NotesStore.saveNote(note.guid)
635- }
636-
637 RowLayout {
638- anchors { fill: parent; topMargin: units.gu(1); bottomMargin: units.gu(1) }
639+ anchors { fill: parent; margins: units.gu(1) }
640 spacing: units.gu(1)
641
642 UbuntuShape {
643
644=== added file 'src/app/qml/components/ubuntu_component_store.json'
645--- src/app/qml/components/ubuntu_component_store.json 1970-01-01 00:00:00 +0000
646+++ src/app/qml/components/ubuntu_component_store.json 2015-02-13 01:03:14 +0000
647@@ -0,0 +1,6 @@
648+{
649+ "name": "ListItemWithActions",
650+ "description": "This widget provides an updated listitem which is what the core apps currently use.",
651+ "version": "1.0",
652+ "documentation_url": "http://ubuntu-component-store.readthedocs.org/en/latest/_components/listitemwithactions.html"
653+}
654
655=== modified file 'src/app/qml/reminders.qml'
656--- src/app/qml/reminders.qml 2015-02-12 14:02:35 +0000
657+++ src/app/qml/reminders.qml 2015-02-13 01:03:14 +0000
658@@ -128,7 +128,9 @@
659
660 function switchToEditMode(note) {
661 if (root.narrowMode) {
662- pagestack.pop();
663+ if (pagestack.depth > 1) {
664+ pagestack.pop();
665+ }
666 var component = Qt.createComponent(Qt.resolvedUrl("ui/EditNotePage.qml"));
667 var page = component.createObject();
668 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop()});
669
670=== modified file 'src/app/qml/ui/NotesPage.qml'
671--- src/app/qml/ui/NotesPage.qml 2014-12-16 21:01:28 +0000
672+++ src/app/qml/ui/NotesPage.qml 2015-02-13 01:03:14 +0000
673@@ -20,6 +20,7 @@
674 import QtQuick.Layouts 1.0
675 import Ubuntu.Components 1.1
676 import Ubuntu.Components.ListItems 1.0
677+import Ubuntu.Components.Popups 1.0
678 import Evernote 0.1
679 import "../components"
680
681@@ -148,6 +149,7 @@
682 creationDate: model.created
683 changedDate: model.updated
684 content: model.tagline
685+ triggerActionOnMouseRelease: true
686 tags: {
687 var tags = new Array();
688 for (var i = 0; i < model.tagGuids.length; i++) {
689@@ -163,11 +165,25 @@
690 syncError: model.syncError
691 conflicting: model.conflicting
692
693- onClicked: {
694+ onItemClicked: {
695 if (!model.conflicting) {
696 root.selectedNote = NotesStore.note(guid);
697 }
698 }
699+
700+ onDeleteNote: {
701+ NotesStore.deleteNote(model.guid)
702+ }
703+ onEditNote: {
704+ root.editNote(NotesStore.note(model.guid));
705+ }
706+ onEditReminder: {
707+ pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: NotesStore.note(model.guid) });
708+ }
709+ onEditTags: {
710+ PopupUtils.open(Qt.resolvedUrl("../components/EditTagsDialog.qml"), root,
711+ { note: NotesStore.note(model.guid), pageHeight: root.height });
712+ }
713 }
714
715 section.criteria: ViewSection.FullString
716
717=== modified file 'src/app/qml/ui/RemindersPage.qml'
718--- src/app/qml/ui/RemindersPage.qml 2014-12-14 22:31:00 +0000
719+++ src/app/qml/ui/RemindersPage.qml 2015-02-13 01:03:14 +0000
720@@ -68,8 +68,9 @@
721 delegate: RemindersDelegate {
722 width: remindersListView.width
723 note: notes.note(guid)
724+ triggerActionOnMouseRelease: true
725
726- onClicked: {
727+ onItemClicked: {
728 root.selectedNote = NotesStore.note(guid);
729 }
730 }
731
732=== modified file 'src/libqtevernote/note.cpp'
733--- src/libqtevernote/note.cpp 2014-12-16 21:01:28 +0000
734+++ src/libqtevernote/note.cpp 2015-02-13 01:03:14 +0000
735@@ -35,8 +35,8 @@
736 Note::Note(const QString &guid, quint32 updateSequenceNumber, QObject *parent) :
737 QObject(parent),
738 m_isSearchResult(false),
739+ m_deleted(false),
740 m_updateSequenceNumber(updateSequenceNumber),
741- m_deleted(false),
742 m_loading(false),
743 m_loaded(false),
744 m_syncError(false),
745
746=== modified file 'src/libqtevernote/resourceimageprovider.cpp'
747--- src/libqtevernote/resourceimageprovider.cpp 2014-10-23 21:27:46 +0000
748+++ src/libqtevernote/resourceimageprovider.cpp 2015-02-13 01:03:14 +0000
749@@ -26,7 +26,9 @@
750
751 QImage image;
752 if (mediaType.startsWith("image")) {
753+ qDebug() << "image requested" << NotesStore::instance()->note(noteGuid)->resource(resourceHash);
754 image = QImage::fromData(NotesStore::instance()->note(noteGuid)->resource(resourceHash)->imageData(requestedSize));
755+ qDebug() << "done...";
756 } else if (mediaType.startsWith("audio")) {
757 image.load("/usr/share/icons/ubuntu-mobile/actions/scalable/media-playback-start.svg");
758 } else {

Subscribers

People subscribed via source and target branches