Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Allow actually logging in (linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBriza committed Dec 6, 2019
1 parent bc2cf81 commit e510a9e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
21 changes: 14 additions & 7 deletions src/ui/linux/TogglDesktop/LoginView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ Item {
property bool loggingIn: true
property bool signingUp: !loggingIn

property bool everythingFilled: false
property bool everythingFilled: {
if (loggingIn) {
return username.filled && password.filled
}
else {
return username.filled && password.filled && country.filled && termsAndConditions.filled
}
}

function act() {
if (!everythingFilled)
return
if (loggingIn)
toggl.login(username.text, password.text)
else if (signingUp) {
if (signupWithEmail.checked)
toggl.signup(username.text, password.text, country.selectedID)
else if (signupWithGoogle.checked) {
// don't do anything in this case
}
toggl.signup(username.text, password.text, country.selectedID)
}
}

Expand Down Expand Up @@ -127,6 +130,7 @@ Item {
focus: true
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: qsTr("Email address")
property bool filled: text.length > 0 // change this to a regexp eventually
onAccepted: act()
}

Expand All @@ -139,6 +143,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: "Password"
echoMode: TextField.Password
property bool filled: text.length > 0
onAccepted: act()
}

Expand Down Expand Up @@ -166,6 +171,7 @@ Item {
textRole: "Text"
currentIndex: -1
property int selectedID: toggl.countries && toggl.countries[currentIndex] ? toggl.countries[currentIndex].ID : -1
property bool filled: selectedID >= 0
displayText: currentIndex < 0 ? "Please select your country" : currentText
}

Expand All @@ -176,13 +182,14 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
TogglCheckBox {
id: termsAndConditions
property bool acceptable: checked
}
Text {
id: termsAndConditionsText
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font.pointSize: 9
font.pixelSize: 9
text: "I agree to <a href=\"https://toggl.com/legal/terms/\">terms of service</a> and <a href=\"https://toggl.com/legal/privacy/\">privacy policy</a>"
color: mainPalette.text
}
Expand Down
30 changes: 17 additions & 13 deletions src/ui/linux/TogglDesktop/TogglButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@ Button {
id: background
control: control
}
contentItem: RowLayout {
contentItem: Rectangle {
anchors.fill: parent
spacing: icon.status == Image.Ready ? 3 : 0
Image {
id: icon
Layout.alignment: Qt.AlignCenter
}
Text {
id: text
Layout.alignment: Qt.AlignCenter
color: control.enabled ? control.pressed | control.checked ? mainPalette.text
: mainPalette.text
: disabledPalette.text
text: control.text
color: "blue"
RowLayout {
anchors.fill: parent
spacing: icon.status == Image.Ready ? 3 : 0
Image {
id: icon
Layout.alignment: Qt.AlignCenter
}
Text {
id: text
Layout.alignment: Qt.AlignCenter
color: control.enabled ? control.pressed | control.checked ? mainPalette.text
: mainPalette.text
: disabledPalette.text
text: control.text
}
}
}
}

0 comments on commit e510a9e

Please sign in to comment.