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:
Olivier Goffart 2015-07-29 12:05:00 +02:00
parent 0642e63246
commit 07ddf18b3b
5 changed files with 9 additions and 14 deletions

View file

@ -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&aring requires a password"));

View file

@ -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)

View file

@ -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();

View file

@ -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)
{
}

View file

@ -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;