GIT_SILENT: minor qstring optimization

This commit is contained in:
Laurent Montel 2019-09-08 09:33:41 +02:00
parent dfe713edf0
commit 81065795b7
16 changed files with 18 additions and 18 deletions

View file

@ -230,7 +230,7 @@ void DolphinContextMenu::openItemContextMenu()
addMenu(menu);
addSeparator();
} else if (m_baseUrl.scheme().contains(QStringLiteral("search")) || m_baseUrl.scheme().contains(QStringLiteral("timeline"))) {
} else if (m_baseUrl.scheme().contains(QLatin1String("search")) || m_baseUrl.scheme().contains(QLatin1String("timeline"))) {
addOpenWithActions(fileItemActions);
openParentAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open-folder")),

View file

@ -699,7 +699,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
app = browser;
if (app.startsWith('!')) {
// a literal command has been configured, remove the '!' prefix
app = app.mid(1);
app.remove(0, 1);
}
}
} else {
@ -787,7 +787,7 @@ void DolphinViewContainer::showErrorMessage(const QString& msg)
bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
{
return url.scheme().contains(QStringLiteral("search"));
return url.scheme().contains(QLatin1String("search"));
}
void DolphinViewContainer::saveViewState()

View file

@ -94,7 +94,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
// Don't match the service without trailing "-" (unique instance)
const QString pattern = QStringLiteral("org.kde.dolphin-");
// Don't match the pid without leading "-"
const QString myPid = QStringLiteral("-") + QString::number(QCoreApplication::applicationPid());
const QString myPid = QLatin1Char('-') + QString::number(QCoreApplication::applicationPid());
for (const QString& service : services) {
if (service.startsWith(pattern) && !service.endsWith(myPid)) {
// Check if instance can handle our URLs

View file

@ -1607,7 +1607,7 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
if (m_requestRole[DestinationRole]) {
QString destination = item.linkDest();
if (destination.isEmpty()) {
destination = QStringLiteral("-");
destination = QLatin1Char('-');
}
data.insert(sharedValue("destination"), destination);
}

View file

@ -1482,7 +1482,7 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStrin
size *= qApp->devicePixelRatio();
requestedSize *= qApp->devicePixelRatio();
const QString key = "KStandardItemListWidget:" % name % ":" % overlays.join(QStringLiteral(":")) % ":" % QString::number(size) % ":" % QString::number(mode);
const QString key = "KStandardItemListWidget:" % name % ":" % overlays.join(QLatin1Char(':')) % ":" % QString::number(size) % ":" % QString::number(mode);
QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) {

View file

@ -155,5 +155,5 @@ QString KBalooRolesProvider::tagsFromValues(const QStringList& values) const
QCollator coll;
coll.setNumericMode(true);
std::sort(alphabeticalOrderTags.begin(), alphabeticalOrderTags.end(), [&](const QString& s1, const QString& s2){ return coll.compare(s1, s2) < 0; });
return alphabeticalOrderTags.join(QStringLiteral(", "));
return alphabeticalOrderTags.join(QLatin1String(", "));
}

View file

@ -46,7 +46,7 @@ void KItemListKeyboardSearchManager::addKeys(const QString& keys)
// Do not start a new search if the user pressed Space. Only add
// it to the search string if a search is in progress already.
if (newSearch && keys == QLatin1String(" ")) {
if (newSearch && keys == QLatin1Char(' ')) {
return;
}

View file

@ -111,7 +111,7 @@ void FoldersPanel::rename(const KFileItem& item)
bool FoldersPanel::urlChanged()
{
if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
if (!url().isValid() || url().scheme().contains(QLatin1String("search"))) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
@ -258,7 +258,7 @@ void FoldersPanel::slotRoleEditingFinished(int index, const QByteArray& role, co
if (role == "text") {
const KFileItem item = m_model->fileItem(index);
const QString newName = value.toString();
if (!newName.isEmpty() && newName != item.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
if (!newName.isEmpty() && newName != item.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) {
const QUrl oldUrl = item.url();
QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));

View file

@ -223,7 +223,7 @@ void InformationPanelContent::refreshPreview()
if (InformationPanelSettings::previewsShown()) {
const QUrl itemUrl = m_item.url();
const bool isSearchUrl = itemUrl.scheme().contains(QStringLiteral("search")) && m_item.localPath().isEmpty();
const bool isSearchUrl = itemUrl.scheme().contains(QLatin1String("search")) && m_item.localPath().isEmpty();
if (isSearchUrl) {
m_preview->show();

View file

@ -77,7 +77,7 @@ void PlacesPanel::proceedWithTearDown()
bool PlacesPanel::urlChanged()
{
if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
if (!url().isValid() || url().scheme().contains(QLatin1String("search"))) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;

View file

@ -150,7 +150,7 @@ QString DolphinFacetsWidget::ratingTerm() const
terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate));
}
return terms.join(QStringLiteral(" AND "));
return terms.join(QLatin1String(" AND "));
}
QString DolphinFacetsWidget::facetType() const

View file

@ -505,7 +505,7 @@ QUrl DolphinSearchBox::balooUrlForSearching() const
query.setIncludeFolder(m_searchPath.toLocalFile());
}
query.setSearchString(queryStrings.join(QStringLiteral(" ")));
query.setSearchString(queryStrings.join(QLatin1Char(' ')));
return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
"Query Results from '%1'", text));

View file

@ -54,7 +54,7 @@ void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list)
{
foreach (const KIO::UDSEntry& entry, list) {
const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME);
if (name != QLatin1String(".") && name != QLatin1String("..") && entry.isDir()) {
if (name != QLatin1Char('.') && name != QLatin1String("..") && entry.isDir()) {
++m_progress;
QUrl url(m_dir);

View file

@ -222,7 +222,7 @@ void ServicesSettingsPage::loadServices()
// Load JSON-based plugins that implement the KFileItemActionPlugin interface
const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction"), [](const KPluginMetaData& metaData) {
return metaData.serviceTypes().contains(QStringLiteral("KFileItemAction/Plugin"));
return metaData.serviceTypes().contains(QLatin1String("KFileItemAction/Plugin"));
});
foreach (const auto& jsonMetadata, jsonPlugins) {

View file

@ -188,7 +188,7 @@ void RenameDialog::slotAccepted()
void RenameDialog::slotTextChanged(const QString& newName)
{
bool enable = !newName.isEmpty() && (newName != QLatin1String("..")) && (newName != QLatin1String("."));
bool enable = !newName.isEmpty() && (newName != QLatin1String("..")) && (newName != QLatin1Char('.'));
if (enable && !m_renameOneItem) {
const int count = newName.count(QLatin1Char('#'));
if (count == 0) {

View file

@ -59,7 +59,7 @@ ViewProperties::ViewProperties(const QUrl& url) :
// we store the properties information in a local file.
if (useGlobalViewProps) {
m_filePath = destinationDir(QStringLiteral("global"));
} else if (url.scheme().contains(QStringLiteral("search"))) {
} else if (url.scheme().contains(QLatin1String("search"))) {
m_filePath = destinationDir(QStringLiteral("search/")) + directoryHashForUrl(url);
useDetailsViewWithPath = true;
} else if (url.scheme() == QLatin1String("trash")) {