• Skip to content
  • Skip to link menu
KDE 4.2 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 
00077         static KBookmark::List fromMimeData( const QMimeData *mimeData );
00078     };
00079 
00080 
00086     KBookmark( );
00087 
00093     explicit KBookmark( const QDomElement &elem );
00094 
00098     static KBookmark standaloneBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
00099 
00103     bool isGroup() const;
00104 
00108     bool isSeparator() const;
00109 
00115     bool isNull() const;
00116 
00122     bool hasParent() const;
00123 
00129     QString text() const;
00134     QString fullText() const;
00140     void setFullText(const QString &fullText);
00144     KUrl url() const;
00150     void setUrl(const KUrl &url);
00151     
00156     QString icon() const;
00157     
00163     void setIcon(const QString &icon);
00164 
00169     QString mimeType() const;
00170     
00177     void setMimeType(const QString &mimeType);
00178     
00184     bool showInToolbar() const;
00185     
00189     void setShowInToolbar(bool show);
00190 
00191 
00195     KBookmarkGroup parentGroup() const;
00196 
00201     KBookmarkGroup toGroup() const;
00202 
00210     QString address() const;
00211 
00215     int positionInParent() const;
00216 
00217     // Hard to decide. Good design would imply that each bookmark
00218     // knows about its manager, so that there can be several managers.
00219     // But if we say there is only one manager (i.e. set of bookmarks)
00220     // per application, then KBookmarkManager::self() is much easier.
00221     //KBookmarkManager * manager() const { return m_manager; }
00222 
00226     QDomElement internalElement() const;
00227 
00232     void updateAccessMetadata();
00233 
00234     // Utility functions (internal)
00235 
00239     static QString parentAddress( const QString & address );
00240 
00244     static uint positionInParent( const QString & address );
00245 
00250     static QString previousAddress( const QString & address );
00251 
00256     static QString nextAddress( const QString & address );
00257 
00262     static QString commonParent( const QString &A, const QString &B );
00263 
00268     QDomNode metaData(const QString &owner, bool create) const;     
00269      
00276     QString metaDataItem( const QString &key ) const;
00277 
00285     void setMetaDataItem( const QString &key, const QString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
00286 
00294     void populateMimeData( QMimeData* mimeData ) const;
00295 
00299     bool operator==(const KBookmark& rhs) const;
00300 
00301 protected:
00302     QDomElement element;
00303     // Note: you can't add new member variables here.
00304     // The KBookmarks are created on the fly, as wrappers
00305     // around internal QDomElements. Any additional information
00306     // has to be implemented as an attribute of the QDomElement.
00307 
00308 };
00309 
00310 #ifdef MAKE_KIO_LIB
00311 KDE_DUMMY_QHASH_FUNCTION(KBookmark)
00312 #endif
00313 
00317 class KIO_EXPORT KBookmarkGroup : public KBookmark
00318 {
00319 public:
00326     KBookmarkGroup();
00327 
00331     KBookmarkGroup( const QDomElement &elem );
00332 
00336     bool isOpen() const;
00337 
00341     KBookmark first() const;
00346     KBookmark previous( const KBookmark & current ) const;
00351     KBookmark next( const KBookmark & current ) const;
00352 
00356     int indexOf(const KBookmark& child) const;
00357 
00363     KBookmarkGroup createNewFolder( const QString & text );
00368     KBookmark createNewSeparator();
00369 
00375     KBookmark addBookmark( const KBookmark &bm );
00376 
00385     KBookmark addBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
00386 
00392     bool moveBookmark( const KBookmark & bookmark, const KBookmark & after);
00393 
00394     KDE_DEPRECATED bool moveItem( const KBookmark & item, const KBookmark & after );
00395 
00400     void deleteBookmark( const KBookmark &bk );
00401 
00405     bool isToolbarGroup() const;
00409     QDomElement findToolbar() const;
00410 
00414     QList<KUrl> groupUrlList() const;
00415 
00416 protected:
00417     QDomElement nextKnownTag( const QDomElement &start, bool goNext ) const;
00418 
00419 private:
00420 
00421     // Note: you can't add other member variables here, except for caching info.
00422     // The KBookmarks are created on the fly, as wrappers
00423     // around internal QDomElements. Any additional information
00424     // has to be implemented as an attribute of the QDomElement.
00425 };
00426 
00427 class KIO_EXPORT KBookmarkGroupTraverser {
00428 protected:
00429     virtual ~KBookmarkGroupTraverser();
00430     void traverse(const KBookmarkGroup &);
00431     virtual void visit(const KBookmark &);
00432     virtual void visitEnter(const KBookmarkGroup &);
00433     virtual void visitLeave(const KBookmarkGroup &);
00434 };
00435 
00436 #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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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