Warning, /plasma/kdeplasma-addons/applets/comic/package/contents/ui/configGeneral.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.0
0008 import QtQuick.Controls 2.5 as Controls
0009 import QtQuick.Layouts 1.1 as Layouts
0010 
0011 import org.kde.newstuff 1.62 as NewStuff
0012 import org.kde.kirigami 2.20 as Kirigami
0013 import org.kde.plasma.plasmoid
0014 import org.kde.kcmutils as KCM
0015 
0016 KCM.SimpleKCM {
0017     id: root
0018 
0019     signal configurationChanged
0020 
0021     function saveConfig() {
0022         var newTabs = [];
0023         for (var i in providerColumn.children) {
0024             if (providerColumn.children[i].checked) {
0025                 newTabs.push(providerColumn.children[i].plugin)
0026             }
0027         }
0028         Plasmoid.tabIdentifiers = newTabs;
0029 
0030         Plasmoid.middleClick = middleClickCheckBox.checked;
0031 
0032         Plasmoid.checkNewComicStripsInterval = checkNewComicStripsInterval.value;
0033         Plasmoid.providerUpdateInterval = providerUpdateInterval.value;
0034 
0035         Plasmoid.saveConfig();
0036         Plasmoid.configChanged();
0037     }
0038 
0039     Kirigami.FormLayout {
0040         Component.onCompleted: {
0041             middleClickCheckBox.checked = Plasmoid.middleClick;
0042             checkNewComicStripsInterval.value = Plasmoid.checkNewComicStripsInterval;
0043             providerUpdateInterval.value = Plasmoid.providerUpdateInterval
0044         }
0045 
0046         Item {
0047             Kirigami.FormData.isSection: true
0048         }
0049 
0050         Layouts.ColumnLayout {
0051             id: providerColumn
0052             Kirigami.FormData.label: i18nc("@title:group", "Comics:")
0053             Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater
0054 
0055             Repeater {
0056                 model: Plasmoid.availableComicsModel
0057                 delegate: Controls.CheckBox {
0058                     id: checkbox
0059                     text: model.display
0060                     checked: model.checked
0061                     property string plugin: model.plugin
0062                     Component.onCompleted: {
0063                         checkbox.checked = Plasmoid.tabIdentifiers.indexOf(model.plugin) !== -1
0064                     }
0065                     onCheckedChanged: root.configurationChanged();
0066                 }
0067             }
0068         }
0069 
0070         NewStuff.Button {
0071             id: ghnsButton
0072             text: i18nc("@action:button", "Get New Comics…")
0073             configFile: "comic.knsrc"
0074             onEntryEvent: function(entry, event) {
0075                 if (event == 1) {
0076                     Plasmoid.loadProviders()
0077                 }
0078             }
0079         }
0080 
0081         Controls.CheckBox {
0082             id: middleClickCheckBox
0083             text: i18nc("@option:check", "Middle-click on comic to display at original size")
0084             onCheckedChanged: root.configurationChanged();
0085         }
0086 
0087         Item {
0088             Kirigami.FormData.isSection: true
0089         }
0090 
0091         Layouts.RowLayout {
0092                 Kirigami.FormData.label: i18nc("@label:spinbox", "Check for new plugins every:")
0093 
0094             Controls.SpinBox {
0095                 id: providerUpdateInterval
0096                 stepSize: 1
0097                 onValueChanged: root.configurationChanged();
0098             }
0099 
0100             Controls.Label {
0101                 text: i18ncp("@item:valuesuffix spacing to number + unit", "day", "days")
0102                 textFormat: Text.PlainText
0103             }
0104         }
0105 
0106         Layouts.RowLayout {
0107                 Kirigami.FormData.label: i18nc("@label:spinbox", "Check for new comics every:")
0108 
0109             Controls.SpinBox {
0110                 id: checkNewComicStripsInterval
0111                 stepSize: 1
0112                 onValueChanged: root.configurationChanged();
0113             }
0114 
0115             Controls.Label {
0116                 text: i18ncp("@item:valuesuffix spacing to number + unit (minutes)", "minute", "minutes")
0117                 textFormat: Text.PlainText
0118             }
0119         }
0120     }
0121 }