From: alex-z Date: Tue, 2 Nov 2021 09:01:00 +0000 (+0200) Subject: ShareLinkWidget. Fix incorrect calendar mindate. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~18^2~123^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d88e086b947bdba914618364cf912beb15906770;p=nextcloud-desktop.git ShareLinkWidget. Fix incorrect calendar mindate. Signed-off-by: alex-z --- diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index b80cf08a5..f0ea3c615 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -516,7 +516,9 @@ void ShareLinkWidget::toggleExpireDateOptions(const bool enable) const auto date = enable ? _linkShare->getExpireDate() : QDate::currentDate().addDays(1); _ui->calendar->setDate(date); - _ui->calendar->setMinimumDate(date); + _ui->calendar->setMinimumDate(QDate::currentDate().addDays(1)); + _ui->calendar->setMaximumDate( + QDate::currentDate().addDays(_account->capabilities().sharePublicLinkExpireDateDays())); _ui->calendar->setFocus(); if (!enable && _linkShare && _linkShare->getExpireDate().isValid()) { diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp index afebb981f..154bcbec3 100644 --- a/src/gui/sharemanager.cpp +++ b/src/gui/sharemanager.cpp @@ -146,7 +146,7 @@ void Share::deleteShare() job->deleteShare(getId()); } -bool Share::isUserGroupShare(const ShareType type) +bool Share::isShareTypeUserGroupEmailRoomOrRemote(const ShareType type) { return (type == Share::TypeUser || type == Share::TypeGroup || type == Share::TypeEmail || type == Share::TypeRoom || type == Share::TypeRemote); @@ -323,7 +323,7 @@ UserGroupShare::UserGroupShare(AccountPtr account, , _note(note) , _expireDate(expireDate) { - Q_ASSERT(Share::isUserGroupShare(shareType)); + Q_ASSERT(Share::isShareTypeUserGroupEmailRoomOrRemote(shareType)); Q_ASSERT(shareWith); } @@ -493,7 +493,7 @@ void ShareManager::slotSharesFetched(const QJsonDocument &reply) if (shareType == Share::TypeLink) { newShare = parseLinkShare(data); - } else if (Share::isUserGroupShare(static_cast (shareType))) { + } else if (Share::isShareTypeUserGroupEmailRoomOrRemote(static_cast (shareType))) { newShare = parseUserGroupShare(data); } else { newShare = parseShare(data); diff --git a/src/gui/sharemanager.h b/src/gui/sharemanager.h index 06e53c026..a69ec449d 100644 --- a/src/gui/sharemanager.h +++ b/src/gui/sharemanager.h @@ -133,7 +133,7 @@ public: /* * Is it a share with a user or group (local or remote) */ - static bool isUserGroupShare(const ShareType type); + static bool isShareTypeUserGroupEmailRoomOrRemote(const ShareType type); signals: void permissionsSet(); diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 4b463ad70..0c37c4565 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -249,7 +249,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList> } - Q_ASSERT(Share::isUserGroupShare(share->getShareType())); + Q_ASSERT(Share::isShareTypeUserGroupEmailRoomOrRemote(share->getShareType())); auto userGroupShare = qSharedPointerDynamicCast(share); auto *s = new ShareUserLine(_account, userGroupShare, _maxSharingPermissions, _isFile, _parentScrollArea); connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize); @@ -1102,9 +1102,9 @@ bool ShareUserLine::enforceExpirationDateForShare(const Share::ShareType type) c return _account->capabilities().shareRemoteEnforceExpireDate(); } else if (type == Share::ShareType::TypeEmail) { return _account->capabilities().sharePublicLinkEnforceExpireDate(); - } else { - return _account->capabilities().shareInternalEnforceExpireDate(); } + + return _account->capabilities().shareInternalEnforceExpireDate(); } void ShareUserLine::setPasswordConfirmed()