mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
remove revision-information entries when items got deleted in the model
svn path=/trunk/KDE/kdebase/apps/; revision=998498
This commit is contained in:
parent
a447eb391c
commit
68a2ef9143
2 changed files with 19 additions and 1 deletions
|
@ -70,7 +70,12 @@ bool DolphinModel::setData(const QModelIndex& index, const QVariant& value, int
|
|||
const QPersistentModelIndex key = index;
|
||||
const RevisionState state = static_cast<RevisionState>(value.toInt());
|
||||
if (m_revisionHash.value(key, LocalRevision) != state) {
|
||||
m_hasRevisionData = true;
|
||||
if (!m_hasRevisionData) {
|
||||
connect(this, SIGNAL(rowsRemoved (const QModelIndex&, int, int)),
|
||||
this, SLOT(slotRowsRemoved(const QModelIndex&, int, int)));
|
||||
m_hasRevisionData = true;
|
||||
}
|
||||
|
||||
m_revisionHash.insert(key, state);
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
|
@ -138,6 +143,16 @@ bool DolphinModel::hasRevisionData() const
|
|||
return m_hasRevisionData;
|
||||
}
|
||||
|
||||
void DolphinModel::slotRowsRemoved(const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
Q_ASSERT(hasRevisionData());
|
||||
|
||||
const int column = parent.column();
|
||||
for (int row = start; row <= end; ++row) {
|
||||
m_revisionHash.remove(parent.child(row, column));
|
||||
}
|
||||
}
|
||||
|
||||
QVariant DolphinModel::displayRoleData(const QModelIndex& index) const
|
||||
{
|
||||
QString retString;
|
||||
|
|
|
@ -54,6 +54,9 @@ public:
|
|||
|
||||
bool hasRevisionData() const;
|
||||
|
||||
private slots:
|
||||
void slotRowsRemoved(const QModelIndex& parent, int start, int end);
|
||||
|
||||
private:
|
||||
QVariant displayRoleData(const QModelIndex& index) const;
|
||||
QVariant sortRoleData(const QModelIndex& index) const;
|
||||
|
|
Loading…
Reference in a new issue