Commit 473e8608 authored by Laurent Montel's avatar Laurent Montel 😁

Use QStringLiteral

parent 1ee12f30
......@@ -102,7 +102,7 @@ void ConfigFile::edit()
return;
}
if (m_editName == QStringLiteral("freebusy")) {
if (m_editName == QLatin1String("freebusy")) {
KCMultiDialog *dialog = new KCMultiDialog();
dialog->addModule(QStringLiteral("korganizer_configfreebusy.desktop"));
dialog->show();
......
......@@ -64,33 +64,33 @@ freebusy AutoconfigKolabFreebusy::createFreebusyServer(const QDomElement &n)
QDomElement f = o.toElement();
if (!f.isNull()) {
const QString tagName(f.tagName());
if (tagName == QStringLiteral("hostname")) {
if (tagName == QLatin1String("hostname")) {
s.hostname = replacePlaceholders(f.text());
} else if (tagName == QStringLiteral("port")) {
} else if (tagName == QLatin1String("port")) {
s.port = f.text().toInt();
} else if (tagName == QStringLiteral("socketType")) {
} else if (tagName == QLatin1String("socketType")) {
const QString type(f.text());
if (type == QStringLiteral("plain")) {
if (type == QLatin1String("plain")) {
s.socketType = None;
} else if (type == QStringLiteral("SSL")) {
} else if (type == QLatin1String("SSL")) {
s.socketType = SSL;
}
if (type == QStringLiteral("TLS")) {
if (type == QLatin1String("TLS")) {
s.socketType = StartTLS;
}
} else if (tagName == QStringLiteral("username")) {
} else if (tagName == QLatin1String("username")) {
s.username = replacePlaceholders(f.text());
} else if (tagName == QStringLiteral("password")) {
} else if (tagName == QLatin1String("password")) {
s.password = f.text();
} else if (tagName == QStringLiteral("authentication")) {
} else if (tagName == QLatin1String("authentication")) {
const QString type(f.text());
if (type == QStringLiteral("none")
|| type == QStringLiteral("plain")) {
if (type == QLatin1String("none")
|| type == QLatin1String("plain")) {
s.authentication = Plain;
} else if (type == QStringLiteral("basic")) {
} else if (type == QLatin1String("basic")) {
s.authentication = Basic;
}
} else if (tagName == QStringLiteral("path")) {
} else if (tagName == QLatin1String("path")) {
s.path = f.text();
}
}
......
......@@ -65,55 +65,55 @@ ldapServer AutoconfigKolabLdap::createLdapServer(const QDomElement &n)
QDomElement f = o.toElement();
if (!f.isNull()) {
const QString tagName(f.tagName());
if (tagName == QStringLiteral("hostname")) {
if (tagName == QLatin1String("hostname")) {
s.hostname = replacePlaceholders(f.text());
} else if (tagName == QStringLiteral("port")) {
} else if (tagName == QLatin1String("port")) {
s.port = f.text().toInt();
} else if (tagName == QStringLiteral("socketType")) {
} else if (tagName == QLatin1String("socketType")) {
const QString type(f.text());
if (type == QStringLiteral("plain")) {
if (type == QLatin1String("plain")) {
s.socketType = KLDAP::LdapServer::None;
} else if (type == QStringLiteral("SSL")) {
} else if (type == QLatin1String("SSL")) {
s.socketType = KLDAP::LdapServer::SSL;
} else if (type == QStringLiteral("TLS")) {
} else if (type == QLatin1String("TLS")) {
s.socketType = KLDAP::LdapServer::TLS;
}
} else if (tagName == QStringLiteral("authentication")) {
} else if (tagName == QLatin1String("authentication")) {
const QString type(f.text());
if (type == QStringLiteral("anonyoum")) {
if (type == QLatin1String("anonyoum")) {
s.authentication = KLDAP::LdapServer::Anonymous;
} else if (type == QStringLiteral("simple")) {
} else if (type == QLatin1String("simple")) {
s.authentication = KLDAP::LdapServer::Simple;
} else if (type == QStringLiteral("sasl")) {
} else if (type == QLatin1String("sasl")) {
s.authentication = KLDAP::LdapServer::SASL;
}
} else if (tagName == QStringLiteral("bindDn")) {
} else if (tagName == QLatin1String("bindDn")) {
s.bindDn = f.text();
} else if (tagName == QStringLiteral("sasl-mech")) {
} else if (tagName == QLatin1String("sasl-mech")) {
s.saslMech = f.text();
} else if (tagName == QStringLiteral("username")) {
} else if (tagName == QLatin1String("username")) {
s.username = f.text();
} else if (tagName == QStringLiteral("password")) {
} else if (tagName == QLatin1String("password")) {
s.password = f.text();
} else if (tagName == QStringLiteral("realm")) {
} else if (tagName == QLatin1String("realm")) {
s.realm = f.text();
} else if (tagName == QStringLiteral("dn")) {
} else if (tagName == QLatin1String("dn")) {
s.dn = f.text();
} else if (tagName == QStringLiteral("ldapVersion")) {
} else if (tagName == QLatin1String("ldapVersion")) {
s.ldapVersion = f.text().toInt();
} else if (tagName == QStringLiteral("filter")) {
} else if (tagName == QLatin1String("filter")) {
s.filter = f.text();
} else if (tagName == QStringLiteral("pagesize")) {
} else if (tagName == QLatin1String("pagesize")) {
s.pageSize = f.text().toInt();
if (s.pageSize < 1 || s.pageSize > 9999999) {
s.pageSize = -1;
}
} else if (tagName == QStringLiteral("timelimit")) {
} else if (tagName == QLatin1String("timelimit")) {
s.timeLimit = f.text().toInt();
if (s.timeLimit < 1 || s.timeLimit > 9999999) {
s.timeLimit = -1;
}
} else if (tagName == QStringLiteral("sizelimit")) {
} else if (tagName == QLatin1String("sizelimit")) {
s.sizeLimit = f.text().toInt();
if (s.sizeLimit < 1 || s.sizeLimit > 9999999) {
s.sizeLimit = -1;
......
......@@ -166,31 +166,31 @@ void Ispdb::parseResult(const QDomDocument &document)
if (!e.isNull()) {
//qCDebug(ACCOUNTWIZARD_LOG) << qPrintable(e.tagName());
const QString tagName(e.tagName());
if (tagName == QStringLiteral("domain")) {
if (tagName == QLatin1String("domain")) {
mDomains << e.text();
} else if (tagName == QStringLiteral("displayName")) {
} else if (tagName == QLatin1String("displayName")) {
mDisplayName = e.text();
} else if (tagName == QStringLiteral("displayShortName")) {
} else if (tagName == QLatin1String("displayShortName")) {
mDisplayShortName = e.text();
} else if (tagName == QStringLiteral("incomingServer")
&& e.attribute(QStringLiteral("type")) == QStringLiteral("imap")) {
} else if (tagName == QLatin1String("incomingServer")
&& e.attribute(QStringLiteral("type")) == QLatin1String("imap")) {
Server s = createServer(e);
if (s.isValid()) {
mImapServers.append(s);
}
} else if (tagName == QStringLiteral("incomingServer")
&& e.attribute(QStringLiteral("type")) == QStringLiteral("pop3")) {
} else if (tagName == QLatin1String("incomingServer")
&& e.attribute(QStringLiteral("type")) == QLatin1String("pop3")) {
Server s = createServer(e);
if (s.isValid()) {
mPop3Servers.append(s);
}
} else if (tagName == QStringLiteral("outgoingServer")
&& e.attribute(QStringLiteral("type")) == QStringLiteral("smtp")) {
} else if (tagName == QLatin1String("outgoingServer")
&& e.attribute(QStringLiteral("type")) == QLatin1String("smtp")) {
Server s = createServer(e);
if (s.isValid()) {
mSmtpServers.append(s);
}
} else if (tagName == QStringLiteral("identity")) {
} else if (tagName == QLatin1String("identity")) {
identity i = createIdentity(e);
if (i.isValid()) {
mIdentities.append(i);
......@@ -232,37 +232,37 @@ Server Ispdb::createServer(const QDomElement &n)
QDomElement f = o.toElement();
if (!f.isNull()) {
const QString tagName(f.tagName());
if (tagName == QStringLiteral("hostname")) {
if (tagName == QLatin1String("hostname")) {
s.hostname = replacePlaceholders(f.text());
} else if (tagName == QStringLiteral("port")) {
} else if (tagName == QLatin1String("port")) {
s.port = f.text().toInt();
} else if (tagName == QStringLiteral("socketType")) {
} else if (tagName == QLatin1String("socketType")) {
const QString type(f.text());
if (type == QStringLiteral("plain")) {
if (type == QLatin1String("plain")) {
s.socketType = None;
} else if (type == QStringLiteral("SSL")) {
} else if (type == QLatin1String("SSL")) {
s.socketType = SSL;
}
if (type == QStringLiteral("STARTTLS")) {
if (type == QLatin1String("STARTTLS")) {
s.socketType = StartTLS;
}
} else if (tagName == QStringLiteral("username")) {
} else if (tagName == QLatin1String("username")) {
s.username = replacePlaceholders(f.text());
} else if (tagName == QStringLiteral("authentication")) {
} else if (tagName == QLatin1String("authentication")) {
const QString type(f.text());
if (type == QStringLiteral("password-cleartext")
|| type == QStringLiteral("plain")) {
if (type == QLatin1String("password-cleartext")
|| type == QLatin1String("plain")) {
s.authentication = Plain;
} else if (type == QStringLiteral("password-encrypted")
|| type == QStringLiteral("secure")) {
} else if (type == QLatin1String("password-encrypted")
|| type == QLatin1String("secure")) {
s.authentication = CramMD5;
} else if (type == QStringLiteral("NTLM")) {
} else if (type == QLatin1String("NTLM")) {
s.authentication = NTLM;
} else if (type == QStringLiteral("GSSAPI")) {
} else if (type == QLatin1String("GSSAPI")) {
s.authentication = GSSAPI;
} else if (type == QStringLiteral("client-ip-based")) {
} else if (type == QLatin1String("client-ip-based")) {
s.authentication = ClientIP;
} else if (type == QStringLiteral("none")) {
} else if (type == QLatin1String("none")) {
s.authentication = NoAuth;
}
}
......@@ -287,15 +287,15 @@ identity Ispdb::createIdentity(const QDomElement &n)
QDomElement f = o.toElement();
if (!f.isNull()) {
const QString tagName(f.tagName());
if (tagName == QStringLiteral("default")) {
i.mDefault = f.text().toLower() == QStringLiteral("true");
} else if (tagName == QStringLiteral("email")) {
if (tagName == QLatin1String("default")) {
i.mDefault = f.text().toLower() == QLatin1String("true");
} else if (tagName == QLatin1String("email")) {
i.email = f.text();
} else if (tagName == QStringLiteral("name")) {
} else if (tagName == QLatin1String("name")) {
i.name = f.text();
} else if (tagName == QStringLiteral("organization")) {
} else if (tagName == QLatin1String("organization")) {
i.organization = f.text();
} else if (tagName == QStringLiteral("signature")) {
} else if (tagName == QLatin1String("signature")) {
QTextStream stream(&i.signature);
f.save(stream, 0);
i.signature = i.signature.trimmed();
......
......@@ -42,7 +42,7 @@ void ServerTest::test(const QString &server, const QString &protocol)
qCDebug(ACCOUNTWIZARD_LOG) << server << protocol;
m_serverTest->setServer(server);
m_serverTest->setProtocol(protocol);
if (protocol == QStringLiteral("submission")) {
if (protocol == QLatin1String("submission")) {
m_serverTest->setProtocol(QStringLiteral("smtp"));
m_serverTest->setPort(MailTransport::Transport::EnumEncryption::None, 587);
m_serverTest->setPort(MailTransport::Transport::EnumEncryption::SSL, 0); //No ssl port for submission
......
......@@ -67,7 +67,7 @@ void SetupAutoconfigKolabFreebusy::fillFreebusyServer(int i, QObject *o) const
url += path.path();
bool fullDomainRetrieval = (path.baseName() == QStringLiteral("$EMAIL$"));
bool fullDomainRetrieval = (path.baseName() == QLatin1String("$EMAIL$"));
QString group(QStringLiteral("FreeBusy Retrieve"));
......
......@@ -244,13 +244,13 @@ void SetupManager::setPersonalDataAvailable(bool available)
QObject *SetupManager::ispDB(const QString &type)
{
const QString t = type.toLower();
if (t == QStringLiteral("autoconfigkolabmail")) {
if (t == QLatin1String("autoconfigkolabmail")) {
return new SetupAutoconfigKolabMail(this);
} else if (t == QStringLiteral("autoconfigkolabldap")) {
} else if (t == QLatin1String("autoconfigkolabldap")) {
return new SetupAutoconfigKolabLdap(this);
} else if (t == QStringLiteral("autoconfigkolabfreebusy")) {
} else if (t == QLatin1String("autoconfigkolabfreebusy")) {
return new SetupAutoconfigKolabFreebusy(this);
} else if (t == QStringLiteral("ispdb")) {
} else if (t == QLatin1String("ispdb")) {
return new SetupIspdb(this);
} else {
return new SetupIspdb(this);
......
......@@ -62,7 +62,7 @@ void ArchiveMailManager::load()
qDeleteAll(mListArchiveInfo);
mListArchiveInfo.clear();
const QStringList collectionList = mConfig->groupList().filter(QRegExp(QLatin1String("ArchiveMailCollection \\d+")));
const QStringList collectionList = mConfig->groupList().filter(QRegExp(QStringLiteral("ArchiveMailCollection \\d+")));
const int numberOfCollection = collectionList.count();
for (int i = 0 ; i < numberOfCollection; ++i) {
KConfigGroup group = mConfig->group(collectionList.at(i));
......
......@@ -242,7 +242,7 @@ QString SendLaterManager::printDebugInfo()
QString SendLaterManager::infoToStr(SendLater::SendLaterInfo *info)
{
QString infoStr = QLatin1String("Recusive ") + (info->isRecurrence() ? QLatin1String("true") : QLatin1String("false"));
QString infoStr = QLatin1String("Recusive ") + (info->isRecurrence() ? QStringLiteral("true") : QStringLiteral("false"));
infoStr += QLatin1String("Item id :") + QString::number(info->itemId());
infoStr += QLatin1String("Send date:") + info->dateTime().toString();
infoStr += QLatin1String("Last saved date: ") + info->lastDateTimeSend().toString();
......
......@@ -39,7 +39,7 @@ MonitorItem::MonitorItem(const QString &identifier_, MonitorsModel *model):
}
mInterface = new org::freedesktop::Akonadi::NotificationSource(
service, QLatin1String("/subscriber/") + identifier,
service, QStringLiteral("/subscriber/") + identifier,
QDBusConnection::sessionBus(), this);
if (!mInterface) {
qCWarning(AKONADICONSOLE_LOG) << "Failed to connect to org.freedesktop.Akonadi.NotificationSource of subscriber" << identifier_;
......
......@@ -96,7 +96,7 @@ void RawSocketConsole::connectClicked()
} else {
QString connectionConfigFile;
if (Akonadi::ServerManager::self()->hasInstanceIdentifier()) {
const QString akonadiPath = XdgBaseDirs::findResourceDir("config", QLatin1String("akonadi"));
const QString akonadiPath = XdgBaseDirs::findResourceDir("config", QStringLiteral("akonadi"));
connectionConfigFile = akonadiPath + QLatin1String("/instance/")
+ Akonadi::ServerManager::self()->instanceIdentifier()
+ QLatin1String("/akonadiconnectionrc");
......@@ -112,7 +112,7 @@ void RawSocketConsole::connectClicked()
}
QSettings conSettings(connectionConfigFile, QSettings::IniFormat);
#ifdef Q_OS_WIN //krazy:exclude=cpp
const QString namedPipe = conSettings.value(QLatin1String("Data/NamedPipe"), QLatin1String("Akonadi")).toString();
const QString namedPipe = conSettings.value(QLatin1String("Data/NamedPipe"), QStringLiteral("Akonadi")).toString();
mSocket->connectToServer(namedPipe);
#else
const QString defaultSocketDir = XdgBaseDirs::saveDir("data", QStringLiteral("akonadi"));
......
......@@ -122,7 +122,7 @@ void FeedStorageMK4Impl::convertOldArchive()
return;
}
Syndication::DocumentSource src(file.readAll(), QLatin1String("http://foo"));
Syndication::DocumentSource src(file.readAll(), QStringLiteral("http://foo"));
file.close();
Syndication::FeedPtr feed = Syndication::parse(src);
......@@ -152,7 +152,7 @@ FeedStorageMK4Impl::FeedStorageMK4Impl(const QString &url, StorageMK4Impl *main)
QString t = url2;
QString t2 = url2;
QString filePath = main->archivePath() + QLatin1Char('/') + t.replace(QLatin1Char('/'), QLatin1Char('_')).replace(QLatin1Char(':'), QLatin1Char('_'));
d->oldArchivePath = KGlobal::dirs()->saveLocation("data", QLatin1String("akregator/Archive/")) + t2.replace(QLatin1Char('/'), QLatin1Char('_')).replace(QLatin1Char(':'), QLatin1Char('_')) + QLatin1String(".xml");
d->oldArchivePath = KGlobal::dirs()->saveLocation("data", QStringLiteral("akregator/Archive/")) + t2.replace(QLatin1Char('/'), QLatin1Char('_')).replace(QLatin1Char(':'), QLatin1Char('_')) + QLatin1String(".xml");
d->convert = !QFile::exists(filePath + QLatin1String(".mk4")) && QFile::exists(d->oldArchivePath);
d->storage = new c4_Storage(QString(filePath + QLatin1String(".mk4")).toLocal8Bit(), true);
......
......@@ -39,7 +39,7 @@ K_PLUGIN_FACTORY(MK4PluginFactory,
void MK4Plugin::doInitialize()
{
m_factory = new StorageFactoryMK4Impl();
StorageFactoryRegistry::self()->registerFactory(m_factory, QLatin1String("metakit"));
StorageFactoryRegistry::self()->registerFactory(m_factory, QStringLiteral("metakit"));
}
MK4Plugin::MK4Plugin(QObject *parent, const QVariantList &params) : Plugin(parent, params), m_factory(0)
......
......@@ -480,17 +480,17 @@ QDomElement Akregator::Feed::toOPML(QDomElement parent, QDomDocument document) c
el.setAttribute(QStringLiteral("maxArticleAge"), d->maxArticleAge);
el.setAttribute(QStringLiteral("maxArticleNumber"), d->maxArticleNumber);
if (d->markImmediatelyAsRead) {
el.setAttribute(QStringLiteral("markImmediatelyAsRead"), QLatin1String("true"));
el.setAttribute(QStringLiteral("markImmediatelyAsRead"), QStringLiteral("true"));
}
if (d->useNotification) {
el.setAttribute(QStringLiteral("useNotification"), QLatin1String("true"));
el.setAttribute(QStringLiteral("useNotification"), QStringLiteral("true"));
}
if (d->loadLinkedWebsite) {
el.setAttribute(QStringLiteral("loadLinkedWebsite"), QLatin1String("true"));
el.setAttribute(QStringLiteral("loadLinkedWebsite"), QStringLiteral("true"));
}
el.setAttribute(QStringLiteral("maxArticleNumber"), d->maxArticleNumber);
el.setAttribute(QStringLiteral("type"), QLatin1String("rss")); // despite some additional fields, it is still "rss" OPML
el.setAttribute(QStringLiteral("version"), QLatin1String("RSS"));
el.setAttribute(QStringLiteral("type"), QStringLiteral("rss")); // despite some additional fields, it is still "rss" OPML
el.setAttribute(QStringLiteral("version"), QStringLiteral("RSS"));
parent.appendChild(el);
return el;
}
......
......@@ -73,7 +73,7 @@ QString getIconUrl(const QUrl &url)
FeedIconManager::Private::Private(FeedIconManager *qq) : q(qq)
{
QDBusConnection::sessionBus().registerObject(QLatin1String("/FeedIconManager"), q, QDBusConnection::ExportScriptableSlots);
m_favIconsModule = new QDBusInterface(QLatin1String("org.kde.kded5"), QLatin1String("/modules/favicons"), QLatin1String(FAVICONINTERFACE));
m_favIconsModule = new QDBusInterface(QLatin1String("org.kde.kded5"), QStringLiteral("/modules/favicons"), QLatin1String(FAVICONINTERFACE));
Q_ASSERT(m_favIconsModule);
q->connect(m_favIconsModule, SIGNAL(iconChanged(bool,QString,QString)),
q, SLOT(slotIconChanged(bool,QString,QString)));
......
......@@ -359,10 +359,10 @@ void FeedList::append(FeedList *list, Folder *parent, TreeNode *after)
QDomDocument FeedList::toOpml() const
{
QDomDocument doc;
doc.appendChild(doc.createProcessingInstruction(QLatin1String("xml"), QLatin1String("version=\"1.0\" encoding=\"UTF-8\"")));
doc.appendChild(doc.createProcessingInstruction(QLatin1String("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")));
QDomElement root = doc.createElement(QLatin1String("opml"));
root.setAttribute(QStringLiteral("version"), QLatin1String("1.0"));
root.setAttribute(QStringLiteral("version"), QStringLiteral("1.0"));
doc.appendChild(root);
QDomElement head = doc.createElement(QLatin1String("head"));
......
......@@ -48,7 +48,7 @@ public:
void setMode(Mode mode);
private:
/*reimpl*/ bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
private:
QVector<bool> m_columnStates;
......
......@@ -101,7 +101,7 @@ AddEditBlog::AddEditBlog(int blog_id, QWidget *parent, Qt::WindowFlags flags)
d->ui.txtPass->setText(d->bBlog->password());
d->ui.txtId->setText(d->bBlog->blogid());
QString title = d->bBlog->title();
title = title.replace(QLatin1String("&amp;"), QLatin1String("&"));
title = title.replace(QLatin1String("&amp;"), QStringLiteral("&"));
d->ui.txtTitle->setText(title);
d->ui.comboApi->setCurrentIndex(d->bBlog->api());
d->ui.comboDir->setCurrentIndex(d->bBlog->direction());
......
......@@ -136,7 +136,7 @@ void BlogiloComposerEditor::replaceImageSrc(const QString &src, const QString &d
void BlogiloComposerEditor::slotAddPostSplitter()
{
execCommand(QLatin1String("insertHTML"), QLatin1String("<hr/><!--split-->"));
execCommand(QLatin1String("insertHTML"), QStringLiteral("<hr/><!--split-->"));
}
void BlogiloComposerEditor::slotToggleCode(bool)
......
......@@ -29,7 +29,7 @@ using namespace CalendarSupport;
inline QString &quote(QString &string)
{
Q_ASSERT(CategoryConfig::categorySeparator != QLatin1String("@"));
return string.replace(QLatin1Char('@'), QLatin1String("@0")).replace(QLatin1Char('\\') +
return string.replace(QLatin1Char('@'), QStringLiteral("@0")).replace(QLatin1Char('\\') +
CategoryConfig::categorySeparator,
QLatin1String("@1"));
}
......@@ -38,7 +38,7 @@ inline QStringList &unquote(QStringList &strings)
{
return
strings.replaceInStrings(QLatin1String("@1"), CategoryConfig::categorySeparator).
replaceInStrings(QLatin1String("@0"), QLatin1String("@"));
replaceInStrings(QLatin1String("@0"), QStringLiteral("@"));
}
QStringList CategoryHierarchyReader::path(QString string)
......
......@@ -58,7 +58,7 @@ void TextBrowser::setSource(const QUrl &name)
uri.startsWith(QString::fromLatin1("urn:x-ical").section(QLatin1Char(':'), 0, 0)) ||
uri.startsWith(QStringLiteral("news:")) ||
uri.startsWith(QStringLiteral("mailto:"))) {
uri.replace(QRegExp(QLatin1String("^([^:]+:)/+")), QLatin1String("\\1"));
uri.replace(QRegExp(QLatin1String("^([^:]+:)/+")), QStringLiteral("\\1"));
}
if (uri.startsWith(QStringLiteral("ATTACH:"))) {
......
......@@ -644,7 +644,7 @@ void AgendaItem::addAttendee(const QString &newAttendee)
this,