You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
539 lines
16 KiB
539 lines
16 KiB
15 years ago
|
/* This file is part of the KDE libraries
|
||
|
Copyright (C) 2000 David Faure <faure@kde.org>
|
||
|
Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License version 2 as published by the Free Software Foundation.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#include "kbookmark.h"
|
||
15 years ago
|
#include <tqvaluestack.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
|
#include <kmimetype.h>
|
||
|
#include <kstringhandler.h>
|
||
|
#include <kinputdialog.h>
|
||
12 years ago
|
#include <tdeglobal.h>
|
||
|
#include <tdelocale.h>
|
||
15 years ago
|
#include <assert.h>
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
15 years ago
|
#include <dcopclient.h>
|
||
|
#include <kbookmarkmanager.h>
|
||
|
|
||
|
KBookmarkGroup::KBookmarkGroup()
|
||
15 years ago
|
: KBookmark( TQDomElement() )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
15 years ago
|
KBookmarkGroup::KBookmarkGroup( TQDomElement elem )
|
||
15 years ago
|
: KBookmark(elem)
|
||
|
{
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmarkGroup::groupAddress() const
|
||
15 years ago
|
{
|
||
|
if (m_address.isEmpty())
|
||
|
m_address = address();
|
||
|
return m_address;
|
||
|
}
|
||
|
|
||
|
bool KBookmarkGroup::isOpen() const
|
||
|
{
|
||
|
return element.attribute("folded") == "no"; // default is: folded
|
||
|
}
|
||
|
|
||
|
// Returns first element node equal to or after node n
|
||
15 years ago
|
static TQDomElement firstElement(TQDomNode n)
|
||
15 years ago
|
{
|
||
|
while(!n.isNull() && !n.isElement())
|
||
|
n = n.nextSibling();
|
||
|
return n.toElement();
|
||
|
}
|
||
|
|
||
|
// Returns first element node equal to or before node n
|
||
15 years ago
|
static TQDomElement lastElement(TQDomNode n)
|
||
15 years ago
|
{
|
||
|
while(!n.isNull() && !n.isElement())
|
||
|
n = n.previousSibling();
|
||
|
return n.toElement();
|
||
|
}
|
||
|
|
||
|
KBookmark KBookmarkGroup::first() const
|
||
|
{
|
||
|
return KBookmark( nextKnownTag( firstElement(element.firstChild()), true ) );
|
||
|
}
|
||
|
|
||
|
KBookmark KBookmarkGroup::previous( const KBookmark & current ) const
|
||
|
{
|
||
|
return KBookmark( nextKnownTag( lastElement(current.element.previousSibling()), false ) );
|
||
|
}
|
||
|
|
||
|
KBookmark KBookmarkGroup::next( const KBookmark & current ) const
|
||
|
{
|
||
|
return KBookmark( nextKnownTag( firstElement(current.element.nextSibling()), true ) );
|
||
|
}
|
||
|
|
||
15 years ago
|
// KDE4: Change TQDomElement to TQDomNode so that we can get rid of
|
||
15 years ago
|
// firstElement() and lastElement()
|
||
15 years ago
|
TQDomElement KBookmarkGroup::nextKnownTag( TQDomElement start, bool goNext ) const
|
||
15 years ago
|
{
|
||
12 years ago
|
static const TQString & bookmark = TDEGlobal::staticQString("bookmark");
|
||
|
static const TQString & folder = TDEGlobal::staticQString("folder");
|
||
|
static const TQString & separator = TDEGlobal::staticQString("separator");
|
||
15 years ago
|
|
||
15 years ago
|
for( TQDomNode n = start; !n.isNull(); )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomElement elem = n.toElement();
|
||
|
TQString tag = elem.tagName();
|
||
15 years ago
|
if (tag == folder || tag == bookmark || tag == separator)
|
||
|
return elem;
|
||
|
if (goNext)
|
||
|
n = n.nextSibling();
|
||
|
else
|
||
|
n = n.previousSibling();
|
||
|
}
|
||
15 years ago
|
return TQDomElement();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
KBookmarkGroup KBookmarkGroup::createNewFolder( KBookmarkManager* mgr, const TQString & text, bool emitSignal )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQString txt( text );
|
||
15 years ago
|
if ( text.isEmpty() )
|
||
|
{
|
||
|
bool ok;
|
||
15 years ago
|
TQString caption = parentGroup().fullText().isEmpty() ?
|
||
15 years ago
|
i18n( "Create New Bookmark Folder" ) :
|
||
|
i18n( "Create New Bookmark Folder in %1" )
|
||
|
.arg( parentGroup().text() );
|
||
|
txt = KInputDialog::getText( caption, i18n( "New folder:" ),
|
||
15 years ago
|
TQString::null, &ok );
|
||
15 years ago
|
if ( !ok )
|
||
|
return KBookmarkGroup();
|
||
|
}
|
||
|
|
||
|
Q_ASSERT(!element.isNull());
|
||
15 years ago
|
TQDomDocument doc = element.ownerDocument();
|
||
|
TQDomElement groupElem = doc.createElement( "folder" );
|
||
15 years ago
|
element.appendChild( groupElem );
|
||
15 years ago
|
TQDomElement textElem = doc.createElement( "title" );
|
||
15 years ago
|
groupElem.appendChild( textElem );
|
||
|
textElem.appendChild( doc.createTextNode( txt ) );
|
||
|
|
||
|
KBookmarkGroup grp(groupElem);
|
||
|
|
||
|
if (emitSignal)
|
||
|
emit mgr->notifier().createdNewFolder(
|
||
|
mgr->path(), grp.fullText(),
|
||
|
grp.address() );
|
||
|
|
||
|
return grp;
|
||
|
|
||
|
}
|
||
|
|
||
|
KBookmark KBookmarkGroup::createNewSeparator()
|
||
|
{
|
||
|
Q_ASSERT(!element.isNull());
|
||
15 years ago
|
TQDomDocument doc = element.ownerDocument();
|
||
15 years ago
|
Q_ASSERT(!doc.isNull());
|
||
15 years ago
|
TQDomElement sepElem = doc.createElement( "separator" );
|
||
15 years ago
|
element.appendChild( sepElem );
|
||
|
return KBookmark(sepElem);
|
||
|
}
|
||
|
|
||
|
bool KBookmarkGroup::moveItem( const KBookmark & item, const KBookmark & after )
|
||
|
{
|
||
15 years ago
|
TQDomNode n;
|
||
15 years ago
|
if ( !after.isNull() )
|
||
|
n = element.insertAfter( item.element, after.element );
|
||
|
else // first child
|
||
|
{
|
||
|
if ( element.firstChild().isNull() ) // Empty element -> set as real first child
|
||
15 years ago
|
n = element.insertBefore( item.element, TQDomElement() );
|
||
15 years ago
|
|
||
|
// we have to skip everything up to the first valid child
|
||
15 years ago
|
TQDomElement firstChild = nextKnownTag(element.firstChild().toElement(), true);
|
||
15 years ago
|
if ( !firstChild.isNull() )
|
||
|
n = element.insertBefore( item.element, firstChild );
|
||
|
else
|
||
|
{
|
||
|
// No real first child -> append after the <title> etc.
|
||
|
n = element.appendChild( item.element );
|
||
|
}
|
||
|
}
|
||
|
return (!n.isNull());
|
||
|
}
|
||
|
|
||
|
KBookmark KBookmarkGroup::addBookmark( KBookmarkManager* mgr, const KBookmark &bm, bool emitSignal )
|
||
|
{
|
||
|
element.appendChild( bm.internalElement() );
|
||
|
|
||
|
if (emitSignal) {
|
||
|
if ( bm.hasMetaData() ) {
|
||
|
mgr->notifyCompleteChange( "" );
|
||
|
} else {
|
||
|
emit mgr->notifier().addedBookmark(
|
||
|
mgr->path(), bm.url().url(),
|
||
|
bm.fullText(), bm.address(), bm.icon() );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return bm;
|
||
|
}
|
||
|
|
||
15 years ago
|
KBookmark KBookmarkGroup::addBookmark( KBookmarkManager* mgr, const TQString & text, const KURL & url, const TQString & icon, bool emitSignal )
|
||
15 years ago
|
{
|
||
|
//kdDebug(7043) << "KBookmarkGroup::addBookmark " << text << " into " << m_address << endl;
|
||
15 years ago
|
TQDomDocument doc = element.ownerDocument();
|
||
|
TQDomElement elem = doc.createElement( "bookmark" );
|
||
15 years ago
|
elem.setAttribute( "href", url.url( 0, 106 ) ); // write utf8 URL (106 is mib enum for utf8)
|
||
15 years ago
|
TQString _icon = icon;
|
||
15 years ago
|
if ( _icon.isEmpty() )
|
||
|
_icon = KMimeType::iconForURL( url );
|
||
|
elem.setAttribute( "icon", _icon );
|
||
|
|
||
15 years ago
|
TQDomElement textElem = doc.createElement( "title" );
|
||
15 years ago
|
elem.appendChild( textElem );
|
||
|
textElem.appendChild( doc.createTextNode( text ) );
|
||
|
|
||
|
return addBookmark( mgr, KBookmark( elem ), emitSignal );
|
||
|
}
|
||
|
|
||
|
void KBookmarkGroup::deleteBookmark( KBookmark bk )
|
||
|
{
|
||
|
element.removeChild( bk.element );
|
||
|
}
|
||
|
|
||
|
bool KBookmarkGroup::isToolbarGroup() const
|
||
|
{
|
||
|
return ( element.attribute("toolbar") == "yes" );
|
||
|
}
|
||
|
|
||
14 years ago
|
TQDomElement KBookmarkGroup::findToolbar() const
|
||
15 years ago
|
{
|
||
|
if ( element.attribute("toolbar") == "yes" )
|
||
|
return element;
|
||
15 years ago
|
for (TQDomNode n = element.firstChild(); !n.isNull() ; n = n.nextSibling() )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomElement e = n.toElement();
|
||
15 years ago
|
// Search among the "folder" children only
|
||
|
if ( e.tagName() == "folder" )
|
||
|
{
|
||
|
if ( e.attribute("toolbar") == "yes" )
|
||
|
return e;
|
||
|
else
|
||
|
{
|
||
14 years ago
|
TQDomElement result = KBookmarkGroup(e).findToolbar();
|
||
15 years ago
|
if (!result.isNull())
|
||
|
return result;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
15 years ago
|
return TQDomElement();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQValueList<KURL> KBookmarkGroup::groupUrlList() const
|
||
15 years ago
|
{
|
||
15 years ago
|
TQValueList<KURL> urlList;
|
||
15 years ago
|
for ( KBookmark bm = first(); !bm.isNull(); bm = next(bm) )
|
||
|
{
|
||
|
if ( bm.isSeparator() || bm.isGroup() )
|
||
|
continue;
|
||
|
urlList << bm.url();
|
||
|
}
|
||
|
return urlList;
|
||
|
}
|
||
|
|
||
|
//////
|
||
|
|
||
|
bool KBookmark::isGroup() const
|
||
|
{
|
||
15 years ago
|
TQString tag = element.tagName();
|
||
15 years ago
|
return ( tag == "folder"
|
||
|
|| tag == "xbel" ); // don't forget the toplevel group
|
||
|
}
|
||
|
|
||
|
bool KBookmark::isSeparator() const
|
||
|
{
|
||
|
return (element.tagName() == "separator");
|
||
|
}
|
||
|
|
||
|
bool KBookmark::hasParent() const
|
||
|
{
|
||
14 years ago
|
TQDomElement parent = element.parentNode().toElement();
|
||
15 years ago
|
return !parent.isNull();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmark::text() const
|
||
15 years ago
|
{
|
||
|
return KStringHandler::csqueeze( fullText() );
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmark::fullText() const
|
||
15 years ago
|
{
|
||
|
if (isSeparator())
|
||
|
return i18n("--- separator ---");
|
||
|
|
||
|
return element.namedItem("title").toElement().text();
|
||
|
}
|
||
|
|
||
|
KURL KBookmark::url() const
|
||
|
{
|
||
|
return KURL(element.attribute("href"), 106); // Decode it from utf8 (106 is mib enum for utf8)
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmark::icon() const
|
||
15 years ago
|
{
|
||
15 years ago
|
TQString icon = element.attribute("icon");
|
||
10 years ago
|
if ( icon.isEmpty() ) {
|
||
15 years ago
|
// Default icon depends on URL for bookmarks, and is default directory
|
||
|
// icon for groups.
|
||
10 years ago
|
if ( isGroup() ) {
|
||
15 years ago
|
icon = "bookmark_folder";
|
||
10 years ago
|
}
|
||
|
else {
|
||
|
if ( isSeparator() ) {
|
||
15 years ago
|
icon = "eraser"; // whatever
|
||
10 years ago
|
}
|
||
|
else {
|
||
15 years ago
|
icon = KMimeType::iconForURL( url() );
|
||
10 years ago
|
}
|
||
|
}
|
||
|
}
|
||
15 years ago
|
return icon;
|
||
|
}
|
||
|
|
||
|
KBookmarkGroup KBookmark::parentGroup() const
|
||
|
{
|
||
14 years ago
|
return KBookmarkGroup( element.parentNode().toElement() );
|
||
15 years ago
|
}
|
||
|
|
||
|
KBookmarkGroup KBookmark::toGroup() const
|
||
|
{
|
||
|
Q_ASSERT( isGroup() );
|
||
|
return KBookmarkGroup(element);
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmark::address() const
|
||
15 years ago
|
{
|
||
|
if ( element.tagName() == "xbel" )
|
||
15 years ago
|
return ""; // not TQString::null !
|
||
15 years ago
|
else
|
||
|
{
|
||
|
// Use keditbookmarks's DEBUG_ADDRESSES flag to debug this code :)
|
||
|
if (!hasParent())
|
||
|
{
|
||
|
Q_ASSERT(hasParent());
|
||
|
return "ERROR"; // Avoid an infinite loop
|
||
|
}
|
||
|
KBookmarkGroup group = parentGroup();
|
||
15 years ago
|
TQString parentAddress = group.address();
|
||
15 years ago
|
uint counter = 0;
|
||
|
// Implementation note: we don't use QDomNode's childNode list because we
|
||
|
// would have to skip "TEXT", which KBookmarkGroup already does for us.
|
||
|
for ( KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk), ++counter )
|
||
|
{
|
||
|
if ( bk.element == element )
|
||
15 years ago
|
return parentAddress + "/" + TQString::number(counter);
|
||
15 years ago
|
}
|
||
|
kdWarning() << "KBookmark::address : this can't happen! " << parentAddress << endl;
|
||
|
return "ERROR";
|
||
|
}
|
||
|
}
|
||
|
|
||
15 years ago
|
KBookmark KBookmark::standaloneBookmark( const TQString & text, const KURL & url, const TQString & icon )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomDocument doc("xbel");
|
||
|
TQDomElement elem = doc.createElement("xbel");
|
||
15 years ago
|
doc.appendChild( elem );
|
||
|
KBookmarkGroup grp( elem );
|
||
|
grp.addBookmark( 0L, text, url, icon, false );
|
||
|
return grp.first();
|
||
|
}
|
||
|
|
||
15 years ago
|
// For some strange reason TQString("").left(0) returns TQString::null;
|
||
15 years ago
|
// That breaks commonParent()
|
||
15 years ago
|
TQString KBookmark::left(const TQString & str, uint len)
|
||
15 years ago
|
{
|
||
15 years ago
|
//kdDebug()<<"********"<<TQString("").left(0).isNull()<<endl;
|
||
15 years ago
|
if(len == 0)
|
||
15 years ago
|
return TQString("");
|
||
15 years ago
|
else
|
||
|
return str.left(len);
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmark::commonParent(TQString A, TQString B)
|
||
15 years ago
|
{
|
||
15 years ago
|
TQString error("ERROR");
|
||
15 years ago
|
if(A == error || B == error)
|
||
|
return error;
|
||
|
|
||
|
A += "/";
|
||
|
B += "/";
|
||
|
|
||
|
uint lastCommonSlash = 0;
|
||
|
uint lastPos = A.length() < B.length() ? A.length() : B.length();
|
||
|
for(uint i=0; i < lastPos; ++i)
|
||
|
{
|
||
|
if(A[i] != B[i])
|
||
|
return left(A, lastCommonSlash);
|
||
|
if(A[i] == '/')
|
||
|
lastCommonSlash = i;
|
||
|
}
|
||
|
return left(A, lastCommonSlash);
|
||
|
}
|
||
|
|
||
15 years ago
|
static TQDomNode cd_or_create(TQDomNode node, TQString name)
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomNode subnode = node.namedItem(name);
|
||
15 years ago
|
if (subnode.isNull())
|
||
|
{
|
||
|
subnode = node.ownerDocument().createElement(name);
|
||
|
node.appendChild(subnode);
|
||
|
}
|
||
|
return subnode;
|
||
|
}
|
||
|
|
||
15 years ago
|
static TQDomText get_or_create_text(TQDomNode node)
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomNode subnode = node.firstChild();
|
||
15 years ago
|
if (subnode.isNull())
|
||
|
{
|
||
|
subnode = node.ownerDocument().createTextNode("");
|
||
|
node.appendChild(subnode);
|
||
|
}
|
||
|
return subnode.toText();
|
||
|
}
|
||
|
|
||
|
// Look for a metadata with owner="http://www.kde.org" or without any owner (for compatibility)
|
||
14 years ago
|
static TQDomNode findOrCreateMetadata( TQDomNode& parent )
|
||
15 years ago
|
{
|
||
|
static const char kdeOwner[] = "http://www.kde.org";
|
||
15 years ago
|
TQDomElement metadataElement;
|
||
|
for ( TQDomNode _node = parent.firstChild(); !_node.isNull(); _node = _node.nextSibling() ) {
|
||
|
TQDomElement elem = _node.toElement();
|
||
15 years ago
|
if ( !elem.isNull() && elem.tagName() == "metadata" ) {
|
||
15 years ago
|
const TQString owner = elem.attribute( "owner" );
|
||
15 years ago
|
if ( owner == kdeOwner )
|
||
|
return elem;
|
||
|
if ( owner.isEmpty() )
|
||
|
metadataElement = elem;
|
||
|
}
|
||
|
}
|
||
|
if ( metadataElement.isNull() ) {
|
||
|
metadataElement = parent.ownerDocument().createElement( "metadata" );
|
||
|
parent.appendChild(metadataElement);
|
||
|
}
|
||
|
metadataElement.setAttribute( "owner", kdeOwner );
|
||
|
return metadataElement;
|
||
|
}
|
||
|
|
||
|
bool KBookmark::hasMetaData() const
|
||
|
{
|
||
|
// ### NOTE: this code creates <info> and <metadata>, despite its name and the const.
|
||
|
// It doesn't matter much in practice since it's only called for newly-created bookmarks,
|
||
|
// which will get metadata soon after anyway.
|
||
15 years ago
|
TQDomNode n = cd_or_create( internalElement(), "info" );
|
||
14 years ago
|
return findOrCreateMetadata( n ).hasChildNodes();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KBookmark::updateAccessMetadata()
|
||
|
{
|
||
|
kdDebug(7043) << "KBookmark::updateAccessMetadata " << address() << " " << url().prettyURL() << endl;
|
||
|
|
||
13 years ago
|
const uint timet = TQDateTime::currentDateTime().toTime_t();
|
||
15 years ago
|
setMetaDataItem( "time_added", TQString::number( timet ), DontOverwriteMetaData );
|
||
|
setMetaDataItem( "time_visited", TQString::number( timet ) );
|
||
15 years ago
|
|
||
15 years ago
|
TQString countStr = metaDataItem( "visit_count" ); // TODO use spec'ed name
|
||
15 years ago
|
bool ok;
|
||
|
int currentCount = countStr.toInt(&ok);
|
||
|
if (!ok)
|
||
|
currentCount = 0;
|
||
|
currentCount++;
|
||
15 years ago
|
setMetaDataItem( "visit_count", TQString::number( currentCount ) );
|
||
15 years ago
|
|
||
|
// TODO - for 4.0 - time_modified
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KBookmark::metaDataItem( const TQString &key ) const
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomNode infoNode = cd_or_create( internalElement(), "info" );
|
||
14 years ago
|
infoNode = findOrCreateMetadata( infoNode );
|
||
15 years ago
|
for ( TQDomNode n = infoNode.firstChild(); !n.isNull(); n = n.nextSibling() ) {
|
||
15 years ago
|
if ( !n.isElement() ) {
|
||
|
continue;
|
||
|
}
|
||
15 years ago
|
const TQDomElement e = n.toElement();
|
||
15 years ago
|
if ( e.tagName() == key ) {
|
||
|
return e.text();
|
||
|
}
|
||
|
}
|
||
15 years ago
|
return TQString::null;
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
void KBookmark::setMetaDataItem( const TQString &key, const TQString &value, MetaDataOverwriteMode mode )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQDomNode infoNode = cd_or_create( internalElement(), "info" );
|
||
14 years ago
|
infoNode = findOrCreateMetadata( infoNode );
|
||
15 years ago
|
|
||
15 years ago
|
TQDomNode item = cd_or_create( infoNode, key );
|
||
|
TQDomText text = get_or_create_text( item );
|
||
15 years ago
|
if ( mode == DontOverwriteMetaData && !text.data().isEmpty() ) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
text.setData( value );
|
||
|
}
|
||
|
|
||
|
void KBookmarkGroupTraverser::traverse(const KBookmarkGroup &root)
|
||
|
{
|
||
|
// non-recursive bookmark iterator
|
||
15 years ago
|
TQValueStack<KBookmarkGroup> stack;
|
||
15 years ago
|
stack.push(root);
|
||
|
KBookmark bk = stack.top().first();
|
||
|
for (;;) {
|
||
|
if (bk.isNull())
|
||
|
{
|
||
|
if (stack.isEmpty())
|
||
|
return;
|
||
|
if (stack.count() > 1)
|
||
|
visitLeave(stack.top());
|
||
|
bk = stack.pop();
|
||
|
bk = stack.top().next(bk);
|
||
|
if (bk.isNull())
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
if (bk.isGroup())
|
||
|
{
|
||
|
KBookmarkGroup gp = bk.toGroup();
|
||
|
visitEnter(gp);
|
||
|
if (!gp.first().isNull())
|
||
|
{
|
||
|
stack.push(gp);
|
||
|
bk = gp.first();
|
||
|
continue;
|
||
|
}
|
||
|
// empty group
|
||
|
visitLeave(gp);
|
||
|
}
|
||
|
else
|
||
|
visit(bk);
|
||
|
|
||
|
bk = stack.top().next(bk);
|
||
|
}
|
||
|
|
||
|
// never reached
|
||
|
}
|
||
|
|