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,12 +42,52 @@ Item {
visible: historyModel.count == 0 visible: historyModel.count == 0
} }
PlasmaExtras.ScrollArea { ColumnLayout {
anchors.fill: parent anchors.fill: parent
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 { ListView {
id: view id: view
model: PlasmaCore.SortFilterModel { model: PlasmaCore.SortFilterModel {
id: filterModel
sourceModel: historyModel sourceModel: historyModel
filterRole: "callType"
sortRole: "time" sortRole: "time"
sortOrder: Qt.DescendingOrder sortOrder: Qt.DescendingOrder
} }
@ -67,4 +107,5 @@ Item {
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