kio Library: KBookmarkMenu Class Reference (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KBookmarkMenu Class Reference

This class provides a bookmark menu. More...

`#include <kbookmarkmenu.h>`

Inheritance diagram for KBookmarkMenu:

[legend]
Collaboration diagram for KBookmarkMenu:

[legend]
List of all members.

## Public Slots
void | slotBookmarksChanged (const QString &)
## Signals
void | aboutToShowContextMenu (const KBookmark &, QPopupMenu *)
void | openBookmark (const QString &url, Qt::ButtonState state)
## Public Member Functions
| KBookmarkMenu (KBookmarkManager *mgr, KBookmarkOwner *owner, KPopupMenu *parentMenu, KActionCollection *collec, bool root, bool add=true, const QString &parentAddress="")
void | fillBookmarkMenu ()
void | ensureUpToDate ()
## Static Public Member Functions
static DynMenuInfo | showDynamicBookmarks (const QString &id)
static void | setDynamicBookmarks (const QString &id, const DynMenuInfo &info)
static QStringList | dynamicBookmarksList ()
## Protected Slots
void | slotAboutToShow ()
void | slotAboutToShowContextMenu (KPopupMenu *, int, QPopupMenu *)
void | slotActionHighlighted (KAction *)
void | slotRMBActionRemove (int)
void | slotRMBActionInsert (int)
void | slotRMBActionCopyLocation (int)
void | slotRMBActionEditAt (int)
void | slotRMBActionProperties (int)
void | slotBookmarkSelected ()
void | slotBookmarkSelected (KAction::ActivationReason reason, Qt::ButtonState state)
void | slotAddBookmarksList ()
void | slotAddBookmark ()
void | slotNewFolder ()
void | slotNSLoad ()
## Protected Member Functions
KExtendedBookmarkOwner * | extOwner ()
void | refill ()
void | addAddBookmark ()
void | addAddBookmarksList ()
void | addEditBookmarks ()
void | addNewFolder ()
void | fillContextMenu (QPopupMenu *, const QString &, int)
## Protected Attributes
bool | m_bIsRoot:1
bool | m_bAddBookmark:1
bool | m_bDirty:1
bool | m_bNSBookmark:1
bool | m_bAddShortcuts:1
KBookmarkManager * | m_pManager
KBookmarkOwner * | m_pOwner
KPopupMenu * | m_parentMenu
QPtrList< KBookmarkMenu > | m_lstSubMenus
KActionCollection * | m_actionCollection
QPtrList< KAction > | m_actions
QString | m_parentAddress
## Static Protected Attributes
static QString | s_highlightedAddress
static QString | s_highlightedImportLocation
static QString | s_highlightedImportType
## Friends
class | KBookmarkMenuNSImporter
class | RMB
## Classes
struct | DynMenuInfo
| Structure used for storing information about the dynamic menu setting Since: 3.2. More...

## Detailed Description

This class provides a bookmark menu.

It is typically used in cooperation with KActionMenu but doesn't have to be.

If you use this class by itself, then it will use KDE defaults for everything -- the bookmark path, bookmark editor, bookmark launcher.. everything. These defaults reside in the classes KBookmarkOwner (editing bookmarks) and KBookmarkManager (almost everything else). If you wish to change the defaults in any way, you must reimplement and instantiate those classes before this class is ever called.

Using this class is very simple:

1) Create a popup menu (either KActionMenu or KPopupMenu will do) 2) Instantiate a new KBookmarkMenu object using the above popup menu as a parameter 3) Insert your (now full) popup menu wherever you wish

Again, if you wish to modify any defaults, the procedure is:

1a) Reimplement your own KBookmarkOwner 1b) Reimplement and instantiate your own KBookmarkManager

Definition at line 79 of file kbookmarkmenu.h.

## Constructor & Destructor Documentation

KBookmarkMenu::KBookmarkMenu | ( | KBookmarkManager * | mgr,
|  | KBookmarkOwner * | owner,
|  | KPopupMenu * | parentMenu,
|  | KActionCollection * | collec,
|  | bool | root,
|  | bool | add = `true`,
|  | const QString & | parentAddress = `""`
| ) |

  | Fills a bookmark menu (one instance of KBookmarkMenu is created for the toplevel menu, but also one per submenu). Parameters:
  | mgr | The bookmark manager to use (i.e. for reading and writing)
  | owner | implementation of the KBookmarkOwner callback interface.
  | parentMenu | menu to be filled
  | collec | parent collection for the KActions. Only used for other menus than the toplevel one.
  | root | true for the toplevel menu
  | add | true to show the "Add Bookmark" and "New Folder" entries
  | parentAddress | the address of the group containing the items that we want to show.
See also: KBookmark::address. Be careful : A _null_ parentAddress denotes a NS-bookmark menu. An _empty_ parentAddress denotes the toplevel bookmark menu Definition at line 79 of file kbookmarkmenu.cc. References QObject::connect(), QObject::disconnect(), QString::isNull(), m_actions, m_lstSubMenus, m_parentAddress, m_parentMenu, QPtrList::setAutoDelete(), KActionCollection::setHighlightingEnabled(), and KPopupMenu::setKeyboardShortcutsEnabled(). Referenced by fillBookmarkMenu().

## Member Function Documentation

void KBookmarkMenu::fillBookmarkMenu | ( |  | ) |

| Even if you think you need to use this, you are probably wrong. It fills a bookmark menu starting a given KBookmark. This is public for KBookmarkBar. Definition at line 556 of file kbookmarkmenu.cc. References QPtrList::append(), QValueList::begin(), QObject::connect(), dynamicBookmarksList(), QValueList::end(), KBookmarkManager::findByAddress(), KBookmarkGroup::first(), KBookmarkMenu(), KBookmarkMenu::DynMenuInfo::location, m_actions, m_lstSubMenus, m_parentAddress, KBookmarkMenu::DynMenuInfo::name, KBookmarkGroup::next(), openBookmark(), KBookmarkManager::path(), KActionMenu::plug(), KActionMenu::popupMenu(), QString::replace(), QObject::setProperty(), KBookmarkMenu::DynMenuInfo::show, showDynamicBookmarks(), slotBookmarkSelected(), slotNSLoad(), and KBookmarkMenu::DynMenuInfo::type.

void KBookmarkMenu::ensureUpToDate | ( |  | ) |

| Call ensureUpToDate() if you need KBookmarkMenu to adjust to its final size before it is executed. Definition at line 153 of file kbookmarkmenu.cc.

KBookmarkMenu::DynMenuInfo KBookmarkMenu::showDynamicBookmarks | ( | const QString & | id | ) | `[static]`

| Returns: dynmenu info block for the given dynmenu name Since: 3.2 Definition at line 1100 of file kbookmarkmenu.cc. References KConfigBase::hasGroup(), KConfigBase::hasKey(), KBookmarkMenu::DynMenuInfo::location, KBookmarkMenu::DynMenuInfo::name, KConfigBase::readBoolEntry(), KConfigBase::readEntry(), KConfigBase::readPathEntry(), KBookmarkManager::root(), KConfigBase::setGroup(), KBookmarkMenu::DynMenuInfo::show, KBookmarkMenu::DynMenuInfo::type, and KBookmarkManager::userBookmarksManager(). Referenced by fillBookmarkMenu(), setDynamicBookmarks(), KBookmarkManager::setShowNSBookmarks(), and KBookmarkManager::showNSBookmarks().

void KBookmarkMenu::setDynamicBookmarks | ( | const QString & | id,
|  | const DynMenuInfo & | info
| ) | `[static]`

  | Shows an extra menu for the given bookmarks file and type. Upgrades from option inside XBEL to option in rc file on first call of this function. Parameters:
  | id | the unique identification for the dynamic menu
  | info | a DynMenuInfo struct containing the to be added/modified data
Since: 3.2 Definition at line 1146 of file kbookmarkmenu.cc. References KConfigBase::hasKey(), KBookmarkMenu::DynMenuInfo::location, KBookmarkMenu::DynMenuInfo::name, KConfigBase::readListEntry(), KConfigBase::setGroup(), KBookmarkMenu::DynMenuInfo::show, showDynamicBookmarks(), KConfigBase::sync(), KBookmarkMenu::DynMenuInfo::type, KConfigBase::writeEntry(), and KConfigBase::writePathEntry(). Referenced by KBookmarkManager::setShowNSBookmarks().

QStringList KBookmarkMenu::dynamicBookmarksList | ( |  | ) | `[static]`

| Returns: list of dynamic menu ids Since: 3.2 Definition at line 1132 of file kbookmarkmenu.cc. References KConfigBase::hasKey(), KConfigBase::readListEntry(), and KConfigBase::setGroup(). Referenced by fillBookmarkMenu().

void KBookmarkMenu::openBookmark | ( | const QString & | url,
|  | Qt::ButtonState | state
| ) | `[signal]`

| Since: 3.4 Referenced by fillBookmarkMenu(), and slotBookmarkSelected().

void KBookmarkMenu::slotBookmarkSelected | ( | KAction::ActivationReason | reason,
|  | Qt::ButtonState | state
| ) | `[protected, slot]`

| @ since 3.4 Definition at line 746 of file kbookmarkmenu.cc. References endl(), kdDebug(), openBookmark(), KBookmarkOwner::openBookmarkURL(), and QObject::sender(). Referenced by fillBookmarkMenu().

void KBookmarkMenu::slotNSLoad | ( |  | ) | `[protected, slot]`

| load Netscape's bookmarks Definition at line 769 of file kbookmarkmenu.cc. References QObject::disconnect(), and KBookmarkMenuNSImporter::openBookmarks(). Referenced by fillBookmarkMenu().

## Member Data Documentation

KPopupMenu* KBookmarkMenu::m_parentMenu`[protected]`

| The menu in which we plug our actions. Supplied in the constructor. Definition at line 217 of file kbookmarkmenu.h. Referenced by KBookmarkMenu().

QPtrList<KBookmarkMenu> KBookmarkMenu::m_lstSubMenus`[protected]`

| List of our sub menus. Definition at line 221 of file kbookmarkmenu.h. Referenced by fillBookmarkMenu(), and KBookmarkMenu().

QPtrList<KAction> KBookmarkMenu::m_actions`[protected]`

| List of our actions. Definition at line 226 of file kbookmarkmenu.h. Referenced by fillBookmarkMenu(), and KBookmarkMenu().

QString KBookmarkMenu::m_parentAddress`[protected]`

| Parent bookmark for this menu. Definition at line 230 of file kbookmarkmenu.h. Referenced by fillBookmarkMenu(), and KBookmarkMenu().

The documentation for this class was generated from the following files:

- kbookmarkmenu.h
- kbookmarkmenu.cc

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:18 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003