Warning, /plasma/aura-browser/app/qml/delegates/BookmarkDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com>
0003     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.10
0009 import QtQuick.Controls 2.10 as Controls
0010 import QtQuick.Layouts 1.3
0011 import Aura 1.0 as Aura
0012 import Qt5Compat.GraphicalEffects
0013 import org.kde.kirigami as Kirigami
0014 
0015 Controls.Control {
0016     id: delegate
0017 
0018     implicitWidth: gridView.cellWidth
0019     implicitHeight: gridView.cellHeight
0020 
0021     readonly property GridView gridView: GridView.view
0022 
0023     z: gridView.currentIndex == index ? 2 : 0
0024 
0025     leftPadding: background.extraMargin
0026     topPadding: background.extraMargin
0027     rightPadding: background.extraMargin
0028     bottomPadding: background.extraMargin
0029 
0030     background: Item {
0031         id: background
0032         property real extraMargin:  Math.round(gridView.currentIndex == index && delegate.activeFocus ? -Kirigami.Units.gridUnit/2 : Kirigami.Units.gridUnit/2)
0033         Behavior on extraMargin {
0034             NumberAnimation {
0035                 duration: Kirigami.Units.longDuration
0036                 easing.type: Easing.InOutQuad
0037             }
0038         }
0039 
0040         Rectangle {
0041             id: frame
0042             anchors {
0043                 fill: parent
0044                 margins: background.extraMargin
0045             }
0046             color: Kirigami.Theme.backgroundColor
0047             width: gridView.currentIndex == index && delegate.activeFocus ? parent.width : parent.width - Kirigami.Units.gridUnit
0048             height: gridView.currentIndex == index && delegate.activeFocus ? parent.height : parent.height - Kirigami.Units.gridUnit
0049             opacity: 0.8
0050             layer.enabled: true
0051             layer.effect: DropShadow {
0052                 horizontalOffset: 0
0053                 verticalOffset: 2
0054                 radius: 8.0
0055                 samples: 17
0056                 color: Qt.rgba(0,0,0,0.6)
0057             }
0058         }
0059     }
0060     
0061     contentItem: ColumnLayout {
0062         spacing: 0
0063         Rectangle {
0064             id: bgImgIcon
0065             Layout.fillWidth: true
0066             Layout.preferredHeight: parent.height - label.height
0067             color: model.rand_color
0068 
0069             Kirigami.Heading {
0070                 anchors.centerIn: parent
0071                 text: model.recent_name.substring(0,1)
0072                 font.bold: true
0073                 color: Kirigami.Theme.textColor
0074             }
0075         }
0076 
0077         Kirigami.Heading {
0078             id: label
0079             visible: text.length > 0
0080             level: 3
0081             Layout.fillWidth: true
0082             wrapMode: Text.WordWrap
0083             horizontalAlignment: Text.AlignHCenter
0084             maximumLineCount: 2
0085             elide: Text.ElideRight
0086             text: model.recent_name
0087             color: Kirigami.Theme.textColor
0088         }
0089     }
0090 
0091     Keys.onReturnPressed: (event)=> {
0092         Aura.NavigationSoundEffects.playClickedSound()
0093         urlEntryBox.close()
0094         createTab(model.recent_url)
0095     }
0096 
0097     MouseArea {
0098         id: mouseAreaRecent
0099         anchors.fill: delegate
0100         onClicked: (mouse)=> {
0101             Aura.NavigationSoundEffects.playClickedSound()
0102             urlEntryBox.close()
0103             createTab(model.recent_url)
0104         }
0105     }
0106 }