1 // -*- indent-tabs-mode:nil -*-
2 // vim: set ts=4 sts=4 sw=4 et:
3 /* This file is part of the KDE project
4 Copyright (C) 2000 David Faure <faure@kde.org>
5 Copyright (C) 2002-2003 Alexander Kellett <lypanov@kde.org>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License version 2 or at your option version 3 as published by
10 the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #include "bookmarkiterator.h"
28 #include <QtCore/QTimer>
31 BookmarkIterator::BookmarkIterator(QList
<KBookmark
> bks
) : m_bklist(bks
) {
32 connect(this, SIGNAL( deleteSelf(BookmarkIterator
*) ),
33 SLOT( slotCancelTest(BookmarkIterator
*) ));
37 BookmarkIterator::~BookmarkIterator() {
41 void BookmarkIterator::delayedEmitNextOne() {
42 QTimer::singleShot(1, this, SLOT( nextOne() ));
45 void BookmarkIterator::slotCancelTest(BookmarkIterator
*test
) {
46 holder()->removeItr(test
);
49 const KBookmark
BookmarkIterator::curBk() const {
53 void BookmarkIterator::nextOne() {
54 // kDebug() << "BookmarkIterator::nextOne";
56 if (m_bklist
.isEmpty()) {
57 emit
deleteSelf(this);
61 QList
<KBookmark
>::iterator head
= m_bklist
.begin();
62 KBookmark bk
= (*head
);
64 bool viable
= bk
.hasParent() && isApplicable(bk
);
77 /* --------------------------- */
79 BookmarkIteratorHolder::BookmarkIteratorHolder()
83 void BookmarkIteratorHolder::insertItr(BookmarkIterator
*itr
) {
88 void BookmarkIteratorHolder::removeItr(BookmarkIterator
*itr
) {
89 m_itrs
.removeAll(itr
);
94 void BookmarkIteratorHolder::cancelAllItrs()
101 #include "bookmarkiterator.moc"