Commit a850da49 authored by Chuang Zhu's avatar Chuang Zhu

[applets/taskmanager] Use combobox instead and preserve RTL defaults

parent 4cc84345
......@@ -75,9 +75,9 @@
<label>Whether to request the window manager highlight windows when hovering corresponding task buttons.</label>
<default>false</default>
</entry>
<entry name="rightAlignItems" type="Bool">
<label>Whether to align task items to the right.</label>
<default>false</default>
<entry name="tasksAlignment" type="Int">
<label>Which direction task items align: 0 = Default (follow system settings), 1 = Left, 2 = Right</label>
<default>0</default>
</entry>
<entry name="launchers" type="StringList">
<label>The list of launcher tasks on the widget. Usually .desktop file or executable URLs. Special URLs such as preferred://browser that expand to default applications are supported.</label>
......
......@@ -19,6 +19,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Controls 1.4 as QQC1
import QtQuick.Layouts 1.12
import org.kde.kirigami 2.4 as Kirigami
......@@ -35,7 +36,7 @@ Item {
property alias cfg_showToolTips: showToolTips.checked
property alias cfg_highlightWindows: highlightWindows.checked
property bool cfg_indicateAudioStreams
property alias cfg_rightAlignItems: rightAlignItems.checked
property alias cfg_tasksAlignment: tasksAlignment.currentIndex
property alias cfg_iconSize: iconSize.value
property alias cfg_maxStripes: maxStripes.value
property alias cfg_forceStripes: forceStripes.checked
......@@ -63,9 +64,16 @@ Item {
enabled: plasmaPaAvailable
}
CheckBox {
id: rightAlignItems
text: i18n("Align items to the right")
Item {
Kirigami.FormData.isSection: true
}
// TODO: port to QQC2 version once we've fixed https://bugs.kde.org/show_bug.cgi?id=403153
QQC1.ComboBox {
id: tasksAlignment
Kirigami.FormData.label: i18n("Tasks alignment:")
Layout.fillWidth: true
model: [i18n('Default'), i18n('Left'), i18n('Right')]
}
Item {
......
......@@ -23,7 +23,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
Flow {
property bool animating: false
layoutDirection: plasmoid.configuration.rightAlignItems ? Qt.RightToLeft : Qt.LeftToRight
layoutDirection: tasksAlignmentEnumValue(plasmoid.configuration.tasksAlignment)
property int rows: Math.floor(height / children[0].height)
property int columns: Math.floor(width / children[0].width)
......@@ -41,4 +41,17 @@ Flow {
PropertyAction { target: taskList; property: "animating"; value: false }
}
}
function tasksAlignmentEnumValue(index) {
switch (index) {
case 0:
return Qt.application.layoutDirection
case 1:
return Qt.LeftToRight;
case 2:
return Qt.RightToLeft;
default:
return Qt.application.layoutDirection
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment