feat: 任务栏应用启动方式修改为startManager来启动
在dock类的active方法中,调用ApplicationManager类对象的LaunchApp方法来启动应用 Log: Influence: 从任务栏启动应用 Task: https://pms.uniontech.com/task-view-211667.html Change-Id: I354b583b15932046a807b33c3d7cb253a59938d7
This commit is contained in:
		@ -29,6 +29,7 @@
 | 
			
		||||
#include "x11manager.h"
 | 
			
		||||
#include "windowinfobase.h"
 | 
			
		||||
#include "dbusplasmawindow.h"
 | 
			
		||||
#include "impl/application_manager.h"
 | 
			
		||||
 | 
			
		||||
#include "macro.h"
 | 
			
		||||
 | 
			
		||||
@ -39,7 +40,7 @@
 | 
			
		||||
#define SETTING DockSettings::instance()
 | 
			
		||||
#define XCB XCBUtils::instance()
 | 
			
		||||
 | 
			
		||||
Dock::Dock(QObject *parent)
 | 
			
		||||
Dock::Dock(ApplicationManager *applicationManager, QObject *parent)
 | 
			
		||||
 : SynModule(parent)
 | 
			
		||||
 , m_entriesSum(0)
 | 
			
		||||
 , m_windowIdentify(new WindowIdentify(this))
 | 
			
		||||
