• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • bookmarks
kbookmark.h
Go to the documentation of this file.
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-2005 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 <kio/kio_export.h>
24
25#include <QtCore/QString>
26#include <QtCore/QList>
27#include <QtCore/QMetaType>
28#include <QtXml/QDomElement>
29#include <kurl.h>
30
31class KBookmarkManager;
32class KBookmarkGroup;
33
34class KIO_EXPORT KBookmark
35{
36 friend class KBookmarkGroup;
37public:
38 enum MetaDataOverwriteMode {
39 OverwriteMetaData, DontOverwriteMetaData
40 };
41
48 class KIO_EXPORT List : public QList<KBookmark>
49 {
50 public:
51 List();
52
58 void populateMimeData( QMimeData* mimeData ) const;
59
63 static bool canDecode( const QMimeData *mimeData );
64
68 static QStringList mimeDataTypes();
69
79#ifndef KDE_NO_DEPRECATED
80 static KDE_DEPRECATED KBookmark::List fromMimeData( const QMimeData *mimeData );
81#endif
82
93 static KBookmark::List fromMimeData( const QMimeData *mimeData, QDomDocument& parentDocument );
94 };
95
96
102 KBookmark( );
103
109 explicit KBookmark( const QDomElement &elem );
110
114 static KBookmark standaloneBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
115
119 bool isGroup() const;
120
124 bool isSeparator() const;
125
131 bool isNull() const;
132
138 bool hasParent() const;
139
145 QString text() const;
150 QString fullText() const;
156 void setFullText(const QString &fullText);
160 KUrl url() const;
166 void setUrl(const KUrl &url);
167
172 QString icon() const;
173
179 void setIcon(const QString &icon);
180
185 QString description() const;
186
193 void setDescription(const QString &description);
194
199 QString mimeType() const;
200
207 void setMimeType(const QString &mimeType);
208
214 bool showInToolbar() const;
215
219 void setShowInToolbar(bool show);
220
221
225 KBookmarkGroup parentGroup() const;
226
231 KBookmarkGroup toGroup() const;
232
240 QString address() const;
241
245 int positionInParent() const;
246
247 // Hard to decide. Good design would imply that each bookmark
248 // knows about its manager, so that there can be several managers.
249 // But if we say there is only one manager (i.e. set of bookmarks)
250 // per application, then KBookmarkManager::self() is much easier.
251 //KBookmarkManager * manager() const { return m_manager; }
252
256 QDomElement internalElement() const;
257
262 void updateAccessMetadata();
263
264 // Utility functions (internal)
265
269 static QString parentAddress( const QString & address );
270
274 static uint positionInParent( const QString & address );
275
280 static QString previousAddress( const QString & address );
281
286 static QString nextAddress( const QString & address );
287
292 static QString commonParent( const QString &A, const QString &B );
293
298 QDomNode metaData(const QString &owner, bool create) const;
299
306 QString metaDataItem( const QString &key ) const;
307
315 void setMetaDataItem( const QString &key, const QString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
316
324 void populateMimeData( QMimeData* mimeData ) const;
325
329 bool operator==(const KBookmark& rhs) const;
330
331protected:
332 QDomElement element;
333 // Note: you can't add new member variables here.
334 // The KBookmarks are created on the fly, as wrappers
335 // around internal QDomElements. Any additional information
336 // has to be implemented as an attribute of the QDomElement.
337
338};
339
340#ifdef MAKE_KIO_LIB
341KDE_DUMMY_QHASH_FUNCTION(KBookmark)
342#endif
343
347class KIO_EXPORT KBookmarkGroup : public KBookmark
348{
349public:
356 KBookmarkGroup();
357
361 KBookmarkGroup( const QDomElement &elem );
362
366 bool isOpen() const;
367
371 KBookmark first() const;
376 KBookmark previous( const KBookmark & current ) const;
381 KBookmark next( const KBookmark & current ) const;
382
386 int indexOf(const KBookmark& child) const;
387
393 KBookmarkGroup createNewFolder( const QString & text );
398 KBookmark createNewSeparator();
399
405 KBookmark addBookmark( const KBookmark &bm );
406
415 KBookmark addBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
416
422 bool moveBookmark( const KBookmark & bookmark, const KBookmark & after);
423
424#ifndef KDE_NO_DEPRECATED
425 KDE_DEPRECATED bool moveItem( const KBookmark & item, const KBookmark & after );
426#endif
427
432 void deleteBookmark( const KBookmark &bk );
433
437 bool isToolbarGroup() const;
441 QDomElement findToolbar() const;
442
446 QList<KUrl> groupUrlList() const;
447
448protected:
449 QDomElement nextKnownTag( const QDomElement &start, bool goNext ) const;
450
451private:
452
453 // Note: you can't add other member variables here, except for caching info.
454 // The KBookmarks are created on the fly, as wrappers
455 // around internal QDomElements. Any additional information
456 // has to be implemented as an attribute of the QDomElement.
457};
458
459class KIO_EXPORT KBookmarkGroupTraverser {
460protected:
461 virtual ~KBookmarkGroupTraverser();
462 void traverse(const KBookmarkGroup &);
463 virtual void visit(const KBookmark &);
464 virtual void visitEnter(const KBookmarkGroup &);
465 virtual void visitLeave(const KBookmarkGroup &);
466};
467
468#define KIO_KBOOKMARK_METATYPE_DEFINED 1
469Q_DECLARE_METATYPE( KBookmark )
470
471#endif
KBookmarkGroupTraverser
Definition: kbookmark.h:459
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:348
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:66
KBookmark::List
KUrl::Bookmark is a QList that contains bookmarks with a few convenience methods.
Definition: kbookmark.h:49
KBookmark
Definition: kbookmark.h:35
KBookmark::MetaDataOverwriteMode
MetaDataOverwriteMode
Definition: kbookmark.h:38
KBookmark::OverwriteMetaData
@ OverwriteMetaData
Definition: kbookmark.h:39
KBookmark::element
QDomElement element
Definition: kbookmark.h:332
KUrl
QList
operator==
bool operator==(const KEntry &k1, const KEntry &k2)
kio_export.h
kurl.h
fromMimeData
QColor fromMimeData(const QMimeData *mimeData)
canDecode
bool canDecode(const QMimeData *mimeData)
populateMimeData
void populateMimeData(QMimeData *mimeData, const QColor &color)
next
KAction * next(const QObject *recvr, const char *slot, QObject *parent)
addBookmark
KAction * addBookmark(const QObject *recvr, const char *slot, QObject *parent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal