mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fixed(keyboard-layout):refresh keyboard layout for tray
注销后不显示键盘布局
This commit is contained in:
parent
bf41b1ebb6
commit
6c19ff5e58
@ -92,6 +92,8 @@ void DBusAdaptors::onUserLayoutListChanged(const QStringList &value)
|
|||||||
m_userLayoutList = value;
|
m_userLayoutList = value;
|
||||||
|
|
||||||
refreshMenu();
|
refreshMenu();
|
||||||
|
|
||||||
|
emit layoutChanged(layout());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBusAdaptors::initAllLayoutList()
|
void DBusAdaptors::initAllLayoutList()
|
||||||
|
@ -41,20 +41,37 @@ const QString KeyboardPlugin::pluginDisplayName() const
|
|||||||
void KeyboardPlugin::init(PluginProxyInterface *proxyInter)
|
void KeyboardPlugin::init(PluginProxyInterface *proxyInter)
|
||||||
{
|
{
|
||||||
m_proxyInter = proxyInter;
|
m_proxyInter = proxyInter;
|
||||||
m_dbusAdaptors = new DBusAdaptors(this);
|
if (!m_dbusAdaptors) {
|
||||||
|
|
||||||
QDBusConnection::sessionBus().registerService("com.deepin.dde.Keyboard");
|
QString serverName = "com.deepin.daemon.InputDevices";
|
||||||
QDBusConnection::sessionBus().registerObject("/com/deepin/dde/Keyboard", "com.deepin.dde.Keyboard", this);
|
QDBusConnectionInterface *ifc = QDBusConnection::sessionBus().interface();
|
||||||
|
|
||||||
|
if (!ifc->isServiceRegistered(serverName)) {
|
||||||
|
connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this,
|
||||||
|
[ = ](const QString & name, const QString & oldOwner, const QString & newOwner) {
|
||||||
|
Q_UNUSED(oldOwner);
|
||||||
|
if (name == serverName && !newOwner.isEmpty()) {
|
||||||
|
m_dbusAdaptors = new DBusAdaptors(this);
|
||||||
|
disconnect(ifc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
m_dbusAdaptors = new DBusAdaptors(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().registerService("com.deepin.dde.Keyboard");
|
||||||
|
QDBusConnection::sessionBus().registerObject("/com/deepin/dde/Keyboard", "com.deepin.dde.Keyboard", this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* KeyboardPlugin::itemWidget(const QString &itemKey)
|
QWidget *KeyboardPlugin::itemWidget(const QString &itemKey)
|
||||||
{
|
{
|
||||||
Q_UNUSED(itemKey);
|
Q_UNUSED(itemKey);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* KeyboardPlugin::itemTipsWidget(const QString &itemKey)
|
QWidget *KeyboardPlugin::itemTipsWidget(const QString &itemKey)
|
||||||
{
|
{
|
||||||
Q_UNUSED(itemKey);
|
Q_UNUSED(itemKey);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
QWidget *itemTipsWidget(const QString &itemKey) override;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DBusAdaptors *m_dbusAdaptors;
|
DBusAdaptors *m_dbusAdaptors = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user