fix: 声音、网络、键盘布局等图标排序时不再区分是否系统图标,同时将排序字段统一成pos_%1_%2格式

在图标排序时,对于系统图标,会自动全部排在其他图标后面,而声音图标正好是属于系统图标,在切换Dock显示模式时,会将声音图标显示在网络图标后面

Log: 修复调整声音插件顺序,切换任务栏模式之后,声音插件顺序改变问题(bug:38862)
Bug: https://pms.uniontech.com/zentao/bug-view-38862.html
Change-Id: Ib080d6eed3a361974142911ff81e9fa0003ae01f
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/343
Reviewed-by: lizhongming <lizhongming@uniontech.com>
Tested-by: lizhongming <lizhongming@uniontech.com>
This commit is contained in:
chenjun 2020-07-22 20:38:24 +08:00 committed by lizhongming
parent 6e394a78b4
commit cc9af0844c
4 changed files with 20 additions and 6 deletions

View File

@ -59,7 +59,7 @@ void DatetimePlugin::init(PluginProxyInterface *proxyInter)
QSettings settings("deepin", "dde-dock-datetime");
if (QFile::exists(settings.fileName())) {
Dock::DisplayMode mode = displayMode();
const QString key = QString("pos_%1").arg(mode);
const QString key = QString("pos_%1_%2").arg(pluginName()).arg(mode);
proxyInter->saveValue(this, key, settings.value(key, mode == Dock::DisplayMode::Fashion ? 5 : -1));
QFile::remove(settings.fileName());
}
@ -110,7 +110,7 @@ int DatetimePlugin::itemSortKey(const QString &itemKey)
{
Q_UNUSED(itemKey);
const QString key = QString("pos_%1").arg(Dock::Efficient);
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 5).toInt();
}
@ -118,7 +118,7 @@ void DatetimePlugin::setSortKey(const QString &itemKey, const int order)
{
Q_UNUSED(itemKey);
const QString key = QString("pos_%1").arg(Dock::Efficient);
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -77,3 +77,17 @@ QWidget *KeyboardPlugin::itemTipsWidget(const QString &itemKey)
return nullptr;
}
int KeyboardPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 2).toInt();
}
void KeyboardPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -40,6 +40,9 @@ public:
QWidget *itemWidget(const QString &itemKey) override;
QWidget *itemTipsWidget(const QString &itemKey) override;
int itemSortKey(const QString &itemKey) override;
void setSortKey(const QString &itemKey, const int order) override;
private:
DBusAdaptors *m_dbusAdaptors = nullptr;
};

View File

@ -293,9 +293,6 @@ int AbstractContainer::whereToInsert(FashionTrayWidgetWrapper *wrapper)
return m_wrapperList.size();
}
if (wrapper->absTrayWidget()->trayTyep() == AbstractTrayWidget::TrayType::SystemTray)
destSortKey += m_wrapperList.size();
// 当目标插入位置为列表的大小时将从最后面追加到列表中
int destIndex = m_wrapperList.size();
for (int i = 0; i < m_wrapperList.size(); ++i) {