diff --git a/applets/systemtray/package/contents/config/main.xml b/applets/systemtray/package/contents/config/main.xml
index e550afcfc..dab297114 100644
--- a/applets/systemtray/package/contents/config/main.xml
+++ b/applets/systemtray/package/contents/config/main.xml
@@ -25,8 +25,12 @@
-
-
+
+
+ true
+
+
+
1
diff --git a/applets/systemtray/package/contents/ui/ConfigGeneral.qml b/applets/systemtray/package/contents/ui/ConfigGeneral.qml
index d4d4826d2..98fac4688 100644
--- a/applets/systemtray/package/contents/ui/ConfigGeneral.qml
+++ b/applets/systemtray/package/contents/ui/ConfigGeneral.qml
@@ -20,18 +20,30 @@
***************************************************************************/
import QtQuick 2.14
import QtQuick.Controls 2.14 as QQC2
-import org.kde.kirigami 2.13 as Kirigami
-Kirigami.FormLayout {
+import org.kde.plasma.core 2.1 as PlasmaCore
- property alias cfg_iconSize: iconSizeComboBox.currentIndex
+import org.kde.kirigami 2.13 as Kirigami
- QQC2.ComboBox {
- id: iconSizeComboBox
+Kirigami.FormLayout {
- Kirigami.FormData.label: i18n("Maximum icon size:")
+ property alias cfg_automaticRowsOrColumns: automaticRadioButton.checked
+ property int cfg_rowsOrColumns
- model: [i18n("Very Small"), i18n("Small"), i18n("Medium"), i18n("Large"), i18n("Huge"), i18n("Enormous")]
+ QQC2.RadioButton {
+ id: automaticRadioButton
+ Kirigami.FormData.label: i18nc("The arrangement of system tray icons in the Panel", "Panel icon arrangement:")
+ text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ?
+ i18n("Adapt to Panel height") : i18n("Adapt to Panel width")
+ }
+ QQC2.RadioButton {
+ text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? i18n("One row") : i18n("One column")
+ checked: !automaticRadioButton.checked && cfg_rowsOrColumns === 1
+ onClicked: cfg_rowsOrColumns = 1
+ }
+ QQC2.RadioButton {
+ text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? i18n("Two rows") : i18n("Two columns")
+ checked: !automaticRadioButton.checked && cfg_rowsOrColumns === 2
+ onClicked: cfg_rowsOrColumns = 2
}
-
}
diff --git a/applets/systemtray/package/contents/ui/main.qml b/applets/systemtray/package/contents/ui/main.qml
index 4cbc651b5..72fa1320e 100644
--- a/applets/systemtray/package/contents/ui/main.qml
+++ b/applets/systemtray/package/contents/ui/main.qml
@@ -38,19 +38,12 @@ MouseArea {
LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
- property var iconSizes: ["small", "smallMedium", "medium", "large", "huge", "enormous"];
- property int iconSize: plasmoid.configuration.iconSize + (Kirigami.Settings.tabletMode ? 1 : 0)
-
property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
- readonly property int itemSize: {
- var baseSize = units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes[iconSizes[Math.min(iconSizes.length-1, iconSize)]]));
- if (Kirigami.Settings.tabletMode) {
- // Set the tray items' clickable areas on the panel to be bigger than normal to allow for easier touchability
- return baseSize + units.smallSpacing;
- } else {
- return baseSize + Math.round(units.smallSpacing/2);
- }
- }
+
+ // Used only by AbstractItem, but it's easiest to keep it here since it
+ // uses dimensions from this item to calculate the final value
+ readonly property int itemSize: units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes.enormous));
+
property alias expanded: dialog.visible
property Item activeApplet
@@ -149,22 +142,33 @@ MouseArea {
GridView {
id: tasksGrid
+
+ readonly property int thickness: root.vertical ? root.width : root.height
+ readonly property bool autoSize: plasmoid.configuration.automaticRowsOrColumns
+ readonly property int rowsOrColumns: {
+ if (autoSize) {
+ if (thickness <= units.iconSizes.smallMedium * 2) {
+ return 1
+ } else {
+ return 2
+ }
+ } else {
+ return plasmoid.configuration.rowsOrColumns
+ }
+ }
+ readonly property int cellLength: thickness / rowsOrColumns
+ readonly property int totalLength: cellLength * Math.round(count / rowsOrColumns)
+
Layout.alignment: Qt.AlignCenter
interactive: false //disable features we don't need
flow: vertical ? GridView.LeftToRight : GridView.TopToBottom
- cellHeight: vertical ? cellLength : root.height / rows
- cellWidth: vertical ? root.width / columns : cellLength
-
- readonly property int cellLength: root.itemSize + units.smallSpacing
- readonly property int columns: !vertical ? Math.ceil(count / rows) :
- Math.max(1, Math.floor(root.width / cellLength))
- readonly property int rows: vertical ? Math.ceil(count / columns) :
- Math.max(1, Math.floor(root.height / cellLength))
+ implicitHeight: root.vertical ? totalLength : root.height
+ implicitWidth: !root.vertical ? totalLength : root.width
- implicitHeight: rows * cellHeight
- implicitWidth: columns * cellWidth
+ cellHeight: cellLength
+ cellWidth: cellLength
model: PlasmaCore.SortFilterModel {
sourceModel: plasmoid.nativeInterface.systemTrayModel