mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-01 07:05:48 +00:00
fix: the item that removed is exist yet
undock items that removed Issus: https://github.com/linuxdeepin/developer-center/issues/4631
This commit is contained in:
parent
e47a6dfb80
commit
3a5438b399
@ -22,6 +22,13 @@ DBusHandler::DBusHandler(TaskManager *taskmanager, QObject *parent)
|
||||
, m_xEventMonitor(nullptr)
|
||||
, m_launcher(new org::deepin::dde::Launcher1(launcherService, launcherPath, QDBusConnection::sessionBus(), this))
|
||||
{
|
||||
QDBusInterface *interAM = new QDBusInterface(ApplicationManager1DBusName, "/org/desktopspec/ApplicationManager1", "org.desktopspec.DBus.ObjectManager", QDBusConnection::sessionBus(), this);
|
||||
if (interAM->isValid()) {
|
||||
connect(interAM, SIGNAL(InterfacesRemoved(const QDBusObjectPath &, const QStringList &)), this, SIGNAL(appUninstalled(const QDBusObjectPath &, const QStringList &)));
|
||||
} else {
|
||||
qWarning() << "The interface of AM is invalid:" << interAM->lastError();
|
||||
}
|
||||
|
||||
connect(m_wmSwitcher, &org::deepin::dde::WMSwitcher1::WMChanged, this, [&](QString name) {m_taskmanager->setWMName(name);});
|
||||
if (!isWaylandSession()) {
|
||||
m_xEventMonitor = new org::deepin::dde::XEventMonitor1("org.deepin.dde.XEventMonitor1", "/org/deepin/dde/XEventMonitor1", QDBusConnection::sessionBus(), this);
|
||||
|
@ -66,6 +66,9 @@ public:
|
||||
bool newStartManagerAvaliable();
|
||||
void sendFailedDockNotification(const QString &appName);
|
||||
|
||||
Q_SIGNALS:
|
||||
void appUninstalled(const QDBusObjectPath &objectPath, const QStringList &interfaces);
|
||||
|
||||
private Q_SLOTS:
|
||||
void handleWlActiveWindowChange();
|
||||
void onActiveWindowButtonRelease(int type, int x, int y, const QString &key);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "waylandmanager.h"
|
||||
#include "windowinfobase.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
#include "org_deepin_dde_kwayland_plasmawindow.h"
|
||||
|
||||
#include <QDir>
|
||||
@ -27,10 +26,15 @@
|
||||
#include <QPixmap>
|
||||
|
||||
#include <cstdint>
|
||||
#include <dtkcore_global.h>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include <dutil.h>
|
||||
|
||||
DCORE_USE_NAMESPACE
|
||||
|
||||
#define SETTING DockSettings::instance()
|
||||
#define XCB XCBUtils::instance()
|
||||
bool shouldShowEntry(Entry *entry)
|
||||
@ -91,6 +95,20 @@ TaskManager::TaskManager(QObject *parent)
|
||||
connect(m_x11Manager, &X11Manager::requestHandleActiveWindowChange, this, &TaskManager::handleActiveWindowChanged);
|
||||
connect(m_x11Manager, &X11Manager::requestAttachOrDetachWindow, this, &TaskManager::attachOrDetachWindow);
|
||||
}
|
||||
connect(m_dbusHandler, &DBusHandler::appUninstalled, this, [this] (const QDBusObjectPath &objectPath, const QStringList &interfaces) {
|
||||
Q_UNUSED(interfaces)
|
||||
QString desktopFile = DUtil::unescapeFromObjectPath(objectPath.path());
|
||||
QString desktopName = desktopFile.split('/').last();
|
||||
QList<Entry *> entries = m_entries->getEntries();
|
||||
auto desktopEntryIter = std::find_if(entries.begin(), entries.end(), [desktopName] (Entry *entry) {
|
||||
return entry->getDesktopFile().contains(desktopName);
|
||||
});
|
||||
if (desktopEntryIter != entries.end()) {
|
||||
undockEntry(*desktopEntryIter);
|
||||
} else {
|
||||
qWarning() << "The entry which is to be removed is not found!";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
TaskManager::~TaskManager()
|
||||
|
Loading…
x
Reference in New Issue
Block a user