2 // C++ Interface: ksayitbookmarkhandler
7 // Author: Robert Vogl <voglrobe@web.de>, (C) 2005
9 // Copyright: See COPYING file that comes with this distribution
12 #ifndef KSAYITBOOKMARKHANDLER_H
13 #define KSAYITBOOKMARKHANDLER_H
19 #include <kbookmarkmanager.h>
25 Each of the objects in the TreeView that can be bookmarked has an unique ID.
26 The "URL" is to be created as follows: \p ksayit://filename/ID.\n
27 The "Title" is either the content of column 0 of the TreeView or the 32nd leading
28 charcters of the text (e.g. if the item references to a paragraph).
31 class KSayItBookmarkHandler
: public KBookmarkOwner
34 KSayItBookmarkHandler(KBookmarkManager
*bkManager
=0, KSayItApp
* parent
=0);
35 virtual ~KSayItBookmarkHandler();
39 * Reimplemented from base class.\n
40 * Called when a bookmark in the menu was clicked.
41 * \param url The URL of the selected bookmark.
43 void openBookmarkURL(const QString
&url
);
46 * Reimplemented from base class.\n
47 * Returns the Title when a new bookmark is about to be created.
48 * \returns The title of the bookmark.
50 QString
currentTitle() const;
54 * Reimplemented from base class.\n
55 * Returns the URL when a new bookmark is about to be created.
56 * \returns The URL of the bookmark.
58 QString
currentUrl() const;
61 * Sets ID and title of the current TreeView item.
62 * \param ID The unique ID of the item.
63 * \param title The bookmark title of the item.
65 void notifyBookmarkHandler(const QString
&ID
, const QString
&title
);
68 * Deletes the bookmark designated by the given url.
69 * \param url The url of the bookmark.
71 void deleteBookmark(const QString
&url
, const QString
&title
);
74 * Iterates recursively through all bookmarks below the
76 * \param bkGroup The KBookmarkGroup to start.
78 void traverseBookmarks(KBookmarkGroup bkGroup
);
82 * Searches the Bookmark designted by its URL.
83 * \param bookmark A reference that will contain the search result (bookmark).
84 * \param group A reference that will contain the search result
85 * (the group the found bookmark belongs to).
86 * \param bkGroup The root-bookmark from which the search will start
87 * (usually the topmost bookmark in the tree).
88 * \param url The URL of the bookmark to search for (including <tt>ksayit://</tt>).
89 * \returns \em true, if the bookmark was found, \em false, if not.
91 bool recursiveGetBkByURL(
93 KBookmarkGroup
&group
,
94 const KBookmarkGroup
&bkGroup
,
98 * Searches the Bookmark designted by its URL.
99 * \param bookmark A reference that will contain the search result (bookmark).
100 * \param group A reference that will contain the search result
101 * (the group the found bookmark belongs to).
102 * \param bkGroup The root-bookmark from which the search will start
103 * (usually the topmost bookmark in the tree).
104 * \param title The title of the bookmark to search for.
105 * \returns Number of bookmarks with the given title.
107 int recursiveGetBkByTitle(
109 KBookmarkGroup
&group
,
110 const KBookmarkGroup
&bkGroup
,
111 const QString
&title
);
115 KBookmarkManager
*m_bkManager
;