]> cloud.milkyroute.net Git - dolphin.git/commitdiff
GIT_SILENT: minor qstring optimization
authorLaurent Montel <montel@kde.org>
Sun, 8 Sep 2019 07:33:41 +0000 (09:33 +0200)
committerLaurent Montel <montel@kde.org>
Sun, 8 Sep 2019 07:33:41 +0000 (09:33 +0200)
16 files changed:
src/dolphincontextmenu.cpp
src/dolphinviewcontainer.cpp
src/global.cpp
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kstandarditemlistwidget.cpp
src/kitemviews/private/kbaloorolesprovider.cpp
src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp
src/panels/folders/folderspanel.cpp
src/panels/information/informationpanelcontent.cpp
src/panels/places/placespanel.cpp
src/search/dolphinfacetswidget.cpp
src/search/dolphinsearchbox.cpp
src/settings/applyviewpropsjob.cpp
src/settings/services/servicessettingspage.cpp
src/views/renamedialog.cpp
src/views/viewproperties.cpp

index 056da4d8dfa5c44fef27f5c614923e9f93d2158d..50bd9e515515a129048b861937a127cec4f93ec3 100644 (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")),
index 416a63e67c3bf6afdecb95cc390d247eefce210a..9af1bc92608c34cc8c491d09c80c65215599c36a 100644 (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()
index 12f86a2f369ace55f2dc082acdee69a09f6e479c..48e78e9eadec06eec42fd9daea27617c09df2652 100644 (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
index 091044c06c4e00480db701157891d3dbd49a525f..c11aae3d2b960582964125a950d33039aed60554 100644 (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);
     }
index 296cd9bbbfbbbfabce6d14436d914c37411ae103..617ed57f87ad7846a015e021aa75482b1b9e56ae 100644 (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)) {
index f3671540dd89c4e6d49fbfdfe18404d978d44c4b..8a2a64b31d5fdce3044cb7f193787fb6c03e09fd 100644 (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(", "));
 }
index ffa92a1cf0bd19cb578484a6076f4871333d6a06..8f18b92bf1694a838f1925709993bd2f73341284 100644 (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;
     }
 
index 020c41e552a263e5b1b97a8082bf74a775b3fbfa..01f338461f0d8990651ed615612cab5d239fa589 100644 (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));
index d54ed66b6f5171f1b18874eb82e4265310731f75..8c5d56da5e2468eee696581d58d8d9410b27a611 100644 (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();
 
index 3ee36dc08f61848f711b365ae116403fccf9cfa7..8469399a7ff98bcca3cd7f7c467d22be3f525c91 100644 (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;
index 7c0e97f86ca4f4f12a7e65fa6d0f267487094fe2..e4388f2e7a9ea20044be0582a3af81d89f24b3cd 100644 (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
index d846e5b6c44a7ef8487b26aa62ee6d54dc19f671..f3dd204626a77cd54f99ca34a2e41b3a19f7e0aa 100644 (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));
index b274bb8fbf52013697e73e83a843be161d320777..183c85225822af51e25644620c5845f46da98a01 100644 (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);
index ff00ca1774d33a8fc3b4e489285882bfb5f5557d..83672b556d5302e4c68b923205fe731e19e05c99 100644 (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) {
index 5d329c3ce57a9545631f878ddce8dbdbe2dafc5c..96068564d16dab31659d3c96507a24ef695aed53 100644 (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) {
index 48ed654715ca55ccdcbaa697eebdc5d6ba49edcd..e5f3a82c47172f548263655c384b43ec6689aa89 100644 (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")) {