on xenial help sign in
fix some review comments
28025f0Michael Zanetti
qml/Components/WindowPositionStorage/WindowPositionStorage.qml+6−6
@@ -24,14 +24,14 @@ QtObject {
24 property var db: null
24 property var db: null
25
25
26 function openDB() {
26 function openDB() {
27− if(db !== null) return;
27+ if (db !== null) return;
28
28
29 // db = LocalStorage.openDatabaseSync(identifier, version, description, estimated_size, callback(db))
29 // db = LocalStorage.openDatabaseSync(identifier, version, description, estimated_size, callback(db))
30 db = LocalStorage.openDatabaseSync("unity8", "0.1", "", 100000);
30 db = LocalStorage.openDatabaseSync("unity8", "0.1", "", 100000);
31
31
32 try {
32 try {
33− db.transaction(function(tx){
33+ db.transaction(function(tx) {
34− tx.executeSql('CREATE TABLE IF NOT EXISTS settings(windowId TEXT UNIQUE, x INTEGER, y INTEGER, width INTEGER, height INTEGER)');
34+ tx.executeSql('CREATE TABLE IF NOT EXISTS windowproperties(windowId TEXT UNIQUE, x INTEGER, y INTEGER, width INTEGER, height INTEGER)');
35 });
35 });
36 } catch (err) {
36 } catch (err) {
37 console.log("Error creating table in database: " + err);
37 console.log("Error creating table in database: " + err);
@@ -42,7 +42,7 @@ QtObject {
42 function savePosition(windowId, x, y, width, height) {
42 function savePosition(windowId, x, y, width, height) {
43 priv.openDB();
43 priv.openDB();
44 priv.db.transaction( function(tx){
44 priv.db.transaction( function(tx){
45− tx.executeSql('INSERT OR REPLACE INTO settings VALUES(?, ?, ?, ?, ?)', [windowId, x, y, width, height]);
45+ tx.executeSql('INSERT OR REPLACE INTO windowproperties VALUES(?, ?, ?, ?, ?)', [windowId, x, y, width, height]);
46 });
46 });
47 }
47 }
48
48
@@ -50,9 +50,9 @@ QtObject {
50 priv.openDB();
50 priv.openDB();
51 var res = new Object();
51 var res = new Object();
52 priv.db.transaction(function(tx) {
52 priv.db.transaction(function(tx) {
53− var rs = tx.executeSql('SELECT x, y, width, height FROM settings WHERE windowId=?;', [windowId]);
53+ var rs = tx.executeSql('SELECT x, y, width, height FROM windowproperties WHERE windowId=?;', [windowId]);
54 if (rs.rows.length === 0) {
54 if (rs.rows.length === 0) {
55− res = unefined;
55+ res = undefined;
56 } else {
56 } else {
57 res.x = rs.rows.item(0).x
57 res.x = rs.rows.item(0).x
58 res.y = rs.rows.item(0).y
58 res.y = rs.rows.item(0).y