Commit 4b20f3a9 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[kicker] Use arrow functions in signal handlers

Summary: Fixes warnings from qmllint about unqualified property access. It also makes the code more readable since it's clear which are the signal's arguments

Test Plan: Did kicker/dashboard things

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26409
parent 64aa8043
......@@ -333,7 +333,7 @@ Kicker.DashboardWindow {
onClicked: searchField.clear();
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
event.accepted = true;
......@@ -471,7 +471,7 @@ Kicker.DashboardWindow {
systemFavoritesGrid.tryActivate(0, currentCol());
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
event.accepted = true;
......@@ -528,7 +528,7 @@ Kicker.DashboardWindow {
globalFavoritesGrid.tryActivate(globalFavoritesGrid.rows - 1, currentCol());
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
event.accepted = true;
......@@ -770,7 +770,7 @@ Kicker.DashboardWindow {
}
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
event.accepted = true;
......@@ -886,7 +886,7 @@ Kicker.DashboardWindow {
}
}
onPositionChanged: { // Lazy menu implementation.
onPositionChanged: mouse => { // Lazy menu implementation.
mouseCol = mouse.x;
if (justOpenedTimer.running || ListView.view.currentIndex === 0 || index === ListView.view.currentIndex) {
......@@ -904,7 +904,7 @@ Kicker.DashboardWindow {
updateCurrentItemTimer.restart();
}
onPressed: {
onPressed: mouse => {
if (mouse.buttons & Qt.RightButton) {
if (hasActionList) {
openActionMenu(item, mouse.x, mouse.y);
......@@ -912,7 +912,7 @@ Kicker.DashboardWindow {
}
}
onClicked: {
onClicked: mouse => {
if (mouse.button == Qt.LeftButton) {
updateCurrentItem();
}
......@@ -1049,7 +1049,7 @@ Kicker.DashboardWindow {
}
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Left) {
event.accepted = true;
......@@ -1068,13 +1068,13 @@ Kicker.DashboardWindow {
}
}
onPressed: {
onPressed: mouse => {
if (mouse.button == Qt.RightButton) {
contextMenu.open(mouse.x, mouse.y);
}
}
onClicked: {
onClicked: mouse => {
if (mouse.button == Qt.LeftButton) {
root.toggle();
}
......
......@@ -28,7 +28,7 @@ Row {
signal containsMouseChanged(int index, bool containsMouse)
onContainsMouseChanged: {
onContainsMouseChanged: (index, containsMouse) => {
if (containsMouse) {
hoveredTab = index;
} else {
......@@ -58,19 +58,19 @@ Row {
focus: parent.focus & active
}
Keys.onLeftPressed: {
Keys.onLeftPressed: event => {
if (activeTab == 1) {
activeTab = 0;
}
}
Keys.onRightPressed: {
Keys.onRightPressed: event => {
if (activeTab == 0) {
activeTab = 1;
}
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
event.accepted = true;
......
......@@ -114,7 +114,7 @@ Item {
onContainsMouseChanged: item.GridView.view.itemContainsMouseChanged(containsMouse)
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Menu && hasActionList) {
event.accepted = true;
openActionMenu(item);
......
......@@ -403,7 +403,7 @@ FocusScope {
return item;
}
onPressed: {
onPressed: mouse => {
mouse.accepted = true;
updatePositionProperties(mouse.x, mouse.y);
......@@ -426,7 +426,7 @@ FocusScope {
}
}
onReleased: {
onReleased: mouse => {
mouse.accepted = true;
updatePositionProperties(mouse.x, mouse.y);
......@@ -446,7 +446,7 @@ FocusScope {
pressedItem = null;
}
onPositionChanged: {
onPositionChanged: mouse => {
var item = pressedItem? pressedItem : updatePositionProperties(mouse.x, mouse.y);
if (gridView.currentIndex != -1) {
......
......@@ -96,7 +96,7 @@ Item {
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: {
onPressed: mouse => {
if (mouse.buttons & Qt.RightButton) {
if (item.hasActionList) {
item.openActionMenu(mouseArea, mouse.x, mouse.y);
......@@ -108,7 +108,7 @@ Item {
}
}
onReleased: {
onReleased: mouse => {
if (pressed && !item.hasChildren) {
item.ListView.view.model.trigger(index, "", null);
plasmoid.expanded = false;
......@@ -119,7 +119,7 @@ Item {
pressY = -1;
}
onPositionChanged: {
onPositionChanged: mouse => {
if (pressX != -1 && model.url && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
dragHelper.startDrag(kicker, model.url, model.decoration);
pressed = false;
......
......@@ -199,7 +199,7 @@ FocusScope {
}
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Up) {
event.accepted = true;
......
......@@ -243,7 +243,7 @@ FocusScope {
}
}
Keys.onPressed: {
Keys.onPressed: event => {
var target = null;
if (event.key === Qt.Key_Right) {
......@@ -374,7 +374,7 @@ FocusScope {
}
}]
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Up) {
if (rootList.visible) {
rootList.showChildDialogs = false;
......@@ -443,7 +443,7 @@ FocusScope {
}
}
Keys.onPressed: {
Keys.onPressed: event => {
if (event.key === Qt.Key_Escape) {
plasmoid.expanded = false;
}
......
......@@ -37,12 +37,12 @@ Item {
|| (("hasActionList" in model) && (model.hasActionList !== null)))
property int itemIndex: model.index
onAboutToShowActionMenu: {
onAboutToShowActionMenu: actionMenu => {
var actionList = (model.hasActionList !== null) ? model.actionList : [];
Tools.fillActionMenu(i18n, actionMenu, actionList, repeater.model, model.favoriteId);
}
onActionTriggered: {
onActionTriggered: (actionId, actionArgument) => {
if (Tools.triggerAction(repeater.model, model.index, actionId, actionArgument) === true) {
plasmoid.expanded = false;
}
......
......@@ -35,7 +35,7 @@ DropArea {
property alias model: repeater.model
property alias usesPlasmaTheme: repeater.usesPlasmaTheme
onDragMove: {
onDragMove: event => {
if (flow.animating) {
return;
}
......
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