mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Extended capabilities API
* Naming of capabilities is now a bit more consistent
This commit is contained in:
parent
225da68832
commit
4a7242c8f9
3 changed files with 33 additions and 10 deletions
|
@ -143,15 +143,15 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
|
|||
// Parse capabilities
|
||||
|
||||
// If password is enforced then don't allow users to disable it
|
||||
if (_account->capabilities().publicLinkEnforcePassword()) {
|
||||
if (_account->capabilities().sharePublicLinkEnforcePassword()) {
|
||||
_ui->checkBox_password->setEnabled(false);
|
||||
}
|
||||
|
||||
// If expiredate is enforced do not allow disable and set max days
|
||||
if (_account->capabilities().publicLinkEnforceExpireDate()) {
|
||||
if (_account->capabilities().sharePublicLinkEnforceExpireDate()) {
|
||||
_ui->checkBox_expire->setEnabled(false);
|
||||
_ui->calendar->setMaximumDate(QDate::currentDate().addDays(
|
||||
_account->capabilities().publicLinkExpireDateDays()
|
||||
_account->capabilities().sharePublicLinkExpireDateDays()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void ShareDialog::slotCheckBoxShareLinkClicked()
|
|||
* Check the capabilities if the server requires a password for a share
|
||||
* Ask for it directly
|
||||
*/
|
||||
if (_account->capabilities().publicLinkEnforcePassword()) {
|
||||
if (_account->capabilities().sharePublicLinkEnforcePassword()) {
|
||||
_pi_link->stopAnimation();
|
||||
_ui->checkBox_password->setChecked(true);
|
||||
_ui->checkBox_password->setEnabled(false);
|
||||
|
|
|
@ -23,21 +23,41 @@ Capabilities::Capabilities(const QVariantMap &capabilities)
|
|||
{
|
||||
}
|
||||
|
||||
bool Capabilities::publicLinkEnforcePassword() const
|
||||
bool Capabilities::shareAPI() const
|
||||
{
|
||||
if (_capabilities["files_sharing"].toMap().contains("api_enabled")) {
|
||||
return _capabilities["files_sharing"].toMap()["api_enabled"].toBool();
|
||||
} else {
|
||||
// This was later added so if it is not present just assume the API is enabled.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Capabilities::sharePublicLink() const
|
||||
{
|
||||
return _capabilities["files_sharing"].toMap()["public"].toMap()["enabled"].toBool();
|
||||
}
|
||||
|
||||
bool Capabilities::sharePublicLinkEnforcePassword() const
|
||||
{
|
||||
return _capabilities["files_sharing"].toMap()["public"].toMap()["password"].toMap()["enforced"].toBool();
|
||||
}
|
||||
|
||||
bool Capabilities::publicLinkEnforceExpireDate() const
|
||||
bool Capabilities::sharePublicLinkEnforceExpireDate() const
|
||||
{
|
||||
return _capabilities["files_sharing"].toMap()["public"].toMap()["expire_date"].toMap()["enforced"].toBool();
|
||||
}
|
||||
|
||||
int Capabilities::publicLinkExpireDateDays() const
|
||||
int Capabilities::sharePublicLinkExpireDateDays() const
|
||||
{
|
||||
return _capabilities["files_sharing"].toMap()["public"].toMap()["expire_date"].toMap()["days"].toInt();
|
||||
}
|
||||
|
||||
bool Capabilities::shareResharing() const
|
||||
{
|
||||
return _capabilities["files_sharing"].toMap()["resharing"].toBool();
|
||||
}
|
||||
|
||||
QStringList Capabilities::supportedChecksumTypes() const
|
||||
{
|
||||
return QStringList();
|
||||
|
|
|
@ -32,9 +32,12 @@ class OWNCLOUDSYNC_EXPORT Capabilities {
|
|||
public:
|
||||
Capabilities(const QVariantMap &capabilities);
|
||||
|
||||
bool publicLinkEnforcePassword() const;
|
||||
bool publicLinkEnforceExpireDate() const;
|
||||
int publicLinkExpireDateDays() const;
|
||||
bool shareAPI() const;
|
||||
bool sharePublicLink() const;
|
||||
bool sharePublicLinkEnforcePassword() const;
|
||||
bool sharePublicLinkEnforceExpireDate() const;
|
||||
int sharePublicLinkExpireDateDays() const;
|
||||
bool shareResharing() const;
|
||||
QStringList supportedChecksumTypes() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue