diff --git a/containments/desktop/package/contents/ui/ConfigFilter.qml b/containments/desktop/package/contents/ui/ConfigFilter.qml index c9b08a5d2..a2c9ee11f 100644 --- a/containments/desktop/package/contents/ui/ConfigFilter.qml +++ b/containments/desktop/package/contents/ui/ConfigFilter.qml @@ -1,255 +1,227 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 1.0 +import QtQuick 2.5 +import QtQuick.Controls 2.5 +import QtQuick.Controls 1.0 as QQC1 import QtQuick.Layouts 1.0 +import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.private.desktopcontainment.folder 0.1 as Folder -Item { +ColumnLayout { id: configIcons - width: childrenRect.width - height: childrenRect.height - property alias cfg_filterMode: filterMode.currentIndex property alias cfg_filterPattern: filterPattern.text property alias cfg_filterMimeTypes: mimeTypesModel.checkedTypes PlasmaCore.SortFilterModel { id: filteredMimeTypesModel sourceModel: Folder.MimeTypesModel { id: mimeTypesModel } // SortFilterModel doesn't have a case-sensitivity option // but filterRegExp always causes case-insensitive sorting. filterRegExp: mimeFilter.text filterRole: "name" sortRole: mimeTypesView.getColumn(mimeTypesView.sortIndicatorColumn).role sortOrder: mimeTypesView.sortIndicatorOrder function checkFiltered() { var types = []; for (var i = 0; i < count; ++i) { types.push(get(i).name); } mimeTypesModel.checkedTypes = types; } function uncheckFiltered() { var types = []; for (var i = 0; i < count; ++i) { types.push(get(i).name); } mimeTypesModel.checkedTypes = mimeTypesModel.checkedTypes.filter(function(x) { return types.indexOf(x) < 0; }); } } - - ColumnLayout { - width: parent.width - height: parent.height - + Kirigami.FormLayout { ComboBox { id: filterMode - - Layout.fillWidth: true - - model: [i18n("Show All Files"), i18n("Show Files Matching"), i18n("Hide Files Matching")] - } - - Label { - Layout.fillWidth: true - - text: i18n("File name pattern:") + Kirigami.FormData.label: i18n("Files:") + model: [i18n("Show all"), i18n("Show matching"), i18n("Hide matching")] } TextField { id: filterPattern - - Layout.fillWidth: true - + Kirigami.FormData.label: i18n("File name pattern:") enabled: (filterMode.currentIndex > 0) } - Label { - Layout.fillWidth: true - - text: i18n("File types:") - } - TextField { id: mimeFilter - - Layout.fillWidth: true - + Kirigami.FormData.label: i18n("File types:") enabled: (filterMode.currentIndex > 0) - - placeholderText: i18n("Search file type...") + placeholderText: i18n("Search...") } + } - RowLayout { - Layout.fillWidth: true - Layout.fillHeight: true + ColumnLayout { + Layout.fillWidth: true + Layout.fillHeight: true - CheckBox { // Purely for metrics. - id: metricsCheckBox - visible: false - } + CheckBox { // Purely for metrics. + id: metricsCheckBox + visible: false + } - TableView { - id: mimeTypesView + QQC1.TableView { + id: mimeTypesView - // Signal the delegates listen to when user presses space to toggle current row. - signal toggleCurrent + // Signal the delegates listen to when user presses space to toggle current row. + signal toggleCurrent - Layout.fillWidth: true - Layout.fillHeight: true + Layout.fillWidth: true + Layout.fillHeight: true - enabled: (filterMode.currentIndex > 0) + enabled: (filterMode.currentIndex > 0) - model: filteredMimeTypesModel + model: filteredMimeTypesModel - sortIndicatorVisible: true - sortIndicatorColumn: 2 // Default to sort by "File type". + sortIndicatorVisible: true + sortIndicatorColumn: 2 // Default to sort by "File type". - onSortIndicatorColumnChanged: { // Disallow sorting by icon. - if (sortIndicatorColumn === 1) { - sortIndicatorColumn = 2; - } + onSortIndicatorColumnChanged: { // Disallow sorting by icon. + if (sortIndicatorColumn === 1) { + sortIndicatorColumn = 2; } + } - Keys.onSpacePressed: toggleCurrent() + Keys.onSpacePressed: toggleCurrent() - function adjustColumns() { - // Resize description column to take whatever space is left. - var width = viewport.width; - for (var i = 0; i < columnCount - 1; ++i) { - width -= getColumn(i).width; - } - descriptionColumn.width = width; + function adjustColumns() { + // Resize description column to take whatever space is left. + var width = viewport.width; + for (var i = 0; i < columnCount - 1; ++i) { + width -= getColumn(i).width; } + descriptionColumn.width = width; + } - onWidthChanged: adjustColumns() - // Component.onCompleted is too early to do this... - onRowCountChanged: adjustColumns() - - TableViewColumn { - role: "checked" - width: metricsCheckBox.width - resizable: false - movable: false - - delegate: CheckBox { - id: checkBox - - checked: styleData.value - activeFocusOnTab: false // only let the TableView as a whole get focus - onClicked: { - model.checked = checked - // Clicking it breaks the binding to the model value which becomes - // an issue during sorting as TableView re-uses delegates. - checked = Qt.binding(function() { - return styleData.value; - }); - } + onWidthChanged: adjustColumns() + // Component.onCompleted is too early to do this... + onRowCountChanged: adjustColumns() + + QQC1.TableViewColumn { + role: "checked" + width: metricsCheckBox.width + resizable: false + movable: false + + delegate: CheckBox { + id: checkBox + + checked: styleData.value + activeFocusOnTab: false // only let the TableView as a whole get focus + onClicked: { + model.checked = checked + // Clicking it breaks the binding to the model value which becomes + // an issue during sorting as TableView re-uses delegates. + checked = Qt.binding(function() { + return styleData.value; + }); + } - Connections { - target: mimeTypesView - onToggleCurrent: { - if (styleData.row === mimeTypesView.currentRow) { - model.checked = !checkBox.checked - } + Connections { + target: mimeTypesView + onToggleCurrent: { + if (styleData.row === mimeTypesView.currentRow) { + model.checked = !checkBox.checked } } } } - - TableViewColumn { - role: "decoration" - width: units.iconSizes.small - resizable: false - movable: false - - delegate: PlasmaCore.IconItem { - width: units.iconSizes.small - height: units.iconSizes.small - animated: false // TableView re-uses delegates, avoid animation when sorting/filtering. - source: styleData.value - } - } - - TableViewColumn { - id: nameColumn - role: "name" - title: i18n("File type") - width: units.gridUnit * 10 // Assume somewhat reasonable default for mime type name. - onWidthChanged: mimeTypesView.adjustColumns() - movable: false - } - TableViewColumn { - id: descriptionColumn - role: "comment" - title: i18n("Description") - movable: false - resizable: false - } } - ColumnLayout { - Layout.alignment: Qt.AlignTop - // Need to explicitly base the size off the button's implicitWidth - // to avoid the column from growing way too wide due to fillWidth... - Layout.maximumWidth: Math.max(selectAllButton.implicitWidth, deselectAllButton.implicitWidth) - - Button { - id: selectAllButton - Layout.fillWidth: true - - enabled: (filterMode.currentIndex > 0) - - text: i18n("Select All") + QQC1.TableViewColumn { + role: "decoration" + width: units.iconSizes.small + resizable: false + movable: false - onClicked: filteredMimeTypesModel.checkFiltered() + delegate: PlasmaCore.IconItem { + width: units.iconSizes.small + height: units.iconSizes.small + animated: false // TableView re-uses delegates, avoid animation when sorting/filtering. + source: styleData.value } + } - Button { - id: deselectAllButton - Layout.fillWidth: true + QQC1.TableViewColumn { + id: nameColumn + role: "name" + title: i18n("File type") + width: units.gridUnit * 10 // Assume somewhat reasonable default for mime type name. + onWidthChanged: mimeTypesView.adjustColumns() + movable: false + } - enabled: (filterMode.currentIndex > 0) + QQC1.TableViewColumn { + id: descriptionColumn + role: "comment" + title: i18n("Description") + movable: false + resizable: false + } + } - text: i18n("Deselect All") + RowLayout { + Button { + id: selectAllButton + enabled: (filterMode.currentIndex > 0) + icon.name: "edit-select-all" + ToolTip.delay: 1000 + ToolTip.timeout: 5000 + ToolTip.visible: (Kirigami.Settings.isMobile ? pressed : hovered) && ToolTip.text.length > 0 + ToolTip.text: i18n("Select All") + onClicked: filteredMimeTypesModel.checkFiltered() + } - onClicked: filteredMimeTypesModel.uncheckFiltered() - } + Button { + id: deselectAllButton + enabled: (filterMode.currentIndex > 0) + icon.name: "edit-select-none" + ToolTip.delay: 1000 + ToolTip.timeout: 5000 + ToolTip.visible: (Kirigami.Settings.isMobile ? pressed : hovered) && ToolTip.text.length > 0 + ToolTip.text: i18n("Deselect All") + onClicked: filteredMimeTypesModel.uncheckFiltered() } } } } diff --git a/containments/desktop/package/contents/ui/ConfigIcons.qml b/containments/desktop/package/contents/ui/ConfigIcons.qml index 37d5c8a78..cc7dc85e8 100644 --- a/containments/desktop/package/contents/ui/ConfigIcons.qml +++ b/containments/desktop/package/contents/ui/ConfigIcons.qml @@ -1,334 +1,332 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * Copyright (C) 2015 by Kai Uwe Broulik * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ -import QtQuick 2.4 -import QtQuick.Controls 1.0 +import QtQuick 2.5 +import QtQuick.Controls 2.5 import QtQuick.Dialogs 1.1 import QtQuick.Layouts 1.0 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 import org.kde.kconfig 1.0 // for KAuthorized -import org.kde.kirigami 2.4 as Kirigami +import org.kde.kirigami 2.5 as Kirigami import org.kde.private.desktopcontainment.desktop 0.1 as Desktop import org.kde.private.desktopcontainment.folder 0.1 as Folder Item { id: configIcons - width: childrenRect.width - height: childrenRect.height - property bool isPopup: (plasmoid.location !== PlasmaCore.Types.Floating) property string cfg_icon: plasmoid.configuration.icon property alias cfg_useCustomIcon: useCustomIcon.checked property alias cfg_arrangement: arrangement.currentIndex property alias cfg_alignment: alignment.currentIndex property bool cfg_locked property alias cfg_sortMode: sortMode.mode property alias cfg_sortDesc: sortDesc.checked property alias cfg_sortDirsFirst: sortDirsFirst.checked property alias cfg_toolTips: toolTips.checked property alias cfg_selectionMarkers: selectionMarkers.checked property alias cfg_popups: popups.checked property alias cfg_previews: previews.checked property alias cfg_previewPlugins: previewPluginsDialog.previewPlugins property alias cfg_viewMode: viewMode.currentIndex property alias cfg_iconSize: iconSize.value property alias cfg_labelWidth: labelWidth.currentIndex property alias cfg_textLines: textLines.value readonly property bool lockedByKiosk: !KAuthorized.authorize("editable_desktop_icons") IconDialog { id: iconDialog onIconNameChanged: cfg_icon = iconName || "folder" } Kirigami.FormLayout { anchors.horizontalCenter: parent.horizontalCenter // Panel button RowLayout { spacing: units.smallSpacing visible: isPopup Kirigami.FormData.label: i18n("Panel button:") CheckBox { id: useCustomIcon visible: isPopup checked: cfg_useCustomIcon text: i18n("Use a custom icon") } Button { id: iconButton Layout.minimumWidth: units.iconSizes.large + units.smallSpacing * 2 Layout.maximumWidth: Layout.minimumWidth Layout.minimumHeight: Layout.minimumWidth Layout.maximumHeight: Layout.minimumWidth checkable: true enabled: useCustomIcon.checked onClicked: { checked = Qt.binding(function() { return iconMenu.status === PlasmaComponents.DialogStatus.Open; }) iconMenu.open(0, height); } PlasmaCore.IconItem { anchors.centerIn: parent width: units.iconSizes.large height: width source: cfg_icon } } PlasmaComponents.ContextMenu { id: iconMenu visualParent: iconButton PlasmaComponents.MenuItem { text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") icon: "document-open-folder" onClicked: iconDialog.open() } PlasmaComponents.MenuItem { text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") icon: "edit-clear" onClicked: cfg_icon = "folder" } } } Item { visible: isPopup Kirigami.FormData.isSection: true } // Arrangement section ComboBox { id: arrangement Layout.fillWidth: true Kirigami.FormData.label: i18n("Arrangement:") model: [i18n("Rows"), i18n("Columns")] } ComboBox { id: alignment Layout.fillWidth: true - model: [i18n("Align Left"), i18n("Align Right")] + model: [i18n("Align left"), i18n("Align right")] } CheckBox { id: locked visible: ("containmentType" in plasmoid) checked: cfg_locked || lockedByKiosk enabled: !lockedByKiosk onCheckedChanged: { if (!lockedByKiosk) { cfg_locked = checked; } } text: i18n("Lock in place") } Item { Kirigami.FormData.isSection: true } // Sorting section ComboBox { id: sortMode Layout.fillWidth: true Kirigami.FormData.label: i18n("Sorting:") property int mode // FIXME TODO HACK: This maps the combo box list model to the KDirModel::ModelColumns // enum, which should be done in C++. property variant indexToMode: [-1, 0, 1, 6, 2] property variant modeToIndex: {'-1' : '0', '0' : '1', '1' : '2', '6' : '3', '2' : '4'} model: [i18n("Manual"), i18n("Name"), i18n("Size"), i18n("Type"), i18n("Date")] Component.onCompleted: currentIndex = modeToIndex[mode] onActivated: mode = indexToMode[index] } CheckBox { id: sortDesc enabled: (sortMode.currentIndex != 0) text: i18n("Descending") } CheckBox { id: sortDirsFirst enabled: (sortMode.currentIndex != 0) text: i18n("Folders first") } Item { Kirigami.FormData.isSection: true } // View Mode section (only if we're a pop-up) ComboBox { id: viewMode visible: isPopup Layout.fillWidth: true Kirigami.FormData.label: i18nc("whether to use icon or list view", "View mode:") model: [i18n("List"), i18n("Icons")] } // Size section Slider { id: iconSize Layout.fillWidth: true visible: !isPopup || viewMode.currentIndex === 1 Kirigami.FormData.label: i18n("Icon size:") - minimumValue: 0 - maximumValue: 5 + from: 0 + to: 5 stepSize: 1 - tickmarksEnabled: true + snapMode: Slider.SnapAlways } RowLayout { Layout.fillWidth: true Label { Layout.alignment: Qt.AlignLeft visible: !isPopup || viewMode.currentIndex === 1 text: i18n("Small") } Item { Layout.fillWidth: true } Label { Layout.alignment: Qt.AlignRight visible: !isPopup || viewMode.currentIndex === 1 text: i18n("Large") } } ComboBox { id: labelWidth visible: !isPopup || viewMode.currentIndex === 1 Kirigami.FormData.label: i18n("Label width:") model: [ i18n("Narrow"), i18n("Medium"), i18n("Wide") ] } SpinBox { id: textLines visible: !isPopup || viewMode.currentIndex === 1 Kirigami.FormData.label: i18n("Text lines:") - minimumValue: 1 - maximumValue: 10 + from: 1 + to: 10 stepSize: 1 } Item { Kirigami.FormData.isSection: true } // Features section CheckBox { id: toolTips Kirigami.FormData.label: i18n("Features:") text: i18n("Tooltips") } CheckBox { id: selectionMarkers visible: Qt.styleHints.singleClickActivation text: i18n("Selection markers") } CheckBox { id: popups visible: !isPopup text: i18n("Folder preview popups") } CheckBox { id: previews text: i18n("Preview thumbnails") } Button { id: previewSettings - text: i18n("More Preview Options...") + icon.name: "configure" + text: i18n("Configure Preview Plugins...") onClicked: { previewPluginsDialog.visible = true; } } } FolderItemPreviewPluginsDialog { id: previewPluginsDialog } } diff --git a/containments/desktop/package/contents/ui/ConfigLocation.qml b/containments/desktop/package/contents/ui/ConfigLocation.qml index 84668a44b..078037fcc 100644 --- a/containments/desktop/package/contents/ui/ConfigLocation.qml +++ b/containments/desktop/package/contents/ui/ConfigLocation.qml @@ -1,227 +1,212 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 1.0 +import QtQuick 2.5 +import QtQuick.Controls 2.5 import QtQuick.Layouts 1.0 import org.kde.plasma.plasmoid 2.0 -import org.kde.kirigami 2.4 as Kirigami +import org.kde.kirigami 2.5 as Kirigami import org.kde.private.desktopcontainment.folder 0.1 as Folder Item { id: configLocation - width: childrenRect.width - height: childrenRect.height - property string cfg_url property alias cfg_labelMode: labelMode.currentIndex property alias cfg_labelText: labelText.text property bool titleVisible: !("containmentType" in plasmoid) onCfg_urlChanged: applyConfig() function applyConfig(force) { - if (!force && locationGroup.current != null) { + if (!force && locationGroup.checkedButton != null) { return; } if (cfg_url == "desktop:/") { locationDesktop.checked = true; locationCustomValue.text = ""; } else if (cfg_url == "activities:/current/") { locationCurrentActivity.checked = true; locationCustomValue.text = ""; } else { var placeForUrl = placesModel.indexForUrl(cfg_url); if (placeForUrl !== -1) { locationPlace.checked = true; locationPlaceValue.currentIndex = placeForUrl; locationCustomValue.text = ""; } else { locationCustom.checked = true; locationCustomValue.text = cfg_url; } } locationPlaceValue.enabled = locationPlace.checked; } Folder.PlacesModel { id: placesModel showDesktopEntry: false onPlacesChanged: applyConfig(true) } - ExclusiveGroup { + ButtonGroup { id: locationGroup - onCurrentChanged: { - if (current == locationDesktop) { + buttons: [locationDesktop, locationCurrentActivity, locationPlace, locationCustom] + + onCheckedButtonChanged: { + if (checkedButton == locationDesktop) { cfg_url = "desktop:/"; - } else if (current == locationCurrentActivity) { + } else if (checkedButton == locationCurrentActivity) { cfg_url = "activities:/current/"; } } } Kirigami.FormLayout { anchors.horizontalCenter: parent.horizontalCenter RadioButton { id: locationDesktop Kirigami.FormData.label: i18n("Show:") text: i18n("Desktop folder") - exclusiveGroup: locationGroup } RadioButton { id: locationCurrentActivity visible: placesModel.activityLinkingEnabled text: i18n("Files linked to the current activity") - exclusiveGroup: locationGroup } - RadioButton { - id: locationPlace - - text: i18n("Places panel item:") + RowLayout { + RadioButton { + id: locationPlace - exclusiveGroup: locationGroup + text: i18n("Places panel item:") - onCheckedChanged: { - locationPlaceValue.enabled = checked; + onCheckedChanged: { + locationPlaceValue.enabled = checked; + } } - } - RowLayout { - Layout.fillWidth: true - Item { - width: units.largeSpacing - } ComboBox { id: locationPlaceValue Layout.fillWidth: true model: placesModel textRole: "display" enabled: true onEnabledChanged: { if (enabled && currentIndex != -1) { cfg_url = placesModel.urlForIndex(currentIndex); } } onActivated: { cfg_url = placesModel.urlForIndex(index); } } } - RadioButton { - id: locationCustom - - exclusiveGroup: locationGroup - text: i18n("Custom location:") - } - RowLayout { - Layout.fillWidth: true - Item { - width: units.largeSpacing + RadioButton { + id: locationCustom + + text: i18n("Custom location:") } + TextField { id: locationCustomValue enabled: locationCustom.checked Layout.fillWidth: true - placeholderText: i18n("Type a path or a URL here") + placeholderText: i18n("Type path or URL...") onEnabledChanged: { if (enabled && text != "") { cfg_url = text; } } onTextChanged: { if (enabled) { cfg_url = text; } } } Button { - iconName: "document-open" + icon.name: "document-open" enabled: locationCustom.checked onClicked: { directoryPicker.open(); } } Folder.DirectoryPicker { id: directoryPicker onUrlChanged: { locationCustomValue.text = url; } } } Item { visible: titleVisible Kirigami.FormData.isSection: true } ComboBox { id: labelMode visible: titleVisible - Layout.fillWidth: true Kirigami.FormData.label: i18n("Title:") model: [i18n("None"), i18n("Default"), i18n("Full path"), i18n("Custom title")] } RowLayout { - Layout.fillWidth: true visible: titleVisible Item { width: units.largeSpacing } + TextField { id: labelText Layout.fillWidth: true enabled: (labelMode.currentIndex == 3) - placeholderText: i18n("Enter custom title here") + placeholderText: i18n("Enter custom title...") } } } }