diff --git a/dialer/package/contents/ui/Dialer/History.qml b/dialer/package/contents/ui/Dialer/History.qml index 9479bb1f..48aa91ba 100644 --- a/dialer/package/contents/ui/Dialer/History.qml +++ b/dialer/package/contents/ui/Dialer/History.qml @@ -41,11 +41,16 @@ Item { text: i18n("No recent calls") visible: false } + PlasmaExtras.ScrollArea { anchors.fill: parent ListView { id: view - model: historyModel + model: PlasmaCore.SortFilterModel { + sourceModel: historyModel + sortRole: "time" + sortOrder: Qt.DescendingOrder + } section { property: "date" labelPositioning: ViewSection.CurrentLabelAtStart diff --git a/dialer/package/contents/ui/Dialer/HistoryDelegate.qml b/dialer/package/contents/ui/Dialer/HistoryDelegate.qml index 57bc9f9e..7dcaa30c 100644 --- a/dialer/package/contents/ui/Dialer/HistoryDelegate.qml +++ b/dialer/package/contents/ui/Dialer/HistoryDelegate.qml @@ -109,7 +109,7 @@ Item { ColumnLayout { PlasmaComponents.Label { Layout.alignment: Qt.AlignRight - text: Qt.formatTime(model.date+" "+model.time, Qt.locale().timeFormat(Locale.ShortFormat)); + text: Qt.formatTime(model.time, Qt.locale().timeFormat(Locale.ShortFormat)); } PlasmaComponents.Label { Layout.alignment: Qt.AlignRight diff --git a/dialer/package/contents/ui/main.qml b/dialer/package/contents/ui/main.qml index 94f5288b..9ec510b0 100644 --- a/dialer/package/contents/ui/main.qml +++ b/dialer/package/contents/ui/main.qml @@ -103,7 +103,7 @@ ApplicationWindow { db.transaction( function(tx) { - var rs = tx.executeSql("INSERT INTO History VALUES(NULL, ?, date('now'), time('now'), ?, ? )", [number, duration, callType]); + var rs = tx.executeSql("INSERT INTO History VALUES(NULL, ?, date('now'), datetime('now'), ?, ? )", [number, duration, callType]); // Show all added greetings var rs = tx.executeSql('SELECT * FROM History where id=?', [rs.insertId]); @@ -126,7 +126,7 @@ ApplicationWindow { db.transaction( function(tx) { - tx.executeSql("DELETE from History WHERE id=?", [id]); + tx.executeSql("DELETE from History WHERE id=?", [item.id]); } ) @@ -147,7 +147,7 @@ ApplicationWindow { function(tx) { // Create the database if it doesn't already exist //callType: wether is incoming, outgoing, unanswered - tx.executeSql('CREATE TABLE IF NOT EXISTS History(id INTEGER PRIMARY KEY AUTOINCREMENT, number TEXT, date DATE, time TIME, duration INTEGER, callType INTEGER)'); + tx.executeSql('CREATE TABLE IF NOT EXISTS History(id INTEGER PRIMARY KEY AUTOINCREMENT, number TEXT, date DATE, time DATETIME, duration INTEGER, callType INTEGER)'); // Add (another) greeting row // tx.executeSql("INSERT INTO History VALUES(NULL, ?, date('now'), time('now'), ? )", ['+39000', 0]);