Warning, /plasma/plasma-workspace/plasmacalendarintegration/HolidaysConfig.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: 2015 Martin Klapetek <mklapetek@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 2.5 0009 import QtQuick.Controls 1.4 as QQC1 0010 import QtQuick.Controls 2.5 as QQC2 0011 import QtQuick.Layouts 1.3 0012 import QtQuick.Dialogs 1.1 0013 0014 import org.kde.plasma.core 2.1 as PlasmaCore 0015 import org.kde.kholidays 1.0 as KHolidays 0016 import org.kde.holidayeventshelperplugin 1.0 0017 import org.kde.kirigami 2.15 as Kirigami 0018 0019 ColumnLayout { 0020 id: holidaysConfig 0021 anchors.left: parent.left 0022 anchors.right: parent.right 0023 0024 signal configurationChanged 0025 0026 function saveConfig() 0027 { 0028 configHelper.saveConfig(); 0029 } 0030 0031 // This is just for getting the column width 0032 QQC2.CheckBox { 0033 id: checkbox 0034 visible: false 0035 } 0036 0037 QmlConfigHelper { 0038 id: configHelper 0039 } 0040 0041 Kirigami.SearchField { 0042 id: filter 0043 Layout.fillWidth: true 0044 } 0045 0046 // Still QQC1 bevcause there's no QQC2 TableView 0047 QQC1.TableView { 0048 id: holidaysView 0049 0050 signal toggleCurrent 0051 0052 Layout.fillWidth: true 0053 Layout.fillHeight: true 0054 0055 Keys.onSpacePressed: toggleCurrent() 0056 0057 model: PlasmaCore.SortFilterModel { 0058 sourceModel: KHolidays.HolidayRegionsModel { 0059 id: holidaysModel 0060 } 0061 // SortFilterModel doesn't have a case-sensitivity option... 0062 // but filterRegExp always causes case-insensitive sorting 0063 filterRegExp: filter.text 0064 filterRole: "name" 0065 } 0066 0067 QQC1.TableViewColumn { 0068 width: checkbox.width 0069 delegate: QQC2.CheckBox { 0070 id: checkBox 0071 anchors.centerIn: parent 0072 checked: model ? configHelper.selectedRegions.indexOf(model.region) !== -1 : false 0073 activeFocusOnTab: false // only let the TableView as a whole get focus 0074 onClicked: { 0075 //needed for model's setData to be called 0076 if (checked) { 0077 configHelper.addRegion(model.region); 0078 } else { 0079 configHelper.removeRegion(model.region); 0080 } 0081 holidaysConfig.configurationChanged(); 0082 } 0083 } 0084 0085 resizable: false 0086 movable: false 0087 } 0088 QQC1.TableViewColumn { 0089 role: "region" 0090 title: i18nd("kholidays_calendar_plugin", "Region") 0091 } 0092 QQC1.TableViewColumn { 0093 role: "name" 0094 title: i18nd("kholidays_calendar_plugin", "Name") 0095 } 0096 QQC1.TableViewColumn { 0097 role: "description" 0098 title: i18nd("kholidays_calendar_plugin", "Description") 0099 } 0100 } 0101 }