diff options
| author | Peter Penz <[email protected]> | 2012-05-03 22:26:10 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-03 22:27:11 +0200 |
| commit | 067642a23cfd759442a541335e42cef0e8c09e7f (patch) | |
| tree | c46b774ac25e918ffa85da633c970933d72ce0c6 /src | |
| parent | 9c033396b93d429b2cbefb0304e1eddd3b6c5cd2 (diff) | |
Places Panel: Implement PlacesItemModel::setHiddenItemsShown(false)
Diffstat (limited to 'src')
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 4fb85dea0..2e8cb67b1 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -121,6 +121,7 @@ void PlacesItemModel::setHiddenItemsShown(bool show) m_hiddenItemsShown = show; if (show) { + // Move all items that are part of m_hiddenItems to the model. int modelIndex = 0; for (int hiddenIndex = 0; hiddenIndex < m_hiddenItems.count(); ++hiddenIndex) { if (m_hiddenItems[hiddenIndex]) { @@ -133,7 +134,17 @@ void PlacesItemModel::setHiddenItemsShown(bool show) ++modelIndex; } } else { - + // Move all items of the model, where the "isHidden" property is true, to + // m_hiddenItems. + Q_ASSERT(m_hiddenItems.count() == count()); + for (int i = count() - 1; i >= 0; --i) { + KStandardItem* visibleItem = item(i); + if (visibleItem->dataValue("isHidden").toBool()) { + KStandardItem* hiddenItem = new KStandardItem(*visibleItem); + removeItem(i); + m_hiddenItems.insert(i, hiddenItem); + } + } } #ifdef PLACESITEMMODEL_DEBUG kDebug() << "Changed visibility of hidden items"; |
