fix: AM 暴露出调起应用的接口
org.desktopspec.ApplicationManager启动应用服务接口导出 Log: Influence: dbus接口暴露给启动器/任务栏等应用调用 Task: https://pms.uniontech.com/task-view-211667.html Change-Id: I2ccbaf31513db18438cbd18daf96c8bc552e46c5
This commit is contained in:
		@ -1,50 +1,34 @@
 | 
			
		||||
<interface name='org.desktopspec.ApplicationManager'>
 | 
			
		||||
    <method name='Launch'>
 | 
			
		||||
        <arg type='s' name='id' direction='in'/>
 | 
			
		||||
        <arg type='as' name='files' direction='in' />
 | 
			
		||||
        <arg type='o' name='instance' direction='out'/>
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='AddAutostart'>
 | 
			
		||||
        <arg type='s' name='fileNamae' direction='in' />
 | 
			
		||||
        <arg type='b' name='outArg0' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='RemoveAutostart'>
 | 
			
		||||
        <arg type='s' name='fileNamae' direction='in' />
 | 
			
		||||
        <arg type='b' name='outArg0' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='AutostartList'>
 | 
			
		||||
        <arg type='as' name='outArg0' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='DumpMemRecord'>
 | 
			
		||||
        <arg type='s' name='outArg0' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='IsAutostart'>
 | 
			
		||||
        <arg type='s' name='fileName' direction='in' />
 | 
			
		||||
        <arg type='b' name='outArg0' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='IsMemSufficient'>
 | 
			
		||||
    <method name='RemoveAutostart'>
 | 
			
		||||
        <arg type='s' name='fileNamae' direction='in' />
 | 
			
		||||
        <arg type='b' name='outArg0' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name="Launch">
 | 
			
		||||
        <arg type='s' name='desktopFile' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name="LaunchApp">
 | 
			
		||||
        <arg type='s' name='desktopFile' direction='in'/>
 | 
			
		||||
        <arg type='u' name='timestamp' direction='in'/>
 | 
			
		||||
        <arg type='as' name='files' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='LaunchAppAction'>
 | 
			
		||||
        <arg type='s' name='desktopFile' direction='in' />
 | 
			
		||||
        <arg type='s' name='action' direction='in' />
 | 
			
		||||
        <arg type='u' name='timestamp' direction='in' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='RunCommand'>
 | 
			
		||||
        <arg type='s' name='exe' direction='in' />
 | 
			
		||||
        <arg type='as' name='args' direction='in' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='TryAgain'>
 | 
			
		||||
        <arg type='b' name='launch' direction='in' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='IsPidVirtualMachine'>
 | 
			
		||||
           <arg type='i' name='pid' direction='in' />
 | 
			
		||||
           <arg type='b' name='isVM' direction='out' />
 | 
			
		||||
    </method>
 | 
			
		||||
    <signal name='AutostartChanged'>
 | 
			
		||||
     	<arg type='s' name='status' />
 | 
			
		||||
     	<arg type='s' name='filePath' />
 | 
			
		||||
    </signal>
 | 
			
		||||
    <property access='read' type='ao' name='list' />
 | 
			
		||||
    <property access='read' type='ao' name='instances' />
 | 
			
		||||
</interface>
 | 
			
		||||
 | 
			
		||||
@ -95,16 +95,6 @@ QStringList StartManager::autostartList()
 | 
			
		||||
    return autostartFiles;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString StartManager::dumpMemRecord()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString StartManager::getApps()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief StartManager::isAutostart
 | 
			
		||||
 * @param fileName  desktopFile
 | 
			
		||||
