Commit 3686a5ac authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[plasmoid] Show device battery percentage

While it is typically shown in Battery Monitor, it can still be useful to have it in Bluetooth plasmoid.

Differential Revision: https://phabricator.kde.org/D25860
parent 5101d790
......@@ -403,45 +403,53 @@ PlasmaComponents.ListItem {
return Connected ? i18n("Disconnecting") : i18n("Connecting");
}
var labels = [];
switch (Type) {
case BluezQt.Device.Headset:
case BluezQt.Device.Headphones:
case BluezQt.Device.OtherAudio:
return i18n("Audio device");
labels.push(i18n("Audio device"));
break;
case BluezQt.Device.Keyboard:
case BluezQt.Device.Mouse:
case BluezQt.Device.Joypad:
case BluezQt.Device.Tablet:
return i18n("Input device");
labels.push(i18n("Input device"));
break;
default:
break;
}
var profiles = [];
if (Uuids.indexOf(BluezQt.Services.ObexFileTransfer) != -1) {
profiles.push(i18n("File transfer"));
}
if (Uuids.indexOf(BluezQt.Services.ObexObjectPush) != -1) {
profiles.push(i18n("Send file"));
}
if (Uuids.indexOf(BluezQt.Services.HumanInterfaceDevice) != -1) {
profiles.push(i18n("Input"));
}
if (Uuids.indexOf(BluezQt.Services.AdvancedAudioDistribution) != -1) {
profiles.push(i18n("Audio"));
}
if (Uuids.indexOf(BluezQt.Services.Nap) != -1) {
profiles.push(i18n("Network"));
}
var profiles = [];
if (!profiles.length) {
profiles.push(i18n("Other device"));
}
if (Uuids.indexOf(BluezQt.Services.ObexFileTransfer) != -1) {
profiles.push(i18n("File transfer"));
}
if (Uuids.indexOf(BluezQt.Services.ObexObjectPush) != -1) {
profiles.push(i18n("Send file"));
}
if (Uuids.indexOf(BluezQt.Services.HumanInterfaceDevice) != -1) {
profiles.push(i18n("Input"));
}
if (Uuids.indexOf(BluezQt.Services.AdvancedAudioDistribution) != -1) {
profiles.push(i18n("Audio"));
}
if (Uuids.indexOf(BluezQt.Services.Nap) != -1) {
profiles.push(i18n("Network"));
labels.push(profiles.join(", "));
}
if (!profiles.length) {
return i18n("Other device");
if (Battery) {
labels.push(i18n("%1% Battery", Battery.percentage));
}
return profiles.join(", ");
return labels.join(" · ");
}
function connectToDevice()
......
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