mirror of https://github.com/qt/qtdoc.git
ToDoList example: Fix some qmllint warnings
Pick-to: 6.10 Task-number: QTBUG-138189 Change-Id: I8c3d60bfd75a1756966c93346c808763726ea54b Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
parent
e31802fb15
commit
ac229f05e3
|
@ -4,7 +4,6 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
import QtQml
|
import QtQml
|
||||||
import QtQuick
|
|
||||||
import QtQuick.LocalStorage
|
import QtQuick.LocalStorage
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -19,7 +18,7 @@ QtObject {
|
||||||
let db = LocalStorage.openDatabaseSync("ToDoList", "1.0", "ToDoList app database")
|
let db = LocalStorage.openDatabaseSync("ToDoList", "1.0", "ToDoList app database")
|
||||||
|
|
||||||
db.transaction(function (tx) {
|
db.transaction(function (tx) {
|
||||||
tx.executeSql('CREATE TABLE IF NOT EXISTS tasks (
|
tx.executeSql(`CREATE TABLE IF NOT EXISTS tasks (
|
||||||
task_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
task_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
task_name,
|
task_name,
|
||||||
task_dueDate TEXT,
|
task_dueDate TEXT,
|
||||||
|
@ -27,7 +26,7 @@ QtObject {
|
||||||
task_notes TEXT,
|
task_notes TEXT,
|
||||||
done INTEGER,
|
done INTEGER,
|
||||||
highlighted INTEGER
|
highlighted INTEGER
|
||||||
)');
|
)`);
|
||||||
})
|
})
|
||||||
|
|
||||||
_db = db
|
_db = db
|
||||||
|
@ -40,8 +39,8 @@ QtObject {
|
||||||
function addTask(taskName, taskDueDate, taskDueTime, taskNotes, taskDone, taskHighlighted) {
|
function addTask(taskName, taskDueDate, taskDueTime, taskNotes, taskDone, taskHighlighted) {
|
||||||
let results
|
let results
|
||||||
root._database().transaction(function(tx){
|
root._database().transaction(function(tx){
|
||||||
tx.executeSql("INSERT INTO tasks (task_name, task_dueDate, task_dueTime,
|
tx.executeSql(`INSERT INTO tasks (task_name, task_dueDate, task_dueTime,
|
||||||
task_notes, done, highlighted) VALUES(?,?,?,?,?,?);",
|
task_notes, done, highlighted) VALUES(?,?,?,?,?,?);`,
|
||||||
[taskName, taskDueDate, taskDueTime, taskNotes, taskDone, taskHighlighted])
|
[taskName, taskDueDate, taskDueTime, taskNotes, taskDone, taskHighlighted])
|
||||||
results = tx.executeSql("SELECT * FROM tasks ORDER BY task_id DESC LIMIT 1")
|
results = tx.executeSql("SELECT * FROM tasks ORDER BY task_id DESC LIMIT 1")
|
||||||
})
|
})
|
||||||
|
@ -50,8 +49,8 @@ QtObject {
|
||||||
|
|
||||||
function updateTask(taskId, taskName, taskDueDate, taskDueTime, taskNotes) {
|
function updateTask(taskId, taskName, taskDueDate, taskDueTime, taskNotes) {
|
||||||
root._database().transaction(function (tx) {
|
root._database().transaction(function (tx) {
|
||||||
tx.executeSql("UPDATE tasks set task_name=?, task_dueDate=?, task_dueTime=?,
|
tx.executeSql(`UPDATE tasks set task_name=?, task_dueDate=?, task_dueTime=?,
|
||||||
task_notes=? WHERE task_id=?",
|
task_notes=? WHERE task_id=?`,
|
||||||
[taskName, taskDueDate, taskDueTime, taskNotes, taskId])
|
[taskName, taskDueDate, taskDueTime, taskNotes, taskId])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue