diff --git a/dialer/package/contents/ui/Dialer/History.qml b/dialer/package/contents/ui/Dialer/History.qml index 96e48d92..07ec51a8 100644 --- a/dialer/package/contents/ui/Dialer/History.qml +++ b/dialer/package/contents/ui/Dialer/History.qml @@ -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 {} } } } \ No newline at end of file diff --git a/dialer/package/contents/ui/main.qml b/dialer/package/contents/ui/main.qml index 39ec3dca..8b381dc0 100644 --- a/dialer/package/contents/ui/main.qml +++ b/dialer/package/contents/ui/main.qml @@ -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