@ -52,6 +53,7 @@ Dock::Dock(QObject *parent)
 | 
			
		||||
 , m_windowOperateMutex(QMutex(QMutex::NonRecursive))
 | 
			
		||||
 , m_showRecent(false)
 | 
			
		||||
 , m_showMultiWindow(false)
 | 
			
		||||
 , m_applicationManager(applicationManager)
 | 
			
		||||
{
 | 
			
		||||
    registeModule("dock");
 | 
			
		||||
 | 
			
		||||
@ -1146,7 +1148,7 @@ void Dock::detachWindow(WindowInfoBase *info)
 | 
			
		||||
 */
 | 
			
		||||
void Dock::launchApp(const QString desktopFile, uint32_t timestamp, QStringList files)
 | 
			
		||||
{
 | 
			
		||||
    m_dbusHandler->launchApp(desktopFile, timestamp, files);
 | 
			
		||||
    m_applicationManager->LaunchApp(desktopFile, timestamp, files, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -1157,7 +1159,7 @@ void Dock::launchApp(const QString desktopFile, uint32_t timestamp, QStringList
 | 
			
		||||
 */
 | 
			
		||||
void Dock::launchAppAction(const QString desktopFile, QString action, uint32_t timestamp)
 | 
			
		||||
{
 | 
			
		||||
    m_dbusHandler->launchAppAction(desktopFile, action, timestamp);
 | 
			
		||||
    m_applicationManager->LaunchAppAction(desktopFile, action ,timestamp, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -38,6 +38,7 @@ class WaylandManager;
 | 
			
		||||
class X11Manager;
 | 
			
		||||
class WindowInfoK;
 | 
			
		||||
class WindowInfoX;
 | 
			
		||||
class ApplicationManager;
 | 
			
		||||
 | 
			
		||||
enum class HideState
 | 
			
		||||
{
 | 
			
		||||
@ -51,7 +52,7 @@ class Dock : public SynModule
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit Dock(QObject *parent = nullptr);
 | 
			
		||||
    explicit Dock(ApplicationManager *applicationManager, QObject *parent = nullptr);
 | 
			
		||||
    ~Dock();
 | 
			
		||||
 | 
			
		||||
    bool dockEntry(Entry *entry, bool moveToEnd = false);
 | 
			
		||||
@ -202,6 +203,7 @@ private:
 | 
			
		||||
    QMutex m_windowOperateMutex;  // 窗口合并或拆分锁
 | 
			
		||||
    bool m_showRecent;
 | 
			
		||||
    bool m_showMultiWindow;
 | 
			
		||||
    ApplicationManager *m_applicationManager;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // DOCK_H
 | 
			
		||||
 | 
			
		||||
@ -21,14 +21,15 @@
 | 
			
		||||
 | 
			
		||||
#include "dockmanager.h"
 | 
			
		||||
#include "dock.h"
 | 
			
		||||
#include "impl/application_manager.h"
 | 
			
		||||
 | 
			
		||||
#include <QDBusConnection>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDBusError>
 | 
			
		||||
 | 
			
		||||
DockManager::DockManager(QObject *parent)
 | 
			
		||||
DockManager::DockManager(ApplicationManager *parent)
 | 
			
		||||
 : QObject(parent)
 | 
			
		||||
 , m_dock(new Dock(this))
 | 
			
		||||
 , m_dock(new Dock(parent, this))
 | 
			
		||||
{
 | 
			
		||||
    qInfo() << "DockManager";
 | 
			
		||||
    m_adaptor = new DBusAdaptorDock(m_dock);
 | 
			
		||||
 | 
			
		||||
@ -27,13 +27,14 @@
 | 
			
		||||
#include <QObject>
 | 
			
		||||
 | 
			
		||||
class Dock;
 | 
			
		||||
class ApplicationManager;
 | 
			
		||||
 | 
			
		||||
// 任务栏管理类
 | 
			
		||||
class DockManager : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit DockManager(QObject *parent = nullptr);
 | 
			
		||||
    explicit DockManager(ApplicationManager *parent = nullptr);
 | 
			
		||||
    ~DockManager();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
@ -570,7 +570,8 @@ bool Entry::attachWindow(WindowInfoBase *info)
 | 
			
		||||
 | 
			
		||||
void Entry::launchApp(uint32_t timestamp)
 | 
			
		||||
{
 | 
			
		||||
    m_dock->launchApp(m_app->getFileName(), timestamp, QStringList());
 | 
			
		||||
    if (m_app)
 | 
			
		||||
        m_dock->launchApp(m_app->getFileName(), timestamp, QStringList());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Entry::containsWindow(XWindow xid)
 | 
			
		||||
 | 
			
		||||
@ -282,29 +282,29 @@ bool ApplicationManager::IsAutostart(const QString &fileName)
 | 
			
		||||
    return d->startManager->isAutostart(fileName);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::Launch(const QString &desktopFile)
 | 
			
		||||
void ApplicationManager::Launch(const QString &desktopFile, bool withMsgCheck)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
    if (withMsgCheck && !d->checkDMsgUid())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    d->startManager->launchApp(desktopFile);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files)
 | 
			
		||||
void ApplicationManager::LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files, bool withMsgCheck)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
    if (withMsgCheck && !d->checkDMsgUid())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    d->startManager->launchApp(desktopFile, timestamp, files);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ApplicationManager::LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp)
 | 
			
		||||
void ApplicationManager::LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp, bool withMsgCheck)
 | 
			
		||||
{
 | 
			
		||||
    Q_D(ApplicationManager);
 | 
			
		||||
    if (!d->checkDMsgUid())
 | 
			
		||||
    if (withMsgCheck && !d->checkDMsgUid())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    d->startManager->launchAppAction(desktopFile, action, timestamp);
 | 
			
		||||
 | 
			
		||||
@ -71,9 +71,9 @@ public Q_SLOTS:
 | 
			
		||||
    QStringList AutostartList();
 | 
			
		||||
    bool IsAutostart(const QString &fileName);
 | 
			
		||||
    bool RemoveAutostart(const QString &fileName);
 | 
			
		||||
    void Launch(const QString &desktopFile);
 | 
			
		||||
    void LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files);
 | 
			
		||||
    void LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp);
 | 
			
		||||
    void Launch(const QString &desktopFile, bool withMsgCheck = true);
 | 
			
		||||
    void LaunchApp(const QString &desktopFile, uint32_t timestamp, const QStringList &files, bool withMsgCheck = true);
 | 
			
		||||
    void LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp, bool withMsgCheck = true);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    ApplicationManager(QObject *parent = nullptr);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user