KIO
kbookmarkmanager.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, 2006 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 __kbookmarkmanager_h 00021 #define __kbookmarkmanager_h 00022 00023 #include <QtCore/QString> 00024 #include <QtCore/QStringList> 00025 #include <QtCore/QObject> 00026 #include <QtCore/QPair> 00027 #include <QtXml/QDomDocument> 00028 #include <QtXml/QDomElement> 00029 00030 #include <kurl.h> 00031 #include "kbookmark.h" 00032 00033 class KBookmarkGroup; 00034 class QDBusMessage; 00035 00036 class QTreeWidgetItem; 00037 class QLabel; 00038 class QTreeWidget; 00039 class KLineEdit; 00040 class KMenu; 00041 class KBookmarkDialog; 00042 00065 class KIO_EXPORT KBookmarkManager : public QObject 00066 { 00067 Q_OBJECT 00068 private: 00086 KBookmarkManager( const QString & bookmarksFile, const QString& dbusObjectName ); 00087 00093 KBookmarkManager( const QString & bookmarksFile ); 00094 00098 KBookmarkManager(); 00099 00100 public: 00104 ~KBookmarkManager(); 00105 00115 bool autoErrorHandlingEnabled() const; 00116 00128 void setAutoErrorHandlingEnabled( bool enable, QWidget *parent ); 00129 00134 void setUpdate( bool update ); 00135 00142 // KDE5 TODO: Use an enum and not a bool 00143 bool saveAs( const QString & filename, bool toolbarCache = true ) const; 00144 00150 bool updateAccessMetadata( const QString &url ); 00151 00152 /* 00153 * NB. currently *unimplemented* 00154 * 00155 * Update favicon url for a given url. 00156 * @param url the viewed url 00157 * @param faviconurl the favicion url 00158 */ 00159 void updateFavicon( const QString &url, const QString &faviconurl ); 00160 00167 QString path() const; 00168 00175 KBookmarkGroup root() const; 00176 00183 KBookmarkGroup toolbar(); 00184 00191 KBookmark findByAddress( const QString & address); 00192 00193 00198 void emitChanged(); 00199 00204 void emitChanged( const KBookmarkGroup & group ); 00205 00214 // KDE5 TODO: Use an enum and not a bool 00215 bool save( bool toolbarCache = true ) const; 00216 00217 00218 void emitConfigChanged(); 00219 00229 // KDE5 TODO: Use an enum and not a bool 00230 void setEditorOptions( const QString& caption, bool browser ); 00231 00251 static KBookmarkManager* managerForFile( const QString& bookmarksFile, 00252 const QString& dbusObjectName ); 00253 00260 static KBookmarkManager* managerForExternalFile( const QString& bookmarksFile); 00261 00265 static KBookmarkManager* createTempManager(); 00266 00270 static KBookmarkManager* userBookmarksManager(); 00271 00275 QDomDocument internalDocument() const; 00276 00277 public Q_SLOTS: 00278 void slotEditBookmarks(); 00279 void slotEditBookmarksAtAddress( const QString& address ); 00280 00287 void notifyCompleteChange( const QString &caller ); 00288 00297 void notifyChanged( const QString &groupAddress, const QDBusMessage &msg ); 00298 00299 void notifyConfigChanged(); 00300 00301 Q_SIGNALS: 00305 void bookmarkCompleteChange( QString caller ); 00306 00310 void bookmarksChanged( QString groupAddress ); 00311 00315 void bookmarkConfigChanged(); 00316 00323 void changed( const QString & groupAddress, const QString & caller ); 00324 00328 void configChanged(); 00329 00335 void error(const QString &errorMessage); 00336 00337 private Q_SLOTS: 00338 void slotFileChanged(const QString& path); // external bookmarks 00339 00340 private: 00341 // consts added to avoid a copy-and-paste of internalDocument 00342 void parse() const; 00343 00352 static KBookmarkManager* managerForFile( const QString&, int); 00353 void init( const QString& dbusPath ); 00354 00355 class Private; 00356 Private * const d; 00357 00358 friend class KBookmarkGroup; 00359 }; 00360 00382 class KIO_EXPORT KBookmarkOwner 00383 { 00384 public: 00385 virtual ~KBookmarkOwner() {} 00386 00396 virtual QString currentTitle() const { return QString(); } 00397 00407 virtual QString currentUrl() const { return QString(); } 00408 00409 00414 virtual bool supportsTabs() const { return false; } 00415 00420 virtual QList<QPair<QString, QString> > currentBookmarkList() const { return QList<QPair<QString, QString> >(); } 00421 00422 enum BookmarkOption { ShowAddBookmark, ShowEditBookmark }; 00423 00424 00431 virtual bool enableOption(BookmarkOption option) const; 00432 00436 virtual void openBookmark(const KBookmark & bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km) = 0; 00437 00443 virtual void openFolderinTabs(const KBookmarkGroup &bm); 00444 00445 virtual KBookmarkDialog * bookmarkDialog(KBookmarkManager * mgr, QWidget *parent); 00446 00447 private: 00448 class KBookmarkOwnerPrivate; 00449 KBookmarkOwnerPrivate *d; 00450 }; 00451 00452 #endif 00453
KDE 4.6 API Reference