Verified Commit 8031139a authored by ivan tkachenko's avatar ivan tkachenko
Browse files

[applets/systemtray] Clean up QML/JavaScript code

parent d4ffa0f8
......@@ -18,13 +18,13 @@ PlasmaCore.ToolTipArea {
mainText: Plasmoid.toolTipMainText
subText: Plasmoid.toolTipSubText
location: if (Plasmoid.parent && Plasmoid.parent.inHiddenLayout && Plasmoid.location !== PlasmaCore.Types.LeftEdge) {
return PlasmaCore.Types.RightEdge;
} else {
return Plasmoid.location;
}
return PlasmaCore.Types.RightEdge;
} else {
return Plasmoid.location;
}
active: !Plasmoid.expanded
textFormat: Plasmoid.toolTipTextFormat
mainItem: Plasmoid.toolTipItem ? Plasmoid.toolTipItem : null
mainItem: Plasmoid.toolTipItem
property Item fullRepresentation
property Item compactRepresentation
......
......@@ -71,9 +71,7 @@ PlasmaComponents3.ScrollView {
model: PlasmaCore.SortFilterModel {
sourceModel: Plasmoid.nativeInterface.systemTrayModel
filterRole: "effectiveStatus"
filterCallback: function(source_row, value) {
return value === PlasmaCore.Types.PassiveStatus
}
filterCallback: (source_row, value) => value === PlasmaCore.Types.PassiveStatus
}
delegate: ItemLoader {}
......
......@@ -64,9 +64,9 @@ PlasmaCore.ToolTipArea {
PulseAnimation {
targetItem: iconContainer
running: (abstractItem.status === PlasmaCore.Types.NeedsAttentionStatus ||
abstractItem.status === PlasmaCore.Types.RequiresAttentionStatus ) &&
PlasmaCore.Units.longDuration > 0
running: (abstractItem.status === PlasmaCore.Types.NeedsAttentionStatus
|| abstractItem.status === PlasmaCore.Types.RequiresAttentionStatus)
&& PlasmaCore.Units.longDuration > 0
}
function startActivatedAnimation() {
......
......@@ -37,11 +37,11 @@ AbstractItem {
}
onActivated: {
let service = model.Service;
let operation = service.operationDescription("Activate");
const service = model.Service;
const operation = service.operationDescription("Activate");
operation.x = pos.x; //mouseX
operation.y = pos.y; //mouseY
let job = service.startOperationCall(operation);
const job = service.startOperationCall(operation);
job.finished.connect(() => {
if (!job.result) {
// On error try to invoke the context menu.
......@@ -66,10 +66,9 @@ AbstractItem {
openContextMenu(pos);
break;
case Qt.MiddleButton:
var operation = service.operationDescription("SecondaryActivate");
let service = model.Service;
const operation = service.operationDescription("SecondaryActivate");
const service = model.Service;
operation.x = pos.x;
operation.y = pos.y;
service.startOperationCall(operation);
taskIcon.startActivatedAnimation()
......@@ -78,13 +77,13 @@ AbstractItem {
}
function openContextMenu(pos = Qt.point(width/2, height/2)) {
var service = model.Service;
var operation = service.operationDescription("ContextMenu");
const service = model.Service;
const operation = service.operationDescription("ContextMenu");
operation.x = pos.x;
operation.y = pos.y;
var job = service.startOperationCall(operation);
job.finished.connect(function () {
const job = service.startOperationCall(operation);
job.finished.connect(() => {
Plasmoid.nativeInterface.showStatusNotifierContextMenu(job, taskIcon);
});
}
......@@ -92,16 +91,16 @@ AbstractItem {
onWheel: {
//don't send activateVertScroll with a delta of 0, some clients seem to break (kmix)
if (wheel.angleDelta.y !== 0) {
var service = model.Service;
var operation = service.operationDescription("Scroll");
operation.delta =wheel.angleDelta.y;
const service = model.Service;
const operation = service.operationDescription("Scroll");
operation.delta = wheel.angleDelta.y;
operation.direction = "Vertical";
service.startOperationCall(operation);
}
if (wheel.angleDelta.x !== 0) {
var service = model.Service;
var operation = service.operationDescription("Scroll");
operation.delta =wheel.angleDelta.x;
const service = model.Service;
const operation = service.operationDescription("Scroll");
operation.delta = wheel.angleDelta.x;
operation.direction = "Horizontal";
service.startOperationCall(operation);
}
......
......@@ -30,7 +30,7 @@ MouseArea {
readonly property alias itemSize: tasksGrid.itemSize
readonly property alias visibleLayout: tasksGrid
readonly property alias hiddenLayout: expandedRepresentation.hiddenLayout
readonly property bool oneRowOrColumn: tasksGrid.rowsOrColumns == 1
readonly property bool oneRowOrColumn: tasksGrid.rowsOrColumns === 1
onWheel: {
// Don't propagate unhandled wheel events
......@@ -55,7 +55,7 @@ MouseArea {
DnD.DropArea {
anchors.fill: parent
preventStealing: true;
preventStealing: true
/** Extracts the name of the system tray applet in the drag data if present
* otherwise returns null*/
......@@ -63,7 +63,7 @@ MouseArea {
if (event.mimeData.formats.indexOf("text/x-plasmoidservicename") < 0) {
return null;
}
var plasmoidId = event.mimeData.getDataAsByteArray("text/x-plasmoidservicename");
const plasmoidId = event.mimeData.getDataAsByteArray("text/x-plasmoidservicename");
if (!Plasmoid.nativeInterface.isSystemTrayApplet(plasmoidId)) {
return null;
......@@ -78,14 +78,14 @@ MouseArea {
}
onDrop: {
var plasmoidId = systemTrayAppletName(event);
const plasmoidId = systemTrayAppletName(event);
if (!plasmoidId) {
event.ignore();
return;
}
if (Plasmoid.configuration.extraItems.indexOf(plasmoidId) < 0) {
var extraItems = Plasmoid.configuration.extraItems;
const extraItems = Plasmoid.configuration.extraItems;
extraItems.push(plasmoidId);
Plasmoid.configuration.extraItems = extraItems;
}
......@@ -155,9 +155,7 @@ MouseArea {
model: PlasmaCore.SortFilterModel {
sourceModel: Plasmoid.nativeInterface.systemTrayModel
filterRole: "effectiveStatus"
filterCallback: function(source_row, value) {
return value === PlasmaCore.Types.ActiveStatus
}
filterCallback: (source_row, value) => value === PlasmaCore.Types.ActiveStatus
}
delegate: ItemLoader {
......@@ -257,19 +255,19 @@ MouseArea {
visible: [PlasmaCore.Types.TopEdge, PlasmaCore.Types.LeftEdge, PlasmaCore.Types.RightEdge, PlasmaCore.Types.BottomEdge]
.includes(Plasmoid.location)
anchors {
top: Plasmoid.location == PlasmaCore.Types.BottomEdge ? undefined : parent.top
left: Plasmoid.location == PlasmaCore.Types.RightEdge ? undefined : parent.left
right: Plasmoid.location == PlasmaCore.Types.LeftEdge ? undefined : parent.right
bottom: Plasmoid.location == PlasmaCore.Types.TopEdge ? undefined : parent.bottom
topMargin: Plasmoid.location == PlasmaCore.Types.BottomEdge ? undefined : -dialog.margins.top
leftMargin: Plasmoid.location == PlasmaCore.Types.RightEdge ? undefined : -dialog.margins.left
rightMargin: Plasmoid.location == PlasmaCore.Types.LeftEdge ? undefined : -dialog.margins.right
bottomMargin: Plasmoid.location == PlasmaCore.Types.TopEdge ? undefined : -dialog.margins.bottom
top: Plasmoid.location === PlasmaCore.Types.BottomEdge ? undefined : parent.top
left: Plasmoid.location === PlasmaCore.Types.RightEdge ? undefined : parent.left
right: Plasmoid.location === PlasmaCore.Types.LeftEdge ? undefined : parent.right
bottom: Plasmoid.location === PlasmaCore.Types.TopEdge ? undefined : parent.bottom
topMargin: Plasmoid.location === PlasmaCore.Types.BottomEdge ? undefined : -dialog.margins.top
leftMargin: Plasmoid.location === PlasmaCore.Types.RightEdge ? undefined : -dialog.margins.left
rightMargin: Plasmoid.location === PlasmaCore.Types.LeftEdge ? undefined : -dialog.margins.right
bottomMargin: Plasmoid.location === PlasmaCore.Types.TopEdge ? undefined : -dialog.margins.bottom
}
height: (Plasmoid.location == PlasmaCore.Types.TopEdge || Plasmoid.location == PlasmaCore.Types.BottomEdge) ? 1 : undefined
width: (Plasmoid.location == PlasmaCore.Types.LeftEdge || Plasmoid.location == PlasmaCore.Types.RightEdge) ? 1 : undefined
height: (Plasmoid.location === PlasmaCore.Types.TopEdge || Plasmoid.location === PlasmaCore.Types.BottomEdge) ? 1 : undefined
width: (Plasmoid.location === PlasmaCore.Types.LeftEdge || Plasmoid.location === PlasmaCore.Types.RightEdge) ? 1 : undefined
z: 999 /* Draw the line on top of the applet */
elementId: (Plasmoid.location == PlasmaCore.Types.TopEdge || Plasmoid.location == PlasmaCore.Types.BottomEdge) ? "horizontal-line" : "vertical-line"
elementId: (Plasmoid.location === PlasmaCore.Types.TopEdge || Plasmoid.location === PlasmaCore.Types.BottomEdge) ? "horizontal-line" : "vertical-line"
svg: PlasmaCore.Svg {
imagePath: "widgets/line"
}
......
Supports Markdown
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