• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/bookmarks
 

tdeio/bookmarks

  • tdeio
  • bookmarks
kbookmark.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18#ifndef __kbookmark_h
19#define __kbookmark_h
20
21#include <tqstring.h>
22#include <tqvaluelist.h>
23#include <tqdom.h>
24#include <kurl.h>
25
26class KBookmarkManager;
27class KBookmarkGroup;
28
29class TDEIO_EXPORT KBookmark
30{
31 friend class KBookmarkGroup;
32public:
33 enum MetaDataOverwriteMode {
34 OverwriteMetaData, DontOverwriteMetaData
35 };
36
37 KBookmark( ) {}
38 KBookmark( TQDomElement elem ) : element(elem) {}
39
40 static KBookmark standaloneBookmark( const TQString & text, const KURL & url, const TQString & icon = TQString::null );
41
45 bool isGroup() const;
46
50 bool isSeparator() const;
51
57 bool isNull() const {return element.isNull();}
58
65 bool hasParent() const;
66
72 TQString text() const;
77 TQString fullText() const;
81 KURL url() const;
86 TQString icon() const;
87
91 KBookmarkGroup parentGroup() const;
92
97 KBookmarkGroup toGroup() const;
98
105 TQString address() const;
106
107 // Hard to decide. Good design would imply that each bookmark
108 // knows about its manager, so that there can be several managers.
109 // But if we say there is only one manager (i.e. set of bookmarks)
110 // per application, then KBookmarkManager::self() is much easier.
111 //KBookmarkManager * manager() const { return m_manager; }
112
116 TQDomElement internalElement() const { return element; }
117
123 void updateAccessMetadata();
124
125 // Utility functions (internal)
126
130 static TQString parentAddress( const TQString & address )
131 { return address.left( address.findRev('/') ); }
132
136 static uint positionInParent( const TQString & address )
137 { return address.mid( address.findRev('/') + 1 ).toInt(); }
138
143 static TQString previousAddress( const TQString & address )
144 {
145 uint pp = positionInParent(address);
146 return pp>0 ? parentAddress(address) + '/' + TQString::number(pp-1) : TQString::null;
147 }
148
153 static TQString nextAddress( const TQString & address )
154 { return parentAddress(address) + '/' + TQString::number(positionInParent(address)+1); }
155
161 static TQString commonParent(TQString A, TQString B);
162
170 TQString metaDataItem( const TQString &key ) const;
171
180 void setMetaDataItem( const TQString &key, const TQString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
181
182protected:
183 TQDomElement element;
184 // Note: you can't add new member variables here.
185 // The KBookmarks are created on the fly, as wrappers
186 // around internal QDomElements. Any additional information
187 // has to be implemented as an attribute of the TQDomElement.
188
189private:
190 bool hasMetaData() const;
191 static TQString left(const TQString & str, uint len);
192};
193
197class TDEIO_EXPORT KBookmarkGroup : public KBookmark
198{
199public:
206 KBookmarkGroup();
207
211 KBookmarkGroup( TQDomElement elem );
212
217 TQString groupAddress() const;
218
222 bool isOpen() const;
223
227 KBookmark first() const;
232 KBookmark previous( const KBookmark & current ) const;
237 KBookmark next( const KBookmark & current ) const;
238
245 KBookmarkGroup createNewFolder( KBookmarkManager* mgr, const TQString & text = TQString::null, bool emitSignal = true );
250 KBookmark createNewSeparator();
251
260 KBookmark addBookmark( KBookmarkManager* mgr, const KBookmark &bm, bool emitSignal = true );
261
272 KBookmark addBookmark( KBookmarkManager* mgr, const TQString & text, const KURL & url, const TQString & icon = TQString::null, bool emitSignal = true );
273
279 bool moveItem( const KBookmark & item, const KBookmark & after );
280
285 void deleteBookmark( KBookmark bk );
286
290 bool isToolbarGroup() const;
294 TQDomElement findToolbar() const;
295
300 TQValueList<KURL> groupUrlList() const;
301
302protected:
303 TQDomElement nextKnownTag( TQDomElement start, bool goNext ) const;
304
305private:
306 mutable TQString m_address;
307 // Note: you can't add other member variables here, except for caching info.
308 // The KBookmarks are created on the fly, as wrappers
309 // around internal QDomElements. Any additional information
310 // has to be implemented as an attribute of the TQDomElement.
311};
312
316class TDEIO_EXPORT KBookmarkGroupTraverser {
317protected:
318 virtual ~KBookmarkGroupTraverser() { ; }
319 void traverse(const KBookmarkGroup &);
320 virtual void visit(const KBookmark &) { ; }
321 virtual void visitEnter(const KBookmarkGroup &) { ; }
322 virtual void visitLeave(const KBookmarkGroup &) { ; }
323private:
324 class KBookmarkGroupTraverserPrivate *d;
325};
326
327#endif
KBookmarkGroupTraverser
Definition: kbookmark.h:316
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:198
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:52

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/bookmarks by doxygen 1.9.4
This website is maintained by Timothy Pearson.