Warning, /network/angelfish/src/contents/ui/UrlDelegate.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 2.3
0006 import QtQuick.Controls 2.0 as Controls
0007 import QtQuick.Layouts 1.3
0008 
0009 import org.kde.kirigami 2.5 as Kirigami
0010 
0011 Kirigami.SwipeListItem {
0012     id: urlDelegate
0013 
0014     property bool showRemove: true
0015 
0016     property string highlightText
0017     property var regex: new RegExp(highlightText, 'i')
0018     property string highlightedText: "<b><font color=\"" + Kirigami.Theme.selectionTextColor + "\">$&</font></b>"
0019 
0020     height: Kirigami.Units.gridUnit * 3
0021 
0022     Kirigami.Theme.colorSet: Kirigami.Theme.View
0023 
0024     onClicked: {
0025         currentWebView.url = url;
0026     }
0027 
0028     signal removed
0029 
0030     contentItem: RowLayout {
0031         Kirigami.Theme.inherit: true
0032 
0033         Item {
0034             Layout.preferredHeight: parent.height
0035             Layout.preferredWidth: parent.height
0036 
0037             Image {
0038                 anchors.fill: parent
0039                 fillMode: Image.PreserveAspectFit
0040 
0041                 source: model && model.icon ? model.icon : ""
0042             }
0043         }
0044 
0045         ColumnLayout {
0046             Layout.fillWidth: true
0047 
0048             // title
0049             Controls.Label {
0050                 text: title ? (highlightText ? title.replace(regex, highlightedText) : title) : ""
0051                 elide: Qt.ElideRight
0052                 maximumLineCount: 1
0053                 Layout.fillWidth: true
0054             }
0055 
0056             // url
0057             Controls.Label {
0058                 text: url ? (highlightText ? url.replace(regex, highlightedText) : url) : ""
0059                 opacity: 0.6
0060                 elide: Qt.ElideRight
0061                 maximumLineCount: 1
0062                 Layout.fillWidth: true
0063             }
0064         }
0065     }
0066 
0067     actions: [
0068         Kirigami.Action {
0069             icon.name: "list-remove"
0070             visible: urlDelegate.showRemove
0071             onTriggered: urlDelegate.removed();
0072         }
0073     ]
0074 }