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

kio/bookmarks

  • kio
  • bookmarks
kbookmark.h
1 // -*- c-basic-offset: 4; indent-tabs-mode:nil -*-
2 // vim: set ts=4 sts=4 sw=4 et:
3 /* This file is part of the KDE libraries
4  Copyright (C) 2000 David Faure <faure@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 #ifndef __kbookmark_h
21 #define __kbookmark_h
22 
23 #include <tqstring.h>
24 #include <tqvaluelist.h>
25 #include <tqdom.h>
26 #include <kurl.h>
27 
28 class KBookmarkManager;
29 class KBookmarkGroup;
30 
31 class KIO_EXPORT KBookmark
32 {
33  friend class KBookmarkGroup;
34 public:
35  enum MetaDataOverwriteMode {
36  OverwriteMetaData, DontOverwriteMetaData
37  };
38 
39  KBookmark( ) {}
40  KBookmark( TQDomElement elem ) : element(elem) {}
41 
42  static KBookmark standaloneBookmark( const TQString & text, const KURL & url, const TQString & icon = TQString::null );
43 
47  bool isGroup() const;
48 
52  bool isSeparator() const;
53 
59  bool isNull() const {return element.isNull();}
60 
67  bool hasParent() const;
68 
74  TQString text() const;
79  TQString fullText() const;
83  KURL url() const;
88  TQString icon() const;
89 
93  KBookmarkGroup parentGroup() const;
94 
99  KBookmarkGroup toGroup() const;
100 
107  TQString address() const;
108 
109  // Hard to decide. Good design would imply that each bookmark
110  // knows about its manager, so that there can be several managers.
111  // But if we say there is only one manager (i.e. set of bookmarks)
112  // per application, then KBookmarkManager::self() is much easier.
113  //KBookmarkManager * manager() const { return m_manager; }
114 
118  TQDomElement internalElement() const { return element; }
119 
125  void updateAccessMetadata();
126 
127  // Utility functions (internal)
128 
132  static TQString parentAddress( const TQString & address )
133  { return address.left( address.findRev('/') ); }
134 
138  static uint positionInParent( const TQString & address )
139  { return address.mid( address.findRev('/') + 1 ).toInt(); }
140 
145  static TQString previousAddress( const TQString & address )
146  {
147  uint pp = positionInParent(address);
148  return pp>0 ? parentAddress(address) + '/' + TQString::number(pp-1) : TQString::null;
149  }
150 
155  static TQString nextAddress( const TQString & address )
156  { return parentAddress(address) + '/' + TQString::number(positionInParent(address)+1); }
157 
163  static TQString commonParent(TQString A, TQString B);
164 
172  TQString metaDataItem( const TQString &key ) const;
173 
182  void setMetaDataItem( const TQString &key, const TQString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
183 
184 protected:
185  TQDomElement element;
186  // Note: you can't add new member variables here.
187  // The KBookmarks are created on the fly, as wrappers
188  // around internal QDomElements. Any additional information
189  // has to be implemented as an attribute of the TQDomElement.
190 
191 private:
192  bool hasMetaData() const;
193  static TQString left(const TQString & str, uint len);
194 };
195 
199 class KIO_EXPORT KBookmarkGroup : public KBookmark
200 {
201 public:
208  KBookmarkGroup();
209 
213  KBookmarkGroup( TQDomElement elem );
214 
219  TQString groupAddress() const;
220 
224  bool isOpen() const;
225 
229  KBookmark first() const;
234  KBookmark previous( const KBookmark & current ) const;
239  KBookmark next( const KBookmark & current ) const;
240 
247  KBookmarkGroup createNewFolder( KBookmarkManager* mgr, const TQString & text = TQString::null, bool emitSignal = true );
252  KBookmark createNewSeparator();
253 
262  KBookmark addBookmark( KBookmarkManager* mgr, const KBookmark &bm, bool emitSignal = true );
263 
274  KBookmark addBookmark( KBookmarkManager* mgr, const TQString & text, const KURL & url, const TQString & icon = TQString::null, bool emitSignal = true );
275 
281  bool moveItem( const KBookmark & item, const KBookmark & after );
282 
287  void deleteBookmark( KBookmark bk );
288 
292  bool isToolbarGroup() const;
296  TQDomElement findToolbar() const;
297 
302  TQValueList<KURL> groupUrlList() const;
303 
304 protected:
305  TQDomElement nextKnownTag( TQDomElement start, bool goNext ) const;
306 
307 private:
308  mutable TQString m_address;
309  // Note: you can't add other member variables here, except for caching info.
310  // The KBookmarks are created on the fly, as wrappers
311  // around internal QDomElements. Any additional information
312  // has to be implemented as an attribute of the TQDomElement.
313 };
314 
318 class KIO_EXPORT KBookmarkGroupTraverser {
319 protected:
320  virtual ~KBookmarkGroupTraverser() { ; }
321  void traverse(const KBookmarkGroup &);
322  virtual void visit(const KBookmark &) { ; }
323  virtual void visitEnter(const KBookmarkGroup &) { ; }
324  virtual void visitLeave(const KBookmarkGroup &) { ; }
325 private:
326  class KBookmarkGroupTraverserPrivate *d;
327 };
328 
329 #endif

kio/bookmarks

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

kio/bookmarks

Skip menu "kio/bookmarks"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/bookmarks by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |