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

fix a case to autoupdate free_activities_id

--when free_activities layout becomes shared
then another layout should become responsible
for FREE_ACTIVITIES
This commit is contained in:
Michail Vourlakos 2020-03-19 01:44:52 +02:00
parent 97e5345f40
commit 2bc4e63431

View File

@ -427,7 +427,7 @@ void Layouts::autoAssignFreeActivitiesLayout()
QString activeCurrentId = m_layoutsTable.idForOriginalName(m_corona->layoutsManager()->currentLayoutName()); QString activeCurrentId = m_layoutsTable.idForOriginalName(m_corona->layoutsManager()->currentLayoutName());
int row = m_layoutsTable.indexOf(activeCurrentId); int row = m_layoutsTable.indexOf(activeCurrentId);
if (row>=0 && m_layoutsTable[row].activities.isEmpty()) { if (row>=0 && !(m_inMultipleMode && m_layoutsTable[row].isShared()) && m_layoutsTable[row].activities.isEmpty()) {
m_layoutsTable[row].activities << Data::Layout::FREEACTIVITIESID; m_layoutsTable[row].activities << Data::Layout::FREEACTIVITIESID;
emit dataChanged(index(row,BACKGROUNDCOLUMN), index(row,ACTIVITYCOLUMN), roles); emit dataChanged(index(row,BACKGROUNDCOLUMN), index(row,ACTIVITYCOLUMN), roles);
return; return;
@ -435,7 +435,7 @@ void Layouts::autoAssignFreeActivitiesLayout()
//! Active layouts with no activities have mid priority //! Active layouts with no activities have mid priority
for(int i=0; i<rowCount(); ++i) { for(int i=0; i<rowCount(); ++i) {
if (m_layoutsTable[i].isActive && m_layoutsTable[i].activities.isEmpty()) { if (m_layoutsTable[i].isActive && m_layoutsTable[i].activities.isEmpty() && !(m_inMultipleMode && m_layoutsTable[i].isShared())) {
m_layoutsTable[i].activities << Data::Layout::FREEACTIVITIESID; m_layoutsTable[i].activities << Data::Layout::FREEACTIVITIESID;
emit dataChanged(index(i,BACKGROUNDCOLUMN), index(i,ACTIVITYCOLUMN), roles); emit dataChanged(index(i,BACKGROUNDCOLUMN), index(i,ACTIVITYCOLUMN), roles);
return; return;
@ -444,7 +444,7 @@ void Layouts::autoAssignFreeActivitiesLayout()
//! Inactive layouts with no activities have lowest priority //! Inactive layouts with no activities have lowest priority
for(int i=0; i<rowCount(); ++i) { for(int i=0; i<rowCount(); ++i) {
if (!m_layoutsTable[i].isActive && m_layoutsTable[i].activities.isEmpty()) { if (!m_layoutsTable[i].isActive && m_layoutsTable[i].activities.isEmpty() && !(m_inMultipleMode && m_layoutsTable[i].isShared())) {
m_layoutsTable[i].activities << Data::Layout::FREEACTIVITIESID; m_layoutsTable[i].activities << Data::Layout::FREEACTIVITIESID;
emit dataChanged(index(i,BACKGROUNDCOLUMN), index(i,ACTIVITYCOLUMN), roles); emit dataChanged(index(i,BACKGROUNDCOLUMN), index(i,ACTIVITYCOLUMN), roles);
return; return;
@ -557,6 +557,13 @@ void Layouts::setShares(const int &row, const QStringList &shares)
emit dataChanged(index(i,IDCOLUMN), index(i,SHAREDCOLUMN), roles); emit dataChanged(index(i,IDCOLUMN), index(i,SHAREDCOLUMN), roles);
} }
} }
if (m_layoutsTable[row].activities.contains(Data::Layout::FREEACTIVITIESID)
&& m_inMultipleMode
&& m_layoutsTable[row].isShared()) {
//! we need to remove the free_activities flag in such case
setActivities(row, QStringList());
}
} }
bool Layouts::setData(const QModelIndex &index, const QVariant &value, int role) bool Layouts::setData(const QModelIndex &index, const QVariant &value, int role)