mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
clear calls button
tabbar to filter only missed calls
This commit is contained in:
parent
fc430058bf
commit
111223b727
2 changed files with 73 additions and 19 deletions
|
|
@ -42,29 +42,70 @@ Item {
|
|||
visible: historyModel.count == 0
|
||||
}
|
||||
|
||||
PlasmaExtras.ScrollArea {
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
ListView {
|
||||
id: view
|
||||
model: PlasmaCore.SortFilterModel {
|
||||
sourceModel: historyModel
|
||||
sortRole: "time"
|
||||
sortOrder: Qt.DescendingOrder
|
||||
}
|
||||
section {
|
||||
property: "date"
|
||||
labelPositioning: ViewSection.CurrentLabelAtStart
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
//width: view.width
|
||||
//height: childrenRect.height
|
||||
//color: syspal.base
|
||||
sectionDelegate: true
|
||||
PlasmaComponents.Label {
|
||||
text: Qt.formatDate(section, Qt.locale().dateFormat(Locale.LongFormat));
|
||||
visible: historyModel.count > 0
|
||||
PlasmaComponents.ToolBar {
|
||||
Layout.fillWidth: true
|
||||
tools: RowLayout {
|
||||
id: toolBarLayout
|
||||
PlasmaComponents.TabBar {
|
||||
tabPosition: Qt.TopEdge
|
||||
PlasmaComponents.TabButton {
|
||||
iconSource: "call-start"
|
||||
text: i18n("All")
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
filterModel.filterString = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.TabButton {
|
||||
iconSource: "list-remove"
|
||||
text: i18n("Missed")
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
filterModel.filterString = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: i18n("Clear")
|
||||
onClicked: clearHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaExtras.ScrollArea {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
ListView {
|
||||
id: view
|
||||
model: PlasmaCore.SortFilterModel {
|
||||
id: filterModel
|
||||
sourceModel: historyModel
|
||||
filterRole: "callType"
|
||||
sortRole: "time"
|
||||
sortOrder: Qt.DescendingOrder
|
||||
}
|
||||
section {
|
||||
property: "date"
|
||||
labelPositioning: ViewSection.CurrentLabelAtStart
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
//width: view.width
|
||||
//height: childrenRect.height
|
||||
//color: syspal.base
|
||||
sectionDelegate: true
|
||||
PlasmaComponents.Label {
|
||||
text: Qt.formatDate(section, Qt.locale().dateFormat(Locale.LongFormat));
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: HistoryDelegate {}
|
||||
}
|
||||
delegate: HistoryDelegate {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -135,6 +135,19 @@ ApplicationWindow {
|
|||
|
||||
historyModel.remove(index);
|
||||
}
|
||||
|
||||
function clearHistory() {
|
||||
var db = LocalStorage.openDatabaseSync("PlasmaPhoneDialer", "1.0", "Call history of the Plasma Phone dialer", 1000000);
|
||||
|
||||
db.transaction(
|
||||
function(tx) {
|
||||
tx.executeSql("DELETE from History");
|
||||
}
|
||||
)
|
||||
|
||||
historyModel.clear();
|
||||
}
|
||||
|
||||
//END FUNCTIONS
|
||||
|
||||
//BEGIN DATABASE
|
||||
|
|
|
|||
Loading…
Reference in a new issue