mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 05:33:50 +03:00
update layout removing in settings window
This commit is contained in:
parent
60d24144b5
commit
e29b5a3e38
@ -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
|
||||
|
@ -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; i<count; ++i) {
|
||||
m_layoutsTable.remove(firstRow);
|
||||
}
|
||||
endRemoveRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant Layouts::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
|
@ -84,12 +84,11 @@ public:
|
||||
const Data::Layout &at(const int &row);
|
||||
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
|
||||
void appendLayout(const Settings::Data::Layout &layout);
|
||||
void clear();
|
||||
void appendLayout(const Settings::Data::Layout &layout);
|
||||
void removeLayout(const QString &id);
|
||||
void remove(const int &row);
|
||||
|
||||
const Data::LayoutsTable ¤tData();
|
||||
void setCurrentData(Data::LayoutsTable &data);
|
||||
|
@ -1268,8 +1268,7 @@ void SettingsDialog::updatePerLayoutButtonsState()
|
||||
}
|
||||
|
||||
//! Remove Layout Button
|
||||
if (originalName != nameInModel
|
||||
|| (originalName == m_corona->layoutsManager()->currentLayoutName())
|
||||
if ((originalName == m_corona->layoutsManager()->currentLayoutName())
|
||||
|| (m_corona->layoutsManager()->synchronizer()->centralLayout(originalName))
|
||||
|| lockedInModel) {
|
||||
ui->removeButton->setEnabled(false);
|
||||
|
Loading…
Reference in New Issue
Block a user