mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +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;
|
||||
|
||||
refreshMenu();
|
||||
|
||||
emit layoutChanged(layout());
|
||||
}
|
||||
|
||||
void DBusAdaptors::initAllLayoutList()
|
||||
|
@ -41,20 +41,37 @@ const QString KeyboardPlugin::pluginDisplayName() const
|
||||
void KeyboardPlugin::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_proxyInter = proxyInter;
|
||||
m_dbusAdaptors = new DBusAdaptors(this);
|
||||
if (!m_dbusAdaptors) {
|
||||
|
||||
QDBusConnection::sessionBus().registerService("com.deepin.dde.Keyboard");
|
||||
QDBusConnection::sessionBus().registerObject("/com/deepin/dde/Keyboard", "com.deepin.dde.Keyboard", this);
|
||||
QString serverName = "com.deepin.daemon.InputDevices";
|
||||
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);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QWidget* KeyboardPlugin::itemTipsWidget(const QString &itemKey)
|
||||
QWidget *KeyboardPlugin::itemTipsWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||
|
||||
private:
|
||||
DBusAdaptors *m_dbusAdaptors;
|
||||
DBusAdaptors *m_dbusAdaptors = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user