mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
GIT_SILENT: minor qstring optimization
This commit is contained in:
parent
dfe713edf0
commit
81065795b7
|
@ -230,7 +230,7 @@ void DolphinContextMenu::openItemContextMenu()
|
||||||
addMenu(menu);
|
addMenu(menu);
|
||||||
|
|
||||||
addSeparator();
|
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);
|
addOpenWithActions(fileItemActions);
|
||||||
|
|
||||||
openParentAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open-folder")),
|
openParentAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open-folder")),
|
||||||
|
|
|
@ -699,7 +699,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
|
||||||
app = browser;
|
app = browser;
|
||||||
if (app.startsWith('!')) {
|
if (app.startsWith('!')) {
|
||||||
// a literal command has been configured, remove the '!' prefix
|
// a literal command has been configured, remove the '!' prefix
|
||||||
app = app.mid(1);
|
app.remove(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -787,7 +787,7 @@ void DolphinViewContainer::showErrorMessage(const QString& msg)
|
||||||
|
|
||||||
bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
|
bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
|
||||||
{
|
{
|
||||||
return url.scheme().contains(QStringLiteral("search"));
|
return url.scheme().contains(QLatin1String("search"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::saveViewState()
|
void DolphinViewContainer::saveViewState()
|
||||||
|
|
|
@ -94,7 +94,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
|
||||||
// Don't match the service without trailing "-" (unique instance)
|
// Don't match the service without trailing "-" (unique instance)
|
||||||
const QString pattern = QStringLiteral("org.kde.dolphin-");
|
const QString pattern = QStringLiteral("org.kde.dolphin-");
|
||||||
// Don't match the pid without leading "-"
|
// 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) {
|
for (const QString& service : services) {
|
||||||
if (service.startsWith(pattern) && !service.endsWith(myPid)) {
|
if (service.startsWith(pattern) && !service.endsWith(myPid)) {
|
||||||
// Check if instance can handle our URLs
|
// Check if instance can handle our URLs
|
||||||
|
|
|
@ -1607,7 +1607,7 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
|
||||||
if (m_requestRole[DestinationRole]) {
|
if (m_requestRole[DestinationRole]) {
|
||||||
QString destination = item.linkDest();
|
QString destination = item.linkDest();
|
||||||
if (destination.isEmpty()) {
|
if (destination.isEmpty()) {
|
||||||
destination = QStringLiteral("-");
|
destination = QLatin1Char('-');
|
||||||
}
|
}
|
||||||
data.insert(sharedValue("destination"), destination);
|
data.insert(sharedValue("destination"), destination);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1482,7 +1482,7 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStrin
|
||||||
size *= qApp->devicePixelRatio();
|
size *= qApp->devicePixelRatio();
|
||||||
requestedSize *= 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;
|
QPixmap pixmap;
|
||||||
|
|
||||||
if (!QPixmapCache::find(key, pixmap)) {
|
if (!QPixmapCache::find(key, pixmap)) {
|
||||||
|
|
|
@ -155,5 +155,5 @@ QString KBalooRolesProvider::tagsFromValues(const QStringList& values) const
|
||||||
QCollator coll;
|
QCollator coll;
|
||||||
coll.setNumericMode(true);
|
coll.setNumericMode(true);
|
||||||
std::sort(alphabeticalOrderTags.begin(), alphabeticalOrderTags.end(), [&](const QString& s1, const QString& s2){ return coll.compare(s1, s2) < 0; });
|
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(", "));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ void KItemListKeyboardSearchManager::addKeys(const QString& keys)
|
||||||
|
|
||||||
// Do not start a new search if the user pressed Space. Only add
|
// 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.
|
// it to the search string if a search is in progress already.
|
||||||
if (newSearch && keys == QLatin1String(" ")) {
|
if (newSearch && keys == QLatin1Char(' ')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ void FoldersPanel::rename(const KFileItem& item)
|
||||||
|
|
||||||
bool FoldersPanel::urlChanged()
|
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
|
// Skip results shown by a search, as possible identical
|
||||||
// directory names are useless without parent-path information.
|
// directory names are useless without parent-path information.
|
||||||
return false;
|
return false;
|
||||||
|
@ -258,7 +258,7 @@ void FoldersPanel::slotRoleEditingFinished(int index, const QByteArray& role, co
|
||||||
if (role == "text") {
|
if (role == "text") {
|
||||||
const KFileItem item = m_model->fileItem(index);
|
const KFileItem item = m_model->fileItem(index);
|
||||||
const QString newName = value.toString();
|
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();
|
const QUrl oldUrl = item.url();
|
||||||
QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
|
QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
|
||||||
newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));
|
newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));
|
||||||
|
|
|
@ -223,7 +223,7 @@ void InformationPanelContent::refreshPreview()
|
||||||
if (InformationPanelSettings::previewsShown()) {
|
if (InformationPanelSettings::previewsShown()) {
|
||||||
|
|
||||||
const QUrl itemUrl = m_item.url();
|
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) {
|
if (isSearchUrl) {
|
||||||
m_preview->show();
|
m_preview->show();
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ void PlacesPanel::proceedWithTearDown()
|
||||||
|
|
||||||
bool PlacesPanel::urlChanged()
|
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
|
// Skip results shown by a search, as possible identical
|
||||||
// directory names are useless without parent-path information.
|
// directory names are useless without parent-path information.
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -150,7 +150,7 @@ QString DolphinFacetsWidget::ratingTerm() const
|
||||||
terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate));
|
terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate));
|
||||||
}
|
}
|
||||||
|
|
||||||
return terms.join(QStringLiteral(" AND "));
|
return terms.join(QLatin1String(" AND "));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DolphinFacetsWidget::facetType() const
|
QString DolphinFacetsWidget::facetType() const
|
||||||
|
|
|
@ -505,7 +505,7 @@ QUrl DolphinSearchBox::balooUrlForSearching() const
|
||||||
query.setIncludeFolder(m_searchPath.toLocalFile());
|
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.",
|
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));
|
"Query Results from '%1'", text));
|
||||||
|
|
|
@ -54,7 +54,7 @@ void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list)
|
||||||
{
|
{
|
||||||
foreach (const KIO::UDSEntry& entry, list) {
|
foreach (const KIO::UDSEntry& entry, list) {
|
||||||
const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME);
|
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;
|
++m_progress;
|
||||||
|
|
||||||
QUrl url(m_dir);
|
QUrl url(m_dir);
|
||||||
|
|
|
@ -222,7 +222,7 @@ void ServicesSettingsPage::loadServices()
|
||||||
|
|
||||||
// Load JSON-based plugins that implement the KFileItemActionPlugin interface
|
// Load JSON-based plugins that implement the KFileItemActionPlugin interface
|
||||||
const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction"), [](const KPluginMetaData& metaData) {
|
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) {
|
foreach (const auto& jsonMetadata, jsonPlugins) {
|
||||||
|
|
|
@ -188,7 +188,7 @@ void RenameDialog::slotAccepted()
|
||||||
|
|
||||||
void RenameDialog::slotTextChanged(const QString& newName)
|
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) {
|
if (enable && !m_renameOneItem) {
|
||||||
const int count = newName.count(QLatin1Char('#'));
|
const int count = newName.count(QLatin1Char('#'));
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ ViewProperties::ViewProperties(const QUrl& url) :
|
||||||
// we store the properties information in a local file.
|
// we store the properties information in a local file.
|
||||||
if (useGlobalViewProps) {
|
if (useGlobalViewProps) {
|
||||||
m_filePath = destinationDir(QStringLiteral("global"));
|
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);
|
m_filePath = destinationDir(QStringLiteral("search/")) + directoryHashForUrl(url);
|
||||||
useDetailsViewWithPath = true;
|
useDetailsViewWithPath = true;
|
||||||
} else if (url.scheme() == QLatin1String("trash")) {
|
} else if (url.scheme() == QLatin1String("trash")) {
|
||||||
|
|
Loading…
Reference in a new issue