summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-10-23 23:00:28 +0200
committerMontel Laurent <[email protected]>2017-10-23 23:00:28 +0200
commitb968a16a8a59b2adba6cb36635fe8debf8abca84 (patch)
tree99c93f4cf2fa4b23f5c68840ba74c1db486f5517
parent8e36fc8af2cdd1ab2a80f4cb52bccfdf71efd32c (diff)
Const'ify
-rw-r--r--resources/tomboynotes/o2/o0baseauth.cpp14
-rw-r--r--resources/tomboynotes/o2/o0baseauth.h8
-rw-r--r--resources/tomboynotes/o2/o2.cpp8
-rw-r--r--resources/tomboynotes/o2/o2.h2
-rw-r--r--resources/tomboynotes/o2/o2replyserver.cpp2
-rw-r--r--resources/tomboynotes/o2/o2simplecrypt.cpp14
6 files changed, 24 insertions, 24 deletions
diff --git a/resources/tomboynotes/o2/o0baseauth.cpp b/resources/tomboynotes/o2/o0baseauth.cpp
index 79ea0ac..fc47516 100644
--- a/resources/tomboynotes/o2/o0baseauth.cpp
+++ b/resources/tomboynotes/o2/o0baseauth.cpp
@@ -48,20 +48,20 @@ void O0BaseAuth::setLinked(bool v)
QString O0BaseAuth::tokenSecret()
{
- QString key = QString::fromLatin1(O2_KEY_TOKEN_SECRET).arg(clientId_);
+ const QString key = QString::fromLatin1(O2_KEY_TOKEN_SECRET).arg(clientId_);
return store_->value(key);
}
void O0BaseAuth::setTokenSecret(const QString &v)
{
- QString key = QString::fromLatin1(O2_KEY_TOKEN_SECRET).arg(clientId_);
+ const QString key = QString::fromLatin1(O2_KEY_TOKEN_SECRET).arg(clientId_);
store_->setValue(key, v);
Q_EMIT tokenSecretChanged();
}
-QString O0BaseAuth::token()
+QString O0BaseAuth::token() const
{
- QString key = QString::fromLatin1(O2_KEY_TOKEN).arg(clientId_);
+ const QString key = QString::fromLatin1(O2_KEY_TOKEN).arg(clientId_);
return store_->value(key);
}
@@ -72,7 +72,7 @@ void O0BaseAuth::setToken(const QString &v)
Q_EMIT tokenChanged();
}
-QString O0BaseAuth::clientId()
+QString O0BaseAuth::clientId() const
{
return clientId_;
}
@@ -83,7 +83,7 @@ void O0BaseAuth::setClientId(const QString &value)
Q_EMIT clientIdChanged();
}
-QString O0BaseAuth::clientSecret()
+QString O0BaseAuth::clientSecret() const
{
return clientSecret_;
}
@@ -94,7 +94,7 @@ void O0BaseAuth::setClientSecret(const QString &value)
Q_EMIT clientSecretChanged();
}
-int O0BaseAuth::localPort()
+int O0BaseAuth::localPort() const
{
return localPort_;
}
diff --git a/resources/tomboynotes/o2/o0baseauth.h b/resources/tomboynotes/o2/o0baseauth.h
index f6ba4e6..ca6bb90 100644
--- a/resources/tomboynotes/o2/o0baseauth.h
+++ b/resources/tomboynotes/o2/o0baseauth.h
@@ -25,7 +25,7 @@ public:
/// Authentication token.
Q_PROPERTY(QString token READ token NOTIFY tokenChanged)
- QString token();
+ QString token() const;
/// Authentication token secret.
Q_PROPERTY(QString tokenSecret READ tokenSecret NOTIFY tokenSecretChanged)
@@ -38,20 +38,20 @@ public:
/// Client application ID.
/// O1 instances with the same (client ID, client secret) share the same "linked", "token" and "tokenSecret" properties.
Q_PROPERTY(QString clientId READ clientId WRITE setClientId NOTIFY clientIdChanged)
- QString clientId();
+ QString clientId() const;
void setClientId(const QString &value);
/// Client application secret.
/// O1 instances with the same (client ID, client secret) share the same "linked", "token" and "tokenSecret" properties.
Q_PROPERTY(QString clientSecret READ clientSecret WRITE setClientSecret NOTIFY clientSecretChanged)
- QString clientSecret();
+ QString clientSecret() const;
void setClientSecret(const QString &value);
/// TCP port number to use in local redirections.
/// The OAuth "redirect_uri" will be set to "http://localhost:<localPort>/".
/// If localPort is set to 0 (default), O2 will replace it with a free one.
Q_PROPERTY(int localPort READ localPort WRITE setLocalPort NOTIFY localPortChanged)
- int localPort();
+ int localPort() const;
void setLocalPort(int value);
/// Sets the storage object to use for storing the OAuth tokens on a peristent medium
diff --git a/resources/tomboynotes/o2/o2.cpp b/resources/tomboynotes/o2/o2.cpp
index 300b348..3c18cb3 100644
--- a/resources/tomboynotes/o2/o2.cpp
+++ b/resources/tomboynotes/o2/o2.cpp
@@ -87,7 +87,7 @@ void O2::setGrantFlow(O2::GrantFlow value)
Q_EMIT grantFlowChanged();
}
-QString O2::username()
+QString O2::username() const
{
return username_;
}
@@ -333,19 +333,19 @@ QByteArray O2::buildRequestBody(const QMap<QString, QString> &parameters)
int O2::expires()
{
- QString key = QString(O2_KEY_EXPIRES).arg(clientId_);
+ const QString key = QString(O2_KEY_EXPIRES).arg(clientId_);
return store_->value(key).toInt();
}
void O2::setExpires(int v)
{
- QString key = QString(O2_KEY_EXPIRES).arg(clientId_);
+ const QString key = QString(O2_KEY_EXPIRES).arg(clientId_);
store_->setValue(key, QString::number(v));
}
QString O2::refreshToken()
{
- QString key = QString(O2_KEY_REFRESH_TOKEN).arg(clientId_);
+ const QString key = QString(O2_KEY_REFRESH_TOKEN).arg(clientId_);
return store_->value(key);
}
diff --git a/resources/tomboynotes/o2/o2.h b/resources/tomboynotes/o2/o2.h
index 6b8e244..49aa3f4 100644
--- a/resources/tomboynotes/o2/o2.h
+++ b/resources/tomboynotes/o2/o2.h
@@ -32,7 +32,7 @@ public:
/// Resource owner username.
/// O2 instances with the same (username, password) share the same "linked" and "token" properties.
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
- QString username();
+ QString username() const;
void setUsername(const QString &value);
/// Resource owner password.
diff --git a/resources/tomboynotes/o2/o2replyserver.cpp b/resources/tomboynotes/o2/o2replyserver.cpp
index 141d38d..2d3eb58 100644
--- a/resources/tomboynotes/o2/o2replyserver.cpp
+++ b/resources/tomboynotes/o2/o2replyserver.cpp
@@ -15,7 +15,7 @@
O2ReplyServer::O2ReplyServer(QObject *parent): QTcpServer(parent)
{
connect(this, &QTcpServer::newConnection, this, &O2ReplyServer::onIncomingConnection);
- replyContent_ = "<HTML></HTML>";
+ replyContent_ = QByteArrayLiteral("<HTML></HTML>");
}
void O2ReplyServer::onIncomingConnection()
diff --git a/resources/tomboynotes/o2/o2simplecrypt.cpp b/resources/tomboynotes/o2/o2simplecrypt.cpp
index 9602a38..4de0f42 100644
--- a/resources/tomboynotes/o2/o2simplecrypt.cpp
+++ b/resources/tomboynotes/o2/o2simplecrypt.cpp
@@ -151,25 +151,25 @@ QString O0SimpleCrypt::encryptToString(const QByteArray &plaintext)
QString O0SimpleCrypt::decryptToString(const QString &cyphertext)
{
- QByteArray cyphertextArray = QByteArray::fromBase64(cyphertext.toLatin1());
- QByteArray plaintextArray = decryptToByteArray(cyphertextArray);
- QString plaintext = QString::fromUtf8(plaintextArray.constData(), plaintextArray.size());
+ const QByteArray cyphertextArray = QByteArray::fromBase64(cyphertext.toLatin1());
+ const QByteArray plaintextArray = decryptToByteArray(cyphertextArray);
+ const QString plaintext = QString::fromUtf8(plaintextArray.constData(), plaintextArray.size());
return plaintext;
}
QString O0SimpleCrypt::decryptToString(const QByteArray &cypher)
{
- QByteArray ba = decryptToByteArray(cypher);
- QString plaintext = QString::fromUtf8(ba.constData(), ba.size());
+ const QByteArray ba = decryptToByteArray(cypher);
+ const QString plaintext = QString::fromUtf8(ba.constData(), ba.size());
return plaintext;
}
QByteArray O0SimpleCrypt::decryptToByteArray(const QString &cyphertext)
{
- QByteArray cyphertextArray = QByteArray::fromBase64(cyphertext.toLatin1());
- QByteArray ba = decryptToByteArray(cyphertextArray);
+ const QByteArray cyphertextArray = QByteArray::fromBase64(cyphertext.toLatin1());
+ const QByteArray ba = decryptToByteArray(cyphertextArray);
return ba;
}