┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-07-17 19:37:47 +0000
committerPeter Penz <[email protected]>2009-07-17 19:37:47 +0000
commit68a2ef914305fac139eaf3bdb8264a3927d75e45 (patch)
treebe2ce4220d1fd980e8ccbd5f1c1cd52cad625375 /src
parenta447eb391c53e2731f61375411007b73bf95a0a3 (diff)
remove revision-information entries when items got deleted in the model
svn path=/trunk/KDE/kdebase/apps/; revision=998498
Diffstat (limited to 'src')
-rw-r--r--src/dolphinmodel.cpp17
-rw-r--r--src/dolphinmodel.h3
2 files changed, 19 insertions, 1 deletions
diff --git a/src/dolphinmodel.cpp b/src/dolphinmodel.cpp
index f399c3304..c5ea06a36 100644
--- a/src/dolphinmodel.cpp
+++ b/src/dolphinmodel.cpp
@@ -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;
diff --git a/src/dolphinmodel.h b/src/dolphinmodel.h
index 717f21d4e..45fd1efa2 100644
--- a/src/dolphinmodel.h
+++ b/src/dolphinmodel.h
@@ -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;