mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Merge pull request #3178 from nextcloud/bugfix/improve-public-link-sharing-dialog
Improve public link sharing dialog
This commit is contained in:
commit
98b1203856
8 changed files with 303 additions and 147 deletions
|
@ -39,7 +39,7 @@ QString createRandomPassword()
|
|||
{
|
||||
const auto words = OCC::WordList::getRandomWords(10);
|
||||
|
||||
const auto addFirstLetter = [](const QString ¤t, const QString &next) {
|
||||
const auto addFirstLetter = [](const QString ¤t, const QString &next) -> QString {
|
||||
return current + next.at(0);
|
||||
};
|
||||
|
||||
|
@ -152,48 +152,51 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
|
|||
}
|
||||
}
|
||||
|
||||
void ShareDialog::addLinkShareWidget(const QSharedPointer<LinkShare> &linkShare){
|
||||
ShareLinkWidget *ShareDialog::addLinkShareWidget(const QSharedPointer<LinkShare> &linkShare)
|
||||
{
|
||||
_linkWidgetList.append(new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this));
|
||||
int index = _linkWidgetList.size()-1;
|
||||
_linkWidgetList.at(index)->setLinkShare(linkShare);
|
||||
|
||||
connect(linkShare.data(), &Share::serverError, _linkWidgetList.at(index), &ShareLinkWidget::slotServerError);
|
||||
connect(linkShare.data(), &Share::shareDeleted, _linkWidgetList.at(index), &ShareLinkWidget::slotDeleteShareFetched);
|
||||
const auto linkShareWidget = _linkWidgetList.at(_linkWidgetList.size() - 1);
|
||||
linkShareWidget->setLinkShare(linkShare);
|
||||
|
||||
connect(linkShare.data(), &Share::serverError, linkShareWidget, &ShareLinkWidget::slotServerError);
|
||||
connect(linkShare.data(), &Share::shareDeleted, linkShareWidget, &ShareLinkWidget::slotDeleteShareFetched);
|
||||
|
||||
if(_manager) {
|
||||
connect(_manager, &ShareManager::linkShareRequiresPassword, _linkWidgetList.at(index), &ShareLinkWidget::slotCreateShareRequiresPassword);
|
||||
connect(_manager, &ShareManager::serverError, _linkWidgetList.at(index), &ShareLinkWidget::slotServerError);
|
||||
connect(_manager, &ShareManager::serverError, linkShareWidget, &ShareLinkWidget::slotServerError);
|
||||
}
|
||||
|
||||
// Connect all shares signals to gui slots
|
||||
connect(this, &ShareDialog::toggleAnimation, _linkWidgetList.at(index), &ShareLinkWidget::slotToggleAnimation);
|
||||
connect(_linkWidgetList.at(index), &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
|
||||
connect(_linkWidgetList.at(index), &ShareLinkWidget::deleteLinkShare, this, &ShareDialog::slotDeleteShare);
|
||||
connect(this, &ShareDialog::toggleShareLinkAnimation, linkShareWidget, &ShareLinkWidget::slotToggleShareLinkAnimation);
|
||||
connect(linkShareWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
|
||||
connect(linkShareWidget, &ShareLinkWidget::deleteLinkShare, this, &ShareDialog::slotDeleteShare);
|
||||
connect(linkShareWidget, &ShareLinkWidget::createPassword, this, &ShareDialog::slotCreatePasswordForLinkShare);
|
||||
|
||||
//connect(_linkWidgetList.at(index), &ShareLinkWidget::resizeRequested, this, &ShareDialog::slotAdjustScrollWidgetSize);
|
||||
|
||||
// Connect styleChanged events to our widget, so it can adapt (Dark-/Light-Mode switching)
|
||||
connect(this, &ShareDialog::styleChanged, _linkWidgetList.at(index), &ShareLinkWidget::slotStyleChanged);
|
||||
connect(this, &ShareDialog::styleChanged, linkShareWidget, &ShareLinkWidget::slotStyleChanged);
|
||||
|
||||
_ui->verticalLayout->insertWidget(_linkWidgetList.size()+1, _linkWidgetList.at(index));
|
||||
_linkWidgetList.at(index)->setupUiOptions();
|
||||
_ui->verticalLayout->insertWidget(_linkWidgetList.size() + 1, linkShareWidget);
|
||||
linkShareWidget->setupUiOptions();
|
||||
|
||||
return linkShareWidget;
|
||||
}
|
||||
|
||||
void ShareDialog::initLinkShareWidget(){
|
||||
void ShareDialog::initLinkShareWidget()
|
||||
{
|
||||
if(_linkWidgetList.size() == 0) {
|
||||
_emptyShareLinkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this);
|
||||
_linkWidgetList.append(_emptyShareLinkWidget);
|
||||
|
||||
if (_manager) {
|
||||
connect(_manager, &ShareManager::linkShareRequiresPassword, _emptyShareLinkWidget, &ShareLinkWidget::slotCreateShareRequiresPassword);
|
||||
}
|
||||
|
||||
connect(_emptyShareLinkWidget, &ShareLinkWidget::resizeRequested, this, &ShareDialog::slotAdjustScrollWidgetSize);
|
||||
// connect(this, &ShareDialog::toggleAnimation, _emptyShareLinkWidget, &ShareLinkWidget::slotToggleAnimation);
|
||||
connect(this, &ShareDialog::toggleShareLinkAnimation, _emptyShareLinkWidget, &ShareLinkWidget::slotToggleShareLinkAnimation);
|
||||
connect(_emptyShareLinkWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
|
||||
|
||||
connect(_emptyShareLinkWidget, &ShareLinkWidget::createPassword, this, &ShareDialog::slotCreatePasswordForLinkShare);
|
||||
|
||||
_ui->verticalLayout->insertWidget(_linkWidgetList.size()+1, _emptyShareLinkWidget);
|
||||
_emptyShareLinkWidget->show();
|
||||
|
||||
} else if(_emptyShareLinkWidget) {
|
||||
_emptyShareLinkWidget->hide();
|
||||
_ui->verticalLayout->removeWidget(_emptyShareLinkWidget);
|
||||
|
@ -202,16 +205,20 @@ void ShareDialog::initLinkShareWidget(){
|
|||
}
|
||||
}
|
||||
|
||||
void ShareDialog::slotAddLinkShareWidget(const QSharedPointer<LinkShare> &linkShare){
|
||||
emit toggleAnimation(true);
|
||||
addLinkShareWidget(linkShare);
|
||||
void ShareDialog::slotAddLinkShareWidget(const QSharedPointer<LinkShare> &linkShare)
|
||||
{
|
||||
emit toggleShareLinkAnimation(true);
|
||||
const auto addedLinkShareWidget = addLinkShareWidget(linkShare);
|
||||
initLinkShareWidget();
|
||||
emit toggleAnimation(false);
|
||||
if (linkShare->isPasswordSet()) {
|
||||
addedLinkShareWidget->focusPasswordLineEdit();
|
||||
}
|
||||
emit toggleShareLinkAnimation(false);
|
||||
}
|
||||
|
||||
void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
|
||||
{
|
||||
emit toggleAnimation(true);
|
||||
emit toggleShareLinkAnimation(true);
|
||||
|
||||
const QString versionString = _accountState->account()->serverVersion();
|
||||
qCInfo(lcSharing) << versionString << "Fetched" << shares.count() << "shares";
|
||||
|
@ -225,7 +232,7 @@ void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
|
|||
}
|
||||
|
||||
initLinkShareWidget();
|
||||
emit toggleAnimation(false);
|
||||
emit toggleShareLinkAnimation(false);
|
||||
}
|
||||
|
||||
void ShareDialog::slotAdjustScrollWidgetSize()
|
||||
|
@ -327,18 +334,44 @@ void ShareDialog::slotCreateLinkShare()
|
|||
}
|
||||
}
|
||||
|
||||
void ShareDialog::slotCreatePasswordForLinkShare(const QString &password)
|
||||
{
|
||||
const auto shareLinkWidget = qobject_cast<ShareLinkWidget*>(sender());
|
||||
Q_ASSERT(shareLinkWidget);
|
||||
if (shareLinkWidget) {
|
||||
connect(_manager, &ShareManager::linkShareRequiresPassword, shareLinkWidget, &ShareLinkWidget::slotCreateShareRequiresPassword);
|
||||
connect(shareLinkWidget, &ShareLinkWidget::createPasswordProcessed, this, &ShareDialog::slotCreatePasswordForLinkShareProcessed);
|
||||
shareLinkWidget->getLinkShare()->setPassword(password);
|
||||
} else {
|
||||
qCCritical(lcSharing) << "shareLinkWidget is not a sender!";
|
||||
}
|
||||
}
|
||||
|
||||
void ShareDialog::slotCreatePasswordForLinkShareProcessed()
|
||||
{
|
||||
const auto shareLinkWidget = qobject_cast<ShareLinkWidget*>(sender());
|
||||
Q_ASSERT(shareLinkWidget);
|
||||
if (shareLinkWidget) {
|
||||
disconnect(_manager, &ShareManager::linkShareRequiresPassword, shareLinkWidget, &ShareLinkWidget::slotCreateShareRequiresPassword);
|
||||
disconnect(shareLinkWidget, &ShareLinkWidget::createPasswordProcessed, this, &ShareDialog::slotCreatePasswordForLinkShareProcessed);
|
||||
} else {
|
||||
qCCritical(lcSharing) << "shareLinkWidget is not a sender!";
|
||||
}
|
||||
}
|
||||
|
||||
void ShareDialog::slotLinkShareRequiresPassword()
|
||||
{
|
||||
bool ok = false;
|
||||
QString password = QInputDialog::getText(this,
|
||||
tr("Password for share required"),
|
||||
tr("Please enter a password for your link share:"),
|
||||
QLineEdit::Normal,
|
||||
QLineEdit::Password,
|
||||
QString(),
|
||||
&ok);
|
||||
|
||||
if (!ok) {
|
||||
// The dialog was canceled so no need to do anything
|
||||
emit toggleShareLinkAnimation(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,11 +64,13 @@ private slots:
|
|||
void slotAddLinkShareWidget(const QSharedPointer<LinkShare> &linkShare);
|
||||
void slotDeleteShare();
|
||||
void slotCreateLinkShare();
|
||||
void slotCreatePasswordForLinkShare(const QString &password);
|
||||
void slotCreatePasswordForLinkShareProcessed();
|
||||
void slotLinkShareRequiresPassword();
|
||||
void slotAdjustScrollWidgetSize();
|
||||
|
||||
signals:
|
||||
void toggleAnimation(bool);
|
||||
void toggleShareLinkAnimation(bool start);
|
||||
void styleChanged();
|
||||
|
||||
protected:
|
||||
|
@ -76,7 +78,7 @@ protected:
|
|||
|
||||
private:
|
||||
void showSharingUi();
|
||||
void addLinkShareWidget(const QSharedPointer<LinkShare> &linkShare);
|
||||
ShareLinkWidget *addLinkShareWidget(const QSharedPointer<LinkShare> &linkShare);
|
||||
void initLinkShareWidget();
|
||||
|
||||
Ui::ShareDialog *_ui;
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#include <QToolButton>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
namespace {
|
||||
const char *passwordIsSetPlaceholder = "●●●●●●●●";
|
||||
}
|
||||
|
||||
namespace OCC {
|
||||
|
||||
Q_LOGGING_CATEGORY(lcShareLink, "nextcloud.gui.sharelink", QtInfoMsg)
|
||||
|
@ -48,22 +52,21 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
|||
, _localPath(localPath)
|
||||
, _linkShare(nullptr)
|
||||
, _passwordRequired(false)
|
||||
, _noteRequired(false)
|
||||
, _expiryRequired(false)
|
||||
, _namesSupported(true)
|
||||
, _noteRequired(false)
|
||||
, _linkContextMenu(nullptr)
|
||||
, _readOnlyLinkAction(nullptr)
|
||||
, _allowEditingLinkAction(nullptr)
|
||||
, _allowUploadEditingLinkAction(nullptr)
|
||||
, _allowUploadLinkAction(nullptr)
|
||||
, _passwordProtectLinkAction(nullptr)
|
||||
, _noteLinkAction(nullptr)
|
||||
, _expirationDateLinkAction(nullptr)
|
||||
, _unshareLinkAction(nullptr)
|
||||
, _noteLinkAction(nullptr)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
|
||||
QSizePolicy sp = _ui->shareLinkToolButton->sizePolicy();
|
||||
_ui->shareLinkToolButton->hide();
|
||||
|
||||
//Is this a file or folder?
|
||||
|
@ -102,6 +105,11 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
|||
toggleNoteOptions(false);
|
||||
_ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
|
||||
|
||||
_ui->noteProgressIndicator->setVisible(false);
|
||||
_ui->passwordProgressIndicator->setVisible(false);
|
||||
_ui->expirationDateProgressIndicator->setVisible(false);
|
||||
_ui->sharelinkProgressIndicator->setVisible(false);
|
||||
|
||||
// check if the file is already inside of a synced folder
|
||||
if (sharePath.isEmpty()) {
|
||||
qCWarning(lcShareLink) << "Unable to share files not in a sync folder.";
|
||||
|
@ -114,13 +122,28 @@ ShareLinkWidget::~ShareLinkWidget()
|
|||
delete _ui;
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotToggleAnimation(bool start)
|
||||
void ShareLinkWidget::slotToggleShareLinkAnimation(bool start)
|
||||
{
|
||||
_ui->sharelinkProgressIndicator->setVisible(start);
|
||||
if (start) {
|
||||
if (!_ui->progressIndicator->isAnimated())
|
||||
_ui->progressIndicator->startAnimation();
|
||||
if (!_ui->sharelinkProgressIndicator->isAnimated()) {
|
||||
_ui->sharelinkProgressIndicator->startAnimation();
|
||||
}
|
||||
} else {
|
||||
_ui->progressIndicator->stopAnimation();
|
||||
_ui->sharelinkProgressIndicator->stopAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotToggleButtonAnimation(QToolButton *button, QProgressIndicator *progressIndicator, bool optionEnabled, bool start)
|
||||
{
|
||||
button->setVisible(optionEnabled && !start);
|
||||
progressIndicator->setVisible(start);
|
||||
if (start) {
|
||||
if (!progressIndicator->isAnimated()) {
|
||||
progressIndicator->startAnimation();
|
||||
}
|
||||
} else {
|
||||
progressIndicator->stopAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,6 +157,11 @@ QSharedPointer<LinkShare> ShareLinkWidget::getLinkShare()
|
|||
return _linkShare;
|
||||
}
|
||||
|
||||
void ShareLinkWidget::focusPasswordLineEdit()
|
||||
{
|
||||
_ui->lineEdit_password->setFocus();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::setupUiOptions()
|
||||
{
|
||||
connect(_linkShare.data(), &LinkShare::expireDateSet, this, &ShareLinkWidget::slotExpireDateSet);
|
||||
|
@ -202,14 +230,16 @@ void ShareLinkWidget::setupUiOptions()
|
|||
|
||||
if (_linkShare.data()->isPasswordSet()) {
|
||||
_passwordProtectLinkAction->setChecked(true);
|
||||
_ui->lineEdit_password->setPlaceholderText("********");
|
||||
_ui->lineEdit_password->setPlaceholderText(QString::fromUtf8(passwordIsSetPlaceholder));
|
||||
showPasswordOptions(true);
|
||||
}
|
||||
|
||||
// If password is enforced then don't allow users to disable it
|
||||
if (_account->capabilities().sharePublicLinkEnforcePassword()) {
|
||||
if (_linkShare.data()->isPasswordSet()) {
|
||||
_passwordProtectLinkAction->setChecked(true);
|
||||
_passwordProtectLinkAction->setEnabled(false);
|
||||
}
|
||||
_passwordRequired = true;
|
||||
}
|
||||
|
||||
|
@ -264,7 +294,7 @@ void ShareLinkWidget::setupUiOptions()
|
|||
void ShareLinkWidget::setNote(const QString ¬e)
|
||||
{
|
||||
if (_linkShare) {
|
||||
slotToggleAnimation(true);
|
||||
slotToggleButtonAnimation(_ui->confirmNote, _ui->noteProgressIndicator, _noteLinkAction->isChecked(), true);
|
||||
_ui->errorLabel->hide();
|
||||
_linkShare->setNote(note);
|
||||
}
|
||||
|
@ -277,7 +307,7 @@ void ShareLinkWidget::slotCreateNote()
|
|||
|
||||
void ShareLinkWidget::slotNoteSet()
|
||||
{
|
||||
slotToggleAnimation(false);
|
||||
slotToggleButtonAnimation(_ui->confirmNote, _ui->noteProgressIndicator, _noteLinkAction->isChecked(), false);
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCopyLinkShare(bool clicked)
|
||||
|
@ -289,7 +319,7 @@ void ShareLinkWidget::slotCopyLinkShare(bool clicked)
|
|||
|
||||
void ShareLinkWidget::slotExpireDateSet()
|
||||
{
|
||||
slotToggleAnimation(false);
|
||||
slotToggleButtonAnimation(_ui->confirmExpirationDate, _ui->expirationDateProgressIndicator, _expirationDateLinkAction->isChecked(), false);
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotSetExpireDate()
|
||||
|
@ -298,40 +328,54 @@ void ShareLinkWidget::slotSetExpireDate()
|
|||
return;
|
||||
}
|
||||
|
||||
slotToggleAnimation(true);
|
||||
slotToggleButtonAnimation(_ui->confirmExpirationDate, _ui->expirationDateProgressIndicator, _expirationDateLinkAction->isChecked(), true);
|
||||
_ui->errorLabel->hide();
|
||||
_linkShare->setExpireDate(_ui->calendar->date());
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCreatePassword()
|
||||
{
|
||||
if (!_linkShare) {
|
||||
if (!_linkShare || _ui->lineEdit_password->text().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
slotToggleAnimation(true);
|
||||
slotToggleButtonAnimation(_ui->confirmPassword, _ui->passwordProgressIndicator, _passwordProtectLinkAction->isChecked(), true);
|
||||
_ui->errorLabel->hide();
|
||||
_linkShare->setPassword(_ui->lineEdit_password->text());
|
||||
emit createPassword(_ui->lineEdit_password->text());
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCreateShareLink(bool clicked)
|
||||
{
|
||||
Q_UNUSED(clicked);
|
||||
slotToggleAnimation(true);
|
||||
slotToggleShareLinkAnimation(true);
|
||||
emit createLinkShare();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotPasswordSet()
|
||||
{
|
||||
slotToggleButtonAnimation(_ui->confirmPassword, _ui->passwordProgressIndicator, _passwordProtectLinkAction->isChecked(), false);
|
||||
|
||||
_ui->lineEdit_password->setText(QString());
|
||||
if (_linkShare->isPasswordSet()) {
|
||||
_ui->lineEdit_password->setPlaceholderText("********");
|
||||
_ui->lineEdit_password->setEnabled(true);
|
||||
_ui->lineEdit_password->setPlaceholderText(QString::fromUtf8(passwordIsSetPlaceholder));
|
||||
} else {
|
||||
_ui->lineEdit_password->setPlaceholderText(QString());
|
||||
}
|
||||
|
||||
slotToggleAnimation(false);
|
||||
setupUiOptions();
|
||||
|
||||
emit createPasswordProcessed();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotPasswordSetError(int code, const QString &message)
|
||||
{
|
||||
slotToggleButtonAnimation(_ui->confirmPassword, _ui->passwordProgressIndicator, _passwordProtectLinkAction->isChecked(), false);
|
||||
|
||||
slotServerError(code, message);
|
||||
showPasswordOptions(true);
|
||||
_ui->lineEdit_password->setFocus();
|
||||
emit createPasswordProcessed();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::startAnimation(const int start, const int end)
|
||||
|
@ -352,7 +396,7 @@ void ShareLinkWidget::startAnimation(const int start, const int end)
|
|||
|
||||
void ShareLinkWidget::slotDeleteShareFetched()
|
||||
{
|
||||
slotToggleAnimation(false);
|
||||
slotToggleShareLinkAnimation(false);
|
||||
|
||||
// TODO
|
||||
//startAnimation(height(), 0);
|
||||
|
@ -401,7 +445,7 @@ void ShareLinkWidget::slotDeleteAnimationFinished()
|
|||
|
||||
void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message)
|
||||
{
|
||||
slotToggleAnimation(message.isEmpty());
|
||||
slotToggleShareLinkAnimation(message.isEmpty());
|
||||
|
||||
showPasswordOptions(true);
|
||||
if (!message.isEmpty()) {
|
||||
|
@ -474,7 +518,7 @@ void ShareLinkWidget::confirmAndDeleteShare()
|
|||
connect(messageBox, &QMessageBox::finished, this,
|
||||
[messageBox, yesButton, this]() {
|
||||
if (messageBox->clickedButton() == yesButton) {
|
||||
this->slotToggleAnimation(true);
|
||||
this->slotToggleShareLinkAnimation(true);
|
||||
this->_linkShare->deleteShare();
|
||||
}
|
||||
});
|
||||
|
@ -535,18 +579,12 @@ void ShareLinkWidget::slotLinkContextMenuActionTriggered(QAction *action)
|
|||
|
||||
void ShareLinkWidget::slotServerError(int code, const QString &message)
|
||||
{
|
||||
slotToggleAnimation(false);
|
||||
slotToggleShareLinkAnimation(false);
|
||||
|
||||
qCWarning(lcSharing) << "Error from server" << code << message;
|
||||
displayError(message);
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotPasswordSetError(int code, const QString &message)
|
||||
{
|
||||
slotServerError(code, message);
|
||||
_ui->lineEdit_password->setFocus();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::displayError(const QString &errMsg)
|
||||
{
|
||||
_ui->errorLabel->setText(errMsg);
|
||||
|
@ -574,7 +612,7 @@ void ShareLinkWidget::customizeStyle()
|
|||
_ui->confirmPassword->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
|
||||
_ui->confirmExpirationDate->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
|
||||
|
||||
_ui->progressIndicator->setColor(QGuiApplication::palette().color(QPalette::Text));
|
||||
_ui->passwordProgressIndicator->setColor(QGuiApplication::palette().color(QPalette::Text));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QDialog>
|
||||
#include <QSharedPointer>
|
||||
#include <QList>
|
||||
#include <QToolButton>
|
||||
|
||||
class QMenu;
|
||||
class QTableWidgetItem;
|
||||
|
@ -59,9 +60,12 @@ public:
|
|||
void setLinkShare(QSharedPointer<LinkShare> linkShare);
|
||||
QSharedPointer<LinkShare> getLinkShare();
|
||||
|
||||
void focusPasswordLineEdit();
|
||||
|
||||
public slots:
|
||||
void slotDeleteShareFetched();
|
||||
void slotToggleAnimation(bool start);
|
||||
void slotToggleShareLinkAnimation(bool start);
|
||||
void slotToggleButtonAnimation(QToolButton *button, QProgressIndicator *progressIndicator, bool optionEnabled, bool start);
|
||||
void slotServerError(int code, const QString &message);
|
||||
void slotCreateShareRequiresPassword(const QString &message);
|
||||
void slotStyleChanged();
|
||||
|
@ -90,6 +94,8 @@ signals:
|
|||
void deleteLinkShare();
|
||||
void resizeRequested();
|
||||
void visualDeletionDone();
|
||||
void createPassword(const QString &password);
|
||||
void createPasswordProcessed();
|
||||
|
||||
private:
|
||||
void displayError(const QString &errMsg);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>365</width>
|
||||
<height>192</height>
|
||||
<height>238</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -53,7 +53,20 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressIndicator" name="progressIndicator" native="true"/>
|
||||
<widget class="QProgressIndicator" name="sharelinkProgressIndicator" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
|
@ -111,14 +124,14 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>22</number>
|
||||
</property>
|
||||
<item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="noteLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -130,20 +143,20 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Note:</string>
|
||||
<string>Note</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QTextEdit" name="textEdit_note">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -159,8 +172,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="confirmNote">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../theme.qrc">
|
||||
<normaloff>:/client/theme/confirm.svg</normaloff>:/client/theme/confirm.svg</iconset>
|
||||
|
@ -170,14 +189,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="2">
|
||||
<widget class="QProgressIndicator" name="noteProgressIndicator" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -189,17 +220,17 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
<string>Set password</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_password">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
|
@ -212,8 +243,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="confirmPassword">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../theme.qrc">
|
||||
<normaloff>:/client/theme/confirm.svg</normaloff>:/client/theme/confirm.svg</iconset>
|
||||
|
@ -223,14 +260,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="1" column="2">
|
||||
<widget class="QProgressIndicator" name="passwordProgressIndicator" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="expirationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -242,17 +291,17 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Expires:</string>
|
||||
<string>Expires</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDateEdit" name="calendar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
|
@ -262,8 +311,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="confirmExpirationDate">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../theme.qrc">
|
||||
<normaloff>:/client/theme/confirm.svg</normaloff>:/client/theme/confirm.svg</iconset>
|
||||
|
@ -273,8 +328,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QProgressIndicator" name="expirationDateProgressIndicator" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="palette">
|
||||
|
@ -326,6 +399,8 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -302,7 +302,7 @@ void UserGroupShare::setNote(const QString ¬e)
|
|||
{
|
||||
auto *job = new OcsShareJob(_account);
|
||||
connect(job, &OcsShareJob::shareJobFinished, this, &UserGroupShare::slotNoteSet);
|
||||
connect(job, &OcsJob::ocsError, this, &UserGroupShare::slotOcsError);
|
||||
connect(job, &OcsJob::ocsError, this, &UserGroupShare::noteSetError);
|
||||
job->setNote(getId(), note);
|
||||
}
|
||||
|
||||
|
|
|
@ -288,6 +288,7 @@ public:
|
|||
|
||||
signals:
|
||||
void noteSet();
|
||||
void noteSetError();
|
||||
void expireDateSet();
|
||||
|
||||
private:
|
||||
|
|
|
@ -451,6 +451,7 @@ ShareUserLine::ShareUserLine(QSharedPointer<UserGroupShare> share,
|
|||
connect(_ui->calendar, &QDateTimeEdit::dateChanged, this, &ShareUserLine::setExpireDate);
|
||||
|
||||
connect(_share.data(), &UserGroupShare::noteSet, this, &ShareUserLine::disableProgessIndicatorAnimation);
|
||||
connect(_share.data(), &UserGroupShare::noteSetError, this, &ShareUserLine::disableProgessIndicatorAnimation);
|
||||
connect(_share.data(), &UserGroupShare::expireDateSet, this, &ShareUserLine::disableProgessIndicatorAnimation);
|
||||
|
||||
// create menu with checkable permissions
|
||||
|
|
Loading…
Reference in a new issue