import com.nextcloud.desktopclient 1.0
import Style 1.0
import "../tray"
+import "../"
GridLayout {
id: root
property bool waitingForPasswordChange: false
property bool waitingForNoteChange: false
+ function showPasswordSetError(message) {
+ passwordErrorBoxLoader.message = message !== "" ?
+ message : qsTr("An error occurred setting the share password.");
+ }
+
function resetNoteField() {
noteTextEdit.text = note;
waitingForNoteChange = false;
!root.waitingForPasswordProtectEnabledChange
onAccepted: if(text !== root.password && text !== root.passwordPlaceholder) {
+ passwordErrorBoxLoader.message = "";
root.setPassword(text);
root.waitingForPasswordChange = true;
}
}
}
+ Loader {
+ id: passwordErrorBoxLoader
+
+ property string message: ""
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: message !== "" ? implicitHeight : 0
+
+ active: message !== ""
+ visible: active
+
+ sourceComponent: Item {
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ // Artificially add vertical padding
+ implicitHeight: passwordErrorBox.implicitHeight + (Style.smallSpacing * 2)
+
+ ErrorBox {
+ id: passwordErrorBox
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+
+ text: passwordErrorBoxLoader.message
+ }
+ }
+ }
+
CheckBox {
id: expireDateEnabledMenuItem
// password set has failed, meaning we won't be able to easily tell when we
// have had a response from the server in QML. So we listen to this signal
// directly from the model and do the reset of the password field manually.
- function onPasswordSetError(shareId) {
+ function onPasswordSetError(shareId, errorCode, errorMessage) {
if(shareId !== model.shareId) {
return;
}
shareDelegate.resetPasswordField();
+ shareDelegate.showPasswordSetError(errorMessage);
}
function onServerError() {
connect(share.data(), &Share::serverError, this, &ShareModel::slotServerError);
connect(share.data(), &Share::passwordSetError, this, [this, shareId](const int code, const QString &message) {
_shareIdRecentlySetPasswords.remove(shareId);
- slotServerError(code, message);
slotSharePasswordSet(shareId);
- Q_EMIT passwordSetError(shareId);
+ Q_EMIT passwordSetError(shareId, code, message);
});
// Passing shareId by reference here will cause crashing, so we pass by value
void hasInitialShareFetchCompletedChanged();
void serverError(const int code, const QString &message);
- void passwordSetError(const QString &shareId);
+ void passwordSetError(const QString &shareId, const int code, const QString &message);
void requestPasswordForLinkShare();
void requestPasswordForEmailSharee(const ShareePtr &sharee);