diff options
| author | Don Sanders <don.sanders@nokia.com> | 2010-02-04 20:57:50 +1000 |
|---|---|---|
| committer | Don Sanders <don.sanders@nokia.com> | 2010-02-04 20:57:50 +1000 |
| commit | 1f4314e3d57d8c9b54da25598a47d1dbb0c14957 (patch) | |
| tree | fba19393818bb7713896efb12f739b075641a2d1 /examples/applications/qtmail/messagelistview.cpp | |
| parent | 040fcb664545c794f240796d51337f39251035a7 (diff) | |
Simplify last commit.
Diffstat (limited to 'examples/applications/qtmail/messagelistview.cpp')
| -rw-r--r-- | examples/applications/qtmail/messagelistview.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/examples/applications/qtmail/messagelistview.cpp b/examples/applications/qtmail/messagelistview.cpp index c8a94622..c2529354 100644 --- a/examples/applications/qtmail/messagelistview.cpp +++ b/examples/applications/qtmail/messagelistview.cpp @@ -1038,32 +1038,15 @@ void MessageListView::expandAll() QTimer::singleShot(0, this, SLOT(reviewVisibleMessages())); } -QModelIndex MessageListView::find(const QModelIndex &start, const QMailMessageId &id) -{ - QModelIndex parent(start.parent()); - for (int i = start.row(); i < mModel->rowCount(parent); ++i) { - QModelIndex index(mModel->index(i, 0, parent)); - if (id == (mModel->idFromIndex(index))) { - return index; - } - if (mModel->hasChildren(index)) { - QModelIndex found(find(mModel->index(0, 0, index), id)); - if (found.isValid()) - return found; - } - } - return QModelIndex(); -} - void MessageListView::scrollTo(const QMailMessageId &id) { if (!id.isValid()) return; - QModelIndex found(find(mModel->index(0,0), id)); - if (found.isValid()) { - mMessageList->scrollTo(found); - mMessageList->setCurrentIndex(found); + QModelIndex index(mModel->indexFromId(id)); + if (index.isValid()) { + mMessageList->scrollTo(index); + mMessageList->setCurrentIndex(index); } } |
