• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

kbookmark.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4; indent-tabs-mode:nil -*-
00002 // vim: set ts=4 sts=4 sw=4 et:
00003 /* This file is part of the KDE libraries
00004    Copyright (C) 2000-2005 David Faure <faure@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 #ifndef __kbookmark_h
00021 #define __kbookmark_h
00022 
00023 #include <kio/kio_export.h>
00024 
00025 #include <QtCore/QString>
00026 #include <QtCore/QList>
00027 #include <QtXml/QDomElement>
00028 #include <kurl.h>
00029 
00030 class KBookmarkManager;
00031 class KBookmarkGroup;
00032 
00033 class KIO_EXPORT KBookmark
00034 {
00035     friend class KBookmarkGroup;
00036 public:
00037     enum MetaDataOverwriteMode {
00038         OverwriteMetaData, DontOverwriteMetaData
00039     };
00040 
00047     class KIO_EXPORT List : public QList<KBookmark>
00048     {
00049     public:
00050         List();
00051 
00057         void populateMimeData( QMimeData* mimeData ) const;
00058 
00062         static bool canDecode( const QMimeData *mimeData );
00063 
00067         static QStringList mimeDataTypes();
00068 
00078         static KDE_DEPRECATED KBookmark::List fromMimeData( const QMimeData *mimeData );
00079 
00090         static KBookmark::List fromMimeData( const QMimeData *mimeData, QDomDocument& parentDocument );
00091     };
00092 
00093 
00099     KBookmark( );
00100 
00106     explicit KBookmark( const QDomElement &elem );
00107 
00111     static KBookmark standaloneBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
00112 
00116     bool isGroup() const;
00117 
00121     bool isSeparator() const;
00122 
00128     bool isNull() const;
00129 
00135     bool hasParent() const;
00136 
00142     QString text() const;
00147     QString fullText() const;
00153     void setFullText(const QString &fullText);
00157     KUrl url() const;
00163     void setUrl(const KUrl &url);
00164 
00169     QString icon() const;
00170 
00176     void setIcon(const QString &icon);
00177 
00182     QString mimeType() const;
00183 
00190     void setMimeType(const QString &mimeType);
00191 
00197     bool showInToolbar() const;
00198 
00202     void setShowInToolbar(bool show);
00203 
00204 
00208     KBookmarkGroup parentGroup() const;
00209 
00214     KBookmarkGroup toGroup() const;
00215 
00223     QString address() const;
00224 
00228     int positionInParent() const;
00229 
00230     // Hard to decide. Good design would imply that each bookmark
00231     // knows about its manager, so that there can be several managers.
00232     // But if we say there is only one manager (i.e. set of bookmarks)
00233     // per application, then KBookmarkManager::self() is much easier.
00234     //KBookmarkManager * manager() const { return m_manager; }
00235 
00239     QDomElement internalElement() const;
00240 
00245     void updateAccessMetadata();
00246 
00247     // Utility functions (internal)
00248 
00252     static QString parentAddress( const QString & address );
00253 
00257     static uint positionInParent( const QString & address );
00258 
00263     static QString previousAddress( const QString & address );
00264 
00269     static QString nextAddress( const QString & address );
00270 
00275     static QString commonParent( const QString &A, const QString &B );
00276 
00281     QDomNode metaData(const QString &owner, bool create) const;
00282 
00289     QString metaDataItem( const QString &key ) const;
00290 
00298     void setMetaDataItem( const QString &key, const QString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
00299 
00307     void populateMimeData( QMimeData* mimeData ) const;
00308 
00312     bool operator==(const KBookmark& rhs) const;
00313 
00314 protected:
00315     QDomElement element;
00316     // Note: you can't add new member variables here.
00317     // The KBookmarks are created on the fly, as wrappers
00318     // around internal QDomElements. Any additional information
00319     // has to be implemented as an attribute of the QDomElement.
00320 
00321 };
00322 
00323 #ifdef MAKE_KIO_LIB
00324 KDE_DUMMY_QHASH_FUNCTION(KBookmark)
00325 #endif
00326 
00330 class KIO_EXPORT KBookmarkGroup : public KBookmark
00331 {
00332 public:
00339     KBookmarkGroup();
00340 
00344     KBookmarkGroup( const QDomElement &elem );
00345 
00349     bool isOpen() const;
00350 
00354     KBookmark first() const;
00359     KBookmark previous( const KBookmark & current ) const;
00364     KBookmark next( const KBookmark & current ) const;
00365 
00369     int indexOf(const KBookmark& child) const;
00370 
00376     KBookmarkGroup createNewFolder( const QString & text );
00381     KBookmark createNewSeparator();
00382 
00388     KBookmark addBookmark( const KBookmark &bm );
00389 
00398     KBookmark addBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
00399 
00405     bool moveBookmark( const KBookmark & bookmark, const KBookmark & after);
00406 
00407     KDE_DEPRECATED bool moveItem( const KBookmark & item, const KBookmark & after );
00408 
00413     void deleteBookmark( const KBookmark &bk );
00414 
00418     bool isToolbarGroup() const;
00422     QDomElement findToolbar() const;
00423 
00427     QList<KUrl> groupUrlList() const;
00428 
00429 protected:
00430     QDomElement nextKnownTag( const QDomElement &start, bool goNext ) const;
00431 
00432 private:
00433 
00434     // Note: you can't add other member variables here, except for caching info.
00435     // The KBookmarks are created on the fly, as wrappers
00436     // around internal QDomElements. Any additional information
00437     // has to be implemented as an attribute of the QDomElement.
00438 };
00439 
00440 class KIO_EXPORT KBookmarkGroupTraverser {
00441 protected:
00442     virtual ~KBookmarkGroupTraverser();
00443     void traverse(const KBookmarkGroup &);
00444     virtual void visit(const KBookmark &);
00445     virtual void visitEnter(const KBookmarkGroup &);
00446     virtual void visitLeave(const KBookmarkGroup &);
00447 };
00448 
00449 #endif

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal