mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
GODT-2258: change login label and suggest email instead of username.
This commit is contained in:
@ -64,7 +64,7 @@ Item {
|
||||
}
|
||||
|
||||
function primaryEmail() {
|
||||
return (root.user && (root.user.addresses.length > 0)) ? root.user.addresses[0] : ""
|
||||
return root.user ? root.user.primaryEmailOrUsername() : ""
|
||||
}
|
||||
|
||||
// width expected to be set by parent object
|
||||
|
||||
@ -117,7 +117,7 @@ QtObject {
|
||||
// fit above
|
||||
_y = iconRect.top - height
|
||||
if (isInInterval(_y, screenRect.top, screenRect.bottom - height)) {
|
||||
// position preferebly in the horizontal center but bound to the screen rect
|
||||
// position preferably in the horizontal center but bound to the screen rect
|
||||
_x = bound(iconRect.left + (iconRect.width - width)/2, screenRect.left, screenRect.right - width)
|
||||
return Qt.point(_x, _y)
|
||||
}
|
||||
@ -125,7 +125,7 @@ QtObject {
|
||||
// fit below
|
||||
_y = iconRect.bottom
|
||||
if (isInInterval(_y, screenRect.top, screenRect.bottom - height)) {
|
||||
// position preferebly in the horizontal center but bound to the screen rect
|
||||
// position preferably in the horizontal center but bound to the screen rect
|
||||
_x = bound(iconRect.left + (iconRect.width - width)/2, screenRect.left, screenRect.right - width)
|
||||
return Qt.point(_x, _y)
|
||||
}
|
||||
@ -133,7 +133,7 @@ QtObject {
|
||||
// fit to the left
|
||||
_x = iconRect.left - width
|
||||
if (isInInterval(_x, screenRect.left, screenRect.right - width)) {
|
||||
// position preferebly in the vertical center but bound to the screen rect
|
||||
// position preferably in the vertical center but bound to the screen rect
|
||||
_y = bound(iconRect.top + (iconRect.height - height)/2, screenRect.top, screenRect.bottom - height)
|
||||
return Qt.point(_x, _y)
|
||||
}
|
||||
@ -141,12 +141,12 @@ QtObject {
|
||||
// fit to the right
|
||||
_x = iconRect.right
|
||||
if (isInInterval(_x, screenRect.left, screenRect.right - width)) {
|
||||
// position preferebly in the vertical center but bound to the screen rect
|
||||
// position preferably in the vertical center but bound to the screen rect
|
||||
_y = bound(iconRect.top + (iconRect.height - height)/2, screenRect.top, screenRect.bottom - height)
|
||||
return Qt.point(_x, _y)
|
||||
}
|
||||
|
||||
// Fallback: position satatus window right above icon and let window manager decide.
|
||||
// Fallback: position status window right above icon and let window manager decide.
|
||||
console.warn("Can't position status window: screenRect =", screenRect, "iconRect =", iconRect)
|
||||
_x = bound(iconRect.left + (iconRect.width - width)/2, screenRect.left, screenRect.right - width)
|
||||
_y = bound(iconRect.top + (iconRect.height - height)/2, screenRect.top, screenRect.bottom - height)
|
||||
|
||||
@ -188,7 +188,7 @@ Item {
|
||||
if (user.state !== EUserState.SignedOut) {
|
||||
rightContent.showAccount()
|
||||
} else {
|
||||
signIn.username = user.username
|
||||
signIn.username = user.primaryEmailOrUsername()
|
||||
rightContent.showSignIn()
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,8 @@ Item {
|
||||
return Backend.users.get(accounts.currentIndex)
|
||||
}
|
||||
onShowSignIn: {
|
||||
signIn.username = this.user.username
|
||||
var user = this.user
|
||||
signIn.username = user ? user.primaryEmailOrUsername() : ""
|
||||
rightContent.showSignIn()
|
||||
}
|
||||
onShowSetupGuide: function(user, address) {
|
||||
|
||||
@ -116,7 +116,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
if ((Backend.users.count === 1) && (u.state === EUserState.SignedOut)) {
|
||||
showSignIn(u.username)
|
||||
showSignIn(u.primaryEmailOrUsername())
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ FocusScope {
|
||||
TextField {
|
||||
colorScheme: root.colorScheme
|
||||
id: usernameTextField
|
||||
label: qsTr("Username or email")
|
||||
label: qsTr("Email or username")
|
||||
focus: true
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 24
|
||||
@ -221,7 +221,7 @@ FocusScope {
|
||||
|
||||
validator: function(str) {
|
||||
if (str.length === 0) {
|
||||
return qsTr("Enter username or email")
|
||||
return qsTr("Enter email or username")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -55,6 +55,14 @@ void User::update(User const &user) {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The user's primary email. If not known, return turn username
|
||||
//****************************************************************************************************************************************************
|
||||
QString User::primaryEmailOrUsername() const {
|
||||
return addresses_.isEmpty() ? username_ : addresses_.front();
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] makeItActive Should split mode be made active.
|
||||
//****************************************************************************************************************************************************
|
||||
|
||||
@ -73,6 +73,7 @@ public: // member functions.
|
||||
User &operator=(User const &) = delete; ///< Disabled assignment operator.
|
||||
User &operator=(User &&) = delete; ///< Disabled move assignment operator.
|
||||
void update(User const &user); ///< Update the user.
|
||||
Q_INVOKABLE QString primaryEmailOrUsername() const; ///< Return the user primary email, or, if unknown its username.
|
||||
|
||||
public slots:
|
||||
// slots for QML generated calls
|
||||
|
||||
Reference in New Issue
Block a user