Commit 4a8adbae authored by Niccolò Venerandi's avatar Niccolò Venerandi

Converted to Page with a PlasmoidHeading in the heading

Summary:
Now the main view is a Page, the toolbar is moved to the heading and it's contained in a PlasmoidHeading

Depends on D28466
Depends on D28575

Test Plan: {F8208545}

Reviewers: #plasma, ngraham

Reviewed By: ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Maniphest Tasks: T10470

Differential Revision: https://phabricator.kde.org/D28467
parent be8c0f18
......@@ -23,103 +23,57 @@ import QtQuick 2.2
import org.kde.bluezqt 1.0 as BluezQt
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.bluetooth 1.0 as PlasmaBt
FocusScope {
focus: true
PlasmaComponents3.Page {
PlasmaBt.DevicesProxyModel {
id: devicesModel
sourceModel: BluezQt.DevicesModel { }
header: Toolbar {
id: toolbar
}
PlasmaExtras.Heading {
id: noAdaptersHeading
level: 3
opacity: 0.6
text: i18n("No Adapters Available")
FocusScope {
anchors.fill: parent
focus: true
anchors {
top: parent.top
left: parent.left
PlasmaBt.DevicesProxyModel {
id: devicesModel
sourceModel: BluezQt.DevicesModel { }
}
}
Item {
id: bluetoothDisabledView
anchors.fill: parent
PlasmaExtras.Heading {
id: bluetoothDisabledHeading
id: noAdaptersHeading
level: 3
opacity: 0.6
text: i18n("Bluetooth is Disabled")
text: i18n("No Adapters Available")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: enableBluetoothButton.top
bottomMargin: units.smallSpacing
top: parent.top
left: parent.left
}
}
PlasmaComponents.Button {
id: enableBluetoothButton
text: i18n("Enable Bluetooth")
iconSource: "preferences-system-bluetooth"
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
onClicked: {
toolbar.toggleBluetooth();
}
}
}
Toolbar {
id: toolbar
anchors {
left: parent.left
right: parent.right
top: parent.top
}
}
PlasmaExtras.ScrollArea {
id: scrollView
visible: toolbar.visible
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
top: toolbar.bottom
}
Item {
id: noDevicesView
id: bluetoothDisabledView
anchors.fill: parent
PlasmaExtras.Heading {
id: noDevicesHeading
id: bluetoothDisabledHeading
level: 3
opacity: 0.6
text: i18n("No Devices Found")
text: i18n("Bluetooth is Disabled")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: addDeviceButton.top
bottom: enableBluetoothButton.top
bottomMargin: units.smallSpacing
}
}
PlasmaComponents.Button {
id: addDeviceButton
text: i18n("Add New Device")
iconSource: "list-add"
id: enableBluetoothButton
text: i18n("Enable Bluetooth")
iconSource: "preferences-system-bluetooth"
anchors {
horizontalCenter: parent.horizontalCenter
......@@ -127,54 +81,94 @@ FocusScope {
}
onClicked: {
PlasmaBt.LaunchApp.runCommand("bluedevil-wizard");
toolbar.toggleBluetooth();
}
}
}
ListView {
id: devicesView
PlasmaExtras.ScrollArea {
id: scrollView
visible: toolbar.visible
anchors.fill: parent
clip: true
model: devicesModel
currentIndex: -1
enabled: btManager.bluetoothOperational
boundsBehavior: Flickable.StopAtBounds
section.property: "Section"
section.delegate: Header {
text: section == "Connected" ? i18n("Connected devices") : i18n("Available devices")
Item {
id: noDevicesView
anchors.fill: parent
PlasmaExtras.Heading {
id: noDevicesHeading
level: 3
opacity: 0.6
text: i18n("No Devices Found")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: addDeviceButton.top
bottomMargin: units.smallSpacing
}
}
PlasmaComponents.Button {
id: addDeviceButton
text: i18n("Add New Device")
iconSource: "list-add"
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
onClicked: {
PlasmaBt.LaunchApp.runCommand("bluedevil-wizard");
}
}
}
ListView {
id: devicesView
anchors.fill: parent
clip: true
model: devicesModel
currentIndex: -1
enabled: btManager.bluetoothOperational
boundsBehavior: Flickable.StopAtBounds
section.property: "Section"
section.delegate: Header {
text: section == "Connected" ? i18n("Connected devices") : i18n("Available devices")
}
highlight: PlasmaComponents.Highlight { }
highlightMoveDuration: units.longDuration
highlightResizeDuration: units.longDuration
delegate: DeviceItem { }
}
highlight: PlasmaComponents.Highlight { }
highlightMoveDuration: units.longDuration
highlightResizeDuration: units.longDuration
delegate: DeviceItem { }
}
}
states: [
State {
name: "BlockedState"
when: btManager.bluetoothBlocked
},
State {
name: "DevicesState"
when: btManager.devices.length
},
State {
name: "NoDevicesState"
when: btManager.adapters.length && !btManager.devices.length
},
State {
name: "NoAdaptersState"
when: !btManager.adapters.length
states: [
State {
name: "BlockedState"
when: btManager.bluetoothBlocked
},
State {
name: "DevicesState"
when: btManager.devices.length
},
State {
name: "NoDevicesState"
when: btManager.adapters.length && !btManager.devices.length
},
State {
name: "NoAdaptersState"
when: !btManager.adapters.length
}
]
onStateChanged: {
noAdaptersHeading.visible = (state == "NoAdaptersState");
toolbar.visible = (state == "DevicesState" || state == "NoDevicesState");
noDevicesView.visible = (state == "NoDevicesState");
bluetoothDisabledView.visible = (state == "BlockedState");
devicesView.visible = (state == "DevicesState");
}
]
onStateChanged: {
noAdaptersHeading.visible = (state == "NoAdaptersState");
toolbar.visible = (state == "DevicesState" || state == "NoDevicesState");
noDevicesView.visible = (state == "NoDevicesState");
bluetoothDisabledView.visible = (state == "BlockedState");
devicesView.visible = (state == "DevicesState");
}
}
......@@ -23,18 +23,14 @@ import QtQuick 2.2
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.bluetooth 1.0 as PlasmaBt
Item {
PlasmaExtras.PlasmoidHeading {
id: toolbar
height: btSwitchButton.height
PlasmaCore.Svg {
id: lineSvg
imagePath: "widgets/line"
}
SwitchButton {
id: btSwitchButton
......
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