kio Library API Documentation

kbookmarkmanager.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 #ifndef __kbookmarkmanager_h
00019 #define __kbookmarkmanager_h
00020 
00021 #include <qstring.h>
00022 #include <qobject.h>
00023 #include <qdom.h>
00024 #include <dcopobject.h>
00025 #include "kbookmark.h"
00026 #include "kbookmarknotifier.h"
00027 
00048 class KBookmarkManager : public QObject, public DCOPObject
00049 {
00050     Q_OBJECT
00051     K_DCOP
00052 protected:
00067     KBookmarkManager( const QString & bookmarksFile,
00068                          bool bImportDesktopFiles = true );
00069 
00070 public:
00071     ~KBookmarkManager();
00072 
00077     void setUpdate(bool update);
00078 
00084     bool save( bool toolbarCache = true ) const;
00085 
00092     bool saveAs( const QString & filename, bool toolbarCache = true ) const;
00093 
00100     QString path() { return m_bookmarksFile; }
00101 
00108     KBookmarkGroup root() const;
00109 
00116     KBookmarkGroup toolbar();
00117 
00123     KBookmark findByAddress( const QString & address, bool tolerate = false );
00124 
00128     void emitChanged( KBookmarkGroup & group );
00129 
00134     bool showNSBookmarks() const;
00135 
00140     void setShowNSBookmarks( bool show );
00141     
00158     static KBookmarkManager* managerForFile( const QString& bookmarksFile,
00159                                    bool bImportDesktopFiles = true );
00160 
00164     const QDomDocument & internalDocument() const;
00165 
00169     KBookmarkNotifier& notifier() { return m_notifier; }
00170 
00171 public slots:
00172     void slotEditBookmarks();
00173 
00174 public:
00175 k_dcop:
00180     ASYNC notifyCompleteChange( QString caller );
00181 
00188     ASYNC notifyChanged( QString groupAddress );
00189 
00190 signals:
00195     void changed( const QString & groupAddress, const QString & caller );
00196 
00197 protected:
00198     // consts added to avoid a copy-and-paste of internalDocument
00199     void parse() const;
00200     void importDesktopFiles();
00201     static void convertToXBEL( QDomElement & group );
00202     static void convertAttribute( QDomElement elem, const QString & oldName, const QString & newName );
00203 
00204 private:
00205     KBookmarkNotifier m_notifier;
00206     QString m_bookmarksFile;
00207     mutable QDomDocument m_doc;
00208     mutable QDomDocument m_toolbarDoc;
00209     mutable bool m_docIsLoaded;
00210     bool m_update;
00211     static QPtrList<KBookmarkManager>* s_pSelf;
00212     bool m_showNSBookmarks;
00213 };
00214 
00236 class KBookmarkOwner
00237 {
00238 public:
00243   virtual void openBookmarkURL(const QString& _url);
00244 
00253   virtual QString currentTitle() const { return QString::null; }
00254 
00263   virtual QString currentURL() const { return QString::null; }
00264 
00265 protected:
00266   virtual void virtual_hook( int id, void* data );
00267 };
00268 
00269 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:28 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001