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

0001 //SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
0002 //SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 import QtQuick.Window
0008 
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.kirigamiaddons.delegates as Delegates
0011 
0012 import org.kde.angelfish 1.0
0013 
0014 Kirigami.ScrollablePage {
0015     globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None
0016     Kirigami.ColumnView.fillWidth: false
0017 
0018     header: QQC2.ToolBar {
0019         anchors.horizontalCenter: parent.horizontalCenter
0020         height: webBrowser.pageStack.globalToolBar.preferredHeight + 1 // to match tabs height
0021         width: parent.width
0022 
0023         RowLayout {
0024             anchors.fill: parent
0025 
0026             Kirigami.SearchField {
0027                 id: search
0028                 Layout.fillWidth: true
0029 
0030                 placeholderText: i18n("Search bookmarks…")
0031                 inputMethodHints: rootPage.privateMode ? Qt.ImhNoPredictiveText : Qt.ImhNone
0032                 onAccepted: {
0033                     if (text === "" || text.length > 2) {
0034                         list.model.filter = displayText;
0035                     }
0036                 }
0037                 Keys.onEscapePressed: pageStack.pop()
0038                 Component.onCompleted: search.forceActiveFocus()
0039             }
0040             QQC2.ToolButton {
0041                 icon.name: "tab-close"
0042                 onClicked: pageStack.pop()
0043             }
0044         }
0045     }
0046 
0047     ListView {
0048         id: list
0049 
0050         currentIndex: -1
0051 
0052         model: BookmarksHistoryModel {
0053             history: false
0054             bookmarks: true
0055         }
0056 
0057         delegate: Delegates.RoundedItemDelegate {
0058             id: bookmarkDelegate
0059 
0060             required property int index
0061             required property string title
0062             required property string url
0063             required property string iconName
0064 
0065             text: title
0066 
0067             icon {
0068                 name: iconName.length > 0 ? iconName : "internet-services"
0069                 width: Kirigami.Units.largeSpacing * 3
0070                 height: Kirigami.Units.largeSpacing * 3
0071             }
0072 
0073             onClicked: currentWebView.url = bookmarkDelegate.url
0074 
0075             contentItem: RowLayout {
0076                 spacing: Kirigami.Units.smallSpacing
0077 
0078                 Delegates.SubtitleContentItem {
0079                     itemDelegate: bookmarkDelegate
0080                     subtitle: bookmarkDelegate.url
0081                 }
0082 
0083                 QQC2.ToolButton {
0084                     icon.name: "entry-delete"
0085                     onClicked: BrowserManager.removeBookmark(bookmarkDelegate.url);
0086                 }
0087             }
0088         }
0089 
0090         Kirigami.PlaceholderMessage {
0091             visible: list.count === 0
0092             anchors.centerIn: parent
0093             width: parent.width - Kirigami.Units.gridUnit * 4
0094 
0095             text: i18n("No bookmarks yet")
0096         }
0097     }
0098 }