mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 22:34:45 +00:00
sort calls by time
This commit is contained in:
parent
fb4765d50a
commit
839208addc
3 changed files with 10 additions and 5 deletions
|
|
@ -41,11 +41,16 @@ Item {
|
||||||
text: i18n("No recent calls")
|
text: i18n("No recent calls")
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaExtras.ScrollArea {
|
PlasmaExtras.ScrollArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
ListView {
|
ListView {
|
||||||
id: view
|
id: view
|
||||||
model: historyModel
|
model: PlasmaCore.SortFilterModel {
|
||||||
|
sourceModel: historyModel
|
||||||
|
sortRole: "time"
|
||||||
|
sortOrder: Qt.DescendingOrder
|
||||||
|
}
|
||||||
section {
|
section {
|
||||||
property: "date"
|
property: "date"
|
||||||
labelPositioning: ViewSection.CurrentLabelAtStart
|
labelPositioning: ViewSection.CurrentLabelAtStart
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ Item {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
Layout.alignment: Qt.AlignRight
|
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 {
|
PlasmaComponents.Label {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
db.transaction(
|
db.transaction(
|
||||||
function(tx) {
|
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
|
// Show all added greetings
|
||||||
var rs = tx.executeSql('SELECT * FROM History where id=?', [rs.insertId]);
|
var rs = tx.executeSql('SELECT * FROM History where id=?', [rs.insertId]);
|
||||||
|
|
@ -126,7 +126,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
db.transaction(
|
db.transaction(
|
||||||
function(tx) {
|
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) {
|
function(tx) {
|
||||||
// Create the database if it doesn't already exist
|
// Create the database if it doesn't already exist
|
||||||
//callType: wether is incoming, outgoing, unanswered
|
//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
|
// Add (another) greeting row
|
||||||
// tx.executeSql("INSERT INTO History VALUES(NULL, ?, date('now'), time('now'), ? )", ['+39000', 0]);
|
// tx.executeSql("INSERT INTO History VALUES(NULL, ?, date('now'), time('now'), ? )", ['+39000', 0]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue