KBookmarkOwner

Search for usage in LXR

KBookmarkOwner Class Referenceabstract

#include <KBookmarkOwner>

Classes

class  FutureBookmark
 

Public Types

enum  BookmarkOption { ShowAddBookmark , ShowEditBookmark }
 

Public Member Functions

virtual QList< FutureBookmarkcurrentBookmarkList () const
 
virtual QString currentIcon () const
 
virtual QString currentTitle () const
 
virtual QUrl currentUrl () const
 
virtual bool enableOption (BookmarkOption option) const
 
virtual void openBookmark (const KBookmark &bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km)=0
 
virtual void openFolderinTabs (const KBookmarkGroup &bm)
 
virtual void openInNewTab (const KBookmark &bm)
 
virtual void openInNewWindow (const KBookmark &bm)
 
virtual bool supportsTabs () const
 

Detailed Description

The KBookmarkMenu and KBookmarkBar classes gives the user the ability to either edit bookmarks or add their own.

In the first case, the app may want to open the bookmark in a special way. In the second case, the app must supply the name and the URL for the bookmark.

This class gives the app this callback-like ability.

If your app does not give the user the ability to add bookmarks and you don't mind using the default bookmark editor to edit your bookmarks, then you don't need to overload this class at all. Rather, just use something like:

bookmarks = new KBookmarkMenu(manager, nullptr, menu);
This class provides a bookmark menu.

If you wish to use your own editor or allow the user to add bookmarks, you must overload this class.

Definition at line 42 of file kbookmarkowner.h.

Member Enumeration Documentation

◆ BookmarkOption

enum KBookmarkOwner::BookmarkOption

Definition at line 134 of file kbookmarkowner.h.

Constructor & Destructor Documentation

◆ KBookmarkOwner()

KBookmarkOwner::KBookmarkOwner ( )

Definition at line 59 of file kbookmarkowner.cpp.

Member Function Documentation

◆ currentBookmarkList()

virtual QList< FutureBookmark > KBookmarkOwner::currentBookmarkList ( ) const
inlinevirtual

Returns a list of bookmark data for the open tabs.

The default returns an empty list.

Definition at line 129 of file kbookmarkowner.h.

◆ currentIcon()

virtual QString KBookmarkOwner::currentIcon ( ) const
inlinevirtual

This function is called whenever the user wants to add the current page to the bookmarks list.

The icon will become the icon of the bookmark. You must overload this function if you wish to give your users the ability to add bookmarks. The default returns an empty string.

A very common implementation for this method is return KIO::iconNameForUrl(currentUrl());

Returns
the icon name of the current page.
Since
5.0

Definition at line 90 of file kbookmarkowner.h.

◆ currentTitle()

virtual QString KBookmarkOwner::currentTitle ( ) const
inlinevirtual

This function is called whenever the user wants to add the current page to the bookmarks list.

The title will become the "name" of the bookmark. You must overload this function if you wish to give your users the ability to add bookmarks. The default returns an empty string.

Returns
the title of the current page.

Definition at line 57 of file kbookmarkowner.h.

◆ currentUrl()

virtual QUrl KBookmarkOwner::currentUrl ( ) const
inlinevirtual

This function is called whenever the user wants to add the current page to the bookmarks list.

The URL will become the URL of the bookmark. You must overload this function if you wish to give your users the ability to add bookmarks. The default returns an empty string.

Returns
the URL of the current page. Since 5.0 this method returns a QUrl. While porting it, remember to implement currentIcon too.

Definition at line 72 of file kbookmarkowner.h.

◆ enableOption()

bool KBookmarkOwner::enableOption ( BookmarkOption option) const
virtual

Returns true if action should be shown in the menu The default is to show both a add and editBookmark Entry //TODO ContextMenuAction? to disable the contextMenu? Delete and Properties to disable those in the context menu?

Definition at line 66 of file kbookmarkowner.cpp.

◆ openBookmark()

virtual void KBookmarkOwner::openBookmark ( const KBookmark & bm,
Qt::MouseButtons mb,
Qt::KeyboardModifiers km )
pure virtual

Called if a bookmark is selected.

You need to override this.

◆ openFolderinTabs()

void KBookmarkOwner::openFolderinTabs ( const KBookmarkGroup & bm)
virtual

Called if the user wants to open every bookmark in this folder in a new tab.

The default implementation does nothing. This is only called if supportsTabs() returns true

Definition at line 77 of file kbookmarkowner.cpp.

◆ openInNewTab()

void KBookmarkOwner::openInNewTab ( const KBookmark & bm)
virtual

Called when a bookmark should be opened in a new tab.

The default implementation calls openBookmark.

Since
5.0

Definition at line 81 of file kbookmarkowner.cpp.

◆ openInNewWindow()

void KBookmarkOwner::openInNewWindow ( const KBookmark & bm)
virtual

Called when a bookmark should be opened in a new window.

The default implementation calls openBookmark.

Since
5.0

Definition at line 87 of file kbookmarkowner.cpp.

◆ supportsTabs()

virtual bool KBookmarkOwner::supportsTabs ( ) const
inlinevirtual

This function returns whether the owner supports tabs.

The default returns false.

Definition at line 99 of file kbookmarkowner.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.