fixed(dde-dock): change the plugins sort for bug 10319

This commit is contained in:
wangxuwen 2020-01-11 10:35:29 +08:00
parent 4376f36beb
commit c841e462fd
12 changed files with 31 additions and 55 deletions

View File

@ -345,7 +345,7 @@ void DockSettings::onDisplayModeChanged()
emit displayModeChanegd();
calculateWindowConfig();
QTimer::singleShot(1, m_itemManager, &DockItemManager::sortPluginItems);
//QTimer::singleShot(1, m_itemManager, &DockItemManager::sortPluginItems);
}
void DockSettings::hideModeChanged()

View File

@ -109,21 +109,15 @@ int DatetimePlugin::itemSortKey(const QString &itemKey)
{
Q_UNUSED(itemKey);
Dock::DisplayMode mode = displayMode();
const QString key = QString("pos_%1").arg(mode);
if (mode == Dock::DisplayMode::Fashion) {
return m_proxyInter->getValue(this, key, 3).toInt();
} else {
return m_proxyInter->getValue(this, key, -1).toInt();
}
const QString key = QString("pos_%1").arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 5).toInt();
}
void DatetimePlugin::setSortKey(const QString &itemKey, const int order)
{
Q_UNUSED(itemKey);
const QString key = QString("pos_%1").arg(displayMode());
const QString key = QString("pos_%1").arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -139,14 +139,14 @@ void MultitaskingPlugin::refreshIcon(const QString &itemKey)
int MultitaskingPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 2).toInt();
}
void MultitaskingPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -147,14 +147,14 @@ QWidget *NetworkPlugin::itemPopupApplet(const QString &itemKey)
int NetworkPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, displayMode() == Dock::DisplayMode::Fashion ? 2 : 2).toInt();
return m_proxyInter->getValue(this, key, 2).toInt();
}
void NetworkPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -126,19 +126,13 @@ void OnboardPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
int OnboardPlugin::itemSortKey(const QString &itemKey)
{
Dock::DisplayMode mode = displayMode();
const QString key = QString("pos_%1_%2").arg(itemKey).arg(mode);
if (mode == Dock::DisplayMode::Fashion) {
return m_proxyInter->getValue(this, key, 1).toInt();
} else {
return m_proxyInter->getValue(this, key, 4).toInt();
}
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 3).toInt();
}
void OnboardPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -121,19 +121,13 @@ void OverlayWarningPlugin::displayModeChanged(const Dock::DisplayMode displayMod
int OverlayWarningPlugin::itemSortKey(const QString &itemKey)
{
Dock::DisplayMode mode = displayMode();
const QString key = QString("pos_%1_%2").arg(itemKey).arg(mode);
if (mode == Dock::DisplayMode::Fashion) {
return m_proxyInter->getValue(this, key, 2).toInt();
} else {
return m_proxyInter->getValue(this, key, 5).toInt();
}
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 3).toInt();
}
void OverlayWarningPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -139,14 +139,14 @@ void PowerPlugin::refreshIcon(const QString &itemKey)
int PowerPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, displayMode() == Dock::DisplayMode::Fashion ? 3 : 3).toInt();
return m_proxyInter->getValue(this, key, 4).toInt();
}
void PowerPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -139,14 +139,14 @@ void ShowDesktopPlugin::refreshIcon(const QString &itemKey)
int ShowDesktopPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 1).toInt();
}
void ShowDesktopPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -199,19 +199,13 @@ void ShutdownPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
int ShutdownPlugin::itemSortKey(const QString &itemKey)
{
Dock::DisplayMode mode = displayMode();
const QString key = QString("pos_%1_%2").arg(itemKey).arg(mode);
if (mode == Dock::DisplayMode::Fashion) {
return m_proxyInter->getValue(this, key, 2).toInt();
} else {
return m_proxyInter->getValue(this, key, 5).toInt();
}
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 6).toInt();
}
void ShutdownPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -107,14 +107,14 @@ void SoundPlugin::invokedMenuItem(const QString &itemKey, const QString &menuId,
int SoundPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, displayMode() == Dock::DisplayMode::Fashion ? 1 : 1).toInt();
return m_proxyInter->getValue(this, key, 1).toInt();
}
void SoundPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -154,13 +154,13 @@ void TrashPlugin::pluginStateSwitched()
int TrashPlugin::itemSortKey(const QString &itemKey)
{
const QString &key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
return m_proxyInter->getValue(this, key, -1).toInt();
const QString &key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 7).toInt();
}
void TrashPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString &key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
const QString &key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -176,7 +176,7 @@ int TrayPlugin::itemSortKey(const QString &itemKey)
return defaultSort;
}
const QString key = QString("pos_%1_%2").arg(trayWidget->itemKeyForConfig()).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(trayWidget->itemKeyForConfig()).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, defaultSort).toInt();
}
@ -197,7 +197,7 @@ void TrayPlugin::setSortKey(const QString &itemKey, const int order)
return;
}
const QString key = QString("pos_%1_%2").arg(trayWidget->itemKeyForConfig()).arg(displayMode());
const QString key = QString("pos_%1_%2").arg(trayWidget->itemKeyForConfig()).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}