diff --git a/app/settings/data/layoutdata.cpp b/app/settings/data/layoutdata.cpp index a2f858014..4ca29d4bc 100644 --- a/app/settings/data/layoutdata.cpp +++ b/app/settings/data/layoutdata.cpp @@ -124,7 +124,7 @@ bool Layout::isShared() const bool Layout::nameWasEdited() const { - return !m_editedName.isEmpty() && (m_editedName != m_originalName); + return (!m_editedName.isEmpty() && (m_editedName != m_originalName)) || id.startsWith("/tmp"); } QString Layout::editedName() const diff --git a/app/settings/models/layoutsmodel.cpp b/app/settings/models/layoutsmodel.cpp index 0f8fd1280..e30172f91 100644 --- a/app/settings/models/layoutsmodel.cpp +++ b/app/settings/models/layoutsmodel.cpp @@ -116,20 +116,33 @@ void Layouts::appendLayout(const Settings::Data::Layout &layout) void Layouts::removeLayout(const QString &id) { - if (m_layoutsTable.contains(id)) { - beginInsertRows(QModelIndex(), m_layoutsTable.rowCount(), m_layoutsTable.rowCount()); - m_layoutsTable.removeLayout(id); + int index = m_layoutsTable.indexOf(id); + + if (index >= 0) { + beginRemoveRows(QModelIndex(), index, index); + m_layoutsTable.remove(index); endInsertRows(); } } -void Layouts::remove(const int &row) +bool Layouts::removeRows(int row, int count, const QModelIndex &parent) { - if (m_layoutsTable.rowExists(row)) { - beginInsertRows(QModelIndex(), m_layoutsTable.rowCount(), m_layoutsTable.rowCount()); - m_layoutsTable.remove(row); - endInsertRows(); + Q_UNUSED(parent) + + int firstRow = row; + int lastRow = row+count-1; + + if (count > 0 && m_layoutsTable.rowExists(firstRow) && (m_layoutsTable.rowExists(lastRow))) { + beginRemoveRows(QModelIndex(), firstRow, lastRow); + for(int i=0; ilayoutsManager()->currentLayoutName()) + if ((originalName == m_corona->layoutsManager()->currentLayoutName()) || (m_corona->layoutsManager()->synchronizer()->centralLayout(originalName)) || lockedInModel) { ui->removeButton->setEnabled(false);