Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the item that removed is exist yet #959

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions frame/taskmanager/dbushandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
, 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);});

Check warning on line 32 in frame/taskmanager/dbushandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Parameter 'name' is passed by value. It could be passed as a const reference which is usually faster and recommended in C++.
if (!isWaylandSession()) {
m_xEventMonitor = new org::deepin::dde::XEventMonitor1("org.deepin.dde.XEventMonitor1", "/org/deepin/dde/XEventMonitor1", QDBusConnection::sessionBus(), this);
m_activeWindowMonitorKey = m_xEventMonitor->RegisterFullScreen();
Expand Down
3 changes: 3 additions & 0 deletions frame/taskmanager/dbushandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class DBusHandler : public QObject
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);
Expand Down
20 changes: 19 additions & 1 deletion frame/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "waylandmanager.h"
#include "windowinfobase.h"
#include "dbusutil.h"

#include "org_deepin_dde_kwayland_plasmawindow.h"

#include <QDir>
Expand All @@ -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)
Expand Down Expand Up @@ -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!";
FeiWang1119 marked this conversation as resolved.
Show resolved Hide resolved
}
});
}

TaskManager::~TaskManager()
Expand Down