← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mzanetti/reminders-app/save-on-inactive into lp:reminders-app

 

Michael Zanetti has proposed merging lp:~mzanetti/reminders-app/save-on-inactive into lp:reminders-app.

Commit message:
save the note when the app becomes inactive

Requested reviews:
  Ubuntu Reminders app developers (reminders-app-dev)
Related bugs:
  Bug #1459430 in Ubuntu Notes app: "Closing the app in edit note view loses changes"
  https://bugs.launchpad.net/reminders-app/+bug/1459430

For more details, see:
https://code.launchpad.net/~mzanetti/reminders-app/save-on-inactive/+merge/260387
-- 
Your team Ubuntu Reminders app developers is requested to review the proposed merge of lp:~mzanetti/reminders-app/save-on-inactive into lp:reminders-app.
=== modified file 'src/app/qml/ui/EditNoteView.qml'
--- src/app/qml/ui/EditNoteView.qml	2015-05-07 21:41:41 +0000
+++ src/app/qml/ui/EditNoteView.qml	2015-05-27 21:58:39 +0000
@@ -89,6 +89,17 @@
         }
     }
 
+    Connections {
+        target: Qt.application
+        onActiveChanged: {
+            print("active changed", root, root.note, active)
+            if (root.note) {
+                print("Saving note:", root.note.guid)
+                root.saveNote()
+            }
+        }
+    }
+
     Column {
         anchors { left: parent.left; top: parent.top; right: parent.right; bottom: toolbox.top }
 
@@ -211,6 +222,14 @@
                          textMargin: units.gu(1)
                          selectionColor: UbuntuColors.blue
 
+                         property int lastCursorPos: -1
+                         onCursorPositionChanged: {
+                             lastCursorPos = cursorPosition;
+                         }
+                         onTextChanged: {
+                             cursorPosition = lastCursorPos
+                         }
+
                          // Due to various things updating when creating the view,
                          // we need to set the focus in the next event loop pass
                          // in order to have any effect.


Follow ups