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

GIT_SILENT: Use QLatin1String/QLatin1Char + fix usage

QString::replace/remove
parent 4064c065
......@@ -58,7 +58,7 @@ AppEntry::AppEntry(AbstractModel *owner, const QString &id) : AbstractEntry(owne
{
const QUrl url(id);
if (url.scheme() == QStringLiteral("preferred")) {
if (url.scheme() == QLatin1String("preferred")) {
m_service = defaultAppByName(url.host());
m_id = id;
} else {
......
......@@ -156,7 +156,7 @@ void ContainmentInterface::addLauncher(QObject *appletInterface, ContainmentInte
QQuickItem *rootItem = nullptr;
foreach(QQuickItem *item, gObj->childItems()) {
if (item->objectName() == QStringLiteral("folder")) {
if (item->objectName() == QLatin1String("folder")) {
rootItem = item;
break;
......
......@@ -637,7 +637,7 @@ void KAStatsFavoritesModel::setFavoriteOn(const QString &id, const QString &acti
qCDebug(KICKER_DEBUG) << "%%%%%%%%%%% Activity is" << activityId;
if (activityId.isEmpty() || activityId == QLatin1String(":any") ||
activityId == QStringLiteral(":global") ||
activityId == QLatin1String(":global") ||
activityId == m_activities->currentActivity()) {
d->m_ignoredItems << url;
}
......
......@@ -319,9 +319,9 @@ AbstractEntry *SimpleFavoritesModel::favoriteFromId(const QString &id)
const QUrl url(id);
const QString &s = url.scheme();
if ((s.isEmpty() && id.contains(QStringLiteral(".desktop"))) || s == QStringLiteral("preferred")) {
if ((s.isEmpty() && id.contains(QLatin1String(".desktop"))) || s == QLatin1String("preferred")) {
return new AppEntry(this, id);
} else if (s == QStringLiteral("ktp")) {
} else if (s == QLatin1String("ktp")) {
return new ContactEntry(this, id);
} else if (url.isValid() && !url.scheme().isEmpty()) {
return new FileEntry(this, url);
......
......@@ -25,6 +25,6 @@
void KimpanelPlugin::registerTypes(const char* uri)
{
Q_UNUSED(uri);
Q_ASSERT(QLatin1String(uri) == QStringLiteral("org.kde.plasma.private.kimpanel"));
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.kimpanel"));
qmlRegisterType<Screen>(uri, 0, 1, "Screen");
}
......@@ -123,7 +123,7 @@ void Backend::setHighlightWindows(bool highlight)
QUrl Backend::tryDecodeApplicationsUrl(const QUrl &launcherUrl)
{
if (launcherUrl.isValid() && launcherUrl.scheme() == QStringLiteral("applications")) {
if (launcherUrl.isValid() && launcherUrl.scheme() == QLatin1String("applications")) {
const KService::Ptr service = KService::serviceByMenuId(launcherUrl.path());
if (service) {
......
......@@ -127,7 +127,7 @@ void Item::setLauncherUrl(const QUrl &launcherUrl)
m_storageId.clear();
clear();
if (launcherUrl.scheme() == QStringLiteral("applications")) {
if (launcherUrl.scheme() == QLatin1String("applications")) {
const KService::Ptr service = KService::serviceByMenuId(launcherUrl.path());
if (service && launcherUrl.path() == service->menuId()) {
......
......@@ -1396,7 +1396,7 @@ bool FolderModel::isDir(const QModelIndex &index, const KDirModel *dirModel) con
return true;
}
if (KProtocolInfo::protocolClass(url.scheme()) != QStringLiteral(":local")) {
if (KProtocolInfo::protocolClass(url.scheme()) != QLatin1String(":local")) {
return false;
}
......@@ -1530,7 +1530,7 @@ inline bool FolderModel::matchMimeType(const KFileItem &item) const
return false;
}
if (m_mimeSet.contains(QStringLiteral("all/all")) || m_mimeSet.contains(QStringLiteral("all/allfiles"))) {
if (m_mimeSet.contains(QLatin1String("all/all")) || m_mimeSet.contains(QStringLiteral("all/allfiles"))) {
return true;
}
......
......@@ -38,17 +38,17 @@ void KimpanelJob::start()
} else if (operation == QLatin1String("LookupTablePageDown")) {
m_panelAgent->lookupTablePageDown();
} else if (operation == QLatin1String("MovePreeditCaret")) {
if (parameters().contains(QStringLiteral("position"))) {
if (parameters().contains(QLatin1String("position"))) {
int position = parameters()[QStringLiteral("position")].toInt();
m_panelAgent->movePreeditCaret(position);
}
} else if (operation == QLatin1String("SelectCandidate")) {
if (parameters().contains(QStringLiteral("candidate"))) {
if (parameters().contains(QLatin1String("candidate"))) {
int candidate = parameters()[QStringLiteral("candidate")].toInt();
m_panelAgent->selectCandidate(candidate);
}
} else if (operation == QLatin1String("TriggerProperty")) {
if (parameters().contains(QStringLiteral("key"))) {
if (parameters().contains(QLatin1String("key"))) {
QString key = parameters()[QStringLiteral("key")].toString();
m_panelAgent->triggerProperty(key);
}
......
......@@ -209,8 +209,8 @@ void Autostart::load()
const QStringList onlyShowList = grp.readXdgListEntry("OnlyShowIn");
const bool disabled = hidden ||
notShowList.contains(QStringLiteral("KDE")) ||
(!onlyShowList.isEmpty() && !onlyShowList.contains(QStringLiteral("KDE")));
notShowList.contains(QLatin1String("KDE")) ||
(!onlyShowList.isEmpty() && !onlyShowList.contains(QLatin1String("KDE")));
int indexPath = m_paths.indexOf((item->fileName().adjusted(QUrl::RemoveFilename).toString() ) );
if ( indexPath > 2 )
......@@ -414,19 +414,19 @@ void Autostart::slotAdvanced()
if (grp.hasKey("OnlyShowIn"))
{
lstEntry = grp.readXdgListEntry("OnlyShowIn");
status = lstEntry.contains(QStringLiteral("KDE"));
status = lstEntry.contains(QLatin1String("KDE"));
}
AdvancedDialog *dlg = new AdvancedDialog( this,status );
if ( dlg->exec() )
{
status = dlg->onlyInKde();
if ( lstEntry.contains( QStringLiteral("KDE") ) && !status )
if ( lstEntry.contains(QLatin1String("KDE") ) && !status )
{
lstEntry.removeAll( QStringLiteral("KDE") );
grp.writeXdgListEntry( "OnlyShowIn", lstEntry );
}
else if ( !lstEntry.contains( QStringLiteral("KDE") ) && status )
else if ( !lstEntry.contains(QLatin1String("KDE") ) && status )
{
lstEntry.append( QStringLiteral("KDE") );
grp.writeXdgListEntry( "OnlyShowIn", lstEntry );
......
......@@ -54,7 +54,7 @@ KclockModule::KclockModule(QWidget *parent, const QVariantList &)
QStringLiteral("org.freedesktop.DBus"),
QStringLiteral("ListActivatableNames")));
if (!reply.arguments().isEmpty() && reply.arguments().first().value<QStringList>().contains(QStringLiteral("org.freedesktop.timedate1"))) {
if (!reply.arguments().isEmpty() && reply.arguments().first().value<QStringList>().contains(QLatin1String("org.freedesktop.timedate1"))) {
m_haveTimedated = true;
}
......
......@@ -187,7 +187,7 @@ void KCMDesktopTheme::installTheme(const QString &path)
const QString program = QStringLiteral("kpackagetool5");
const QStringList arguments = { QStringLiteral("--type"), QStringLiteral("Plasma/Theme"), QStringLiteral("--install"), path};
qCDebug(KCM_DESKTOP_THEME) << program << arguments.join(QStringLiteral(" "));
qCDebug(KCM_DESKTOP_THEME) << program << arguments.join(QLatin1String(" "));
QProcess *myProcess = new QProcess(this);
connect(myProcess, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this, [this, myProcess](int exitCode, QProcess::ExitStatus exitStatus) {
......
......@@ -121,7 +121,7 @@ void KCMFormats::addLocaleToCombo(QComboBox *combo, const QLocale &locale)
// "it_IT")
// TODO: Properly handle scripts (@foo)
QString cvalue = locale.name();
if (!cvalue.contains(QLatin1Char('.')) && cvalue != QStringLiteral("C")) {
if (!cvalue.contains(QLatin1Char('.')) && cvalue != QLatin1Char('C')) {
// explicitly add the encoding,
// otherwise Qt doesn't accept dead keys and garbles the output as well
cvalue.append(QLatin1Char('.') + QTextCodec::codecForLocale()->name());
......
......@@ -259,7 +259,7 @@ void JoyWidget::deviceChanged(const QString &dev)
int start, stop;
QString devName;
if ( (start = dev.indexOf(QStringLiteral("/dev"))) == -1 )
if ( (start = dev.indexOf(QLatin1String("/dev"))) == -1 )
{
KMessageBox::sorry(this,
i18n("The given device name is invalid (does not contain /dev).\n"
......@@ -270,7 +270,7 @@ void JoyWidget::deviceChanged(const QString &dev)
return;
}
if ( (stop = dev.indexOf(QStringLiteral(")"), start)) != -1 ) // seems to be text selected from our list
if ( (stop = dev.indexOf(QLatin1String(")"), start)) != -1 ) // seems to be text selected from our list
devName = dev.mid(start, stop - start);
else
devName = dev.mid(start);
......
......@@ -515,8 +515,8 @@ QString includeGeometry(QString geometry)
QString startLine = lines[0];
for (int i = 0; i < lines.size(); i++) {
includeLineStr = lines[i];
lines[i] = lines[i].remove(QStringLiteral(" "));
lines[i] = lines[i].remove(QStringLiteral("\r"));
lines[i].remove(QStringLiteral(" "));
lines[i].remove(QStringLiteral("\r"));
if (lines[i].startsWith(QLatin1String("include"))) {
includeLine = i;
break;
......@@ -525,19 +525,19 @@ QString includeGeometry(QString geometry)
if (includeLine == -1) {
return geometry;
}
geometry = geometry.remove(includeLineStr);
lines[includeLine] = lines[includeLine].remove(QStringLiteral("include"));
lines[includeLine] = lines[includeLine].remove(QStringLiteral("\""));
lines[includeLine] = lines[includeLine].remove(QStringLiteral(")"));
if (lines[includeLine].contains(QStringLiteral("("))) {
geometry.remove(includeLineStr);
lines[includeLine].remove(QStringLiteral("include"));
lines[includeLine].remove(QStringLiteral("\""));
lines[includeLine].remove(QStringLiteral(")"));
if (lines[includeLine].contains(QLatin1String("("))) {
QString includeFile = lines[includeLine].split(QStringLiteral("("))[0];
QString includeGeom = lines[includeLine].split(QStringLiteral("("))[1];
qCDebug(KEYBOARD_PREVIEW) << "looking to include " << "geometryName" << includeGeom << "in" << includeFile;
QString includeStr = getGeometry(includeFile, includeGeom);
includeStr = getGeometryStrContent(includeStr);
geometry = geometry.remove(startLine);
geometry = geometry.prepend(includeStr);
geometry = geometry.prepend(startLine);
geometry.remove(startLine);
geometry.prepend(includeStr);
geometry.prepend(startLine);
includeGeometry(geometry);
}
......@@ -546,7 +546,7 @@ QString includeGeometry(QString geometry)
QString getGeometryStrContent(QString geometryStr)
{
int k = geometryStr.indexOf(QStringLiteral("{"));
int k = geometryStr.indexOf(QLatin1String("{"));
int k2 = geometryStr.lastIndexOf(QLatin1String("};"));
geometryStr = geometryStr.mid(k + 1, k2 - k - 2);
return geometryStr;
......
......@@ -48,14 +48,14 @@ Aliases::Aliases()
QString temp = als.at(i);
temp = temp.remove(QStringLiteral(" "));
temp = temp.remove(QStringLiteral("\n"));
temp = temp.remove(QStringLiteral("\""));
temp = temp.remove(QStringLiteral(">"));
temp = temp.remove(QStringLiteral("<"));
temp = temp.remove(QStringLiteral(";"));
temp = temp.remove(QStringLiteral("}"));
temp = temp.remove(QStringLiteral("{"));
temp.remove(QStringLiteral(" "));
temp.remove(QStringLiteral("\n"));
temp.remove(QStringLiteral("\""));
temp.remove(QStringLiteral(">"));
temp.remove(QStringLiteral("<"));
temp.remove(QStringLiteral(";"));
temp.remove(QStringLiteral("}"));
temp.remove(QStringLiteral("{"));
QList<QString>alskeys;
......@@ -66,7 +66,7 @@ Aliases::Aliases()
for (int k = 1; k < alskeys.size(); k++) {
QString tmp = alskeys.at(k);
int inofeq = tmp.indexOf(QStringLiteral("="));
int inofeq = tmp.indexOf(QLatin1String("="));
QString lat = tmp.left(inofeq);
QString key = tmp.mid(inofeq + 1);
......@@ -80,7 +80,7 @@ Aliases::Aliases()
for (int k = 1; k < alskeys.size(); k++) {
QString tmp = alskeys.at(k);
int inofeq = tmp.indexOf(QStringLiteral("="));
int inofeq = tmp.indexOf(QLatin1String("="));
QString lat = tmp.left(inofeq);
QString key = tmp.mid(inofeq + 1);
......@@ -94,7 +94,7 @@ Aliases::Aliases()
QString tmp = alskeys.at(k);
int inofeq = tmp.indexOf(QStringLiteral("="));
int inofeq = tmp.indexOf(QLatin1String("="));
QString lat = tmp.left(inofeq);
QString key = tmp.mid(inofeq + 1);
......
......@@ -41,7 +41,7 @@ void KeySymbols::setKey(const QString &a)
i = str.indexOf("]");
QString st = str.left(i);
st = st.remove(" ");
st.remove(" ");
//QStringList klst;
symbols = st.split(",");
......
......@@ -191,11 +191,11 @@ QString findLayout(const QString &layout, const QString &layoutVariant)
QString symbolCont = scontentList.at(current);
int index = symbolCont.indexOf(QStringLiteral("\""));
int index = symbolCont.indexOf(QLatin1String("\""));
symbolCont = symbolCont.mid(index);
index = symbolCont.indexOf(QStringLiteral("{"));
index = symbolCont.indexOf(QLatin1String("{"));
symbolCont = symbolCont.left(index);
symbolCont = symbolCont.remove(QStringLiteral(" "));
symbolCont.remove(QStringLiteral(" "));
variant = symbolCont.remove(QStringLiteral("\""));
input.prepend("xkb_symbols");
......
......@@ -80,7 +80,7 @@ void executeXmodmap(const QString& configFileName)
KProcess xmodmapProcess;
xmodmapProcess << xmodmapExe;
xmodmapProcess << configFileName;
qCDebug(KCM_KEYBOARD) << "Executing" << xmodmapProcess.program().join(QStringLiteral(" "));
qCDebug(KCM_KEYBOARD) << "Executing" << xmodmapProcess.program().join(QLatin1String(" "));
if( xmodmapProcess.execute() != 0 ) {
qCCritical(KCM_KEYBOARD) << "Failed to execute " << xmodmapProcess.program();
}
......@@ -108,13 +108,13 @@ bool XkbHelper::runConfigLayoutCommand(const QStringList& setxkbmapCommandArgume
int res = setxkbmapProcess.execute();
if( res == 0 ) { // restore Xmodmap mapping reset by setxkbmap
qCDebug(KCM_KEYBOARD) << "Executed successfully in " << timer.elapsed() << "ms" << setxkbmapProcess.program().join(QStringLiteral(" "));
qCDebug(KCM_KEYBOARD) << "Executed successfully in " << timer.elapsed() << "ms" << setxkbmapProcess.program().join(QLatin1String(" "));
restoreXmodmap();
qCDebug(KCM_KEYBOARD) << "\t and with xmodmap" << timer.elapsed() << "ms";
return true;
}
else {
qCCritical(KCM_KEYBOARD) << "Failed to run" << setxkbmapProcess.program().join(QStringLiteral(" ")) << "return code:" << res;
qCCritical(KCM_KEYBOARD) << "Failed to run" << setxkbmapProcess.program().join(QLatin1String(" ")) << "return code:" << res;
}
return false;
}
......
......@@ -269,7 +269,7 @@ bool RulesHandler::startElement(const QString &/*namespaceURI*/, const QString &
{
path << QString(qName);
QString strPath = path.join(QStringLiteral("/"));
QString strPath = path.join(QLatin1String("/"));
if( strPath.endsWith(QLatin1String("layoutList/layout/configItem")) ) {
rules->layoutInfos << new LayoutInfo(fromExtras);
}
......@@ -302,7 +302,7 @@ bool RulesHandler::endElement(const QString &/*namespaceURI*/, const QString &/*
bool RulesHandler::characters(const QString &str)
{
if( !str.trimmed().isEmpty() ) {
QString strPath = path.join(QStringLiteral("/"));
QString strPath = path.join(QLatin1String("/"));
if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/name")) ) {
if( rules->layoutInfos.last() != nullptr ) {
rules->layoutInfos.last()->name = str.trimmed();
......
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