diff --git a/containments/desktop/package/contents/ui/ConfigFilter.qml b/containments/desktop/package/contents/ui/ConfigFilter.qml --- a/containments/desktop/package/contents/ui/ConfigFilter.qml +++ b/containments/desktop/package/contents/ui/ConfigFilter.qml @@ -17,20 +17,19 @@ * 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 @@ -71,184 +70,157 @@ 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 --- a/containments/desktop/package/contents/ui/ConfigIcons.qml +++ b/containments/desktop/package/contents/ui/ConfigIcons.qml @@ -18,27 +18,24 @@ * 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 @@ -149,7 +146,7 @@ id: alignment Layout.fillWidth: true - model: [i18n("Align Left"), i18n("Align Right")] + model: [i18n("Align left"), i18n("Align right")] } CheckBox { @@ -233,10 +230,10 @@ Kirigami.FormData.label: i18n("Icon size:") - minimumValue: 0 - maximumValue: 5 + from: 0 + to: 5 stepSize: 1 - tickmarksEnabled: true + snapMode: Slider.SnapAlways } RowLayout { @@ -278,8 +275,8 @@ Kirigami.FormData.label: i18n("Text lines:") - minimumValue: 1 - maximumValue: 10 + from: 1 + to: 10 stepSize: 1 } @@ -320,7 +317,8 @@ Button { id: previewSettings - text: i18n("More Preview Options...") + icon.name: "configure" + text: i18n("Configure Preview Plugins...") onClicked: { previewPluginsDialog.visible = true; diff --git a/containments/desktop/package/contents/ui/ConfigLocation.qml b/containments/desktop/package/contents/ui/ConfigLocation.qml --- a/containments/desktop/package/contents/ui/ConfigLocation.qml +++ b/containments/desktop/package/contents/ui/ConfigLocation.qml @@ -17,30 +17,27 @@ * 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; } @@ -73,13 +70,15 @@ 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/"; } } @@ -94,34 +93,26 @@ 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 @@ -144,24 +135,19 @@ } } - 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 != "") { @@ -176,7 +162,7 @@ } } Button { - iconName: "document-open" + icon.name: "document-open" enabled: locationCustom.checked @@ -201,26 +187,25 @@ 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...") } } }