Reply to topic

[Solved]Bookmarks quickstart

User avatar YeahReally
Registered Member
Posts
71
Karma
1
OS

[Solved]Bookmarks quickstart

Wed Jan 07, 2009 9:48 pm
I want to add a bookmarks feature to my application so I searched the api (api.kde.org) and the techbase (techbase.kde.org). I only found some stuff in the former but I still do not understand.

First, there is this set of classes: KBookmarkMenu, KBookmarkActionMenu, KBookmarkOwner, KBookmarkManager, and KActionMenu. But I do not know how to stich these to my KXmlGuiWindow. There even seems to be inaccurate documentation in KBookmarkMenu:
Using this class is very simple:
1) Create a popup menu (either KActionMenu or KMenu 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

But KActionMenu does not fit anywhere I can see.

So I ask for a quickstart, little hint on how to handle these classes.

Thanks for reading so far.

Last edited by YeahReally on Sun Jan 11, 2009 1:56 am, edited 1 time in total.


Debian GNU/Linux Lenny
KDE 4.1.96

How many bugs have you triaged today?
User avatar anda_skoa
KDE Developer
Posts
783
Karma
4
OS

RE: Bookmarks quickstart

Thu Jan 08, 2009 1:40 pm
YeahReally wrote:But KActionMenu does not fit anywhere I can see.


You can get the associated KMenu by calling the action's menu() method.

I think it basically works like this:

get a bookmark manager instance using KBookmarkManager::userBookmarksManager()

Get (from the XmlGuiWindow) or create a bookmark menu/action.

Pass the manager and the menu to the KBookmarkMenu constructor.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
User avatar YeahReally
Registered Member
Posts
71
Karma
1
OS

RE: Bookmarks quickstart

Thu Jan 08, 2009 4:47 pm
Thanks, I get it now. I added the KActionMenu to a menu from my xml file, passed it as paremeter for the KBookmarkMenu and it appears, but as a submenu. So, how do I get a top-level menu to pass to the KBookmarkMenu constructor?

It seems I will have to implement KBookmarkOwner too, but that is another topic I think I can handle.


Debian GNU/Linux Lenny
KDE 4.1.96

How many bugs have you triaged today?
User avatar anda_skoa
KDE Developer
Posts
783
Karma
4
OS

RE: Bookmarks quickstart

Fri Jan 09, 2009 2:34 pm
I think the KXmlGuiClient or KXmlGuiFactory API allows you to get the menu from the xml file, basically avoiding the additional menu in between.

Something with containers IIRC.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.

 
Reply to topic

Bookmarks



Who is online

Registered users: allanmills, Baidu [Spider], Bing [Bot], boudewijn, cairncrossr, chechoxque, Google [Bot], ipwizard, Yahoo [Bot]