Commit 48a8a405 authored by Kurt Hindenburg's avatar Kurt Hindenburg

More changes to QLatin1String, QLatin1Char and QStringLiteral

parent b9c3cd66
......@@ -115,7 +115,7 @@ void Application::populateCommandLineParser(QCommandLineParser *parser)
QStringList Application::getCustomCommand(QStringList &args)
{
int i = args.indexOf("-e");
int i = args.indexOf(QLatin1String("-e"));
QStringList customCommand;
if ((0 < i) && (i < (args.size() - 1))) {
// -e was specified with at least one extra argument
......@@ -266,16 +266,16 @@ bool Application::processTabsFromFileArgs(MainWindow* window)
unsigned int sessions = 0;
while (!tabsFile.atEnd()) {
QString lineString(tabsFile.readLine().trimmed());
if ((lineString.isEmpty()) || (lineString[0] == '#'))
QString lineString(QString::fromUtf8(tabsFile.readLine()).trimmed());
if ((lineString.isEmpty()) || (lineString[0] == QLatin1Char('#')))
continue;
QHash<QString, QString> lineTokens;
QStringList lineParts = lineString.split(QStringLiteral(";;"), QString::SkipEmptyParts);
for (int i = 0; i < lineParts.size(); ++i) {
QString key = lineParts.at(i).section(':', 0, 0).trimmed().toLower();
QString value = lineParts.at(i).section(':', 1, -1).trimmed();
QString key = lineParts.at(i).section(QLatin1Char(':'), 0, 0).trimmed().toLower();
QString value = lineParts.at(i).section(QLatin1Char(':'), 1, -1).trimmed();
lineTokens[key] = value;
}
// should contain at least one of 'command' and 'profile'
......@@ -323,7 +323,7 @@ void Application::createTabFromArgs(MainWindow* window,
if (!command.isEmpty()) {
newProfile->setProperty(Profile::Command, command);
newProfile->setProperty(Profile::Arguments, command.split(' '));
newProfile->setProperty(Profile::Arguments, command.split(QLatin1Char(' ')));
shouldUseNewProfile = true;
}
......@@ -480,7 +480,7 @@ Profile::Ptr Application::processProfileChangeArgs(Profile::Ptr baseProfile)
}
// temporary changes to profile options specified on the command line
foreach(const QString & value , m_parser->values("p")) {
foreach(const QString & value , m_parser->values(QLatin1String("p"))) {
ProfileCommandParser parser;
QHashIterator<Profile::Property, QVariant> iter(parser.parse(value));
......
......@@ -158,7 +158,7 @@ void MainWindow::rememberMenuAccelerators()
void MainWindow::removeMenuAccelerators()
{
foreach(QAction* menuItem, menuBar()->actions()) {
menuItem->setText(menuItem->text().replace('&', QString()));
menuItem->setText(menuItem->text().replace(QLatin1Char('&'), QString()));
}
}
......@@ -384,7 +384,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
// NOTE: defaultProfile seems to not work here, sigh.
Profile::Ptr profile = ProfileManager::instance()->defaultProfile();
if (profile && profile->name() == sessionAction->text().remove('&')) {
if (profile && profile->name() == sessionAction->text().remove(QLatin1Char('&'))) {
QIcon icon(KIconLoader::global()->loadIcon(profile->icon(), KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList(QStringLiteral("emblem-favorite"))));
sessionAction->setIcon(icon);
_newTabMenuAction->menu()->setDefaultAction(sessionAction);
......@@ -402,7 +402,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
Profile::Ptr profile = ProfileManager::instance()->defaultProfile();
// NOTE: Compare names w/o any '&'
if (sessionActions.size() == 2 && sessionActions[1]->text().remove('&') != profile->name()) {
if (sessionActions.size() == 2 && sessionActions[1]->text().remove(QLatin1Char('&')) != profile->name()) {
_newTabMenuAction->menu()->addAction(sessionActions[1]);
} else {
_newTabMenuAction->menu()->deleteLater();
......@@ -491,13 +491,13 @@ Session* MainWindow::createSSHSession(Profile::Ptr profile, const QUrl& url)
sshCommand += QStringLiteral("-p %1 ").arg(url.port());
}
if (!url.userName().isEmpty()) {
sshCommand += (url.userName() + '@');
sshCommand += (url.userName() + QLatin1Char('@'));
}
if (!url.host().isEmpty()) {
sshCommand += url.host();
}
session->sendTextToTerminal(sshCommand, '\r');
session->sendTextToTerminal(sshCommand, QLatin1Char('\r'));
// create view before starting the session process so that the session
// doesn't suffer a change in terminal size right after the session
......@@ -540,8 +540,8 @@ bool MainWindow::queryClose()
continue;
}
const QString defaultProc = session->program().split('/').last();
const QString currentProc = session->foregroundProcessName().split('/').last();
const QString defaultProc = session->program().split(QLatin1Char('/')).last();
const QString currentProc = session->foregroundProcessName().split(QLatin1Char('/')).last();
if (currentProc.isEmpty())
continue;
......
......@@ -46,7 +46,7 @@ QString ShellCommand::fullCommand() const
if (arg[j].isSpace())
hasSpace = true;
if (hasSpace)
quotedArgs[i] = '\"' + arg + '\"';
quotedArgs[i] = QLatin1Char('\"') + arg + QLatin1Char('\"');
}
return quotedArgs.join(QLatin1Char(' '));
}
......
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