Commit 540a90cd authored by Jonathan Marten's avatar Jonathan Marten

Folder View location properties: Improve visual layout

Differential Revision: https://phabricator.kde.org/D8424
parent d0eefce0
......@@ -34,6 +34,7 @@ Item {
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()
......@@ -70,184 +71,190 @@ Item {
onPlacesChanged: applyConfig(true)
}
ColumnLayout {
GroupBox {
id: locationGroupBox
ExclusiveGroup {
id: locationGroup
Layout.fillWidth: true
title: i18n("Location")
flat: true
ColumnLayout {
ExclusiveGroup {
id: locationGroup
onCurrentChanged: {
if (current == locationDesktop) {
cfg_url = "desktop:/";
} else if (current == locationCurrentActivity) {
cfg_url = "activities:/current/";
}
}
}
RadioButton {
id: locationDesktop
text: i18n("Show the Desktop folder")
exclusiveGroup: locationGroup
}
onCurrentChanged: {
if (current == locationDesktop) {
cfg_url = "desktop:/";
} else if (current == locationCurrentActivity) {
cfg_url = "activities:/current/";
}
}
}
RadioButton {
id: locationCurrentActivity
visible: placesModel.activityLinkingEnabled
text: i18n("Show files linked to the current activity")
exclusiveGroup: locationGroup
}
GridLayout {
GridLayout {
RadioButton {
id: locationPlace
// Row 0: "Show the Desktop folder"
Label {
id: locationLabel
Layout.column: 0
Layout.row: 0
text: i18n("Location:")
}
Layout.column: 0
Layout.rowSpan: 2
Layout.alignment: Qt.AlignTop
RadioButton {
id: locationDesktop
Layout.row: 0
Layout.column: 1
Layout.columnSpan: 3
text: i18n("Show the Desktop folder")
exclusiveGroup: locationGroup
}
exclusiveGroup: locationGroup
// Row 1: "Show files linked to the current activity"
RadioButton {
id: locationCurrentActivity
Layout.row: 1
Layout.column: 1
Layout.columnSpan: 3
onCheckedChanged: {
locationPlaceValue.enabled = checked;
}
}
visible: placesModel.activityLinkingEnabled
text: i18n("Show files linked to the current activity")
exclusiveGroup: locationGroup
}
Label {
Layout.row: 0
Layout.column: 1
Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
// Rows 2+3: "Show a place"
RadioButton {
id: locationPlace
Layout.row: 2
Layout.column: 1
Layout.columnSpan: 3
text: i18n("Show a place:")
text: i18n("Show a place:")
}
exclusiveGroup: locationGroup
ComboBox {
id: locationPlaceValue
onCheckedChanged: {
locationPlaceValue.enabled = checked;
}
}
Layout.row: 1
Layout.column: 1
Layout.fillWidth: false
Item {
id: indentSpacer
Layout.row: 3
Layout.column: 1
Layout.minimumWidth: units.largeSpacing
}
model: placesModel
textRole: "display"
ComboBox {
id: locationPlaceValue
Layout.row: 3
Layout.column: 2
Layout.columnSpan: 2
Layout.fillWidth: true
enabled: true
model: placesModel
textRole: "display"
onEnabledChanged: {
if (enabled && currentIndex != -1) {
cfg_url = placesModel.urlForIndex(currentIndex);
}
}
enabled: true
onActivated: {
cfg_url = placesModel.urlForIndex(index);
}
}
onEnabledChanged: {
if (enabled && currentIndex != -1) {
cfg_url = placesModel.urlForIndex(currentIndex);
}
}
GridLayout {
RadioButton {
id: locationCustom
Layout.column: 0
Layout.rowSpan: 2
Layout.alignment: Qt.AlignTop
exclusiveGroup: locationGroup
}
Label {
Layout.row: 0
Layout.column: 1
Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
text: i18n("Specify a folder:")
}
TextField {
id: locationCustomValue
Layout.row: 1
Layout.column: 1
Layout.fillWidth: true
enabled: locationCustom.checked
onActivated: {
cfg_url = placesModel.urlForIndex(index);
}
}
placeholderText: i18n("Type a path or a URL here")
// Rows 4+5: "Specify a folder"
onEnabledChanged: {
if (enabled && text != "") {
cfg_url = text;
}
}
RadioButton {
id: locationCustom
Layout.row: 4
Layout.column: 1
Layout.columnSpan: 3
onTextChanged: {
if (enabled) {
cfg_url = text;
}
}
}
exclusiveGroup: locationGroup
text: i18n("Specify a folder:")
}
Button {
iconName: "document-open"
TextField {
id: locationCustomValue
Layout.row: 5
Layout.column: 2
Layout.fillWidth: true
enabled: locationCustom.checked
enabled: locationCustom.checked
onClicked: {
directoryPicker.open();
}
}
placeholderText: i18n("Type a path or a URL here")
Folder.DirectoryPicker {
id: directoryPicker
onEnabledChanged: {
if (enabled && text != "") {
cfg_url = text;
}
}
onUrlChanged: {
locationCustomValue.text = url;
}
}
onTextChanged: {
if (enabled) {
cfg_url = text;
}
}
}
GroupBox {
id: titleGroupBox
Button {
Layout.row: 5
Layout.column: 3
Layout.alignment: Qt.AlignLeft
iconName: "document-open"
Layout.fillWidth: true
enabled: locationCustom.checked
visible: !("containmentType" in plasmoid)
onClicked: {
directoryPicker.open();
}
}
title: i18n("Title")
Folder.DirectoryPicker {
id: directoryPicker
flat: true
onUrlChanged: {
locationCustomValue.text = url;
}
}
ColumnLayout {
ComboBox {
id: labelMode
// Row 6: Spacing
Item {
id: titleSpacer
Layout.column: 0
Layout.row: 6
Layout.minimumHeight: units.largeSpacing
visible: titleVisible
}
Layout.fillWidth: false
// Rows 7+8: "Title"
Label {
id: titleLabel
Layout.column: 0
Layout.row: 7
text: i18n("Title:")
visible: titleVisible
}
model: [i18n("None"), i18n("Default"), i18n("Full path"), i18n("Custom title")]
}
ComboBox {
id: labelMode
Layout.row: 7
Layout.column: 1
Layout.columnSpan: 3
Layout.fillWidth: true
visible: titleVisible
TextField {
id: labelText
model: [i18n("None"), i18n("Default"), i18n("Full path"), i18n("Custom title")]
}
Layout.fillWidth: true
TextField {
id: labelText
Layout.row: 8
Layout.column: 2
Layout.columnSpan: 2
Layout.fillWidth: true
visible: titleVisible
enabled: (labelMode.currentIndex == 3)
enabled: (labelMode.currentIndex == 3)
placeholderText: i18n("Enter custom title here")
}
}
placeholderText: i18n("Enter custom title here")
}
}
}
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