clear calls button

tabbar to filter only missed calls
This commit is contained in:
Marco Martin 2015-04-27 13:50:37 +02:00
parent fc430058bf
commit 111223b727
2 changed files with 73 additions and 19 deletions

View file

@ -42,29 +42,70 @@ Item {
visible: historyModel.count == 0 visible: historyModel.count == 0
} }
PlasmaExtras.ScrollArea { ColumnLayout {
anchors.fill: parent anchors.fill: parent
ListView { visible: historyModel.count > 0
id: view PlasmaComponents.ToolBar {
model: PlasmaCore.SortFilterModel { Layout.fillWidth: true
sourceModel: historyModel tools: RowLayout {
sortRole: "time" id: toolBarLayout
sortOrder: Qt.DescendingOrder PlasmaComponents.TabBar {
} tabPosition: Qt.TopEdge
section { PlasmaComponents.TabButton {
property: "date" iconSource: "call-start"
labelPositioning: ViewSection.CurrentLabelAtStart text: i18n("All")
delegate: PlasmaComponents.ListItem { onCheckedChanged: {
//width: view.width if (checked) {
//height: childrenRect.height filterModel.filterString = "";
//color: syspal.base }
sectionDelegate: true }
PlasmaComponents.Label { }
text: Qt.formatDate(section, Qt.locale().dateFormat(Locale.LongFormat)); 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 {}
} }
} }
} }

View file

@ -135,6 +135,19 @@ ApplicationWindow {
historyModel.remove(index); 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 //END FUNCTIONS
//BEGIN DATABASE //BEGIN DATABASE