64 lines
1.3 KiB
QML
64 lines
1.3 KiB
QML
|
import QtQuick 2.4
|
||
|
import Ubuntu.Components 1.3
|
||
|
import Ubuntu.Components.Popups 1.3
|
||
|
|
||
|
Dialog {
|
||
|
id: credProvider
|
||
|
title: i18n.tr("Authentication required")
|
||
|
text_user: i18n.tr("Enter user :")
|
||
|
text_password: i18n.tr("Enter password :")
|
||
|
|
||
|
signal validated(string user, string password)
|
||
|
signal canceled
|
||
|
|
||
|
function activateFocus() {
|
||
|
user.forceActiveFocus()
|
||
|
}
|
||
|
|
||
|
TextField {
|
||
|
id: userField
|
||
|
|
||
|
placeholderText: i18n.tr("user")
|
||
|
echoMode: TextInput.Password
|
||
|
|
||
|
onAccepted: passwordField.forceActiveFocus()
|
||
|
}
|
||
|
|
||
|
TextField {
|
||
|
id: passwordField
|
||
|
|
||
|
placeholderText: i18n.tr("password")
|
||
|
echoMode: TextInput.Password
|
||
|
|
||
|
onAccepted: okButton.clicked(text)
|
||
|
}
|
||
|
|
||
|
Button {
|
||
|
id: okButton
|
||
|
|
||
|
text: i18n.tr("Ok")
|
||
|
color: UbuntuColors.green
|
||
|
|
||
|
onClicked: {
|
||
|
validated(userField.text, passwordField.text)
|
||
|
userField.text = ""
|
||
|
passwordField.text = ""
|
||
|
PopupUtils.close(credProvider)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Button {
|
||
|
id: cancelButton
|
||
|
text: i18n.tr("Cancel")
|
||
|
|
||
|
color: UbuntuColors.red
|
||
|
|
||
|
onClicked: {
|
||
|
userField.text = ""
|
||
|
passwordField.text = ""
|
||
|
canceled()
|
||
|
PopupUtils.close(credProvider)
|
||
|
}
|
||
|
}
|
||
|
}
|