More deprecation warnings.
This commit is contained in:
parent
3383df193b
commit
c3e935029e
|
@ -325,7 +325,7 @@ void VApplication::NewValentina(const QString &fileName)
|
|||
qCDebug(vApp, "New process without arguments. program = %s",
|
||||
qUtf8Printable(QCoreApplication::applicationFilePath()));
|
||||
// Path can contain spaces.
|
||||
if (QProcess::startDetached("\""+QCoreApplication::applicationFilePath()+"\""))
|
||||
if (QProcess::startDetached(QCoreApplication::applicationFilePath(), QStringList()))
|
||||
{
|
||||
qCDebug(vApp, "The process was started successfully.");
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ void VApplication::NewValentina(const QString &fileName)
|
|||
{
|
||||
const QString run = QStringLiteral("\"%1\" \"%2\"").arg(QCoreApplication::applicationFilePath(), fileName);
|
||||
qCDebug(vApp, "New process with arguments. program = %s", qUtf8Printable(run));
|
||||
if (QProcess::startDetached(run))
|
||||
if (QProcess::startDetached(QCoreApplication::applicationFilePath(), QStringList{fileName}))
|
||||
{
|
||||
qCDebug(vApp, "The process was started successfully.");
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include <QPixmapCache>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGlobalStatic>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "vabstractapplication.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
|
@ -396,49 +397,19 @@ QPixmap darkenPixmap(const QPixmap &pixmap)
|
|||
void ShowInGraphicalShell(const QString &filePath)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QStringList args;
|
||||
args << "-e";
|
||||
args << "tell application \"Finder\"";
|
||||
args << "-e";
|
||||
args << "activate";
|
||||
args << "-e";
|
||||
args << "select POSIX file \""+filePath+"\"";
|
||||
args << "-e";
|
||||
args << "end tell";
|
||||
QProcess::startDetached("osascript", args);
|
||||
QStringList args{
|
||||
"-e", "tell application \"Finder\"",
|
||||
"-e", "activate",
|
||||
"-e", "select POSIX file \""+filePath+"\"",
|
||||
"-e", "end tell"
|
||||
};
|
||||
QProcess::startDetached(QStringLiteral("osascript"), args);
|
||||
#elif defined(Q_OS_WIN)
|
||||
QProcess::startDetached(QString("explorer /select, \"%1\"").arg(QDir::toNativeSeparators(filePath)));
|
||||
QProcess::startDetached(QStringLiteral("explorer"), QStringList{"/select", QDir::toNativeSeparators(filePath)});
|
||||
#else
|
||||
const QString app = "xdg-open %d";
|
||||
QString cmd;
|
||||
for (int i = 0; i < app.size(); ++i)
|
||||
{
|
||||
QChar c = app.at(i);
|
||||
if (c == QLatin1Char('%') && i < app.size()-1)
|
||||
{
|
||||
c = app.at(++i);
|
||||
QString s;
|
||||
if (c == QLatin1Char('d'))
|
||||
{
|
||||
s = QLatin1Char('"') + QFileInfo(filePath).path() + QLatin1Char('"');
|
||||
}
|
||||
else if (c == QLatin1Char('%'))
|
||||
{
|
||||
s = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = QLatin1Char('%');
|
||||
s += c;
|
||||
}
|
||||
cmd += s;
|
||||
continue;
|
||||
}
|
||||
cmd += c;
|
||||
}
|
||||
QProcess::startDetached(cmd);
|
||||
// we cannot select a file here, because no file browser really supports it...
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(filePath).path()));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user