1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
//
// C++ Interface: ksayitbookmarkhandler
//
// Description:
//
//
// Author: Robert Vogl <voglrobe@web.de>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef KSAYITBOOKMARKHANDLER_H
#define KSAYITBOOKMARKHANDLER_H
// TQt includes
#include <tqstring.h>
// KDE includes
#include <kbookmarkmanager.h>
class KSayItApp;
/**
Each of the objects in the TreeView that can be bookmarked has an unique ID.
The "URL" is to be created as follows: \p ksayit://filename/ID.\n
The "Title" is either the content of column 0 of the TreeView or the 32nd leading
charcters of the text (e.g. if the item references to a paragraph).
@author Robert Vogl
*/
class KSayItBookmarkHandler : public KBookmarkOwner
{
public:
KSayItBookmarkHandler(KBookmarkManager *bkManager=0, KSayItApp* tqparent=0);
virtual ~KSayItBookmarkHandler();
public:
/**
* Reimplemented from base class.\n
* Called when a bookmark in the menu was clicked.
* \param url The URL of the selected bookmark.
*/
void openBookmarkURL(const TQString &url);
/**
* Reimplemented from base class.\n
* Returns the Title when a new bookmark is about to be created.
* \returns The title of the bookmark.
*/
TQString currentTitle() const;
/**
* Reimplemented from base class.\n
* Returns the URL when a new bookmark is about to be created.
* \returns The URL of the bookmark.
*/
TQString currentURL() const;
/**
* Sets ID and title of the current TreeView item.
* \param ID The unique ID of the item.
* \param title The bookmark title of the item.
*/
void notifyBookmarkHandler(const TQString &ID, const TQString &title);
/**
* Deletes the bookmark designated by the given url.
* \param url The url of the bookmark.
*/
void deleteBookmark(const TQString &url, const TQString &title);
/**
* Iterates recursively through all bookmarks below the
* given group.
* \param bkGroup The KBookmarkGroup to start.
*/
void traverseBookmarks(KBookmarkGroup bkGroup);
private:
/**
* Searches the Bookmark designted by its URL.
* \param bookmark A reference that will contain the search result (bookmark).
* \param group A reference that will contain the search result
* (the group the found bookmark belongs to).
* \param bkGroup The root-bookmark from which the search will start
* (usually the topmost bookmark in the tree).
* \param url The URL of the bookmark to search for (including <tt>ksayit://</tt>).
* \returns \em true, if the bookmark was found, \em false, if not.
*/
bool recursiveGetBkByURL(
KBookmark &bookmark,
KBookmarkGroup &group,
const KBookmarkGroup &bkGroup,
const TQString &url);
/**
* Searches the Bookmark designted by its URL.
* \param bookmark A reference that will contain the search result (bookmark).
* \param group A reference that will contain the search result
* (the group the found bookmark belongs to).
* \param bkGroup The root-bookmark from which the search will start
* (usually the topmost bookmark in the tree).
* \param title The title of the bookmark to search for.
* \returns Number of bookmarks with the given title.
*/
int recursiveGetBkByTitle(
KBookmark &bookmark,
KBookmarkGroup &group,
const KBookmarkGroup &bkGroup,
const TQString &title);
private:
TQString m_ID;
TQString m_title;
KBookmarkManager *m_bkManager;
KSayItApp *m_parent;
};
#endif
|