Warning, /plasma/plasma-nm/applet/contents/ui/DetailsText.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2013-2017 Jan Grulich <jgrulich@redhat.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 import QtQuick 2.2 0008 import QtQuick.Layouts 1.15 0009 0010 import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons 0011 import org.kde.plasma.core 2.0 as PlasmaCore 0012 import org.kde.plasma.components 2.0 as PlasmaComponents // for ContextMenu+MenuItem 0013 import org.kde.plasma.components 3.0 as PlasmaComponents3 0014 0015 MouseArea { 0016 height: detailsGrid.implicitHeight 0017 0018 property var details: [] 0019 0020 acceptedButtons: Qt.RightButton 0021 0022 onPressed: { 0023 const item = detailsGrid.childAt(mouse.x, mouse.y); 0024 if (!item || !item.isContent) { 0025 return; 0026 } 0027 contextMenu.show(this, item.text, mouse.x, mouse.y); 0028 } 0029 0030 KQuickControlsAddons.Clipboard { 0031 id: clipboard 0032 } 0033 0034 PlasmaComponents.ContextMenu { 0035 id: contextMenu 0036 property string text 0037 0038 function show(item, text, x, y) { 0039 contextMenu.text = text 0040 visualParent = item 0041 open(x, y) 0042 } 0043 0044 PlasmaComponents.MenuItem { 0045 text: i18n("Copy") 0046 icon: "edit-copy" 0047 enabled: contextMenu.text !== "" 0048 onClicked: clipboard.content = contextMenu.text 0049 } 0050 } 0051 0052 GridLayout { 0053 id: detailsGrid 0054 width: parent.width 0055 columns: 2 0056 rowSpacing: PlasmaCore.Units.smallSpacing / 4 0057 0058 Repeater { 0059 id: repeater 0060 0061 model: details.length 0062 0063 PlasmaComponents3.Label { 0064 Layout.fillWidth: true 0065 0066 readonly property bool isContent: index % 2 0067 0068 elide: isContent ? Text.ElideRight : Text.ElideNone 0069 font: PlasmaCore.Theme.smallestFont 0070 horizontalAlignment: isContent ? Text.AlignLeft : Text.AlignRight 0071 text: isContent ? details[index] : `${details[index]}:` 0072 textFormat: Text.PlainText 0073 opacity: isContent ? 1 : 0.6 0074 } 0075 } 0076 } 0077 }