Warning, /plasma/kdeplasma-addons/applets/dict/package/contents/ui/AvailableDictSheet.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2013 Kai Uwe Broulik <kde@privat.broulik.de> 0003 SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.15 0009 import QtQuick.Controls 2.15 as QQC2 0010 import QtQuick.Layouts 1.15 0011 0012 import org.kde.kirigami 2.20 as Kirigami 0013 import org.kde.kitemmodels 1.0 as KItemModels 0014 0015 Kirigami.OverlaySheet { 0016 id: sheet 0017 0018 readonly property alias view: sheetListView 0019 0020 onOpened: { 0021 filter.text = ""; 0022 filter.forceActiveFocus() 0023 } 0024 0025 // Need to manually set the parent when using this in a Plasma config dialog 0026 parent: sheet.parent.parent 0027 0028 header: ColumnLayout { 0029 Layout.preferredWidth: sheetListView.implicitWidth 0030 0031 Kirigami.Heading { 0032 Layout.fillWidth: true 0033 text: i18n("Add More Dictionaries") 0034 textFormat: Text.PlainText 0035 wrapMode: Text.Wrap 0036 } 0037 Kirigami.SearchField { 0038 id: filter 0039 Layout.fillWidth: true 0040 } 0041 } 0042 0043 footer: QQC2.DialogButtonBox { 0044 standardButtons: QQC2.DialogButtonBox.Ok 0045 onAccepted: sheet.close() 0046 } 0047 0048 ListView { 0049 id: sheetListView 0050 focus: true // keyboard navigation 0051 activeFocusOnTab: true // keyboard navigation 0052 implicitWidth: Kirigami.Units.gridUnit * 25 0053 0054 reuseItems: true 0055 0056 model: KItemModels.KSortFilterProxyModel { 0057 sourceModel: dictionariesModel 0058 filterRoleName: "EditRole" // id 0059 filterString: filter.text 0060 filterCaseSensitivity: Qt.CaseInsensitive 0061 } 0062 0063 delegate: QQC2.CheckDelegate { 0064 id: checkbox 0065 width: sheetListView.width 0066 focus: true // keyboard navigation 0067 text: `${model.id} (${model.description})` 0068 checked: model.checked 0069 onToggled: { 0070 model.checked = checked; 0071 sheetListView.currentIndex = index; // highlight 0072 sheetListView.forceActiveFocus(); // keyboard navigation 0073 } 0074 highlighted: ListView.isCurrentItem 0075 } 0076 } 0077 }