KBookmarks 5.109.0
Public Member Functions | Protected Member Functions | List of all members
KBookmarkGroup

A group of bookmarks. More...

#include <kbookmark.h>

Public Member Functions

 KBookmarkGroup ()
 Create an invalid group.
 
 KBookmarkGroup (const QDomElement &elem)
 Create a bookmark group as specified by the given element.
 
KBookmark addBookmark (const KBookmark &bm)
 Create a new bookmark, as the last child of this group Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.
 
KBookmark addBookmark (const QString &text, const QUrl &url, const QString &icon)
 Create a new bookmark, as the last child of this group Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.
 
KBookmarkGroup createNewFolder (const QString &text)
 Create a new bookmark folder, as the last child of this group.
 
KBookmark createNewSeparator ()
 Create a new bookmark separator Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.
 
void deleteBookmark (const KBookmark &bk)
 Delete a bookmark - it has to be one of our children ! Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.
 
QDomElement findToolbar () const
 
KBookmark first () const
 Return the first child bookmark of this group.
 
QList< QUrl > groupUrlList () const
 
int indexOf (const KBookmark &child) const
 Return the index of a child bookmark, -1 if not found.
 
bool isOpen () const
 
bool isToolbarGroup () const
 
bool moveBookmark (const KBookmark &bookmark, const KBookmark &after)
 Moves bookmark after after (which should be a child of ours).
 
KBookmark next (const KBookmark &current) const
 Return the next sibling of a child bookmark of this group.
 
KBookmark previous (const KBookmark &current) const
 Return the previous sibling of a child bookmark of this group.
 
- Public Member Functions inherited from KBookmark
 KBookmark ()
 Constructs a null bookmark, i.e.
 
 KBookmark (const QDomElement &elem)
 Creates the KBookmark wrapper for.
 
QString address () const
 Return the "address" of this bookmark in the whole tree.
 
QString description () const
 
QString fullText () const
 Text shown for the bookmark, not truncated.
 
bool hasParent () const
 
QString icon () const
 
QDomElement internalElement () const
 
bool isGroup () const
 Whether the bookmark is a group or a normal bookmark.
 
bool isNull () const
 
bool isSeparator () const
 Whether the bookmark is a separator.
 
QDomNode metaData (const QString &owner, bool create) const
 
QString metaDataItem (const QString &key) const
 Get the value of a specific metadata item (owner = "http://www.kde.org").
 
QString mimeType () const
 
bool operator== (const KBookmark &rhs) const
 Comparison operator.
 
KBookmarkGroup parentGroup () const
 
void populateMimeData (QMimeData *mimeData) const
 Adds this bookmark into the given QMimeData.
 
int positionInParent () const
 Return the position in the parent, i.e.
 
void setDescription (const QString &description)
 Set the description of the bookmark.
 
void setFullText (const QString &fullText)
 Set the text shown for the bookmark.
 
void setIcon (const QString &icon)
 Set the icon name of the bookmark.
 
void 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 (owner = "http://www.kde.org").
 
void setMimeType (const QString &mimeType)
 Set the Mime-Type of this item.
 
void setShowInToolbar (bool show)
 Set whether this bookmark is show in a filterd toolbar.
 
void setUrl (const QUrl &url)
 Set the URL of the bookmark.
 
bool showInToolbar () const
 
QString text () const
 Text shown for the bookmark If bigger than 40, the text is shortened by replacing middle characters with "..." (see KStringHandler::csqueeze)
 
KBookmarkGroup toGroup () const
 Convert this to a group - do this only if isGroup() returns true.
 
void updateAccessMetadata ()
 Updates the bookmarks access metadata Call when a user accesses the bookmark.
 
QUrl url () const
 URL contained by the bookmark.
 

Protected Member Functions

QDomElement nextKnownTag (const QDomElement &start, bool goNext) const
 

Additional Inherited Members

- Public Types inherited from KBookmark
enum  MetaDataOverwriteMode { OverwriteMetaData , DontOverwriteMetaData }
 
- Static Public Member Functions inherited from KBookmark
static QString commonParent (const QString &A, const QString &B)
 
static QString nextAddress (const QString &address)
 
static QString parentAddress (const QString &address)
 
static uint positionInParent (const QString &address)
 
static QString previousAddress (const QString &address)
 
static KBookmark standaloneBookmark (const QString &text, const QUrl &url, const QString &icon)
 Creates a stand alone bookmark.
 
- Protected Attributes inherited from KBookmark
QDomElement element
 

Detailed Description

A group of bookmarks.

Constructor & Destructor Documentation

◆ KBookmarkGroup() [1/2]

KBookmarkGroup::KBookmarkGroup ( )

Create an invalid group.

This is mostly for use in QList, and other places where we need a null group. Also used as a parent for a bookmark that doesn't have one (e.g. Netscape bookmarks)

◆ KBookmarkGroup() [2/2]

KBookmarkGroup::KBookmarkGroup ( const QDomElement &  elem)

Create a bookmark group as specified by the given element.

Member Function Documentation

◆ addBookmark() [1/2]

KBookmark KBookmarkGroup::addBookmark ( const KBookmark bm)

Create a new bookmark, as the last child of this group Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.

Parameters
bmthe bookmark to add

◆ addBookmark() [2/2]

KBookmark KBookmarkGroup::addBookmark ( const QString &  text,
const QUrl &  url,
const QString &  icon 
)

Create a new bookmark, as the last child of this group Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.

Parameters
textfor the bookmark
urlthe URL that the bookmark points to. It will be stored in its QUrl::FullyEncoded string format.
iconthe name of the icon to associate with the bookmark. A suitable default will be determined from the URL if not specified.

◆ createNewFolder()

KBookmarkGroup KBookmarkGroup::createNewFolder ( const QString &  text)

Create a new bookmark folder, as the last child of this group.

Parameters
textfor the folder. If you want an dialog use KBookmarkDialog

◆ createNewSeparator()

KBookmark KBookmarkGroup::createNewSeparator ( )

Create a new bookmark separator Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.

◆ deleteBookmark()

void KBookmarkGroup::deleteBookmark ( const KBookmark bk)

Delete a bookmark - it has to be one of our children ! Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );.

◆ first()

KBookmark KBookmarkGroup::first ( ) const

Return the first child bookmark of this group.

◆ groupUrlList()

QList< QUrl > KBookmarkGroup::groupUrlList ( ) const
Returns
the list of urls of bookmarks at top level of the group

◆ indexOf()

int KBookmarkGroup::indexOf ( const KBookmark child) const

Return the index of a child bookmark, -1 if not found.

◆ isOpen()

bool KBookmarkGroup::isOpen ( ) const
Returns
true if the bookmark folder is opened in the bookmark editor

◆ isToolbarGroup()

bool KBookmarkGroup::isToolbarGroup ( ) const
Returns
true if this is the toolbar group

◆ moveBookmark()

bool KBookmarkGroup::moveBookmark ( const KBookmark bookmark,
const KBookmark after 
)

Moves bookmark after after (which should be a child of ours).

If after is null, bookmark is moved as the first child. Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );

◆ next()

KBookmark KBookmarkGroup::next ( const KBookmark current) const

Return the next sibling of a child bookmark of this group.

Parameters
currenthas to be one of our child bookmarks.

◆ previous()

KBookmark KBookmarkGroup::previous ( const KBookmark current) const

Return the previous sibling of a child bookmark of this group.

Parameters
currenthas to be one of our child bookmarks.