Warning, /utilities/keysmith/src/contents/ui/TokenEntryViewLabels.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-License-Identifier: GPL-3.0-or-later
0003 * SPDX-FileCopyrightText: 2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
0004 */
0005
0006 import QtQuick 2.1
0007 import QtQuick.Controls 2.0 as Controls
0008 import org.kde.kirigami 2.8 as Kirigami
0009
0010 Item {
0011 property string accountName
0012 property string tokenValue
0013 property color labelColor
0014
0015 id: root
0016 /*
0017 * It appears that Kirigami.SwipeListItem is quite broken (at least on Android): without setting an implicitHeight here
0018 * the SwipeListItem which will eventually contain this item is not tall enough even for its own actions!
0019 *
0020 * The work around is to just sort of guess at what an appropriate implicitHeight might be.
0021 * Note that on desktop this does approximately nothing, on Android it seems to set the height to
0022 * Kirigami.Units.iconSizes.small and that appears to be match with the icon size used for SwipeListItem actions there
0023 * as well.
0024 */
0025 implicitHeight: Math.max(accountNameLabel.height, tokenValueLabel.height, Kirigami.Units.iconSizes.small)
0026 Controls.Label {
0027 id: accountNameLabel
0028 horizontalAlignment: Text.AlignLeft
0029 font.weight: Font.Light
0030 elide: Text.ElideRight
0031 text: accountName
0032 color: labelColor
0033 anchors.left: root.left
0034 anchors.verticalCenter: root.verticalCenter
0035 }
0036 Controls.Label {
0037 id: tokenValueLabel
0038 horizontalAlignment: Text.AlignRight
0039 font.weight: Font.Bold
0040 text: tokenValue && tokenValue.length > 0 ? tokenValue : i18nc("placeholder text if no token is available", "(refresh)")
0041 color: labelColor
0042 anchors.right: root.right
0043 anchors.verticalCenter: root.verticalCenter
0044 }
0045 }