uonedb-qt team mailing list archive
-
uonedb-qt team
-
Mailing list archive
-
Message #00343
[Merge] lp:~3v1n0/u1db-qt/doc-path-change-fixes into lp:u1db-qt
Marco Trevisan (Treviño) has proposed merging lp:~3v1n0/u1db-qt/doc-path-change-fixes into lp:u1db-qt with lp:~3v1n0/u1db-qt/uri-path-parsing as a prerequisite.
Commit message:
Document: ensure defaults and contents are set when database path changes
Requested reviews:
U1DB Qt developers (uonedb-qt)
Related bugs:
Bug #1426178 in U1DB Qt/ QML: "When using Qt.resolvedUrl to generate path in U1db.Database, the document contents are invalid"
https://bugs.launchpad.net/u1db-qt/+bug/1426178
For more details, see:
https://code.launchpad.net/~3v1n0/u1db-qt/doc-path-change-fixes/+merge/251439
When database path changes (as it happens when you use a JS call to set it), document does not initialize defaults and contents correctly on it.
--
Your team U1DB Qt developers is requested to review the proposed merge of lp:~3v1n0/u1db-qt/doc-path-change-fixes into lp:u1db-qt.
=== modified file 'examples/u1db-qt-example-1/u1db-qt-example-1.qml'
--- examples/u1db-qt-example-1/u1db-qt-example-1.qml 2015-03-02 12:46:33 +0000
+++ examples/u1db-qt-example-1/u1db-qt-example-1.qml 2015-03-02 12:46:33 +0000
@@ -36,7 +36,7 @@
U1db.Database {
id: aDatabase
- path: "file:///tmp/aDatabase1.db";
+ path: Qt.resolvedUrl("aDatabase1");
}
/*!
=== modified file 'examples/u1db-qt-example-2/u1db-qt-example-2.qml'
--- examples/u1db-qt-example-2/u1db-qt-example-2.qml 2013-05-02 18:20:33 +0000
+++ examples/u1db-qt-example-2/u1db-qt-example-2.qml 2015-03-02 12:46:33 +0000
@@ -35,7 +35,7 @@
U1db.Database {
id: aDatabase
- path: "aDatabase2"
+ path: Qt.resolvedUrl("aDatabase2")
}
Timer {
=== modified file 'examples/u1db-qt-example-2b/u1db-qt-example-2b.qml'
--- examples/u1db-qt-example-2b/u1db-qt-example-2b.qml 2013-05-02 18:20:33 +0000
+++ examples/u1db-qt-example-2b/u1db-qt-example-2b.qml 2015-03-02 12:46:33 +0000
@@ -36,7 +36,7 @@
U1db.Database {
id: aDatabase
- path: "aDatabase2b"
+ path: Qt.resolvedUrl("aDatabase2b")
}
/*!
=== modified file 'examples/u1db-qt-example-3/u1db-qt-example-3.qml'
--- examples/u1db-qt-example-3/u1db-qt-example-3.qml 2013-05-02 18:19:33 +0000
+++ examples/u1db-qt-example-3/u1db-qt-example-3.qml 2015-03-02 12:46:33 +0000
@@ -49,7 +49,7 @@
U1db.Database {
id: aDatabase
- path: "aDatabase3"
+ path: Qt.resolvedUrl("aDatabase3")
}
/*!
=== modified file 'examples/u1db-qt-example-5/u1db-qt-example-5.qml'
--- examples/u1db-qt-example-5/u1db-qt-example-5.qml 2013-05-02 18:20:33 +0000
+++ examples/u1db-qt-example-5/u1db-qt-example-5.qml 2015-03-02 12:46:33 +0000
@@ -27,7 +27,7 @@
U1db.Database {
id: aDatabase
- path: "aDatabase5"
+ path: Qt.resolvedUrl("aDatabase5")
}
U1db.Document {
=== modified file 'examples/u1db-qt-example-6/u1db-qt-example-6.qml'
--- examples/u1db-qt-example-6/u1db-qt-example-6.qml 2013-08-09 10:42:18 +0000
+++ examples/u1db-qt-example-6/u1db-qt-example-6.qml 2015-03-02 12:46:33 +0000
@@ -21,7 +21,6 @@
import U1db 1.0 as U1db
import Ubuntu.Components 0.1
-
Item {
width: units.gu(45)
@@ -29,7 +28,7 @@
U1db.Database {
id: aDatabase
- path: "aDatabase6"
+ path: Qt.resolvedUrl("aDatabase6");
}
U1db.Document {
@@ -143,9 +142,7 @@
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
- text: {
- text: sync_output
- }
+ text: sync_output.message_value
}
}
=== modified file 'src/database.cpp'
--- src/database.cpp 2015-03-02 12:46:33 +0000
+++ src/database.cpp 2015-03-02 12:46:33 +0000
@@ -117,6 +117,7 @@
bool
Database::setError(const QString& error)
{
+ qDebug() << "Error: "<<error;
qWarning("u1db: %s", qPrintable(error));
m_error = error;
Q_EMIT errorChanged(error);
=== modified file 'src/document.cpp'
--- src/document.cpp 2015-02-19 10:37:54 +0000
+++ src/document.cpp 2015-03-02 12:46:33 +0000
@@ -71,6 +71,13 @@
{
if (!m_docId.isEmpty())
{
+ if (m_create && m_defaults.isValid())
+ {
+ // Make sure we create defaults on new path
+ m_create = false;
+ setCreate(true);
+ }
+
m_contents = m_database->getDocUnchecked(m_docId);
Q_EMIT contentsChanged(m_contents);
}
Follow ups