mirror of
https://github.com/KDE/latte-dock.git
synced 2025-08-29 17:49:28 +03:00
choose which layouts must be saved in settings
--through the Layouts model we know which layouts have been saved and which of them do not need to be touched because they do not have any changes
This commit is contained in:
@ -673,8 +673,10 @@ void Layouts::save()
|
||||
|
||||
QList<Data::UniqueIdInfo> alteredIdsInfo;
|
||||
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
Data::Layout iLayoutCurrentData = m_model->at(i);
|
||||
QList<Data::Layout> alteredLayouts = m_model->alteredLayouts();
|
||||
|
||||
for (int i = 0; i < alteredLayouts.count(); ++i) {
|
||||
Data::Layout iLayoutCurrentData = alteredLayouts[i];
|
||||
Data::Layout iLayoutOriginalData = m_model->originalData(iLayoutCurrentData.id);
|
||||
iLayoutOriginalData = iLayoutOriginalData.isEmpty() ? iLayoutCurrentData : iLayoutOriginalData;
|
||||
|
||||
@ -792,8 +794,8 @@ void Layouts::save()
|
||||
}
|
||||
|
||||
//! lock layouts in the end when the user has chosen it
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
Data::Layout layoutCurrentData = m_model->at(i);
|
||||
for (int i = 0; i < alteredLayouts.count(); ++i) {
|
||||
Data::Layout layoutCurrentData = alteredLayouts[i];
|
||||
Data::Layout layoutOriginalData = m_model->originalData(layoutCurrentData.id);
|
||||
layoutOriginalData = layoutOriginalData.isEmpty() ? layoutCurrentData : layoutOriginalData;
|
||||
|
||||
|
@ -978,6 +978,21 @@ void Layouts::setOriginalData(Data::LayoutsTable &data, const bool &inmultiple)
|
||||
emit rowsInserted();
|
||||
}
|
||||
|
||||
QList<Data::Layout> Layouts::alteredLayouts() const
|
||||
{
|
||||
QList<Data::Layout> layouts;
|
||||
|
||||
for(int i=0; i<rowCount(); ++i) {
|
||||
QString currentId = m_layoutsTable[i].id;
|
||||
|
||||
if ((!o_layoutsTable.containsId(currentId))
|
||||
|| m_layoutsTable[currentId] != o_layoutsTable[currentId]) {
|
||||
layouts << m_layoutsTable[i];
|
||||
}
|
||||
}
|
||||
|
||||
return layouts;
|
||||
}
|
||||
|
||||
//! Activities code
|
||||
void Layouts::initActivities()
|
||||
|
@ -130,6 +130,8 @@ public:
|
||||
bool shareIsAvailable(const QString id) const;
|
||||
QStringList availableShareIdsFor(const QString id) const;
|
||||
|
||||
QList<Data::Layout> alteredLayouts() const;
|
||||
|
||||
const Data::LayoutsTable ¤tLayoutsData();
|
||||
const Data::LayoutsTable &originalLayoutsData();
|
||||
void setOriginalData(Data::LayoutsTable &data, const bool &inmultiple);
|
||||
|
Reference in New Issue
Block a user