#include <QFileInfo>
#include <QFileIconProvider>
+#include <QInputDialog>
#include <QPointer>
#include <QPushButton>
#include <QFrame>
_manager = new ShareManager(accountState->account(), this);
connect(_manager, &ShareManager::sharesFetched, this, &ShareDialog::slotSharesFetched);
connect(_manager, &ShareManager::linkShareCreated, this, &ShareDialog::slotAddLinkShareWidget);
+ connect(_manager, &ShareManager::linkShareRequiresPassword, this, &ShareDialog::slotLinkShareRequiresPassword);
}
}
_manager->createLinkShare(_sharePath, QString(), QString());
}
+void ShareDialog::slotLinkShareRequiresPassword()
+{
+ bool ok;
+ QString password = QInputDialog::getText(this,
+ 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
+ _manager->createLinkShare(_sharePath, QString(), password);
+}
void ShareDialog::slotDeleteShare()
{
void slotAddLinkShareWidget(const QSharedPointer<LinkShare> &linkShare);
void slotDeleteShare();
void slotCreateLinkShare();
+ void slotLinkShareRequiresPassword();
void slotAdjustScrollWidgetSize();
signals:
#include <QLocalSocket>
#include <QStringBuilder>
#include <QMessageBox>
+#include <QInputDialog>
#include <QClipboard>
this, &GetOrCreatePublicLinkShare::linkShareCreated);
connect(&_shareManager, &ShareManager::serverError,
this, &GetOrCreatePublicLinkShare::serverError);
+ connect(&_shareManager, &ShareManager::linkShareRequiresPassword,
+ this, &GetOrCreatePublicLinkShare::passwordRequired);
}
void run()
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;