Forráskód Böngészése

Replace deprecated use of QProcess::start()

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Felix Weilbach 4 éve
szülő
commit
b6e3c6d718
1 módosított fájl, 15 hozzáadás és 15 törlés
  1. 15 15
      src/gui/openfilemanager.cpp

+ 15 - 15
src/gui/openfilemanager.cpp

@@ -103,27 +103,27 @@ void showInFileManager(const QString &localPath)
                 return;
 #endif
 
-        QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
-        QFileInfo fi(localPath);
-
-        // canonicalFilePath returns empty if the file does not exist
-        if (!fi.canonicalFilePath().isEmpty()) {
-            QString nativeArgs;
-            if (!fi.isDir()) {
-                nativeArgs += QLatin1String("/select,");
-            }
-            nativeArgs += QLatin1Char('"');
-            nativeArgs += QDir::toNativeSeparators(fi.canonicalFilePath());
-            nativeArgs += QLatin1Char('"');
-
-            QProcess p;
+            const QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
+            QFileInfo fi(localPath);
+
+            // canonicalFilePath returns empty if the file does not exist
+            if (!fi.canonicalFilePath().isEmpty()) {
+                QString nativeArgs;
+                if (!fi.isDir()) {
+                    nativeArgs += QLatin1String("/select,");
+                }
+                nativeArgs += QLatin1Char('"');
+                nativeArgs += QDir::toNativeSeparators(fi.canonicalFilePath());
+                nativeArgs += QLatin1Char('"');
+
+                QProcess p;
 #ifdef Q_OS_WIN
             // QProcess on Windows tries to wrap the whole argument/program string
             // with quotes if it detects a space in it, but explorer wants the quotes
             // only around the path. Use setNativeArguments to bypass this logic.
             p.setNativeArguments(nativeArgs);
 #endif
-            p.start(explorer);
+            p.start(explorer, QStringList {});
             p.waitForFinished(5000);
         }
     } else if (Utility::isMac()) {