Warning, /network/neochat/src/qml/EmojiTonesPicker.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 0005 import QtQuick.Controls as QQC2 0006 import org.kde.kirigami as Kirigami 0007 0008 import org.kde.neochat 0009 0010 QQC2.Popup { 0011 id: root 0012 0013 signal chosen(string emoji) 0014 0015 Component.onCompleted: { 0016 tonesList.currentIndex = 0; 0017 tonesList.forceActiveFocus(); 0018 } 0019 0020 required property string shortName 0021 required property string unicode 0022 required property int categoryIconSize 0023 width: root.categoryIconSize * tonesList.count + 2 * padding 0024 height: root.categoryIconSize + 2 * padding 0025 y: -height 0026 padding: 2 0027 modal: true 0028 dim: true 0029 clip: false 0030 onOpened: x = Math.min(parent.mapFromGlobal(QQC2.Overlay.overlay.width - root.width, 0).x, -(width - parent.width) / 2) 0031 background: Kirigami.ShadowedRectangle { 0032 color: Kirigami.Theme.backgroundColor 0033 radius: Kirigami.Units.mediumSpacing 0034 shadow { 0035 size: Kirigami.Units.largeSpacing 0036 color: Qt.rgba(0.0, 0.0, 0.0, 0.3) 0037 yOffset: 2 0038 } 0039 border { 0040 color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15) 0041 width: 1 0042 } 0043 } 0044 0045 ListView { 0046 id: tonesList 0047 width: parent.width 0048 height: parent.height 0049 orientation: Qt.Horizontal 0050 model: EmojiModel.tones(root.shortName) 0051 keyNavigationEnabled: true 0052 keyNavigationWraps: true 0053 0054 delegate: EmojiDelegate { 0055 id: emojiDelegate 0056 checked: tonesList.currentIndex === model.index 0057 emoji: modelData.unicode 0058 name: modelData.shortName 0059 0060 width: root.categoryIconSize 0061 height: width 0062 0063 Keys.onEnterPressed: clicked() 0064 Keys.onReturnPressed: clicked() 0065 onClicked: { 0066 root.chosen(modelData.unicode); 0067 EmojiModel.emojiUsed(modelData); 0068 root.close(); 0069 } 0070 } 0071 } 0072 }