Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

Search notification history

Bee989463f076fb
diff --git a/desktop/app/qml/Icons.qml b/desktop/app/qml/Icons.qml
index edfb6bf..2c186a3 100644
--- a/desktop/app/qml/Icons.qml
+++ b/desktop/app/qml/Icons.qml
@@ -7,6 +7,7 @@ import QtQuick
QtObject {
readonly property string home: "M3 11l9-7 9 7M5 10v10h14V10"
readonly property string messages: "M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"
+ readonly property string search: "M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14zM20 20l-4-4"
readonly property string moon: "M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z"
readonly property string bell: "M6 8a6 6 0 1 1 12 0c0 7 3 8 3 8H3s3-1 3-8M10 20a2 2 0 0 0 4 0"
readonly property string photo: "M6 3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3zM21 15l-5-5L5 21"
diff --git a/desktop/app/qml/pages/HomePage.qml b/desktop/app/qml/pages/HomePage.qml
index 138776f..8b33f31 100644
--- a/desktop/app/qml/pages/HomePage.qml
+++ b/desktop/app/qml/pages/HomePage.qml
@@ -377,7 +377,10 @@ Item {
size: "sm"
iconPath: Icons.history
text: qsTr("History")
- onClicked: historySheet.open()
+ onClicked: {
+ historySearch.text = ""
+ historySheet.open()
+ }
}
Button {
id: clearAll
@@ -664,6 +667,56 @@ Item {
? qsTr("Notifications that went away on your phone, or that you dismissed, for a day.")
: qsTr("Nothing here yet. Notifications that go away on your phone are kept here for a day.")
}
+ // Search: by app, title or text, ignoring case.
+ Rectangle {
+ width: parent.width
+ height: 40
+ visible: NotificationHistory.count > 0
+ radius: Theme.graphite ? Theme.radiusSm : height / 2
+ color: Theme.graphite ? "transparent" : Theme.surfaceContainerHighest
+ border.width: historySearch.activeFocus ? 2 : 1
+ border.color: historySearch.activeFocus ? Theme.primary : Theme.outlineVariant
+ Icon {
+ id: searchIcon
+ anchors.left: parent.left
+ anchors.leftMargin: 14
+ anchors.verticalCenter: parent.verticalCenter
+ width: 18; height: 18
+ path: Icons.search
+ color: Theme.surfaceContentVariant
+ }
+ TextInput {
+ id: historySearch
+ readonly property string query: text.trim().toLocaleLowerCase()
+ function matches(fields) {
+ return query.length === 0 || fields.join(" ").toLocaleLowerCase().indexOf(query) >= 0
+ }
+ anchors.left: searchIcon.right
+ anchors.leftMargin: 10
+ anchors.right: parent.right
+ anchors.rightMargin: 16
+ anchors.verticalCenter: parent.verticalCenter
+ font.family: Theme.fontUi
+ font.pixelSize: 14
+ color: Theme.surfaceContent
+ selectionColor: Theme.primaryContainer
+ selectedTextColor: Theme.primaryContainerContent
+ clip: true
+ Keys.onEscapePressed: (event) => {
+ // Clears first; a second Escape closes the sheet.
+ event.accepted = text.length > 0
+ text = ""
+ }
+ Accessible.name: qsTr("Search history")
+ Txt {
+ anchors.verticalCenter: parent.verticalCenter
+ visible: historySearch.text.length === 0
+ role: "body"
+ muted: true
+ text: qsTr("Search history")
+ }
+ }
+ }
Flickable {
width: parent.width
height: Math.min(historyColumn.height, page.height - 260)
@@ -675,10 +728,21 @@ Item {
width: parent.width
Repeater {
model: NotificationHistory
- delegate: HistoryItem { width: historyColumn.width }
+ delegate: HistoryItem {
+ width: historyColumn.width
+ visible: historySearch.matches([appName, title, text, sub])
+ }
}
}
}
+ Txt {
+ width: parent.width
+ visible: historySearch.query.length > 0 && historyColumn.height === 0
+ horizontalAlignment: Text.AlignHCenter
+ role: "body"
+ muted: true
+ text: qsTr("Nothing matches “%1”.").arg(historySearch.text.trim())
+ }
Row {
anchors.right: parent.right
Button { text: qsTr("Done"); onClicked: historySheet.close() }