Commit 2f1e2985 authored by Rinigus Saar's avatar Rinigus Saar Committed by Jonah Brüchert
Browse files

Add search fields to bookmarks/history and fix search for navigation entry

parent 815e6b40
......@@ -22,26 +22,43 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.7 as Kirigami
import org.kde.kirigami 2.8 as Kirigami
import org.kde.mobile.angelfish 1.0
Kirigami.ScrollablePage {
// id: options
title: i18n("Bookmarks")
Kirigami.ColumnView.fillWidth: false
header: Item {
anchors.horizontalCenter: parent.horizontalCenter
height: Kirigami.Units.gridUnit * 3
width: list.width
Kirigami.SearchField {
id: search
anchors.centerIn: parent
width: parent.width - Kirigami.Units.gridUnit
clip: true
Kirigami.Theme.inherit: true
onDisplayTextChanged: list.model.filter = displayText;
Keys.onEscapePressed: pageStack.pop()
}
}
Component {
id: delegateComponent
UrlDelegate {
highlightText: list.model.filter
onClicked: pageStack.pop()
onRemoved: BrowserManager.removeBookmark(url);
}
}
ListView {
id: list
anchors.fill: parent
interactive: height < contentHeight
......@@ -52,9 +69,8 @@ Kirigami.ScrollablePage {
}
delegate: Kirigami.DelegateRecycler {
width: parent.width
width: list.width
sourceComponent: delegateComponent
}
}
Component.onCompleted: print("Bookmarks.qml complete.");
}
......@@ -22,24 +22,43 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.7 as Kirigami
import org.kde.kirigami 2.8 as Kirigami
import org.kde.mobile.angelfish 1.0
Kirigami.ScrollablePage {
id: history
title: i18n("History")
Kirigami.ColumnView.fillWidth: false
header: Item {
anchors.horizontalCenter: parent.horizontalCenter
height: Kirigami.Units.gridUnit * 3
width: list.width
Kirigami.SearchField {
id: search
anchors.centerIn: parent
width: parent.width - Kirigami.Units.gridUnit
clip: true
Kirigami.Theme.inherit: true
onDisplayTextChanged: list.model.filter = displayText;
Keys.onEscapePressed: pageStack.pop()
}
}
Component {
id: delegateComponent
UrlDelegate {
highlightText: list.model.filter
onClicked: pageStack.pop()
onRemoved: BrowserManager.removeFromHistory(url);
}
}
ListView {
id: list
anchors.fill: parent
interactive: height < contentHeight
......@@ -49,11 +68,11 @@ Kirigami.ScrollablePage {
history: true
}
delegate: Kirigami.DelegateRecycler {
width: parent.width
width: list.width
sourceComponent: delegateComponent
}
}
Component.onCompleted: print("History.qml complete.");
Component.onCompleted: search.forceActiveFocus()
}
......@@ -75,14 +75,13 @@ Controls.Drawer {
Layout.fillWidth: true
clip: true
focus: false
selectByMouse: true
Kirigami.Theme.inherit: true
onActiveFocusChanged: if (activeFocus) selectAll()
onAccepted: applyUrl()
onTextChanged: {
onDisplayTextChanged: {
if (!openedState) return; // avoid filtering
urlFilter.filter = text;
urlFilter.filter = displayText;
justOpened = false;
}
Keys.onEscapePressed: if (overlay.sheetOpen) overlay.close()
......@@ -125,7 +124,7 @@ Controls.Drawer {
delegate: UrlDelegate {
showRemove: false
onClicked: overlay.close()
highlightText: urlInput.text
highlightText: urlInput.displayText
width: parent.width
}
......
......@@ -32,7 +32,7 @@ Kirigami.SwipeListItem {
property string highlightText
property var regex: new RegExp(highlightText, 'i')
property string highlightedText: "<b><font color=\"" + Kirigami.Theme.highlightColor + "\">$&</font></b>"
property string highlightedText: "<b><font color=\"" + Kirigami.Theme.selectionTextColor + "\">$&</font></b>"
height: Kirigami.Units.gridUnit * 3
......@@ -55,7 +55,7 @@ Kirigami.SwipeListItem {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: model.icon ? model.icon : ""
source: model && model.icon ? model.icon : ""
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment