mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Account Capabilities: style fixup
- Remove the copy constructor. The default constructor is fine. Having a user defined copy constructor inhibit the move constructor. - Pass QVariantMap arguments via const references - Do not return a pointer to Capabilities from the account. It is a value type and should not be used by pointer.
This commit is contained in:
parent
0642e63246
commit
07ddf18b3b
5 changed files with 9 additions and 14 deletions
|
@ -147,15 +147,15 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
|
|||
// Parse capabilities
|
||||
|
||||
// If password is enforced make don't allow users to disable it
|
||||
if (_account->capabilities()->publicLinkEnforcePassword()) {
|
||||
if (_account->capabilities().publicLinkEnforcePassword()) {
|
||||
_ui->checkBox_password->setEnabled(false);
|
||||
}
|
||||
|
||||
// If expiredate is enforced do not allow disable and set max days
|
||||
if (_account->capabilities()->publicLinkEnforceExpireDate()) {
|
||||
if (_account->capabilities().publicLinkEnforceExpireDate()) {
|
||||
_ui->checkBox_expire->setEnabled(false);
|
||||
_ui->calendar->setMaximumDate(QDate::currentDate().addDays(
|
||||
_account->capabilities()->publicLinkExpireDateDays()
|
||||
_account->capabilities().publicLinkExpireDateDays()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -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().publicLinkEnforcePassword()) {
|
||||
_ui->checkBox_password->setChecked(true);
|
||||
_ui->checkBox_password->setEnabled(false);
|
||||
_ui->checkBox_password->setText(tr("Public shå requires a password"));
|
||||
|
|
|
@ -440,9 +440,9 @@ void Account::setMigrated(bool mig)
|
|||
_wasMigrated = mig;
|
||||
}
|
||||
|
||||
const Capabilities * Account::capabilities() const
|
||||
const Capabilities &Account::capabilities() const
|
||||
{
|
||||
return &_capabilities;
|
||||
return _capabilities;
|
||||
}
|
||||
|
||||
void Account::setCapabilities(const QVariantMap &caps)
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
void setCertificate(const QByteArray certficate = QByteArray(), const QString privateKey = QString());
|
||||
|
||||
void setCapabilities(const QVariantMap &caps);
|
||||
const Capabilities * capabilities() const;
|
||||
const Capabilities &capabilities() const;
|
||||
void setServerVersion(const QString &version);
|
||||
QString serverVersion();
|
||||
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
namespace OCC {
|
||||
|
||||
|
||||
Capabilities::Capabilities(const Capabilities &capabilities) {
|
||||
_capabilities = capabilities._capabilities;
|
||||
}
|
||||
|
||||
Capabilities::Capabilities(const QVariantMap capabilities)
|
||||
Capabilities::Capabilities(const QVariantMap &capabilities)
|
||||
: _capabilities(capabilities)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@ namespace OCC {
|
|||
class Capabilities {
|
||||
|
||||
public:
|
||||
Capabilities(const Capabilities& capabilities);
|
||||
Capabilities(const QVariantMap capabilities);
|
||||
Capabilities(const QVariantMap &capabilities);
|
||||
|
||||
bool publicLinkEnforcePassword() const;
|
||||
bool publicLinkEnforceExpireDate() const;
|
||||
|
|
Loading…
Reference in a new issue