Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 30c028b6 authored by Àlex Fiestas's avatar Àlex Fiestas

Added const all around

parent f314420d
......@@ -49,7 +49,7 @@ NetworkPackage::NetworkPackage(const QString& type)
void NetworkPackage::createIdentityPackage(NetworkPackage* np)
{
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
QString id = config->group("myself").readEntry<QString>("id","");
const QString id = config->group("myself").readEntry<QString>("id","");
np->mId = QString::number(QDateTime::currentMSecsSinceEpoch());
np->mType = PACKAGE_TYPE_IDENTITY;
np->mPayload = QSharedPointer<QIODevice>();
......@@ -130,9 +130,9 @@ void NetworkPackage::encrypt(QCA::PublicKey& key)
QStringList chunks;
while (!serialized.isEmpty()) {
QByteArray chunk = serialized.left(chunkSize);
const QByteArray chunk = serialized.left(chunkSize);
serialized = serialized.mid(chunkSize);
QByteArray encryptedChunk = key.encrypt(chunk, NetworkPackage::EncryptionAlgorithm).toByteArray();
const QByteArray encryptedChunk = key.encrypt(chunk, NetworkPackage::EncryptionAlgorithm).toByteArray();
chunks.append( encryptedChunk.toBase64() );
}
......@@ -152,7 +152,7 @@ bool NetworkPackage::decrypt(QCA::PrivateKey& key, NetworkPackage* out) const
QByteArray decryptedJson;
Q_FOREACH(const QString& chunk, chunks) {
QByteArray encryptedChunk = QByteArray::fromBase64(chunk.toAscii());
const QByteArray encryptedChunk = QByteArray::fromBase64(chunk.toAscii());
QCA::SecureArray decryptedChunk;
bool success = key.decrypt(encryptedChunk, &decryptedChunk, NetworkPackage::EncryptionAlgorithm);
if (!success) {
......
......@@ -37,12 +37,12 @@ TelephonyPlugin::TelephonyPlugin(QObject *parent, const QVariantList &args)
KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
{
QString event = np.get<QString>("event");
QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown number"));
const QString event = np.get<QString>("event");
const QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown number"));
QString title, content, type, icon;
QString content, type, icon;
title = device()->name();
const QString title = device()->name();
if (event == "ringing") {
type = "callReceived";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment