Warning, /plasma/plasma-pa/applet/contents/ui/DeviceListItem.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 import QtQuick 2.0
0008 
0009 import org.kde.plasma.private.volume 0.1
0010 
0011 import "../code/icon.js" as Icon
0012 
0013 ListItemBase {
0014     readonly property var currentPort: model.Ports[model.ActivePortIndex]
0015     readonly property bool muted: model.Muted
0016     readonly property int activePortIndex: model.ActivePortIndex
0017 
0018     fullNameToShowOnHover: ListView.view.count === 1 ? model.Description : ""
0019 
0020     draggable: false
0021     label: {
0022         if (currentPort && currentPort.description) {
0023             if (ListView.view.count === 1 || !model.Description) {
0024                 return currentPort.description;
0025             } else {
0026                 return i18nc("label of device items", "%1 (%2)", currentPort.description, model.Description);
0027             }
0028         }
0029         if (model.Description) {
0030             return model.Description;
0031         }
0032         if (model.Name) {
0033             return model.Name;
0034         }
0035         return i18n("Device name not found");
0036     }
0037 
0038     onActivePortIndexChanged: {
0039         if (type === "sink" && globalMute && !model.Muted) {
0040             model.Muted = true;
0041         }
0042     }
0043 
0044     onMutedChanged: {
0045         if (type === "sink" && globalMute && !model.Muted) {
0046             config.globalMute = false;
0047             config.globalMuteDevices = [];
0048             config.save();
0049         }
0050     }
0051 }