Commit 4903715b authored by Laurent Montel's avatar Laurent Montel 😁

Use QLatin1String

parent db7c70e3
......@@ -73,7 +73,7 @@ public:
for (int i = 0; i < pathSize; ++i) {
if (path[i] == QLatin1Char('/')) {
QString pathElement = path.mid(begin, i - begin);
pathElement = pathElement.replace(QStringLiteral("\\/"), QStringLiteral("/"));
pathElement = pathElement.replace(QLatin1String("\\/"), QLatin1String("/"));
rv.append(pathElement);
begin = i + 1;
}
......@@ -82,7 +82,7 @@ public:
}
}
QString pathElement = path.mid(begin);
pathElement = pathElement.replace(QStringLiteral("\\/"), QStringLiteral("/"));
pathElement = pathElement.replace(QLatin1String("\\/"), QLatin1String("/"));
rv.append(pathElement);
return rv;
}
......
......@@ -88,16 +88,16 @@ inline QString defaultIconName(const Collection &col)
const QStringList content = col.contentMimeTypes();
if ((content.size() == 1) ||
(content.size() == 2 && content.contains(Collection::mimeType()))) {
if (content.contains(QStringLiteral("text/x-vcard")) ||
content.contains(QStringLiteral("text/directory")) ||
content.contains(QStringLiteral("text/vcard"))) {
if (content.contains(QLatin1String("text/x-vcard")) ||
content.contains(QLatin1String("text/directory")) ||
content.contains(QLatin1String("text/vcard"))) {
return QStringLiteral("x-office-address-book");
}
// TODO: add all other content types and/or fix their mimetypes
if (content.contains(QStringLiteral("akonadi/event")) || content.contains(QStringLiteral("text/ical"))) {
if (content.contains(QLatin1String("akonadi/event")) || content.contains(QLatin1String("text/ical"))) {
return QStringLiteral("view-pim-calendar");
}
if (content.contains(QStringLiteral("akonadi/task"))) {
if (content.contains(QLatin1String("akonadi/task"))) {
return QStringLiteral("view-pim-tasks");
}
} else if (content.isEmpty()) {
......
......@@ -117,7 +117,7 @@ void Firstrun::setupNext()
setupNext();
return;
}
if (type.capabilities().contains(QStringLiteral("Unique"))) {
if (type.capabilities().contains(QLatin1String("Unique"))) {
const Akonadi::AgentInstance::List lstAgents = AgentManager::self()->instances();
for (const AgentInstance &agent : lstAgents) {
if (agent.type() == type) {
......
......@@ -310,7 +310,7 @@ bool ItemModifyJob::doHandleResponse(qint64 tag, const Protocol::CommandPtr &res
return true;
}
if (resp.errorMessage().contains(QStringLiteral("[LLCONFLICT]"))) {
if (resp.errorMessage().contains(QLatin1String("[LLCONFLICT]"))) {
if (d->mAutomaticConflictHandlingEnabled) {
ConflictHandler *handler = new ConflictHandler(ConflictHandler::LocalLocalConflict, this);
handler->setConflictingItems(d->mItems.first(), d->mItems.first());
......
......@@ -142,7 +142,7 @@ Qt::ItemFlags AgentTypeModel::flags(const QModelIndex &index) const
}
const AgentType &type = d->mTypes[index.row()];
if (type.capabilities().contains(QStringLiteral("Unique")) &&
if (type.capabilities().contains(QLatin1String("Unique")) &&
AgentManager::self()->instance(type.identifier()).isValid()) {
return QAbstractItemModel::flags(index) & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
......
......@@ -181,7 +181,7 @@ void EntityTreeModelPrivate::changeFetchState(const Collection &parent)
void EntityTreeModelPrivate::agentInstanceRemoved(const Akonadi::AgentInstance &instance)
{
Q_Q(EntityTreeModel);
if (!instance.type().capabilities().contains(QStringLiteral("Resource"))) {
if (!instance.type().capabilities().contains(QLatin1String("Resource"))) {
return;
}
......
......@@ -466,7 +466,7 @@ bool FavoriteCollectionsModel::dropMimeData(const QMimeData *data, Qt::DropActio
QStringList FavoriteCollectionsModel::mimeTypes() const
{
QStringList mts = KSelectionProxyModel::mimeTypes();
if (!mts.contains(QStringLiteral("text/uri-list"))) {
if (!mts.contains(QLatin1String("text/uri-list"))) {
mts.append(QStringLiteral("text/uri-list"));
}
return mts;
......
......@@ -263,7 +263,7 @@ ServerManager::State ServerManager::state()
// besides the running server processes we also need at least one resource to be operational
const AgentType::List agentTypes = AgentManager::self()->types();
for (const AgentType &type : agentTypes) {
if (type.capabilities().contains(QStringLiteral("Resource"))) {
if (type.capabilities().contains(QLatin1String("Resource"))) {
return Running;
}
}
......
......@@ -648,7 +648,7 @@ bool QSQLiteDriver::open(const QString &db, const QString &, const QString &, co
const QStringList opts = QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';'));
for (const QString &option : opts) {
if (option.startsWith(QStringLiteral("QSQLITE_BUSY_TIMEOUT="))) {
if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
bool ok;
const int nt = option.midRef(21).toInt(&ok);
if (ok) {
......
......@@ -117,7 +117,7 @@ void CachePolicyPage::load(const Collection &collection)
d->mUi->syncOnDemand->setChecked(policy.syncOnDemand());
d->mUi->localParts->setItems(policy.localParts());
const bool fetchBodies = policy.localParts().contains(QStringLiteral("RFC822"));
const bool fetchBodies = policy.localParts().contains(QLatin1String("RFC822"));
d->mUi->retrieveFullMessages->setChecked(fetchBodies);
//done explicitly to disable/enabled widgets
......@@ -152,10 +152,10 @@ void CachePolicyPage::save(Collection &collection)
// view.
if (d->mUi->stackedWidget->currentWidget() != d->mUi->rawPage) {
if (d->mUi->retrieveFullMessages->isChecked() &&
!localParts.contains(QStringLiteral("RFC822"))) {
!localParts.contains(QLatin1String("RFC822"))) {
localParts.append(QStringLiteral("RFC822"));
} else if (!d->mUi->retrieveFullMessages->isChecked() &&
localParts.contains(QStringLiteral("RFC822"))) {
localParts.contains(QLatin1String("RFC822"))) {
localParts.removeAll(QStringLiteral("RFC822"));
}
}
......
......@@ -121,7 +121,7 @@ void CollectionMaintenancePage::init(const Collection &col)
// Check if the resource caches full payloads or at least has local storage
// (so that the indexer can retrieve the payloads on demand)
const auto resource = Akonadi::AgentManager::self()->instance(col.resource()).type();
if (!col.cachePolicy().localParts().contains(QStringLiteral("RFC822"))
if (!col.cachePolicy().localParts().contains(QLatin1String("RFC822"))
&& resource.customProperties().value(QStringLiteral("HasLocalStorage"), QString()) != QLatin1String("true")) {
d->ui.indexingGroup->hide();
}
......
......@@ -183,7 +183,7 @@ void CollectionView::dragMoveEvent(QDragMoveEvent *event)
const Collection collection = Collection::fromUrl(url);
if (collection.isValid()) {
if (!supportedContentTypes.contains(QStringLiteral("inode/directory"))) {
if (!supportedContentTypes.contains(QLatin1String("inode/directory"))) {
break;
}
......
......@@ -227,7 +227,7 @@ void ManageAccountWidget::slotRemoveSelectedAccount()
void ManageAccountWidget::slotAccountSelected(const Akonadi::AgentInstance &current)
{
if (current.isValid()) {
d->ui->mModifyAccountButton->setEnabled(!current.type().capabilities().contains(QStringLiteral("NoConfig")));
d->ui->mModifyAccountButton->setEnabled(!current.type().capabilities().contains(QLatin1String("NoConfig")));
d->ui->mRemoveAccountButton->setEnabled(d->mSpecialCollectionIdentifier != current.identifier());
// Restarting an agent is not possible if it's in Running status... (see AgentProcessInstance::restartWhenIdle)
d->ui->mRestartAccountButton->setEnabled((current.status() != 1));
......
......@@ -242,7 +242,7 @@ void SelfTestDialog::testMySQLServer()
report(Error, ki18n("MySQL server not readable."), details);
} else if (!info.isExecutable()) {
report(Error, ki18n("MySQL server not executable."), details);
} else if (!serverPath.contains(QStringLiteral("mysqld"))) {
} else if (!serverPath.contains(QLatin1String("mysqld"))) {
report(Warning, ki18n("MySQL found with unexpected name."), details);
} else {
report(Success, ki18n("MySQL server found."), details);
......@@ -286,13 +286,13 @@ void SelfTestDialog::testMySQLServerLog()
QStandardItem *item = nullptr;
while (!logFile.atEnd()) {
const QString line = QString::fromUtf8(logFile.readLine());
if (line.contains(QStringLiteral("error"), Qt::CaseInsensitive)) {
if (line.contains(QLatin1String("error"), Qt::CaseInsensitive)) {
item = report(Error, ki18n("MySQL server log contains errors."),
ki18n("The MySQL server error log file '%1' contains errors.").subs(makeLink(logFileName)));
item->setData(logFileName, FileIncludeRole);
return;
}
if (!warningsFound && line.contains(QStringLiteral("warn"), Qt::CaseInsensitive)) {
if (!warningsFound && line.contains(QLatin1String("warn"), Qt::CaseInsensitive)) {
warningsFound = true;
}
}
......@@ -465,7 +465,7 @@ void SelfTestDialog::testResources()
const AgentType::List agentTypes = AgentManager::self()->types();
bool resourceFound = false;
for (const AgentType &type : agentTypes) {
if (type.capabilities().contains(QStringLiteral("Resource"))) {
if (type.capabilities().contains(QLatin1String("Resource"))) {
resourceFound = true;
break;
}
......
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