mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 修复任务栏“显示桌面”无法移除
正常情况下按下菜单的显示桌面,先把读的bool类型值取反写进去,再读,再根据读的值如果为false添加插件true移除插件,插件加载是否完成判断代码存在问题,导致插件位置标签未写入到json变量里,导致在保存插件是否显示状态值时,将位置值写到了状态标签上,使得值一直是正数,导致读到的值一直是false只能添加插件,不能移除插件, Log: 修复任务栏“显示桌面”无法移除,按下菜单的显示桌面无法移除显示桌面插件 Bug: https://pms.uniontech.com/zentao/bug-view-74956.html Change-Id: Ie474c9696e545c8f90b540ec54dd31fd892ebe83
This commit is contained in:
parent
f43195a892
commit
110c4966b1
@ -153,12 +153,6 @@ PluginsItemInterface *AbstractPluginsController::pluginInterAt(QObject *destItem
|
||||
void AbstractPluginsController::startLoader(PluginLoader *loader)
|
||||
{
|
||||
connect(loader, &PluginLoader::finished, loader, &PluginLoader::deleteLater, Qt::QueuedConnection);
|
||||
connect(loader, &PluginLoader::pluginFounded, this, [ = ](const QString &pluginFile){
|
||||
QPair<QString, PluginsItemInterface *> pair;
|
||||
pair.first = pluginFile;
|
||||
pair.second = nullptr;
|
||||
m_pluginLoadMap.insert(pair, false);
|
||||
});
|
||||
connect(loader, &PluginLoader::pluginFounded, this, &AbstractPluginsController::loadPlugin, Qt::QueuedConnection);
|
||||
|
||||
int delay = Utils::SettingValue("com.deepin.dde.dock", "/com/deepin/dde/dock/", "delay-plugins-time", 0).toInt();
|
||||
@ -219,23 +213,15 @@ void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
return;
|
||||
}
|
||||
|
||||
QPair<QString, PluginsItemInterface *> newPair;
|
||||
newPair.first = pluginFile;
|
||||
newPair.second = interface;
|
||||
m_pluginLoadMap.insert(newPair, true);
|
||||
|
||||
// 保存 PluginLoader 对象指针
|
||||
QMap<QString, QObject *> interfaceData;
|
||||
interfaceData["pluginloader"] = pluginLoader;
|
||||
m_pluginsMap.insert(interface, interfaceData);
|
||||
|
||||
for (auto &pair: m_pluginLoadMap.keys()) {
|
||||
if (pair.first == pluginFile) {
|
||||
m_pluginLoadMap.remove(pair);
|
||||
|
||||
QPair<QString, PluginsItemInterface *> newPair;
|
||||
newPair.first = pluginFile;
|
||||
newPair.second = interface;
|
||||
m_pluginLoadMap.insert(newPair, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QString dbusService = meta.value("depends-daemon-dbus-service").toString();
|
||||
if (!dbusService.isEmpty() && !m_dbusDaemonInterface->isServiceRegistered(dbusService).value()) {
|
||||
qDebug() << objectName() << dbusService << "daemon has not started, waiting for signal";
|
||||
@ -264,19 +250,7 @@ void AbstractPluginsController::initPlugin(PluginsItemInterface *interface)
|
||||
{
|
||||
qDebug() << objectName() << "init plugin: " << interface->pluginName();
|
||||
interface->init(this);
|
||||
for (const auto &pair : m_pluginLoadMap.keys()) {
|
||||
if (pair.second == interface)
|
||||
m_pluginLoadMap.insert(pair, true);
|
||||
}
|
||||
|
||||
bool loaded = true;
|
||||
for (int i = 0; i < m_pluginLoadMap.keys().size(); ++i) {
|
||||
if (!m_pluginLoadMap.values()[i]) {
|
||||
loaded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (loaded) {
|
||||
if (qApp->property("PLUGINSNUMBER").toInt() == m_pluginLoadMap.keys().size()) {
|
||||
emit pluginLoaderFinished();
|
||||
}
|
||||
qDebug() << objectName() << "init plugin finished: " << interface->pluginName();
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QDebug>
|
||||
#include <QLibrary>
|
||||
#include <QGSettings>
|
||||
|
||||
#include <QApplication>
|
||||
PluginLoader::PluginLoader(const QString &pluginDirPath, QObject *parent)
|
||||
: QThread(parent)
|
||||
, m_pluginDirPath(pluginDirPath)
|
||||
@ -65,6 +65,7 @@ void PluginLoader::run()
|
||||
}
|
||||
plugins << file;
|
||||
}
|
||||
qApp->setProperty("PLUGINSNUMBER", plugins.count());
|
||||
|
||||
for (auto plugin : plugins) {
|
||||
emit pluginFounded(pluginsDir.absoluteFilePath(plugin));
|
||||
|
Loading…
x
Reference in New Issue
Block a user