fix: 修复控制中心发送应用到任务栏不显示的问题
当应用打开的时候移除驻留,该应用作为最近打开应用,在取消驻留的时候,只是停止了服务,并未从列表中移除;下次驻留的时候,没有启动服务,导致任务栏图标没有驻留 Log: 修复控制中心无法发送应用到任务栏的问题 Influence: 从任务栏打开一个已经驻留的应用,对这个应用取消驻留,关闭应用,打开启动器,把这个应用发送到任务栏,观察任务栏是否有这个应用 Bug: https://pms.uniontech.com/bug-view-165891.html Change-Id: I89fdaad6c33388dab67eb9c7d41dd372d36582bd
This commit is contained in:
parent
873a642f06
commit
6c06ed86b7
@ -187,7 +187,7 @@ bool Dock::dockEntry(Entry *entry, bool moveToEnd)
|
|||||||
if (moveToEnd && SETTING->getDisplayMode() == DisplayMode::Fashion)
|
if (moveToEnd && SETTING->getDisplayMode() == DisplayMode::Fashion)
|
||||||
m_entries->moveEntryToLast(entry);
|
m_entries->moveEntryToLast(entry);
|
||||||
|
|
||||||
entry->setPropIsDocked(true);
|
entry->setIsDocked(true);
|
||||||
entry->updateMenu();
|
entry->updateMenu();
|
||||||
entry->updateMode();
|
entry->updateMode();
|
||||||
return true;
|
return true;
|
||||||
@ -255,7 +255,7 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
|
|||||||
m_entries->moveEntryToLast(entry);
|
m_entries->moveEntryToLast(entry);
|
||||||
|
|
||||||
entry->updateIcon();
|
entry->updateIcon();
|
||||||
entry->setPropIsDocked(false);
|
entry->setIsDocked(false);
|
||||||
entry->updateName();
|
entry->updateName();
|
||||||
entry->updateMenu();
|
entry->updateMenu();
|
||||||
} else {
|
} else {
|
||||||
@ -528,20 +528,15 @@ bool Dock::requestDock(QString desktopFile, int index)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool newCreated = false;
|
|
||||||
Entry *entry = m_entries->getByInnerId(app->getInnerId());
|
Entry *entry = m_entries->getByInnerId(app->getInnerId());
|
||||||
if (!entry) {
|
if (!entry)
|
||||||
newCreated = true;
|
|
||||||
entry = new Entry(this, app, app->getInnerId());
|
entry = new Entry(this, app, app->getInnerId());
|
||||||
}
|
|
||||||
|
|
||||||
if (!dockEntry(entry))
|
if (!dockEntry(entry))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (newCreated) {
|
entry->startExport();
|
||||||
entry->startExport();
|
m_entries->append(entry);
|
||||||
m_entries->append(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
saveDockedApps();
|
saveDockedApps();
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,6 +52,10 @@ Entry *Entries::getByInnerId(QString innerId)
|
|||||||
|
|
||||||
void Entries::append(Entry *entry)
|
void Entries::append(Entry *entry)
|
||||||
{
|
{
|
||||||
|
// 如果当前应用在列表中存在(通常是该应用为最近打开应用但是关闭了最近打开应用的接口或者当前为高效模式)
|
||||||
|
if (m_items.contains(entry))
|
||||||
|
m_items.removeOne(entry);
|
||||||
|
|
||||||
insert(entry, -1);
|
insert(entry, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,10 +280,10 @@ void Entries::removeLastRecent()
|
|||||||
if (unDockCount >= MAX_UNOPEN_RECENT_COUNT && unDockEntrys.size() > 0) {
|
if (unDockCount >= MAX_UNOPEN_RECENT_COUNT && unDockEntrys.size() > 0) {
|
||||||
// 只有当最近使用区域的图标大于等于某个数值(3)的时候,并且存在没有子窗口的Entry,那么就移除该Entry
|
// 只有当最近使用区域的图标大于等于某个数值(3)的时候,并且存在没有子窗口的Entry,那么就移除该Entry
|
||||||
Entry *entry = unDockEntrys[0];
|
Entry *entry = unDockEntrys[0];
|
||||||
m_items.removeOne(entry);
|
|
||||||
removeEntrys << entry;
|
removeEntrys << entry;
|
||||||
}
|
}
|
||||||
for (Entry *entry : removeEntrys) {
|
for (Entry *entry : removeEntrys) {
|
||||||
|
m_items.removeOne(entry);
|
||||||
removeCb(entry);
|
removeCb(entry);
|
||||||
delete entry;
|
delete entry;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ Entry::Entry(Dock *_dock, AppInfo *_app, QString _innerId, QObject *parent)
|
|||||||
, m_isActive(false)
|
, m_isActive(false)
|
||||||
, m_isDocked(false)
|
, m_isDocked(false)
|
||||||
, m_innerId(_innerId)
|
, m_innerId(_innerId)
|
||||||
|
, m_adapterEntry(nullptr)
|
||||||
, m_current(nullptr)
|
, m_current(nullptr)
|
||||||
, m_currentWindow(0)
|
, m_currentWindow(0)
|
||||||
, m_winIconPreferred(false)
|
, m_winIconPreferred(false)
|
||||||
@ -210,7 +211,12 @@ void Entry::startExport()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new DBusAdaptorEntry(this); // export dbus by Adaptor
|
if (m_adapterEntry) {
|
||||||
|
qWarning() << "service " << getName() << " is running";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_adapterEntry = new DBusAdaptorEntry(this); // export dbus by Adaptor
|
||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
if (!con.registerService(dbusService)) {
|
if (!con.registerService(dbusService)) {
|
||||||
qWarning() << "register service Dock1 error:" << con.lastError().message();
|
qWarning() << "register service Dock1 error:" << con.lastError().message();
|
||||||
@ -230,8 +236,16 @@ void Entry::stopExport()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_adapterEntry) {
|
||||||
|
qWarning() << "serice " << getName() << "is not running";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
con.unregisterObject(path());
|
con.unregisterObject(path());
|
||||||
|
|
||||||
|
m_adapterEntry->deleteLater();
|
||||||
|
m_adapterEntry = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::setMenu(AppMenu *_menu)
|
void Entry::setMenu(AppMenu *_menu)
|
||||||
@ -348,14 +362,6 @@ WindowInfoBase *Entry::getWindowInfoByWinId(XWindow windowId)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::setPropIsDocked(bool docked)
|
|
||||||
{
|
|
||||||
if (m_isDocked != docked) {
|
|
||||||
m_isDocked = docked;
|
|
||||||
Q_EMIT isDockedChanged(docked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entry::setPropIcon(QString value)
|
void Entry::setPropIcon(QString value)
|
||||||
{
|
{
|
||||||
if (value != m_icon) {
|
if (value != m_icon) {
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
// 单个应用类
|
// 单个应用类
|
||||||
class Dock;
|
class Dock;
|
||||||
|
class DBusAdaptorEntry;
|
||||||
|
|
||||||
class Entry: public QObject
|
class Entry: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -67,7 +69,6 @@ public:
|
|||||||
void updateIsActive();
|
void updateIsActive();
|
||||||
WindowInfoBase *getWindowInfoByPid(int pid);
|
WindowInfoBase *getWindowInfoByPid(int pid);
|
||||||
WindowInfoBase *getWindowInfoByWinId(XWindow windowId);
|
WindowInfoBase *getWindowInfoByWinId(XWindow windowId);
|
||||||
void setPropIsDocked(bool docked);
|
|
||||||
void setPropIcon(QString value);
|
void setPropIcon(QString value);
|
||||||
void setPropName(QString value);
|
void setPropName(QString value);
|
||||||
void setPropIsActive(bool active);
|
void setPropIsActive(bool active);
|
||||||
@ -145,6 +146,8 @@ private:
|
|||||||
QString m_innerId;
|
QString m_innerId;
|
||||||
QString m_desktopFile;
|
QString m_desktopFile;
|
||||||
|
|
||||||
|
DBusAdaptorEntry *m_adapterEntry;
|
||||||
|
|
||||||
// Dbus属性直接放到interface上
|
// Dbus属性直接放到interface上
|
||||||
QMap<XWindow, WindowInfoBase *> m_windowInfoMap; // 该应用所有窗口
|
QMap<XWindow, WindowInfoBase *> m_windowInfoMap; // 该应用所有窗口
|
||||||
WindowInfoMap m_exportWindowInfos; // 该应用导出的窗口属性
|
WindowInfoMap m_exportWindowInfos; // 该应用导出的窗口属性
|
||||||
|
Loading…
Reference in New Issue
Block a user