Verified Commit 52cdb78e authored by ivan tkachenko's avatar ivan tkachenko
Browse files

sddm-theme: JavaScript/QML code style++

GIT_SILENT
parent 4ba8d9dc
Pipeline #132903 passed with stage
in 5 minutes and 35 seconds
......@@ -17,12 +17,12 @@ ListView {
implicitHeight: userItemHeight
activeFocusOnTab : true
activeFocusOnTab: true
/*
* Signals that a user was explicitly selected
*/
signal userSelected;
signal userSelected()
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
......@@ -42,7 +42,7 @@ ListView {
needsPassword: model.needsPassword
name: {
var displayName = model.realName || model.name
const displayName = model.realName || model.name
if (model.vtNumber === undefined || model.vtNumber < 0) {
return displayName
......@@ -53,14 +53,14 @@ ListView {
}
var location = ""
let location = undefined
if (model.isTty) {
location = i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "User logged in on console number", "TTY %1", model.vtNumber)
} else if (model.displayNumber) {
location = i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "User logged in on console (X display number)", "on TTY %1 (Display %2)", model.vtNumber, model.displayNumber)
}
if (location) {
if (location !== undefined) {
return i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Username (location)", "%1 (%2)", displayName, location)
}
......
......@@ -29,7 +29,7 @@ SessionManagementScreen {
signal loginRequest(string password)
function startLogin() {
var password = passwordBox.text
const password = passwordBox.text
// This is partly because it looks nicer, but more importantly it
// works round a Qt bug that can trigger if the app is closed with a
......
......@@ -14,7 +14,9 @@ PlasmaComponents.ToolButton {
visible: menu.items.length > 1
Component.onCompleted: currentIndex = Qt.binding(function() {return keyboard.currentLayout});
Component.onCompleted: {
currentIndex = Qt.binding(() => keyboard.currentLayout);
}
menu: QQC.Menu {
id: keyboardMenu
......@@ -23,7 +25,7 @@ PlasmaComponents.ToolButton {
id: instantiator
model: keyboard.layouts
onObjectAdded: keyboardMenu.insertItem(index, object)
onObjectRemoved: keyboardMenu.removeItem( object )
onObjectRemoved: keyboardMenu.removeItem(object)
delegate: QQC.MenuItem {
text: modelData.longName
property string shortName: modelData.shortName
......
......@@ -34,8 +34,8 @@ SessionManagementScreen {
* If username field is visible, it will be taken from that, otherwise from the "name" property of the currentIndex
*/
function startLogin() {
var username = showUsernamePrompt ? userNameInput.text : userList.selectedUser
var password = passwordBox.text
const username = showUsernamePrompt ? userNameInput.text : userList.selectedUser
const password = passwordBox.text
footer.enabled = false
mainStack.enabled = false
......@@ -60,10 +60,11 @@ SessionManagementScreen {
focus: showUsernamePrompt && !lastUserName //if there's a username prompt it gets focus first, otherwise password does
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Username")
onAccepted:
onAccepted: {
if (root.loginScreenUiVisible) {
passwordBox.forceActiveFocus()
}
}
}
RowLayout {
......@@ -117,12 +118,12 @@ SessionManagementScreen {
id: loginButton
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log In")
Layout.preferredHeight: passwordBox.implicitHeight
Layout.preferredWidth: text.length == 0 ? loginButton.Layout.preferredHeight : -1
Layout.preferredWidth: text.length === 0 ? loginButton.Layout.preferredHeight : -1
icon.name: text.length == 0 ? (root.LayoutMirroring.enabled ? "go-previous" : "go-next") : ""
icon.name: text.length === 0 ? (root.LayoutMirroring.enabled ? "go-previous" : "go-next") : ""
text: root.showUsernamePrompt || userList.currentItem.needsPassword ? "" : i18n("Log In")
onClicked: startLogin();
onClicked: startLogin()
}
}
}
......@@ -181,21 +181,26 @@ PlasmaCore.ColorScope {
userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0
lastUserName: userModel.lastUser
showUserList: {
if ( !userListModel.hasOwnProperty("count")
|| !userListModel.hasOwnProperty("disableAvatarsThreshold"))
if (!userListModel.hasOwnProperty("count")
|| !userListModel.hasOwnProperty("disableAvatarsThreshold")) {
return (userList.y + mainStack.y) > 0
}
if ( userListModel.count === 0 ) return false
if (userListModel.count === 0 ) {
return false
}
if ( userListModel.hasOwnProperty("containsAllUsers") && !userListModel.containsAllUsers ) return false
if (userListModel.hasOwnProperty("containsAllUsers") && !userListModel.containsAllUsers) {
return false
}
return userListModel.count <= userListModel.disableAvatarsThreshold && (userList.y + mainStack.y) > 0
}
notificationMessage: {
var text = ""
let text = ""
if (keystateSource.data["Caps Lock"]["Locked"]) {
text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on")
text += i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Caps Lock is on")
if (root.notificationMessage) {
text += ""
}
......@@ -207,7 +212,7 @@ PlasmaCore.ColorScope {
actionItems: [
ActionButton {
iconSource: "system-suspend"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel","Suspend to RAM","Sleep")
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Suspend to RAM", "Sleep")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.suspend()
enabled: sddm.canSuspend
......@@ -215,7 +220,7 @@ PlasmaCore.ColorScope {
},
ActionButton {
iconSource: "system-reboot"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart")
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.reboot()
enabled: sddm.canReboot
......@@ -223,7 +228,7 @@ PlasmaCore.ColorScope {
},
ActionButton {
iconSource: "system-shutdown"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down")
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.powerOff()
enabled: sddm.canPowerOff
......@@ -335,7 +340,7 @@ PlasmaCore.ColorScope {
}
function showHide() {
state = state == "hidden" ? "visible" : "hidden";
state = state === "hidden" ? "visible" : "hidden";
}
states: [
......@@ -458,7 +463,7 @@ PlasmaCore.ColorScope {
actionItems: [
ActionButton {
iconSource: "system-suspend"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel","Suspend to RAM","Sleep")
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Suspend to RAM", "Sleep")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.suspend()
enabled: sddm.canSuspend
......@@ -466,7 +471,7 @@ PlasmaCore.ColorScope {
},
ActionButton {
iconSource: "system-reboot"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart")
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.reboot()
enabled: sddm.canReboot
......@@ -474,7 +479,7 @@ PlasmaCore.ColorScope {
},
ActionButton {
iconSource: "system-shutdown"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down")
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.powerOff()
enabled: sddm.canPowerOff
......@@ -482,7 +487,7 @@ PlasmaCore.ColorScope {
},
ActionButton {
iconSource: "system-user-list"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","List Users")
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "List Users")
fontSize: parseInt(config.fontSize) + 1
onClicked: mainStack.pop()
visible: !inputPanel.keyboardActive
......@@ -495,7 +500,7 @@ PlasmaCore.ColorScope {
id: logoShadow
anchors.fill: logo
source: logo
visible: !softwareRendering && config.showlogo == "shown"
visible: !softwareRendering && config.showlogo === "shown"
horizontalOffset: 1
verticalOffset: 1
radius: 6
......@@ -519,7 +524,7 @@ PlasmaCore.ColorScope {
Image {
id: logo
visible: config.showlogo == "shown"
visible: config.showlogo === "shown"
source: config.logo
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: footer.top
......@@ -559,7 +564,7 @@ PlasmaCore.ColorScope {
font.pointSize: config.fontSize
icon.name: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off"
onClicked: inputPanel.showHide()
visible: inputPanel.status == Loader.Ready
visible: inputPanel.status === Loader.Ready
}
KeyboardButton {
......
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