@ -133,6 +123,11 @@ bool StartManager::isMemSufficient()
 | 
			
		||||
    return SETTING->getMemCheckerEnabled() ? MemInfo::isSufficient(minMemAvail, maxSwapUsed) : true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void StartManager::launchApp(const QString &desktopFile)
 | 
			
		||||
{
 | 
			
		||||
    doLaunchAppWithOptions(desktopFile);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void StartManager::launchApp(QString desktopFile, uint32_t timestamp, QStringList files)
 | 
			
		||||
{
 | 
			
		||||
    doLaunchAppWithOptions(desktopFile, timestamp, files, QMap<QString, QString>());
 | 
			
		||||
@ -183,11 +178,6 @@ void StartManager::runCommandWithOptions(QString exe, QStringList args, QMap<QSt
 | 
			
		||||
    doRunCommandWithOptions(exe, args, options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void StartManager::tryAgain(bool launch)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void StartManager::onAutoStartupPathChange(const QString &dirPath)
 | 
			
		||||
{
 | 
			
		||||
    QStringList autostartFilesList = getAutostartList();
 | 
			
		||||
@ -282,6 +272,19 @@ bool StartManager::setAutostart(QString fileName, bool value)
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool StartManager::doLaunchAppWithOptions(const QString &desktopFile)
 | 
			
		||||
{
 | 
			
		||||
    DesktopInfo info(desktopFile.toStdString());
 | 
			
		||||
    if (!info.isValidDesktop())
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    launch(&info, info.getCommandLine().c_str(), 0, QStringList());
 | 
			
		||||
 | 
			
		||||
    dbusHandler->markLaunched(desktopFile);
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool StartManager::doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options)
 | 
			
		||||
{
 | 
			
		||||
    // launchApp
 | 
			
		||||
@ -359,9 +362,23 @@ bool StartManager::launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp
 | 
			
		||||
    QString exec = exeArgs[0];
 | 
			
		||||
    exeArgs.removeAt(0);
 | 
			
		||||
 | 
			
		||||
#ifdef QT_DEBUG
 | 
			
		||||
    qDebug() << "launchApp: " << desktopFile << " exec:  " << exec << " args:   " << exeArgs;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    process.setWorkingDirectory(workingDir.c_str());
 | 
			
		||||
    process.setEnvironment(envs);
 | 
			
		||||
 | 
			
		||||
    if (desktopFile.contains("/persistent/linglong")) {
 | 
			
		||||
        exeArgs.clear();
 | 
			
		||||
 | 
			
		||||
#ifdef QT_DEBUG
 | 
			
		||||
        qDebug() << "exeArgs:"  << cmdLine.section(" ", 1, 2);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        exeArgs.append(cmdLine.section(" ", 1, 2).split(" "));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return process.startDetached(exec, exeArgs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -41,16 +41,14 @@ public:
 | 
			
		||||
    bool addAutostart(QString fileName);
 | 
			
		||||
    bool removeAutostart(QString fileName);
 | 
			
		||||
    QStringList autostartList();
 | 
			
		||||
    QString dumpMemRecord();
 | 
			
		||||
    QString getApps();
 | 
			
		||||
    bool isAutostart(QString fileName);
 | 
			
		||||
    bool isMemSufficient();
 | 
			
		||||
    void launchApp(const QString &desktopFile);
 | 
			
		||||
    void launchApp(QString desktopFile, uint32_t timestamp, QStringList files);
 | 
			
		||||
    void launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
 | 
			
		||||
    void launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
 | 
			
		||||
    void runCommand(QString exe, QStringList args);
 | 
			
		||||
    void runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
 | 
			
		||||
    void tryAgain(bool launch);
 | 
			
		||||
 | 
			
		||||
Q_SIGNALS:
 | 
			
		||||
    void autostartChanged(QString status, QString fileName);
 | 
			
		||||
@ -60,6 +58,7 @@ public Q_SLOTS:
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    bool setAutostart(QString fileName, bool value);
 | 
			
		||||
    bool doLaunchAppWithOptions(const QString &desktopFile);
 | 
			
		||||
    bool doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
 | 
			
		||||
    bool launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp, QStringList files);
 | 
			
		||||
    bool doRunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
 | 
			
		||||
 | 
			
		||||
@ -246,41 +246,6 @@ QList<QDBusObjectPath> ApplicationManager::GetInstances(const QString& id)
 | 
			
		||||
    return {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief ApplicationManager::Launch 启动应用
 | 
			
		||||
 * @param id   QString("/%1/%2/%3").arg(Apptype).arg(d->m_type == Application::Type::System ? "system" : "user").arg(appId)
 | 
			
		||||
 * @param files 应用打开的文件
 | 
			
		||||
 * @return
 | 
			
		||||
 */
 | 
			
		||||
QDBusObjectPath ApplicationManager::Launch(const QString& id, QStringList files)
 | 
			
		||||
{
 | 
			
		||||
    qInfo() << "Launch " << id;
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
        return {};
 | 
			
		||||
 | 
			
		||||
    // 创建一个实例
 | 
			
		||||
    for (const QSharedPointer<Application>& app : d->applications) {
 | 
			
		||||
        QString appId = app->id();
 | 
			
		||||
        if (app->id() == id) {
 | 
			
		||||
            // 创建任务所需的数据,并记录到任务队列,等待 loader 消耗
 | 
			
		||||
            QSharedPointer<ApplicationInstance> instance{app->createInstance(files)};
 | 
			
		||||
            const std::string hash{instance->hash().toStdString()};
 | 
			
		||||
            connect(instance.get(), &ApplicationInstance::taskFinished, this, [ = ] {
 | 
			
		||||
                for (auto it = d->tasks.begin(); it != d->tasks.end(); ++it){
 | 
			
		||||
                    if (it->first == hash) {
 | 
			
		||||
                        d->tasks.erase(it);
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            d->tasks.insert(std::make_pair(hash, instance));
 | 
			
		||||
            return instance->path();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ApplicationManager::AddAutostart(QString fileName)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
@ -308,15 +273,6 @@ QStringList ApplicationManager::AutostartList()
 | 
			
		||||
    return d->startManager->autostartList();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString ApplicationManager::DumpMemRecord()
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
        return "";
 | 
			
		||||
 | 
			
		||||
    return d->startManager->dumpMemRecord();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ApplicationManager::IsAutostart(QString fileName)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
@ -326,16 +282,17 @@ bool ApplicationManager::IsAutostart(QString fileName)
 | 
			
		||||
    return d->startManager->isAutostart(fileName);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ApplicationManager::IsMemSufficient()
 | 
			
		||||
void ApplicationManager::Launch(const QString &desktopFile)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
        return false;
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    return d->startManager->isMemSufficient();
 | 
			
		||||
    d->startManager->launchApp(desktopFile);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::LaunchApp(QString desktopFile, uint32_t timestamp, QStringList files)
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
@ -362,15 +319,6 @@ void ApplicationManager::LaunchAppWithOptions(QString desktopFile, uint32_t time
 | 
			
		||||
    d->startManager->launchAppWithOptions(desktopFile, timestamp, files, options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::RunCommand(QString exe, QStringList args)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    d->startManager->runCommand(exe, args);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::RunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
@ -380,15 +328,6 @@ void ApplicationManager::RunCommandWithOptions(QString exe, QStringList args, QM
 | 
			
		||||
    d->startManager->runCommandWithOptions(exe, args, options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::TryAgain(bool launch)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    d->startManager->tryAgain(launch);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QList<QDBusObjectPath> ApplicationManager::instances() const
 | 
			
		||||
{
 | 
			
		||||
    Q_D(const ApplicationManager);
 | 
			
		||||
@ -414,28 +353,6 @@ QList<QDBusObjectPath> ApplicationManager::list() const
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 如果app manager拥有全部进程信息,可以在app manger里面获取
 | 
			
		||||
bool ApplicationManager::IsPidVirtualMachine(uint32_t pid)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(const ApplicationManager);
 | 
			
		||||
    char buff[256];
 | 
			
		||||
    ssize_t nbytes = readlink(QString("/proc/%1/exe").arg(pid).toStdString().c_str(), buff, 256);
 | 
			
		||||
    if (nbytes == -1) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    std::string execPath(buff);
 | 
			
		||||
 | 
			
		||||
    for (auto iter : d->virtualMachines) {
 | 
			
		||||
        std::string::size_type idx = iter.find(execPath);
 | 
			
		||||
 | 
			
		||||
        if (idx != std::string::npos) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ApplicationManager::IsProcessExist(uint32_t pid)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(const ApplicationManager);
 | 
			
		||||
 | 
			
		||||
@ -66,19 +66,14 @@ public:
 | 
			
		||||
Q_SIGNALS:
 | 
			
		||||
    void AutostartChanged(QString status, QString filePath);
 | 
			
		||||
 | 
			
		||||
public Q_SLOTS: // METHODS
 | 
			
		||||
    //bool Launch(QString desktopFile); deprecated
 | 
			
		||||
public Q_SLOTS:
 | 
			
		||||
    bool AddAutostart(QString fileName);
 | 
			
		||||
    QStringList AutostartList();
 | 
			
		||||
    QString DumpMemRecord();
 | 
			
		||||
    bool IsAutostart(QString fileName);
 | 
			
		||||
    bool IsMemSufficient();
 | 
			
		||||
    QDBusObjectPath Launch(const QString &id, QStringList files);
 | 
			
		||||
    bool RemoveAutostart(QString fileName);
 | 
			
		||||
    bool IsPidVirtualMachine(uint32_t pid);
 | 
			
		||||
    void Launch(const QString &desktopFile);
 | 
			
		||||
    void LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files);
 | 
			
		||||
    void LaunchAppAction(QString desktopFile, QString action, uint32_t timestamp);
 | 
			
		||||
    void RunCommand(QString exe, QStringList args);
 | 
			
		||||
    void TryAgain(bool launch);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    ApplicationManager(QObject *parent = nullptr);
 | 
			
		||||
@ -88,11 +83,7 @@ protected:
 | 
			
		||||
    QList<QDBusObjectPath> list() const;
 | 
			
		||||
    QDBusObjectPath GetInformation(const QString &id);
 | 
			
		||||
    QList<QDBusObjectPath> GetInstances(const QString &id);
 | 
			
		||||
    // com.deepin.StartManager
 | 
			
		||||
    //QString GetApps();
 | 
			
		||||
    void LaunchApp(QString desktopFile, uint32_t timestamp, QStringList files);
 | 
			
		||||
    void LaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
 | 
			
		||||
    //bool LaunchWithTimestamp(QString desktopFile, uint32_t timestamp); deprecated
 | 
			
		||||
    void RunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
 | 
			
		||||
    bool IsProcessExist(uint32_t pid);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,10 @@
 | 
			
		||||
 | 
			
		||||
DCORE_USE_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#define ApplicationManagerServiceName "org.desktopspec.ApplicationManager"
 | 
			
		||||
#define ApplicationManagerServicePath "/org/desktopspec/ApplicationManager"
 | 
			
		||||
#define ApplicationManagerInterface   "org.desktopspec.ApplicationManager"
 | 
			
		||||
 | 
			
		||||
QFileInfoList scan(const QString &path)
 | 
			
		||||
{
 | 
			
		||||
    QDir dir(path);
 | 
			
		||||
@ -83,16 +87,31 @@ int main(int argc, char *argv[])
 | 
			
		||||
    new DockManager(ApplicationManager::instance());
 | 
			
		||||
    new ApplicationManagerAdaptor(ApplicationManager::instance());
 | 
			
		||||
 | 
			
		||||
    QDBusConnection::sessionBus().registerService("org.desktopspec.Application");
 | 
			
		||||
    QDBusConnection::sessionBus().registerService("org.desktopspec.ApplicationManager");
 | 
			
		||||
    QDBusConnection::sessionBus().registerObject("/org/desktopspec/ApplicationManager", "org.desktopspec.ApplicationManager", ApplicationManager::instance());
 | 
			
		||||
    QDBusConnection connection = QDBusConnection::sessionBus();
 | 
			
		||||
    if (!connection.registerService("org.desktopspec.Application")) {
 | 
			
		||||
        qWarning() << "error: " << connection.lastError().message();
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!connection.registerService(ApplicationManagerServiceName)) {
 | 
			
		||||
        qWarning() << "error: " << connection.lastError().message();
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!connection.registerObject(ApplicationManagerServicePath, ApplicationManagerInterface, ApplicationManager::instance())) {
 | 
			
		||||
        qWarning() << "error: " << connection.lastError().message();
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QList<QSharedPointer<Application>> apps{ scanFiles() };
 | 
			
		||||
    QList<QSharedPointer<ApplicationAdaptor>> appAdapters;
 | 
			
		||||
    for (const QSharedPointer<Application> app : apps) {
 | 
			
		||||
        QSharedPointer<ApplicationAdaptor> adapter = QSharedPointer<ApplicationAdaptor>(new ApplicationAdaptor(app.get()));
 | 
			
		||||
        appAdapters << adapter;
 | 
			
		||||
        QDBusConnection::sessionBus().registerObject(app->path().path(), "org.desktopspec.Application", app.get());
 | 
			
		||||
        if (!connection.registerObject(app->path().path(), "org.desktopspec.Application", app.get())) {
 | 
			
		||||
            qWarning() << "error: " << connection.lastError().message();
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ApplicationManager::instance()->addApplication(apps);
 | 
			
		||||
@ -102,8 +121,15 @@ int main(int argc, char *argv[])
 | 
			
		||||
    MimeApp* mimeApp = new MimeApp;
 | 
			
		||||
 | 
			
		||||
    new MimeAdaptor(mimeApp);
 | 
			
		||||
    QDBusConnection::sessionBus().registerService("org.deepin.daemon.Mime1");
 | 
			
		||||
    QDBusConnection::sessionBus().registerObject("/org/deepin/daemon/Mime1", "org.deepin.daemon.Mime1", mimeApp);
 | 
			
		||||
    if (!connection.registerService("org.deepin.daemon.Mime1")) {
 | 
			
		||||
        qWarning() << "error: " << connection.lastError().message();
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!connection.registerObject("/org/deepin/daemon/Mime1", "org.deepin.daemon.Mime1", mimeApp)) {
 | 
			
		||||
        qWarning() << "error: " << connection.lastError().message();
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return app.exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user