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 78f4cc6f authored by Laurent Montel's avatar Laurent Montel 😁

Use QStringLiteral

parent 5b08f70b
......@@ -39,10 +39,10 @@
using namespace Attica;
KdePlatformDependent::KdePlatformDependent()
: m_config(KSharedConfig::openConfig("atticarc")), m_accessManager(0), m_wallet(0)
: m_config(KSharedConfig::openConfig(QStringLiteral("atticarc"))), m_accessManager(nullptr), m_wallet(nullptr)
{
// FIXME: Investigate how to not leak this instance witohut crashing.
m_accessManager = new QNetworkAccessManager(0);
m_accessManager = new QNetworkAccessManager(nullptr);
const QString cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/attica");
QNetworkDiskCache *cache = new QNetworkDiskCache(m_accessManager);
......@@ -65,13 +65,13 @@ bool KdePlatformDependent::openWallet(bool force)
QString networkWallet = KWallet::Wallet::NetworkWallet();
// if not forced, or the folder doesn't exist, don't try to open the wallet
if (force || (!KWallet::Wallet::folderDoesNotExist(networkWallet, "Attica"))) {
if (force || (!KWallet::Wallet::folderDoesNotExist(networkWallet, QStringLiteral("Attica")))) {
m_wallet = KWallet::Wallet::openWallet(networkWallet, 0);
}
if (m_wallet) {
m_wallet->createFolder("Attica");
m_wallet->setFolder("Attica");
m_wallet->createFolder(QStringLiteral("Attica"));
m_wallet->setFolder(QStringLiteral("Attica"));
return true;
}
return false;
......@@ -94,7 +94,7 @@ QNetworkReply* KdePlatformDependent::get(const QNetworkRequest& request)
QNetworkRequest KdePlatformDependent::removeAuthFromRequest(const QNetworkRequest& request)
{
const QStringList noauth = { "no-auth-prompt", "true" };
const QStringList noauth = { QStringLiteral("no-auth-prompt"), QStringLiteral("true") };
QNetworkRequest notConstReq = const_cast<QNetworkRequest&>(request);
notConstReq.setAttribute(QNetworkRequest::User, noauth);
return notConstReq;
......@@ -106,7 +106,7 @@ bool KdePlatformDependent::saveCredentials(const QUrl& baseUrl, const QString& u
if (!m_wallet && !openWallet(true)) {
if (KMessageBox::warningContinueCancel(0, i18n("Should the password be stored in the configuration file? This is unsafe.")
if (KMessageBox::warningContinueCancel(nullptr, i18n("Should the password be stored in the configuration file? This is unsafe.")
, i18n("Social Desktop Configuration"))
== KMessageBox::Cancel) {
return false;
......@@ -127,8 +127,8 @@ bool KdePlatformDependent::saveCredentials(const QUrl& baseUrl, const QString& u
}
const QMap<QString, QString> entries = {
{ "user", user },
{ "password", password }
{ QStringLiteral("user"), user },
{ QStringLiteral("password"), password }
};
qCDebug(ATTICA_PLUGIN_LOG) << "Saved credentials in KWallet";
......@@ -142,8 +142,8 @@ bool KdePlatformDependent::hasCredentials(const QUrl& baseUrl) const
}
QString networkWallet = KWallet::Wallet::NetworkWallet();
if (!KWallet::Wallet::folderDoesNotExist(networkWallet, "Attica") &&
!KWallet::Wallet::keyDoesNotExist(networkWallet, "Attica", baseUrl.toString())) {
if (!KWallet::Wallet::folderDoesNotExist(networkWallet, QStringLiteral("Attica")) &&
!KWallet::Wallet::keyDoesNotExist(networkWallet, QStringLiteral("Attica"), baseUrl.toString())) {
qCDebug(ATTICA_PLUGIN_LOG) << "Found credentials in KWallet";
return true;
}
......@@ -159,8 +159,8 @@ bool KdePlatformDependent::hasCredentials(const QUrl& baseUrl) const
bool KdePlatformDependent::loadCredentials(const QUrl& baseUrl, QString& user, QString& password)
{
QString networkWallet = KWallet::Wallet::NetworkWallet();
if (KWallet::Wallet::folderDoesNotExist(networkWallet, "Attica") &&
KWallet::Wallet::keyDoesNotExist(networkWallet, "Attica", baseUrl.toString())) {
if (KWallet::Wallet::folderDoesNotExist(networkWallet, QStringLiteral("Attica")) &&
KWallet::Wallet::keyDoesNotExist(networkWallet, QStringLiteral("Attica"), baseUrl.toString())) {
// use KConfig
KConfigGroup group(m_config, baseUrl.toString());
user = group.readEntry("user", QString());
......@@ -181,8 +181,8 @@ bool KdePlatformDependent::loadCredentials(const QUrl& baseUrl, QString& user, Q
if (m_wallet->readMap(baseUrl.toString(), entries) != 0) {
return false;
}
user = entries.value("user");
password = entries.value("password");
user = entries.value(QStringLiteral("user"));
password = entries.value(QStringLiteral("password"));
qCDebug(ATTICA_PLUGIN_LOG) << "Successfully loaded credentials.";
m_passwords[baseUrl.toString()] = qMakePair(user, password);
......@@ -203,7 +203,7 @@ bool Attica::KdePlatformDependent::askForCredentials(const QUrl& baseUrl, QStrin
QList<QUrl> KdePlatformDependent::getDefaultProviderFiles() const
{
KConfigGroup group(m_config, "General");
QStringList pathStrings = group.readPathEntry("providerFiles", QStringList("http://download.kde.org/ocs/providers.xml"));
QStringList pathStrings = group.readPathEntry("providerFiles", QStringList(QStringLiteral("http://download.kde.org/ocs/providers.xml")));
QList<QUrl> paths;
foreach (const QString& pathString, pathStrings) {
paths.append(QUrl(pathString));
......@@ -215,7 +215,7 @@ QList<QUrl> KdePlatformDependent::getDefaultProviderFiles() const
void KdePlatformDependent::addDefaultProviderFile(const QUrl& url)
{
KConfigGroup group(m_config, "General");
QStringList pathStrings = group.readPathEntry("providerFiles", QStringList("http://download.kde.org/ocs/providers.xml"));
QStringList pathStrings = group.readPathEntry("providerFiles", QStringList(QStringLiteral("http://download.kde.org/ocs/providers.xml")));
QString urlString = url.toString();
if(!pathStrings.contains(urlString)) {
pathStrings.append(urlString);
......@@ -228,7 +228,7 @@ void KdePlatformDependent::addDefaultProviderFile(const QUrl& url)
void KdePlatformDependent::removeDefaultProviderFile(const QUrl& url)
{
KConfigGroup group(m_config, "General");
QStringList pathStrings = group.readPathEntry("providerFiles", QStringList("http://download.kde.org/ocs/providers.xml"));
QStringList pathStrings = group.readPathEntry("providerFiles", QStringList(QStringLiteral("http://download.kde.org/ocs/providers.xml")));
pathStrings.removeAll(url.toString());
group.writeEntry("providerFiles", pathStrings);
}
......
......@@ -68,8 +68,8 @@ private:
QNetworkRequest removeAuthFromRequest(const QNetworkRequest& request);
KSharedConfigPtr m_config;
QNetworkAccessManager* m_accessManager;
KWallet::Wallet* m_wallet;
QNetworkAccessManager* m_accessManager = nullptr;
KWallet::Wallet* m_wallet = nullptr;
QHash<QString, QPair <QString, QString> > m_passwords;
};
......
......@@ -135,9 +135,9 @@ static QList<TextAttribute> String2AttrList(const QString &str)
if (str.isEmpty()) {
return result;
}
foreach(const QString & s, str.split(';')) {
foreach(const QString & s, str.split(QLatin1Char(';'))) {
TextAttribute attr;
QStringList list = s.split(':');
QStringList list = s.split(QLatin1Char(':'));
if (list.size() < 4)
continue;
switch (list.at(0).toInt()) {
......@@ -168,7 +168,7 @@ static KimpanelProperty String2Property(const QString &str)
{
KimpanelProperty result;
QStringList list = str.split(':');
QStringList list = str.split(QLatin1Char(':'));
if (list.size() < 4)
return result;
......@@ -177,7 +177,7 @@ static KimpanelProperty String2Property(const QString &str)
result.label = list.at(1);
result.icon = list.at(2);
result.tip = list.at(3);
result.hint = list.size() > 4 ? list.at(4) : "";
result.hint = list.size() > 4 ? list.at(4) : QString();
return result;
}
......
......@@ -38,19 +38,18 @@
#include "DeviceModel.h"
K_PLUGIN_FACTORY(DeviceAutomounterKCMFactory, registerPlugin<DeviceAutomounterKCM>();)
K_EXPORT_PLUGIN(DeviceAutomounterKCMFactory("kcm_device_automounter"))
DeviceAutomounterKCM::DeviceAutomounterKCM(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)//DeviceAutomounterKCMFactory::componentData(), parent)
{
KAboutData *about = new KAboutData("kcm_device_automounter",
KAboutData *about = new KAboutData(QStringLiteral("kcm_device_automounter"),
i18n("Device Automounter"),
"2.0",
QStringLiteral("2.0"),
QString(),
KAboutLicense::GPL_V2,
i18n("(c) 2009 Trever Fischer, (c) 2015 Kai Uwe Broulik"));
about->addAuthor(i18n("Trever Fischer"), i18n("Original Author"));
about->addAuthor(i18n("Kai Uwe Broulik"), i18n("Plasma 5 Port"), "kde@privat.broulik.de");
about->addAuthor(i18n("Kai Uwe Broulik"), i18n("Plasma 5 Port"), QStringLiteral("kde@privat.broulik.de"));
setAboutData(about);
setupUi(this);
......
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