fix: 增加DBus接口调用异常信息
使用QDBusContext::sendErrorReply()增加异常返回信息 Log: Influence: org.desktopspec.ApplicationManager服务中接口调用异常时,有提示信息 Bug: https://pms.uniontech.com/bug-view-172281.html Change-Id: Iad2edda7479c284793ec55236292fea0317e5a8c
This commit is contained in:
parent
d0d5bcfdbf
commit
dda953582b
@ -85,8 +85,10 @@ QStringList StartManager::autostartList()
|
|||||||
*/
|
*/
|
||||||
bool StartManager::isAutostart(const QString &desktop)
|
bool StartManager::isAutostart(const QString &desktop)
|
||||||
{
|
{
|
||||||
if (!desktop.endsWith(DESKTOPEXT))
|
if (!desktop.endsWith(DESKTOPEXT)) {
|
||||||
|
qWarning() << "invalid desktop path";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QFileInfo file(desktop);
|
QFileInfo file(desktop);
|
||||||
for (auto autostartDir : BaseDir::autoStartDirs()) {
|
for (auto autostartDir : BaseDir::autoStartDirs()) {
|
||||||
@ -108,21 +110,23 @@ bool StartManager::isMemSufficient()
|
|||||||
return SETTING->getMemCheckerEnabled() ? MemInfo::isSufficient(minMemAvail, maxSwapUsed) : true;
|
return SETTING->getMemCheckerEnabled() ? MemInfo::isSufficient(minMemAvail, maxSwapUsed) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::launchApp(const QString &desktopFile)
|
bool StartManager::launchApp(const QString &desktopFile)
|
||||||
{
|
{
|
||||||
doLaunchAppWithOptions(desktopFile);
|
return doLaunchAppWithOptions(desktopFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::launchApp(QString desktopFile, uint32_t timestamp, QStringList files)
|
bool StartManager::launchApp(QString desktopFile, uint32_t timestamp, QStringList files)
|
||||||
{
|
{
|
||||||
doLaunchAppWithOptions(desktopFile, timestamp, files, QMap<QString, QString>());
|
return doLaunchAppWithOptions(desktopFile, timestamp, files, QMap<QString, QString>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp)
|
bool StartManager::launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp)
|
||||||
{
|
{
|
||||||
DesktopInfo info(desktopFile.toStdString());
|
DesktopInfo info(desktopFile.toStdString());
|
||||||
if (!info.isValidDesktop())
|
if (!info.isValidDesktop()) {
|
||||||
return;
|
qWarning() << "invalid arguments";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
DesktopAction targetAction;
|
DesktopAction targetAction;
|
||||||
for (auto action : info.getActions()) {
|
for (auto action : info.getActions()) {
|
||||||
@ -134,33 +138,34 @@ void StartManager::launchAppAction(QString desktopFile, QString actionSection, u
|
|||||||
|
|
||||||
if (targetAction.section.empty()) {
|
if (targetAction.section.empty()) {
|
||||||
qWarning() << "launchAppAction: targetAction section is empty";
|
qWarning() << "launchAppAction: targetAction section is empty";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetAction.exec.empty()) {
|
if (targetAction.exec.empty()) {
|
||||||
qInfo() << "launchAppAction: targetAction exe is empty";
|
qInfo() << "launchAppAction: targetAction exe is empty";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
launch(&info, targetAction.exec.c_str(), timestamp, QStringList());
|
launch(&info, targetAction.exec.c_str(), timestamp, QStringList());
|
||||||
|
|
||||||
// mark app launched
|
// mark app launched
|
||||||
dbusHandler->markLaunched(desktopFile);
|
dbusHandler->markLaunched(desktopFile);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options)
|
bool StartManager::launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options)
|
||||||
{
|
{
|
||||||
doLaunchAppWithOptions(desktopFile, timestamp, files, options);
|
return doLaunchAppWithOptions(desktopFile, timestamp, files, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::runCommand(QString exe, QStringList args)
|
bool StartManager::runCommand(QString exe, QStringList args)
|
||||||
{
|
{
|
||||||
doRunCommandWithOptions(exe, args, QMap<QString, QString>());
|
return doRunCommandWithOptions(exe, args, QMap<QString, QString>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
bool StartManager::runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
||||||
{
|
{
|
||||||
doRunCommandWithOptions(exe, args, options);
|
return doRunCommandWithOptions(exe, args, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartManager::onAutoStartupPathChange(const QString &path)
|
void StartManager::onAutoStartupPathChange(const QString &path)
|
||||||
@ -251,60 +256,59 @@ void StartManager::onAutoStartupPathChange(const QString &path)
|
|||||||
|
|
||||||
bool StartManager::setAutostart(const QString &desktop, const bool value)
|
bool StartManager::setAutostart(const QString &desktop, const bool value)
|
||||||
{
|
{
|
||||||
if (!desktop.endsWith(".desktop")) {
|
QFileInfo fileInfo(desktop);
|
||||||
qWarning() << "invalid desktop item...";
|
if (!desktop.endsWith(".desktop") && !fileInfo.isAbsolute()) {
|
||||||
|
qWarning() << "invalid desktop path";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString desktopFullPath = desktop;
|
bool exist = false;
|
||||||
QFileInfo info(desktopFullPath);
|
|
||||||
if (!info.isAbsolute()) {
|
|
||||||
for (const std::string &appDir : BaseDir::appDirs()) {
|
for (const std::string &appDir : BaseDir::appDirs()) {
|
||||||
QDir dir(appDir.c_str());
|
QDir dir(appDir.c_str());
|
||||||
dir.setFilter(QDir::Files);
|
dir.setFilter(QDir::Files);
|
||||||
dir.setNameFilters({ "*.desktop" });
|
dir.setNameFilters({ "*.desktop" });
|
||||||
for (const auto &entry : dir.entryInfoList()) {
|
for (const auto &entry : dir.entryInfoList()) {
|
||||||
const QString &desktopPath = entry.absoluteFilePath();
|
const QString &desktopPath = entry.absoluteFilePath();
|
||||||
if (!desktopPath.contains(desktop))
|
if (desktopPath == desktop) {
|
||||||
continue;
|
exist = true;
|
||||||
|
|
||||||
desktopFullPath = desktopPath;
|
|
||||||
info.setFile(desktopFullPath);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exist)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 本地没有找到该应用就直接返回
|
// 本地没有找到该应用就直接返回
|
||||||
if (!info.isAbsolute()) {
|
if (!exist) {
|
||||||
qWarning() << "invalid item...";
|
qWarning() << "no such file or directory";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir autostartDir(BaseDir::userAutoStartDir().c_str());
|
QDir autostartDir(BaseDir::userAutoStartDir().c_str());
|
||||||
const QString &appId = info.baseName();
|
const QString &appId = fileInfo.baseName();
|
||||||
|
|
||||||
if (value && isAutostart(desktopFullPath)) {
|
if (value && isAutostart(desktop)) {
|
||||||
qWarning() << "invalid desktop or item is already in the autostart list.";
|
qWarning() << "invalid path or item is already in the autostart list.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value && !isAutostart(desktopFullPath)) {
|
if (!value && !isAutostart(desktop)) {
|
||||||
qWarning() << "can't find autostart item";
|
qWarning() << "invalid path or item is not in the autostart list.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &autostartDesktopPath = autostartDir.path() + QString("/") + info.fileName();
|
const QString &autostartDesktopPath = autostartDir.path() + QString("/") + fileInfo.fileName();
|
||||||
if (value && !m_autostartFiles.contains(autostartDesktopPath)) {
|
if (value && !m_autostartFiles.contains(autostartDesktopPath)) {
|
||||||
m_autostartFiles.push_back(autostartDesktopPath);
|
m_autostartFiles.push_back(autostartDesktopPath);
|
||||||
|
|
||||||
// 建立映射关系
|
// 建立映射关系
|
||||||
if (!m_desktopDirToAutostartDirMap.keys().contains(desktopFullPath))
|
if (!m_desktopDirToAutostartDirMap.keys().contains(desktop))
|
||||||
m_desktopDirToAutostartDirMap[desktopFullPath] = autostartDesktopPath;
|
m_desktopDirToAutostartDirMap[desktop] = autostartDesktopPath;
|
||||||
|
|
||||||
const bool ret = QFile::copy(info.filePath(), autostartDesktopPath);
|
const bool ret = QFile::copy(fileInfo.filePath(), autostartDesktopPath);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
qWarning() << "add to autostart list failed...";
|
qWarning() << "add to autostart list failed.";
|
||||||
|
|
||||||
/* 设置为自启动时,手动将Hidden字段写入到自启动目录的desktop文件中,并设置为false,只有这样,
|
/* 设置为自启动时,手动将Hidden字段写入到自启动目录的desktop文件中,并设置为false,只有这样,
|
||||||
* 安全中心才不会弹出自启动确认窗口, 这种操作是沿用V20阶段的约定规范,这块已经与安全中心研发对接过 */
|
* 安全中心才不会弹出自启动确认窗口, 这种操作是沿用V20阶段的约定规范,这块已经与安全中心研发对接过 */
|
||||||
@ -316,17 +320,17 @@ bool StartManager::setAutostart(const QString &desktop, const bool value)
|
|||||||
kf.saveToFile(autostartDesktopPath.toStdString());
|
kf.saveToFile(autostartDesktopPath.toStdString());
|
||||||
} else if (!value && m_autostartFiles.contains(autostartDesktopPath)) {
|
} else if (!value && m_autostartFiles.contains(autostartDesktopPath)) {
|
||||||
// 删除映射关系
|
// 删除映射关系
|
||||||
if (m_desktopDirToAutostartDirMap.keys().contains(desktopFullPath))
|
if (m_desktopDirToAutostartDirMap.keys().contains(desktop))
|
||||||
m_desktopDirToAutostartDirMap.remove(desktopFullPath);
|
m_desktopDirToAutostartDirMap.remove(desktop);
|
||||||
|
|
||||||
m_autostartFiles.removeAll(autostartDesktopPath);
|
m_autostartFiles.removeAll(autostartDesktopPath);
|
||||||
autostartDir.remove(info.fileName());
|
autostartDir.remove(fileInfo.fileName());
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "error happen...";
|
qWarning() << "invalid path or item is not in the autostart list.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT autostartChanged(value ? autostartAdded : autostartDeleted, desktopFullPath);
|
Q_EMIT autostartChanged(value ? autostartAdded : autostartDeleted, desktop);
|
||||||
setIsDBusCalled(false);
|
setIsDBusCalled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -334,8 +338,10 @@ bool StartManager::setAutostart(const QString &desktop, const bool value)
|
|||||||
bool StartManager::doLaunchAppWithOptions(const QString &desktopFile)
|
bool StartManager::doLaunchAppWithOptions(const QString &desktopFile)
|
||||||
{
|
{
|
||||||
DesktopInfo info(desktopFile.toStdString());
|
DesktopInfo info(desktopFile.toStdString());
|
||||||
if (!info.isValidDesktop())
|
if (!info.isValidDesktop()) {
|
||||||
|
qWarning() << "invalid desktop path";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
launch(&info, info.getCommandLine().c_str(), 0, QStringList());
|
launch(&info, info.getCommandLine().c_str(), 0, QStringList());
|
||||||
|
|
||||||
@ -348,8 +354,10 @@ bool StartManager::doLaunchAppWithOptions(QString desktopFile, uint32_t timestam
|
|||||||
{
|
{
|
||||||
// launchApp
|
// launchApp
|
||||||
DesktopInfo info(desktopFile.toStdString());
|
DesktopInfo info(desktopFile.toStdString());
|
||||||
if (!info.isValidDesktop())
|
if (!info.isValidDesktop()) {
|
||||||
|
qWarning() << "invalid desktop path";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (options.find("path") != options.end()) {
|
if (options.find("path") != options.end()) {
|
||||||
info.getKeyFile()->setKey(MainSection, KeyPath, options["path"].toStdString());
|
info.getKeyFile()->setKey(MainSection, KeyPath, options["path"].toStdString());
|
||||||
@ -360,7 +368,7 @@ bool StartManager::doLaunchAppWithOptions(QString desktopFile, uint32_t timestam
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info.getCommandLine().empty()) {
|
if (info.getCommandLine().empty()) {
|
||||||
qInfo() << "command line is empty";
|
qWarning() << "command line is empty";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ public:
|
|||||||
QStringList autostartList();
|
QStringList autostartList();
|
||||||
bool isAutostart(const QString &desktop);
|
bool isAutostart(const QString &desktop);
|
||||||
bool isMemSufficient();
|
bool isMemSufficient();
|
||||||
void launchApp(const QString &desktopFile);
|
bool launchApp(const QString &desktopFile);
|
||||||
void launchApp(QString desktopFile, uint32_t timestamp, QStringList files);
|
bool launchApp(QString desktopFile, uint32_t timestamp, QStringList files);
|
||||||
void launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
|
bool launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
|
||||||
void launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
|
bool launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
|
||||||
void runCommand(QString exe, QStringList args);
|
bool runCommand(QString exe, QStringList args);
|
||||||
void runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
bool runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void autostartChanged(const QString &status, const QString &fileName);
|
void autostartChanged(const QString &status, const QString &fileName);
|
||||||
|
@ -249,26 +249,57 @@ QList<QDBusObjectPath> ApplicationManager::GetInstances(const QString& id)
|
|||||||
bool ApplicationManager::AddAutostart(const QString &desktop)
|
bool ApplicationManager::AddAutostart(const QString &desktop)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid())
|
if (!d->checkDMsgUid()) {
|
||||||
return false;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
return d->startManager->addAutostart(desktop);
|
qWarning() << "check msg failed...";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->addAutostart(desktop)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplicationManager::RemoveAutostart(const QString &fileName)
|
bool ApplicationManager::RemoveAutostart(const QString &fileName)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid())
|
if (!d->checkDMsgUid()) {
|
||||||
return false;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
return d->startManager->removeAutostart(fileName);
|
qWarning() << "check msg failed...";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->removeAutostart(fileName)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ApplicationManager::AutostartList()
|
QStringList ApplicationManager::AutostartList()
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid())
|
if (!d->checkDMsgUid()) {
|
||||||
return {};
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
|
qWarning() << "check msg failed...";
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
return d->startManager->autostartList();
|
return d->startManager->autostartList();
|
||||||
}
|
}
|
||||||
@ -276,56 +307,119 @@ QStringList ApplicationManager::AutostartList()
|
|||||||
bool ApplicationManager::IsAutostart(const QString &fileName)
|
bool ApplicationManager::IsAutostart(const QString &fileName)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid())
|
if (!d->checkDMsgUid()) {
|
||||||
return false;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
return d->startManager->isAutostart(fileName);
|
qWarning() << "check msg failed...";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->isAutostart(fileName)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationManager::Launch(const QString &desktopFile, bool withMsgCheck)
|
void ApplicationManager::Launch(const QString &desktopFile, bool withMsgCheck)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (withMsgCheck && !d->checkDMsgUid())
|
if (withMsgCheck && !d->checkDMsgUid()) {
|
||||||
return;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
d->startManager->launchApp(desktopFile);
|
qWarning() << "check msg failed...";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->launchApp(desktopFile)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ApplicationManager::LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files, bool withMsgCheck)
|
void ApplicationManager::LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files, bool withMsgCheck)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (withMsgCheck && !d->checkDMsgUid())
|
if (withMsgCheck && !d->checkDMsgUid()) {
|
||||||
return;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
d->startManager->launchApp(desktopFile, timestamp, files);
|
qWarning() << "check msg failed...";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->launchApp(desktopFile, timestamp, files)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationManager::LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp, bool withMsgCheck)
|
void ApplicationManager::LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp, bool withMsgCheck)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (withMsgCheck && !d->checkDMsgUid())
|
if (withMsgCheck && !d->checkDMsgUid()) {
|
||||||
return;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
d->startManager->launchAppAction(desktopFile, action, timestamp);
|
qWarning() << "check msg failed...";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->launchAppAction(desktopFile, action, timestamp)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationManager::LaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options)
|
void ApplicationManager::LaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid())
|
if (!d->checkDMsgUid()) {
|
||||||
return;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
d->startManager->launchAppWithOptions(desktopFile, timestamp, files, options);
|
qWarning() << "check msg failed...";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->launchAppWithOptions(desktopFile, timestamp, files, options)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationManager::RunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
void ApplicationManager::RunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid())
|
if (!d->checkDMsgUid()) {
|
||||||
return;
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::Failed, "The call failed");
|
||||||
|
|
||||||
d->startManager->runCommandWithOptions(exe, args, options);
|
qWarning() << "check msg failed...";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d->startManager->runCommandWithOptions(exe, args, options)) {
|
||||||
|
if (calledFromDBus())
|
||||||
|
sendErrorReply(QDBusError::InvalidArgs, "invalid arguments");
|
||||||
|
|
||||||
|
qWarning() << "invalid arguments";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QDBusObjectPath> ApplicationManager::instances() const
|
QList<QDBusObjectPath> ApplicationManager::instances() const
|
||||||
|
Loading…
Reference in New Issue
Block a user