diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-01-09 17:10:01 +0300 |
---|---|---|
committer | Michael Schuster <48932272+misch7@users.noreply.github.com> | 2020-01-09 20:20:32 +0300 |
commit | 05083e32c9fc274cc15bed95433ec4b77149d859 (patch) | |
tree | 89be93f9f3abccc05db9c36a66372cf039e7230d /src/gui/socketapi.cpp | |
parent | c6bd8c1221fb60151504883cad141f95929fbe62 (diff) |
Ask for password on password protected link shares
Fixes #1485
This was missed when creating the new share dialog.
Now it pops up with a nice share password dialog to enter for your link
share.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'src/gui/socketapi.cpp')
-rw-r--r-- | src/gui/socketapi.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index b09973d5b..a7bc604b5 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -49,6 +49,7 @@ #include <QLocalSocket> #include <QStringBuilder> #include <QMessageBox> +#include <QInputDialog> #include <QClipboard> @@ -477,6 +478,8 @@ public: this, &GetOrCreatePublicLinkShare::linkShareCreated); connect(&_shareManager, &ShareManager::serverError, this, &GetOrCreatePublicLinkShare::serverError); + connect(&_shareManager, &ShareManager::linkShareRequiresPassword, + this, &GetOrCreatePublicLinkShare::passwordRequired); } void run() @@ -512,6 +515,24 @@ private slots: success(share->getLink().toString()); } + void passwordRequired() { + bool ok; + QString password = QInputDialog::getText(nullptr, + tr("Password for share required"), + tr("Please enter a password for your link share:"), + QLineEdit::Normal, + QString(), + &ok); + + if (!ok) { + // The dialog was canceled so no need to do anything + return; + } + + // Try to create the link share again with the newly entered password + _shareManager.createLinkShare(_localFile, QString(), password); + } + void serverError(int code, const QString &message) { qCWarning(lcPublicLink) << "Share fetch/create error" << code << message; |