Warning, /network/neochat/src/qml/EmojiDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 
0007 import org.kde.kirigami as Kirigami
0008 
0009 import org.kde.neochat
0010 
0011 QQC2.Popup {
0012     id: root
0013 
0014     /**
0015      * @brief The current room that user is viewing.
0016      */
0017     property NeoChatRoom currentRoom
0018 
0019     property bool includeCustom: false
0020     property bool closeOnChosen: true
0021     property bool showQuickReaction: false
0022 
0023     signal chosen(string emoji)
0024 
0025     Connections {
0026         target: RoomManager
0027         function onCurrentRoomChanged() {
0028             root.close();
0029         }
0030     }
0031 
0032     onVisibleChanged: {
0033         if (!visible) {
0034             emojiPicker.clearSearchField();
0035             return;
0036         }
0037         emojiPicker.forceActiveFocus();
0038     }
0039 
0040     background: Kirigami.ShadowedRectangle {
0041         Kirigami.Theme.colorSet: Kirigami.Theme.View
0042         color: Kirigami.Theme.backgroundColor
0043         radius: Kirigami.Units.mediumSpacing
0044         shadow {
0045             size: Kirigami.Units.largeSpacing
0046             color: Qt.rgba(0.0, 0.0, 0.0, 0.3)
0047             yOffset: 2
0048         }
0049         border {
0050             color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
0051             width: 2
0052         }
0053     }
0054 
0055     modal: true
0056     focus: true
0057     clip: false
0058     closePolicy: QQC2.Popup.CloseOnEscape | QQC2.Popup.CloseOnPressOutsideParent
0059     margins: 0
0060     padding: 2
0061 
0062     implicitHeight: Kirigami.Units.gridUnit * 20 + 2 * padding
0063     width: Math.min(contentItem.categoryIconSize * 11 + 2 * padding, QQC2.Overlay.overlay.width)
0064     contentItem: EmojiPicker {
0065         id: emojiPicker
0066         height: 400
0067         currentRoom: root.currentRoom
0068         includeCustom: root.includeCustom
0069         showQuickReaction: root.showQuickReaction
0070         onChosen: emoji => {
0071             root.chosen(emoji);
0072             if (root.closeOnChosen) {
0073                 root.close();
0074             }
0075         }
0076     }
0077 }