1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

fix single mode active layout ordering

--simplify also some code parts in layouts handler
This commit is contained in:
Michail Vourlakos 2021-02-14 18:39:30 +02:00
parent 4a89138a6e
commit 4806a7c5e2
2 changed files with 4 additions and 13 deletions

View File

@ -578,10 +578,7 @@ QVariant Layouts::data(const QModelIndex &index, int role) const
break;
case NAMECOLUMN:
if (role == SORTINGROLE) {
if ((inMultipleMode() && m_layoutsTable[row].isActive)
|| (!inMultipleMode()
&& !original.name.isEmpty()
&& original.name == m_corona->universalSettings()->singleModeLayoutName())) {
if (m_layoutsTable[row].isActive) {
return sortingPriority(HIGHESTPRIORITY, row);
}
@ -802,6 +799,7 @@ void Layouts::updateActiveStates()
roles << Qt::DisplayRole;
roles << Qt::UserRole;
roles << ISACTIVEROLE;
roles << SORTINGROLE;
for(int i=0; i<rowCount(); ++i) {
bool iActive{false};
@ -812,7 +810,6 @@ void Layouts::updateActiveStates()
if (m_layoutsTable[i].isActive != iActive) {
m_layoutsTable[i].isActive = iActive;
emit dataChanged(index(i, BACKGROUNDCOLUMN), index(i,ACTIVITYCOLUMN), roles);
}
}

View File

@ -324,18 +324,12 @@ void TabLayouts::switchLayout()
selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal;
if (m_layoutsController->layoutsAreChanged()) {
showInlineMessage(i18nc("settings:not permitted switching layout","You need to <b>apply</b> your changes first to switch layout..."),
showInlineMessage(i18nc("settings:not permitted switching layout","You need to <b>apply</b> your changes first to switch layout afterwards..."),
KMessageWidget::Warning);
return;
}
if (!m_layoutsController->inMultipleMode()) {
m_corona->layoutsManager()->switchToLayout(selectedLayoutOriginal.name, MemoryUsage::SingleLayout);
m_layoutsController->setOriginalInMultipleMode(false);
} else {
m_corona->layoutsManager()->switchToLayout(selectedLayoutOriginal.name, MemoryUsage::MultipleLayouts);
m_layoutsController->setOriginalInMultipleMode(true);
}
m_corona->layoutsManager()->switchToLayout(selectedLayoutOriginal.name, MemoryUsage::SingleLayout);
updatePerLayoutButtonsState();
}