From 523f16bc109d596f9982b7cd95f0e7166a8266d2 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Wed, 24 Apr 2024 15:27:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(menu):=20=E4=BF=AE=E5=A4=8D=E4=BB=8E?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=8F=9C=E5=8D=95=E5=8F=B3=E9=94=AE=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E6=A1=8C=E9=9D=A2=E7=9A=84=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=97=A0=E5=8F=AF=E6=89=A7=E8=A1=8C=E6=9D=83?= =?UTF-8?q?=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension/menu/app-menu-plugin.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/extension/menu/app-menu-plugin.cpp b/src/extension/menu/app-menu-plugin.cpp index e50ef39..c37a1c4 100644 --- a/src/extension/menu/app-menu-plugin.cpp +++ b/src/extension/menu/app-menu-plugin.cpp @@ -146,10 +146,18 @@ void AppContentMenu::addToDesktopAction(QObject *parent, const QString &appId, Q } QObject::connect(list.last(), &QAction::triggered, parent, [appId, path] { - QFile file(appId); - bool ret = file.copy(path); - if (ret) { - QProcess::startDetached("chmod a+x ", {path}); + if (QFile::copy(appId, path)) { + // 设置权限755 + // QFile::Permissions permissions(0x0755); // 这也是可以的 + QFile::Permissions permissions = { + QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | + QFile::ReadGroup | QFile::ExeGroup | + QFile::ReadOther | QFile::ExeOther + }; + + if (QFile::setPermissions(path, permissions)) { + qWarning() << "set file permissions failed, file:" << path; + } } }); }