mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 解决社区版加载键盘布局插件失败问题
打包配置文件中没有加入etc/dde-dock目录,导致keyboard_layout.json文件拷贝失败 启动器读到文件内容,相关dbus服务没有启动,最终导致插件加载失败. Log: 修复社区版加载键盘布局插件失败问题 Task: https://pms.uniontech.com/zentao/task-view-81376.html Change-Id: Ifc63c547cf976601eaa766b914e59aafcb77d3fe
This commit is contained in:
parent
03977ba903
commit
05907c7fbc
1
debian/dde-dock.install
vendored
1
debian/dde-dock.install
vendored
@ -1,5 +1,6 @@
|
|||||||
usr/share
|
usr/share
|
||||||
usr/bin
|
usr/bin
|
||||||
|
etc/dde-dock
|
||||||
usr/lib/dde-dock/plugins/libdatetime.so
|
usr/lib/dde-dock/plugins/libdatetime.so
|
||||||
usr/lib/dde-dock/plugins/libshutdown.so
|
usr/lib/dde-dock/plugins/libshutdown.so
|
||||||
usr/lib/dde-dock/plugins/libtrash.so
|
usr/lib/dde-dock/plugins/libtrash.so
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
#include "dbusadaptors.h"
|
#include "dbusadaptors.h"
|
||||||
|
|
||||||
#include <DDBusSender>
|
#include <DDBusSender>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@ -26,7 +28,8 @@ DBusAdaptors::DBusAdaptors(QObject *parent)
|
|||||||
m_keyboard(new Keyboard("com.deepin.daemon.InputDevices",
|
m_keyboard(new Keyboard("com.deepin.daemon.InputDevices",
|
||||||
"/com/deepin/daemon/InputDevice/Keyboard",
|
"/com/deepin/daemon/InputDevice/Keyboard",
|
||||||
QDBusConnection::sessionBus(), this)),
|
QDBusConnection::sessionBus(), this)),
|
||||||
m_menu(new QMenu())
|
m_menu(new QMenu()),
|
||||||
|
m_gsettings(Utils::ModuleSettingsPtr("keyboard", QByteArray(), this))
|
||||||
{
|
{
|
||||||
m_keyboard->setSync(false);
|
m_keyboard->setSync(false);
|
||||||
|
|
||||||
@ -39,6 +42,9 @@ DBusAdaptors::DBusAdaptors(QObject *parent)
|
|||||||
initAllLayoutList();
|
initAllLayoutList();
|
||||||
onCurrentLayoutChanged(m_keyboard->currentLayout());
|
onCurrentLayoutChanged(m_keyboard->currentLayout());
|
||||||
onUserLayoutListChanged(m_keyboard->userLayoutList());
|
onUserLayoutListChanged(m_keyboard->userLayoutList());
|
||||||
|
|
||||||
|
if (m_gsettings)
|
||||||
|
connect(m_gsettings, &QGSettings::changed, this, &DBusAdaptors::onGSettingsChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBusAdaptors::~DBusAdaptors()
|
DBusAdaptors::~DBusAdaptors()
|
||||||
@ -47,6 +53,9 @@ DBusAdaptors::~DBusAdaptors()
|
|||||||
|
|
||||||
QString DBusAdaptors::layout() const
|
QString DBusAdaptors::layout() const
|
||||||
{
|
{
|
||||||
|
if (m_gsettings && m_gsettings->keys().contains("enable") && !m_gsettings->get("enable").toBool())
|
||||||
|
return QString();
|
||||||
|
|
||||||
if (m_userLayoutList.size() < 2) {
|
if (m_userLayoutList.size() < 2) {
|
||||||
// do NOT show keyboard indicator
|
// do NOT show keyboard indicator
|
||||||
return QString();
|
return QString();
|
||||||
@ -180,6 +189,18 @@ void DBusAdaptors::handleActionTriggered(QAction *action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DBusAdaptors::onGSettingsChanged(const QString &key)
|
||||||
|
{
|
||||||
|
Q_UNUSED(key);
|
||||||
|
|
||||||
|
// 键盘布局插件处显示的内容就是QLabel中的内容,有文字了就显示,没有文字就不显示了
|
||||||
|
if (m_gsettings && m_gsettings->keys().contains("enable")) {
|
||||||
|
const bool enable = m_gsettings->get("enable").toBool();
|
||||||
|
QString layoutStr = getCurrentKeyboard()->currentLayout().split(';').first();
|
||||||
|
setLayout(enable ? layoutStr : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString DBusAdaptors::duplicateCheck(const QString &kb)
|
QString DBusAdaptors::duplicateCheck(const QString &kb)
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <com_deepin_daemon_inputdevice_keyboard.h>
|
#include <com_deepin_daemon_inputdevice_keyboard.h>
|
||||||
|
|
||||||
using Keyboard = com::deepin::daemon::inputdevice::Keyboard;
|
using Keyboard = com::deepin::daemon::inputdevice::Keyboard;
|
||||||
|
class QGSettings;
|
||||||
|
|
||||||
class DBusAdaptors : public QDBusAbstractAdaptor
|
class DBusAdaptors : public QDBusAbstractAdaptor
|
||||||
{
|
{
|
||||||
@ -64,6 +65,9 @@ private slots:
|
|||||||
void refreshMenuSelection();
|
void refreshMenuSelection();
|
||||||
void handleActionTriggered(QAction *action);
|
void handleActionTriggered(QAction *action);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onGSettingsChanged(const QString &key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString duplicateCheck(const QString &kb);
|
QString duplicateCheck(const QString &kb);
|
||||||
|
|
||||||
@ -76,6 +80,7 @@ private:
|
|||||||
QString m_currentLayout;
|
QString m_currentLayout;
|
||||||
QStringList m_userLayoutList;
|
QStringList m_userLayoutList;
|
||||||
KeyboardLayoutList m_allLayoutList;
|
KeyboardLayoutList m_allLayoutList;
|
||||||
|
const QGSettings *m_gsettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,10 +22,7 @@
|
|||||||
|
|
||||||
KeyboardPlugin::KeyboardPlugin(QObject *parent)
|
KeyboardPlugin::KeyboardPlugin(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_gsettings(Utils::ModuleSettingsPtr(pluginName(), QByteArray(), this))
|
|
||||||
{
|
{
|
||||||
if (m_gsettings)
|
|
||||||
connect(m_gsettings, &QGSettings::changed, this, &KeyboardPlugin::onGSettingsChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardPlugin::~KeyboardPlugin()
|
KeyboardPlugin::~KeyboardPlugin()
|
||||||
@ -95,15 +92,3 @@ void KeyboardPlugin::setSortKey(const QString &itemKey, const int order)
|
|||||||
|
|
||||||
m_proxyInter->saveValue(this, key, order);
|
m_proxyInter->saveValue(this, key, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyboardPlugin::onGSettingsChanged(const QString &key)
|
|
||||||
{
|
|
||||||
Q_UNUSED(key);
|
|
||||||
|
|
||||||
// 键盘布局插件处显示的内容就是QLabel中的内容,有文字了就显示,没有文字就不显示了
|
|
||||||
if (m_gsettings && m_gsettings->keys().contains("enable")) {
|
|
||||||
const bool enable = m_gsettings->get("enable").toBool();
|
|
||||||
QString layoutStr = m_dbusAdaptors->getCurrentKeyboard()->currentLayout().split(';').first();
|
|
||||||
m_dbusAdaptors->setLayout(enable ? layoutStr : "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
#include "pluginsiteminterface.h"
|
#include "pluginsiteminterface.h"
|
||||||
#include "dbusadaptors.h"
|
#include "dbusadaptors.h"
|
||||||
|
|
||||||
class QGSettings;
|
|
||||||
|
|
||||||
class KeyboardPlugin : public QObject, PluginsItemInterface
|
class KeyboardPlugin : public QObject, PluginsItemInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -45,12 +43,8 @@ public:
|
|||||||
int itemSortKey(const QString &itemKey) override;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) override;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onGSettingsChanged(const QString &key);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DBusAdaptors *m_dbusAdaptors = nullptr;
|
DBusAdaptors *m_dbusAdaptors = nullptr;
|
||||||
const QGSettings *m_gsettings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user