kio Library API Documentation

KBookmark Class Reference

Inheritance diagram for KBookmark:

KBookmarkGroup List of all members.

Public Types

enum  MetaDataOverwriteMode { OverwriteMetaData, DontOverwriteMetaData }

Public Member Functions

 KBookmark ()
 KBookmark (QDomElement elem)
bool isGroup () const
bool isSeparator () const
bool isNull () const
bool hasParent () const
QString text () const
QString fullText () const
KURL url () const
QString icon () const
KBookmarkGroup parentGroup () const
KBookmarkGroup toGroup () const
QString address () const
QDomElement internalElement () const
void updateAccessMetadata ()
QString metaDataItem (const QString &key) const
void setMetaDataItem (const QString &key, const QString &value, MetaDataOverwriteMode mode=OverwriteMetaData)

Static Public Member Functions

static KBookmark standaloneBookmark (const QString &text, const KURL &url, const QString &icon=QString::null)
static QString parentAddress (const QString &address)
static uint positionInParent (const QString &address)
static QString previousAddress (const QString &address)
static QString nextAddress (const QString &address)

Protected Attributes

QDomElement element

Friends

class KBookmarkGroup

Detailed Description

Definition at line 31 of file kbookmark.h.


Member Function Documentation

bool KBookmark::isGroup  )  const
 

Whether the bookmark is a group or a normal bookmark.

Definition at line 260 of file kbookmark.cc.

References element, and QDomElement::tagName().

Referenced by KBookmarkManager::findByAddress(), icon(), toGroup(), and KBookmarkGroupTraverser::traverse().

bool KBookmark::isSeparator  )  const
 

Whether the bookmark is a separator.

Definition at line 267 of file kbookmark.cc.

References element, and QDomElement::tagName().

Referenced by fullText(), icon(), and KXBELBookmarkImporterImpl::visit().

bool KBookmark::isNull  )  const [inline]
 

Returns:
true if this is a null bookmark. This will never be the case for a real bookmark (in a menu), but it's used for instance as the end condition for KBookmarkGroup::next()

Definition at line 59 of file kbookmark.h.

References element.

Referenced by KBookmarkManager::addBookmarkDialog(), address(), KBookmarkBar::eventFilter(), KBookmarkBar::fillBookmarkBar(), KBookmarkMenu::fillBookmarkMenu(), KBookmarkManager::findByAddress(), KNSBookmarkExporterImpl::folderAsString(), KBookmarkGroup::groupUrlList(), KBookmarkGroup::moveItem(), KBookmarkMenu::slotAddBookmark(), KBookmarkMenu::slotAddBookmarksList(), KBookmarkBar::slotBookmarksChanged(), KBookmarkMenu::slotNewFolder(), and KBookmarkGroupTraverser::traverse().

bool KBookmark::hasParent  )  const
 

Returns:
true if bookmark is contained by a QDomDocument, if not it is most likely that it has become separated and is thus invalid and/or has been deleted from the bookmarks.
Since:
3.2

Definition at line 272 of file kbookmark.cc.

References element.

Referenced by address().

QString KBookmark::text  )  const
 

Text shown for the bookmark If bigger than 40, the text is shortened by replacing middle characters with ".

.." (see KStringHandler::csqueeze)

Definition at line 278 of file kbookmark.cc.

References KStringHandler::csqueeze(), and fullText().

Referenced by KBookmarkGroup::createNewFolder(), KBookmarkMenu::fillBookmarkMenu(), and setMetaDataItem().

QString KBookmark::fullText  )  const
 

Text shown for the bookmark, not truncated.

You should not use this - this is mainly for keditbookmarks.

Definition at line 283 of file kbookmark.cc.

References element, isSeparator(), and QDomElement::text().

Referenced by KBookmarkGroup::addBookmark(), KBookmarkGroup::createNewFolder(), KBookmarkBar::eventFilter(), text(), KXBELBookmarkImporterImpl::visit(), and KXBELBookmarkImporterImpl::visitEnter().

KURL KBookmark::url  )  const
 

URL contained by the bookmark.

Definition at line 291 of file kbookmark.cc.

References QDomElement::attribute(), and element.

Referenced by KBookmarkGroup::addBookmark(), KBookmarkBar::eventFilter(), icon(), updateAccessMetadata(), and KXBELBookmarkImporterImpl::visit().

QString KBookmark::icon  )  const
 

Returns:
the pixmap file for this bookmark (i.e. the name of the icon)

Definition at line 296 of file kbookmark.cc.

