Fixed QStrings not being passed by ref

This commit is contained in:
Albert Vaca 2016-11-26 16:09:40 +01:00
parent beeae63086
commit b7bb8d94c5
3 changed files with 7 additions and 7 deletions

View file

@ -52,7 +52,7 @@ public:
FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 size, const QUrl &destination);
void start() override;
QUrl destination() const { return mDestination; }
void setOriginName(QString from) { mFrom = from; }
void setOriginName(const QString& from) { mFrom = from; }
private Q_SLOTS:
void doStart();

View file

@ -156,7 +156,7 @@ QString KdeConnectConfig::name()
return name;
}
void KdeConnectConfig::setName(QString name)
void KdeConnectConfig::setName(const QString& name)
{
d->config->setValue(QStringLiteral("name"), name);
d->config->sync();
@ -243,7 +243,7 @@ void KdeConnectConfig::removeTrustedDevice(const QString &deviceId)
}
// Utility functions to set and get a value
void KdeConnectConfig::setDeviceProperty(QString deviceId, QString key, QString value)
void KdeConnectConfig::setDeviceProperty(const QString& deviceId, const QString& key, const QString& value)
{
d->trusted_devices->beginGroup(deviceId);
d->trusted_devices->setValue(key, value);
@ -251,7 +251,7 @@ void KdeConnectConfig::setDeviceProperty(QString deviceId, QString key, QString
d->trusted_devices->sync();
}
QString KdeConnectConfig::getDeviceProperty(QString deviceId, QString key, QString defaultValue)
QString KdeConnectConfig::getDeviceProperty(const QString& deviceId, const QString& key, const QString& defaultValue)
{
QString value;
d->trusted_devices->beginGroup(deviceId);

View file

@ -56,7 +56,7 @@ public:
QString certificatePath();
QSslCertificate certificate();
void setName(QString name);
void setName(const QString& name);
/*
* Trusted devices
@ -67,8 +67,8 @@ public:
void addTrustedDevice(const QString &id, const QString &name, const QString &type);
KdeConnectConfig::DeviceInfo getTrustedDevice(const QString &id);
void setDeviceProperty(QString deviceId, QString name, QString value);
QString getDeviceProperty(QString deviceId, QString name, QString defaultValue = QString());
void setDeviceProperty(const QString& deviceId, const QString& name, const QString& value);
QString getDeviceProperty(const QString& deviceId, const QString& name, const QString& defaultValue = QString());
/*
* Paths for config files, there is no guarantee the directories already exist