Commit b4b4a502 authored by Kurt Hindenburg's avatar Kurt Hindenburg

More changes to QLatin1String, QLatin1Char and QStringLiteral

parent 80321dee
......@@ -139,7 +139,7 @@ Profile::Ptr ProfileManager::loadProfile(const QString& shortPath)
return Profile::Ptr();
if (fileInfo.suffix() != QLatin1String("profile"))
path.append(".profile");
path.append(QLatin1String(".profile"));
if (fileInfo.path().isEmpty() || fileInfo.path() == QLatin1String("."))
path.prepend(QLatin1String("konsole") + QDir::separator());
......@@ -368,7 +368,7 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
newName = QStringLiteral("Profile ") + QString::number(nameSuffix);
newTranslatedName = i18nc("The default name of a profile", "Profile #%1", nameSuffix);
// TODO: remove the # above and below - too many issues
newTranslatedName.remove('#');
newTranslatedName.remove(QLatin1Char('#'));
nameSuffix++;
} while (existingProfileNames.contains(newName));
......@@ -376,7 +376,7 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
newProfile->clone(profile, true);
newProfile->setProperty(Profile::UntranslatedName, newName);
newProfile->setProperty(Profile::Name, newTranslatedName);
newProfile->setProperty(Profile::MenuIndex, QString("0"));
newProfile->setProperty(Profile::MenuIndex, QStringLiteral("0"));
newProfile->setHidden(false);
addProfile(newProfile);
......
......@@ -50,7 +50,7 @@ QStringList KDE4ProfileReader::findProfiles()
Q_FOREACH (const QString& dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.profile"));
Q_FOREACH (const QString& file, fileNames) {
profiles.append(dir + '/' + file);
profiles.append(dir + QLatin1Char('/') + file);
}
}
return profiles;
......@@ -68,7 +68,7 @@ void KDE4ProfileReader::readProperties(const KConfig& config, Profile::Ptr profi
groupName = properties->group;
}
QString name(properties->name);
QString name(QLatin1String(properties->name));
if (group.hasKey(name))
profile->setProperty(properties->property,
......
......@@ -44,7 +44,7 @@ QString KDE4ProfileWriter::getPath(const Profile::Ptr profile)
// the Konsole part can write/save profiles
static const QString localDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/konsole");
return localDataLocation % "/" % profile->untranslatedName() % ".profile";
return localDataLocation % QLatin1String("/") % profile->untranslatedName() % QLatin1String(".profile");
}
void KDE4ProfileWriter::writeProperties(KConfig& config,
const Profile::Ptr profile,
......@@ -61,7 +61,7 @@ void KDE4ProfileWriter::writeProperties(KConfig& config,
}
if (profile->isPropertySet(properties->property))
group.writeEntry(QString(properties->name),
group.writeEntry(QLatin1String(properties->name),
profile->property<QVariant>(properties->property));
}
......
......@@ -194,8 +194,8 @@ void Pty::setInitialWorkingDirectory(const QString& dir)
setWorkingDirectory(pwd);
// setting PWD to "." will cause problem for bash & zsh
if (pwd != ".")
setEnv("PWD", pwd);
if (pwd != QLatin1String("."))
setEnv(QStringLiteral("PWD"), pwd);
}
void Pty::addEnvironmentVariables(const QStringList& environmentVariables)
......@@ -204,7 +204,7 @@ void Pty::addEnvironmentVariables(const QStringList& environmentVariables)
foreach(const QString& pair, environmentVariables) {
// split on the first '=' character
const int separator = pair.indexOf('=');
const int separator = pair.indexOf(QLatin1Char('='));
if (separator >= 0) {
QString variable = pair.left(separator);
......@@ -212,7 +212,7 @@ void Pty::addEnvironmentVariables(const QStringList& environmentVariables)
setEnv(variable, value);
if (variable == "TERM") {
if (variable == QLatin1String("TERM")) {
isTermEnvAdded = true;
}
}
......@@ -220,7 +220,7 @@ void Pty::addEnvironmentVariables(const QStringList& environmentVariables)
// extra safeguard to make sure $TERM is always set
if (!isTermEnvAdded) {
setEnv("TERM", "xterm-256color");
setEnv(QStringLiteral("TERM"), QStringLiteral("xterm-256color"));
}
}
......@@ -249,7 +249,7 @@ int Pty::start(const QString& programName,
// does not have a translation for
//
// BR:149300
setEnv("LANGUAGE", QString(), false /* do not overwrite existing value if any */);
setEnv(QStringLiteral("LANGUAGE"), QString(), false /* do not overwrite existing value if any */);
KProcess::start();
......
......@@ -370,7 +370,7 @@ void Session::terminalWarning(const QString& message)
QString Session::shellSessionId() const
{
QString friendlyUuid(_uniqueIdentifier.toString());
friendlyUuid.remove('-').remove('{').remove('}');
friendlyUuid.remove(QLatin1Char('-')).remove(QLatin1Char('{')).remove(QLatin1Char('}'));
return friendlyUuid;
}
......
......@@ -68,10 +68,10 @@ QVariant SessionListModel::data(const QModelIndex& index, int role) const
// special handling for the "%w" marker which is replaced with the
// window title set by the shell
title.replace("%w", _sessions[row]->userTitle());
title.replace(QLatin1String("%w"), _sessions[row]->userTitle());
// special handling for the "%#" marker which is replaced with the
// number of the shell
title.replace("%#", QString::number(_sessions[row]->sessionId()));
title.replace(QLatin1String("%#"), QString::number(_sessions[row]->sessionId()));
return title;
} else if (column == 0) {
return _sessions[row]->sessionId();
......
......@@ -176,8 +176,8 @@ void SessionManager::applyProfile(Session* session, const Profile::Ptr profile ,
// add environment variable containing home directory of current profile
// (if specified)
QStringList environment = profile->environment();
environment << QString("PROFILEHOME=%1").arg(profile->defaultWorkingDirectory());
environment << QString("KONSOLE_PROFILE_NAME=%1").arg(profile->name());
environment << QStringLiteral("PROFILEHOME=%1").arg(profile->defaultWorkingDirectory());
environment << QStringLiteral("KONSOLE_PROFILE_NAME=%1").arg(profile->name());
session->setEnvironment(environment);
}
......
......@@ -48,7 +48,7 @@ QString ShellCommand::fullCommand() const
if (hasSpace)
quotedArgs[i] = '\"' + arg + '\"';
}
return quotedArgs.join(QChar(' '));
return quotedArgs.join(QLatin1Char(' '));
}
QString ShellCommand::command() const
{
......
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