Warning, /network/angelfish/src/contents/ui/History.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2014-2015 Sebastian Kügler <sebas@kde.org>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts 1.0
0007 
0008 import org.kde.kirigami 2.8 as Kirigami
0009 import org.kde.angelfish 1.0
0010 
0011 Kirigami.ScrollablePage {
0012     title: i18n("History")
0013     Kirigami.ColumnView.fillWidth: false
0014 
0015     actions.main: Kirigami.Action {
0016         text: "Clear"
0017         iconName: "edit-clear-all"
0018 
0019         onTriggered: BrowserManager.clearHistory()
0020     }
0021 
0022     header: Item {
0023         anchors.horizontalCenter: parent.horizontalCenter
0024         height: Kirigami.Units.gridUnit * 3
0025         width: list.width
0026 
0027         Kirigami.SearchField {
0028             id: search
0029             anchors.centerIn: parent
0030             width: parent.width - Kirigami.Units.gridUnit
0031 
0032             clip: true
0033             inputMethodHints: rootPage.privateMode ? Qt.ImhNoPredictiveText : Qt.ImhNone
0034             Kirigami.Theme.inherit: true
0035 
0036             onDisplayTextChanged: {
0037                 if (displayText === "" || displayText.length > 2) {
0038                     list.model.filter = displayText;
0039                     timer.running = false;
0040                 }
0041                 else timer.running = true;
0042             }
0043             Keys.onEscapePressed: pageStack.pop()
0044 
0045             Timer {
0046                 id: timer
0047                 repeat: false
0048                 interval: Math.max(1000, 3000 - search.displayText.length * 1000)
0049                 onTriggered: list.model.filter = search.displayText
0050             }
0051         }
0052     }
0053 
0054     Component {
0055         id: delegateComponent
0056 
0057         UrlDelegate {
0058             highlightText: list.model.filter
0059             width: list.width
0060             onClicked: {
0061                 currentWebView.url = url;
0062                 pageStack.pop();
0063             }
0064             onRemoved: BrowserManager.removeFromHistory(url);
0065         }
0066     }
0067 
0068     ListView {
0069         id: list
0070         anchors.fill: parent
0071 
0072         interactive: height < contentHeight
0073         clip: true
0074 
0075         reuseItems: true
0076         model: BookmarksHistoryModel {
0077             history: true
0078         }
0079 
0080         delegate: delegateComponent
0081     }
0082 
0083     Component.onCompleted: search.forceActiveFocus()
0084 }