sort calls by time

This commit is contained in:
Marco Martin 2015-04-27 11:14:53 +02:00
parent fb4765d50a
commit 839208addc
3 changed files with 10 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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]);