References QDomElement::attribute(), element, KMimeType::iconForURL(), QString::isEmpty(), isGroup(), isSeparator(), and url().

Referenced by KBookmarkGroup::addBookmark().

KBookmarkGroup KBookmark::parentGroup  )  const
 

Returns:
the group containing this bookmark

Definition at line 312 of file kbookmark.cc.

References element, and KBookmarkGroup.

Referenced by address(), KBookmarkGroup::createNewFolder(), KBookmarkBar::eventFilter(), and KBookmarkMenu::slotNewFolder().

KBookmarkGroup KBookmark::toGroup  )  const
 

Convert this to a group - do this only if isGroup() returns true.

Definition at line 317 of file kbookmark.cc.

References element, isGroup(), and KBookmarkGroup.

Referenced by KBookmarkManager::addBookmarkDialog(), KBookmarkMenu::fillBookmarkMenu(), KBookmarkManager::findByAddress(), KBookmarkMenu::slotAddBookmarksList(), KBookmarkMenu::slotNewFolder(), and KBookmarkGroupTraverser::traverse().

QString KBookmark::address  )  const
 

Return the "address" of this bookmark in the whole tree.

This is used when telling other processes about a change in a given bookmark. The encoding of the address is "/4/2", for instance, to design the 2nd child inside the 4th child of the root bk.

Definition at line 323 of file kbookmark.cc.

References address(), element, endl(), KBookmarkGroup::first(), hasParent(), isNull(), kdWarning(), KBookmarkGroup::next(), QString::number(), parentAddress(), parentGroup(), and QDomElement::tagName().

Referenced by KBookmarkGroup::addBookmark(), address(), KBookmarkGroup::createNewFolder(), KBookmarkManager::emitChanged(), KBookmarkGroup::groupAddress(), KBookmarkBar::parentAddress(), KBookmarkBar::slotBookmarksChanged(), and updateAccessMetadata().

void KBookmark::updateAccessMetadata  ) 
 

Updates the bookmarks access metadata Call when a user accesses the bookmark.

Since:
3.2

Definition at line 414 of file kbookmark.cc.

References address(), QDateTime::currentDateTime(), endl(), kdDebug(), metaDataItem(), QString::number(), KURL::prettyURL(), setMetaDataItem(), QString::toInt(), and url().

static QString KBookmark::parentAddress const QString address  )  [inline, static]
 

Returns:
address of parent

Definition at line 132 of file kbookmark.h.

References QString::findRev(), and QString::left().

Referenced by address(), nextAddress(), and previousAddress().

static uint KBookmark::positionInParent const QString address  )  [inline, static]
 

Returns:
position in parent (e.g. /4/5/2 -> 2)

Definition at line 138 of file kbookmark.h.

References QString::findRev(), and QString::mid().

Referenced by nextAddress(), and previousAddress().

static QString KBookmark::previousAddress const QString address  )  [inline, static]
 

Returns:
address of previous sibling (e.g. /4/5/2 -> /4/5/1) Returns QString::null for a first child

Definition at line 145 of file kbookmark.h.

References QString::number(), parentAddress(), and positionInParent().

static QString KBookmark::nextAddress const QString address  )  [inline, static]
 

Returns:
address of next sibling (e.g. /4/5/2 -> /4/5/3) This doesn't check whether it actually exists

Definition at line 155 of file kbookmark.h.

References QString::number(), parentAddress(), and positionInParent().

QString KBookmark::metaDataItem const QString key  )  const
 

Get the value of a specific metadata item.

Parameters:
key Name of the metadata item
Returns:
Value of the metadata item. QString::null is returned in case the specified key does not exist.
Since:
3.4

Definition at line 433 of file kbookmark.cc.

References QDomNode::firstChild(), internalElement(), QDomNode::isElement(), QDomNode::isNull(), QDomNode::nextSibling(), QDomElement::tagName(), QDomElement::text(), and QDomNode::toElement().

Referenced by updateAccessMetadata().

void KBookmark::setMetaDataItem const QString key,
const QString value,
MetaDataOverwriteMode  mode = OverwriteMetaData
 

Change the value of a specific metadata item, or create the given item if it doesn't exist already.

Parameters:
key Name of the metadata item to change
value Value to use for the specified metadata item
mode Whether to overwrite the item's value if it exists already or not.
Since:
3.4

Definition at line 449 of file kbookmark.cc.

References internalElement(), and text().

Referenced by updateAccessMetadata().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Nov 1 10:33:24 2005 by doxygen 1.4.3 written by Dimitri van Heesch, © 1997-2003