diff options
author | Christian Kamm <mail@ckamm.de> | 2017-12-13 15:29:06 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2017-12-14 10:34:44 +0300 |
commit | f40cceaf04e8ca8f7b2f1eb4ec23c3d043a8951c (patch) | |
tree | b117ffa865cdfdaa65a1b13130618d660616f7cb /src/gui/sharelinkwidget.cpp | |
parent | 8a963a67f25fe9226d8700ceaf119e2010c8738c (diff) |
Share link: Adjust design of folder sharing permissions #6192
Diffstat (limited to 'src/gui/sharelinkwidget.cpp')
-rw-r--r-- | src/gui/sharelinkwidget.cpp | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 3742db309..7838e04b5 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -81,8 +81,9 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, connect(_ui->pushButton_setPassword, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPasswordReturnPressed); connect(_ui->checkBox_expire, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCheckBoxExpireClicked); connect(_ui->calendar, &QDateTimeEdit::dateChanged, this, &ShareLinkWidget::slotExpireDateChanged); - connect(_ui->checkBox_editing, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsCheckboxClicked); - connect(_ui->checkBox_fileListing, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsCheckboxClicked); + connect(_ui->radio_readOnly, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsClicked); + connect(_ui->radio_readWrite, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsClicked); + connect(_ui->radio_uploadOnly, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsClicked); _ui->errorLabel->hide(); @@ -149,7 +150,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, // File can't have public upload set; we also hide it if the capability isn't there _ui->widget_editing->setVisible( !_isFile && _account->capabilities().sharePublicLinkAllowUpload()); - _ui->checkBox_fileListing->setVisible( + _ui->radio_uploadOnly->setVisible( _account->capabilities().sharePublicLinkSupportsUploadOnly()); @@ -282,7 +283,9 @@ void ShareLinkWidget::slotShareSelectionChanged() auto share = selectedShare(); if (!share) { _ui->shareProperties->setEnabled(false); - _ui->checkBox_editing->setChecked(false); + _ui->radio_readOnly->setChecked(false); + _ui->radio_readWrite->setChecked(false); + _ui->radio_uploadOnly->setChecked(false); _ui->checkBox_expire->setChecked(false); _ui->checkBox_password->setChecked(false); return; @@ -292,8 +295,11 @@ void ShareLinkWidget::slotShareSelectionChanged() _ui->checkBox_password->setEnabled(!_passwordRequired); _ui->checkBox_expire->setEnabled(!_expiryRequired); - _ui->checkBox_editing->setEnabled( - _account->capabilities().sharePublicLinkAllowUpload()); + _ui->widget_editing->setEnabled(true); + if (!_account->capabilities().sharePublicLinkAllowUpload()) { + _ui->radio_readWrite->setEnabled(false); + _ui->radio_uploadOnly->setEnabled(false); + } // Password state _ui->checkBox_password->setText(tr("P&assword protect")); @@ -324,9 +330,15 @@ void ShareLinkWidget::slotShareSelectionChanged() // Public upload state (box is hidden for files) if (!_isFile) { - _ui->checkBox_editing->setChecked(share->getPublicUpload()); - _ui->checkBox_fileListing->setChecked(share->getShowFileListing()); - _ui->checkBox_fileListing->setEnabled(share->getPublicUpload()); + if (share->getPublicUpload()) { + if (share->getShowFileListing()) { + _ui->radio_readWrite->setChecked(true); + } else { + _ui->radio_uploadOnly->setChecked(true); + } + } else { + _ui->radio_readOnly->setChecked(true); + } } } @@ -456,7 +468,7 @@ void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message) _ui->checkBox_password->setEnabled(false); _ui->checkBox_password->setText(tr("Public shå requires a password")); _ui->checkBox_expire->setEnabled(false); - _ui->checkBox_editing->setEnabled(false); + _ui->widget_editing->setEnabled(false); if (!message.isEmpty()) { _ui->errorLabel->setText(message); _ui->errorLabel->show(); @@ -579,19 +591,18 @@ void ShareLinkWidget::slotDeleteShareClicked() confirmAndDeleteShare(share); } -void ShareLinkWidget::slotPermissionsCheckboxClicked() +void ShareLinkWidget::slotPermissionsClicked() { if (auto current = selectedShare()) { - _ui->checkBox_editing->setEnabled(false); - _ui->checkBox_fileListing->setEnabled(false); + _ui->widget_editing->setEnabled(false); _pi_editing->startAnimation(); _ui->errorLabel->hide(); SharePermissions perm = SharePermissionRead; - if (_ui->checkBox_editing->isChecked() && _ui->checkBox_fileListing->isChecked()) { + if (_ui->radio_readWrite->isChecked()) { perm = SharePermissionRead | SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete; - } else if (_ui->checkBox_editing->isChecked() && !_ui->checkBox_fileListing->isChecked()) { + } else if (_ui->radio_uploadOnly->isChecked()) { perm = SharePermissionCreate; } current->setPermissions(perm); |