Warning, /plasma/kdeplasma-addons/applets/dict/package/contents/ui/ConfigDictionaries.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2017 David Faure <faure@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.15 0008 import QtQuick.Controls 2.5 0009 import QtQuick.Layouts 1.15 0010 import org.kde.kirigami 2.19 as Kirigami 0011 import org.kde.kcmutils as KCM 0012 import org.kde.plasma.private.dict 1.0 0013 0014 KCM.ScrollViewKCM { 0015 0016 property string cfg_dictionary: "" 0017 0018 DictionariesModel { 0019 id: dictionariesModel 0020 Component.onCompleted: enabledDicts = cfg_dictionary 0021 onEnabledDictsChanged: cfg_dictionary = enabledDicts 0022 } 0023 0024 AvailableDictSheet { 0025 id: sheet 0026 } 0027 0028 view: ListView { 0029 id: listView 0030 0031 model: dictionariesModel.enabledDictModel 0032 reuseItems: true 0033 0034 displaced: Transition { 0035 NumberAnimation { 0036 properties: "y" 0037 duration: Kirigami.Units.longDuration 0038 } 0039 } 0040 0041 delegate: DictItemDelegate { 0042 width: listView.width 0043 view: listView 0044 0045 onMoveRequested: (oldIndex, newIndex) => { 0046 dictionariesModel.move(oldIndex, newIndex); 0047 } 0048 onRemoved: index => { 0049 dictionariesModel.setDisabled(index); 0050 } 0051 } 0052 0053 Loader { 0054 active: dictionariesModel.loading || sheet.view.count === 0 || listView.count === 0 0055 asynchronous: true 0056 0057 anchors.centerIn: parent 0058 visible: active 0059 0060 sourceComponent: dictionariesModel.loading ? loadingPlaceHolder : (sheet.view.count === 0 ? errorPlaceHolder : emptyPlaceholder) 0061 0062 Component { 0063 id: loadingPlaceHolder 0064 0065 Kirigami.LoadingPlaceholder { 0066 anchors.centerIn: parent 0067 } 0068 } 0069 0070 Component { 0071 id: errorPlaceHolder 0072 0073 Kirigami.PlaceholderMessage { 0074 anchors.centerIn: parent 0075 width: root.width - (Kirigami.Units.largeSpacing * 4) 0076 icon.name: "network-disconnect" 0077 text: i18n("Unable to load dictionary list") 0078 explanation: i18nc("%2 human-readable error string", "Error code: %1 (%2)", dictionariesModel.errorCode, dictionariesModel.errorString) 0079 } 0080 } 0081 0082 Component { 0083 id: emptyPlaceholder 0084 0085 Kirigami.PlaceholderMessage { 0086 anchors.centerIn: parent 0087 width: root.width - (Kirigami.Units.largeSpacing * 4) 0088 icon.name: "edit-none" 0089 text: i18n("No dictionaries") 0090 } 0091 } 0092 } 0093 } 0094 0095 footer: RowLayout { 0096 Button { 0097 enabled: sheet.view.count > 0 0098 text: i18n("Add Moreā¦") 0099 icon.name: "list-add" 0100 onClicked: { 0101 sheet.open(); 0102 } 0103 } 0104 } 0105 }