Commit dd0f5cd5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent 5d993a64
......@@ -175,7 +175,7 @@ QVariant AccountsModel::data(const QModelIndex& index, int role) const
break;
case IconNameRole:
{
QString iconName = QString::fromLatin1("user-identity");
QString iconName = QStringLiteral("user-identity");
if (account->provider().isValid() && !account->provider().iconName().isEmpty()) {
iconName = account->provider().iconName();
}
......
......@@ -120,7 +120,7 @@ void CreateAccountJob::pluginFinished(const QString &screenName, const QString &
info.setUserName(screenName);
info.setSecret(secret, true);
info.setCaption(m_providerName);
info.setAccessControlList(QStringList(QLatin1String("*")));
info.setAccessControlList(QStringList(QStringLiteral("*")));
info.setType(SignOn::IdentityInfo::Application);
const auto keys = data.keys();
......
......@@ -26,6 +26,8 @@
#include <SignOn/Identity>
#include <KLocalizedString>
#include <QDebug>
#include <QTimer>
......@@ -61,7 +63,7 @@ void GetCredentialsJob::Private::getCredentials()
} else {
qDebug() << repeatedTries << "ending with error";
q->setError(KJob::UserDefinedError);
q->setErrorText(QLatin1String("Could not find account"));
q->setErrorText(i18n("Could not find account"));
q->emitResult();
}
return;
......@@ -76,17 +78,17 @@ void GetCredentialsJob::Private::getCredentials()
if (!identity) {
qWarning() << "Unable to find identity for account id" << id;
q->setError(KJob::UserDefinedError);
q->setErrorText(QLatin1String("Could not find credentials"));
q->setErrorText(i18n("Could not find credentials"));
q->emitResult();
return;
}
authData[QStringLiteral("AccountUsername")] = acc->value(QLatin1String("username")).toString();
authData[QStringLiteral("AccountUsername")] = acc->value(QStringLiteral("username")).toString();
QPointer<SignOn::AuthSession> authSession = identity->createSession(authMethod.isEmpty() ? serviceAuthData.method() : authMethod);
if (!authSession) {
qWarning() << "Unable to create auth session for" << authMethod << serviceAuthData.method();
q->setError(KJob::UserDefinedError);
q->setErrorText(QLatin1String("Could not create auth session"));
q->setErrorText(i18n("Could not create auth session"));
q->emitResult();
return;
}
......@@ -108,7 +110,7 @@ void GetCredentialsJob::Private::getCredentials()
authSession->process(serviceAuthData.parameters(), authMechanism.isEmpty() ? serviceAuthData.mechanism() : authMechanism);
}
GetCredentialsJob::GetCredentialsJob(const Accounts::AccountId &id, QObject *parent)
GetCredentialsJob::GetCredentialsJob(Accounts::AccountId id, QObject *parent)
: KJob(parent)
, d(new Private(this))
{
......@@ -119,7 +121,7 @@ GetCredentialsJob::GetCredentialsJob(const Accounts::AccountId &id, QObject *par
}
GetCredentialsJob::GetCredentialsJob(const Accounts::AccountId &id, const QString &authMethod, const QString &authMechanism, QObject *parent)
GetCredentialsJob::GetCredentialsJob(Accounts::AccountId id, const QString &authMethod, const QString &authMechanism, QObject *parent)
: KJob(parent)
, d(new Private(this))
{
......
......@@ -42,7 +42,7 @@ public:
*
* @param id AccountId for which the credentials will be obtained
*/
explicit GetCredentialsJob(const Accounts::AccountId &id, QObject *parent = nullptr);
explicit GetCredentialsJob(Accounts::AccountId id, QObject *parent = nullptr);
/**
* This version of the constructor allow passing specific auth method and mechanism
* for which we want the credentials
......@@ -57,7 +57,7 @@ public:
* @param authMethod Auth method for which the credentials will be obtained
* @param authMechanism Auth mechanism for which the credentials will be obtained
*/
GetCredentialsJob(const Accounts::AccountId &id, const QString &authMethod = QString(), const QString &authMechanism = QString(), QObject *parent = nullptr);
GetCredentialsJob(Accounts::AccountId id, const QString &authMethod = QString(), const QString &authMechanism = QString(), QObject *parent = nullptr);
~GetCredentialsJob();
/**
......
......@@ -107,7 +107,7 @@ QVariant ProvidersModel::data(const QModelIndex& index, int role) const
break;
}
default:
data.setValue(QString::fromLatin1("No such role: %1").arg(role));
data.setValue(QStringLiteral("No such role: %1").arg(role));
break;
}
}
......
......@@ -135,7 +135,7 @@ void ServicesModel::setAccount(QObject* account)
connect(d->account, &Accounts::Account::displayNameChanged, this, &ServicesModel::accountChanged);
connect(d->account, &Accounts::Account::enabledChanged, this, [this](const QString& serviceName, bool /*enabled*/){
int i{0};
for (const Accounts::Service& service : d->services) {
for (const Accounts::Service& service : qAsConst(d->services)) {
if (service.name() == serviceName) {
break;
}
......
......@@ -58,7 +58,7 @@ Accounts::AccountId RemoveKioService::accountId() const
return m_accountId;
}
void RemoveKioService::setAccountId(const Accounts::AccountId &accId)
void RemoveKioService::setAccountId(Accounts::AccountId accId)
{
m_accountId = accId;
}
......
......@@ -33,7 +33,7 @@ public:
void start() override;
Accounts::AccountId accountId() const;
void setAccountId(const Accounts::AccountId &accId);
void setAccountId(Accounts::AccountId accId);
QString serviceName() const;
void setServiceName(const QString &serviceName);
......
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