[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/office/tellico/src
From: Robby Stephenson <robby () periapsis ! org>
Date: 2011-04-08 17:05:54
Message-ID: 20110408170554.B36A8AC8CF () svn ! kde ! org
[Download RAW message or body]
SVN commit 1227409 by rstephenson:
move filter index function to model class
M +1 -1 commands/removeentries.cpp
M +1 -12 filterview.cpp
M +0 -1 filterview.h
M +1 -1 models/abstractentrymodel.cpp
M +17 -0 models/filtermodel.cpp
M +1 -0 models/filtermodel.h
--- trunk/extragear/office/tellico/src/commands/removeentries.cpp #1227408:1227409
@@ -1,5 +1,5 @@
/***************************************************************************
- Copyright (C) 2005-2009 Robby Stephenson <robby@periapsis.org>
+ Copyright (C) 2005-2011 Robby Stephenson <robby@periapsis.org>
***************************************************************************/
/***************************************************************************
--- trunk/extragear/office/tellico/src/filterview.cpp #1227408:1227409
@@ -219,7 +219,7 @@
// two cases: if the filter used to match the entry and no longer does, then \
check the children indexes // if the filter matches now, check the actual match
foreach(Data::EntryPtr entry, entries_) {
- if(indexContainsEntry(index, entry) || filter->matches(entry)) {
+ if(sourceModel()->indexContainsEntry(index, entry) || filter->matches(entry)) \
{ sourceModel()->invalidate(index);
break;
}
@@ -227,15 +227,4 @@
}
}
-bool FilterView::indexContainsEntry(const QModelIndex& parent_, Data::EntryPtr \
entry_) const {
- QModelIndex entryIndex = sourceModel()->index(0, 0, parent_);
- while(entryIndex.isValid()) {
- if(sourceModel()->entry(entryIndex) == entry_) {
- return true;
- }
- entryIndex = entryIndex.sibling(entryIndex.row()+1, 0);
- }
- return false;
-}
-
#include "filterview.moc"
--- trunk/extragear/office/tellico/src/filterview.h #1227408:1227409
@@ -80,7 +80,6 @@
void contextMenuEvent(QContextMenuEvent* event);
void updateHeader();
void invalidate(Data::EntryList entries);
- bool indexContainsEntry(const QModelIndex& parent, Data::EntryPtr entry) const;
bool m_notSortedYet;
Data::CollPtr m_coll;
--- trunk/extragear/office/tellico/src/models/abstractentrymodel.cpp #1227408:1227409
@@ -1,5 +1,5 @@
/***************************************************************************
- Copyright (C) 2008-2009 Robby Stephenson <robby@periapsis.org>
+ Copyright (C) 2008-2011 Robby Stephenson <robby@periapsis.org>
***************************************************************************/
/***************************************************************************
--- trunk/extragear/office/tellico/src/models/filtermodel.cpp #1227408:1227409
@@ -266,4 +266,21 @@
emit dataChanged(index_, index_);
}
+bool FilterModel::indexContainsEntry(const QModelIndex& parent_, Data::EntryPtr \
entry_) const { + Q_ASSERT(entry_);
+ if(!entry_) {
+ return false;
+ }
+
+ QModelIndex entryIndex = index(0, 0, parent_);
+ while(entryIndex.isValid()) {
+ Node* node = static_cast<Node*>(entryIndex.internalPointer());
+ if(node && node->id() == entry_->id()) {
+ return true;
+ }
+ entryIndex = entryIndex.sibling(entryIndex.row()+1, 0);
+ }
+ return false;
+}
+
#include "filtermodel.moc"
--- trunk/extragear/office/tellico/src/models/filtermodel.h #1227408:1227409
@@ -57,6 +57,7 @@
FilterPtr filter(const QModelIndex& index) const;
Data::EntryPtr entry(const QModelIndex& index) const;
void invalidate(const QModelIndex& index);
+ bool indexContainsEntry(const QModelIndex& parent, Data::EntryPtr entry) const;
private:
FilterList m_filters;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic