\section{KBookmark\-Manager Class Reference}
\label{classKBookmarkManager}\index{KBookmarkManager@{KBookmarkManager}}
This class implements the reading/writing of bookmarks in XML.  


{\tt \#include $<$kbookmarkmanager.h$>$}

Inheritance diagram for KBookmark\-Manager:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=89pt]{classKBookmarkManager__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KBookmark\-Manager:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=312pt]{classKBookmarkManager__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Edit\-Bookmarks} ()\label{classKBookmarkManager_i0}

\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf changed} (const  {\bf QString} \&group\-Address, const  {\bf QString} \&caller)
\begin{CompactList}\small\item\em Signals that the group with the address {\tt group\-Address} (e.g. \item\end{CompactList}\end{CompactItemize}
\subsection*{DCOP Member Functions}
\begin{CompactItemize}
\item 
ASYNC {\bf notify\-Complete\-Change} ({\bf QString} caller)
\begin{CompactList}\small\item\em Reparse the whole bookmarks file and notify about the change (Called by the bookmark editor). \item\end{CompactList}\item 
ASYNC {\bf notify\-Changed} ({\bf QString} group\-Address)
\begin{CompactList}\small\item\em Emit the changed signal for the group whose address is given. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
void {\bf set\-Update} (bool update)
\begin{CompactList}\small\item\em Set the update flag. \item\end{CompactList}\item 
bool {\bf save} (bool toolbar\-Cache=true) const 
\begin{CompactList}\small\item\em Save the bookmarks to the default konqueror XML file on disk. \item\end{CompactList}\item 
bool {\bf save\-As} (const  {\bf QString} \&filename, bool toolbar\-Cache=true) const 
\begin{CompactList}\small\item\em Save the bookmarks to the given XML file on disk. \item\end{CompactList}\item 
{\bf QString} {\bf path} ()
\begin{CompactList}\small\item\em This will return the path that this manager is using to read the bookmarks. \item\end{CompactList}\item 
{\bf KBookmark\-Group} {\bf root} () const 
\begin{CompactList}\small\item\em This will return the root bookmark. \item\end{CompactList}\item 
{\bf KBookmark\-Group} {\bf toolbar} ()
\begin{CompactList}\small\item\em This returns the root of the toolbar menu. \item\end{CompactList}\item 
KBookmark {\bf find\-By\-Address} (const  {\bf QString} \&address, bool tolerate=false)
\item 
void {\bf emit\-Changed} ({\bf KBookmark\-Group} \&group)\label{classKBookmarkManager_a8}

\item 
bool {\bf show\-NSBookmarks} () const 
\item 
void {\bf set\-Show\-NSBookmarks} (bool show)
\begin{CompactList}\small\item\em Shows an extra menu for NS bookmarks. \item\end{CompactList}\item 
const  {\bf QDom\-Document} \& {\bf internal\-Document} () const \label{classKBookmarkManager_a11}

\item 
{\bf KBookmark\-Notifier} \& {\bf notifier} ()
\begin{CompactList}\small\item\em Access to bookmark notifier, for emitting signals. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KBookmark\-Manager} $\ast$ {\bf manager\-For\-File} (const  {\bf QString} \&bookmarks\-File, bool b\-Import\-Desktop\-Files=true)
\begin{CompactList}\small\item\em This static function will return an instance of the KBookmark\-Manager, responsible for the given {\tt bookmarks\-File}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KBookmark\-Manager} (const  {\bf QString} \&bookmarks\-File, bool b\-Import\-Desktop\-Files=true)
\begin{CompactList}\small\item\em Creates a bookmark manager with a path to the bookmarks. \item\end{CompactList}\item 
void {\bf parse} () const \label{classKBookmarkManager_b1}

\item 
void {\bf import\-Desktop\-Files} ()\label{classKBookmarkManager_b2}

\end{CompactItemize}
\subsection*{Static Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf convert\-To\-XBEL} ({\bf QDom\-Element} \&group)\label{classKBookmarkManager_f0}

\item 
void {\bf convert\-Attribute} ({\bf QDom\-Element} elem, const  {\bf QString} \&old\-Name, const  {\bf QString} \&new\-Name)\label{classKBookmarkManager_f1}

\end{CompactItemize}


\subsection{Detailed Description}
This class implements the reading/writing of bookmarks in XML. 

The bookmarks file is read and written using the XBEL standard ({\tt http://pyxml.sourceforge.net/topics/xbel/})

A sample file looks like this :  Developer Web Site  Title of this folder {\bf KDE} Web Site  My own bookmarks KOffice Web Site $<$separator/$>$ KDevelop Web Site    



Definition at line 48 of file kbookmarkmanager.h.

\subsection{Constructor \& Destructor Documentation}
\index{KBookmarkManager@{KBookmark\-Manager}!KBookmarkManager@{KBookmarkManager}}
\index{KBookmarkManager@{KBookmarkManager}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KBookmark\-Manager::KBookmark\-Manager (const {\bf QString} \& {\em bookmarks\-File}, bool {\em b\-Import\-Desktop\-Files} = true)\hspace{0.3cm}{\tt  [protected]}}\label{classKBookmarkManager_b0}


Creates a bookmark manager with a path to the bookmarks. 

By default, it will use the {\bf KDE} standard dirs to find and create the correct location. If you are using your own app-specific bookmarks directory, you must instantiate this class with your own path {\em before\/} {\bf KBookmark\-Manager::manager\-For\-File()}{\rm (p.\,\pageref{classKBookmarkManager_e0})} is ever called.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bookmarks\-File}]full path to the bookmarks file, Use $\sim$/.kde/share/apps/konqueror/bookmarks.xml for the konqueror bookmarks\item[{\em b\-Import\-Desktop\-Files}]if true, and if the bookmarks\-File doesn't already exist, import bookmarks from desktop files \end{description}
\end{Desc}


Definition at line 56 of file kbookmarkmanager.cc.

References QDom\-Document::create\-Element(), QFile::exists(), and QString::is\-Empty().

Referenced by manager\-For\-File().

\subsection{Member Function Documentation}
\index{KBookmarkManager@{KBookmark\-Manager}!setUpdate@{setUpdate}}
\index{setUpdate@{setUpdate}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KBookmark\-Manager::set\-Update (bool {\em update})}\label{classKBookmarkManager_a1}


Set the update flag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em update}]iff true will KBookmark\-Manager listen to DCOP update requests. \end{description}
\end{Desc}


Definition at line 84 of file kbookmarkmanager.cc.\index{KBookmarkManager@{KBookmark\-Manager}!save@{save}}
\index{save@{save}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KBookmark\-Manager::save (bool {\em toolbar\-Cache} = true) const}\label{classKBookmarkManager_a2}


Save the bookmarks to the default konqueror XML file on disk. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em toolbar\-Cache}]iff true save a cache of the toolbar folder, too \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if saving was successful \end{Desc}


Definition at line 208 of file kbookmarkmanager.cc.

References save\-As().\index{KBookmarkManager@{KBookmark\-Manager}!saveAs@{saveAs}}
\index{saveAs@{saveAs}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KBookmark\-Manager::save\-As (const {\bf QString} \& {\em filename}, bool {\em toolbar\-Cache} = true) const}\label{classKBookmarkManager_a3}


Save the bookmarks to the given XML file on disk. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]full path to the desired bookmarks file location \item[{\em toolbar\-Cache}]iff true save a cache of the toolbar folder, too \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if saving was successful \end{Desc}


Definition at line 213 of file kbookmarkmanager.cc.

References KSave\-File::close(), KMessage\-Box::error(), KSave\-File::file(), KBookmark\-Group::find\-Toolbar(), QString::from\-Latin1(), KBookmark\-Group::is\-Toolbar\-Group(), QCString::length(), QFile::remove(), root(), KSave\-File::status(), QDom\-Document::to\-CString(), and QString::utf8().

Referenced by save().\index{KBookmarkManager@{KBookmark\-Manager}!path@{path}}
\index{path@{path}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KBookmark\-Manager::path ()\hspace{0.3cm}{\tt  [inline]}}\label{classKBookmarkManager_a4}


This will return the path that this manager is using to read the bookmarks. 



Definition at line 100 of file kbookmarkmanager.h.

Referenced by KBookmark\-Group::add\-Bookmark(), and KBookmark\-Group::create\-New\-Folder().\index{KBookmarkManager@{KBookmark\-Manager}!root@{root}}
\index{root@{root}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KBookmark\-Group} KBookmark\-Manager::root () const}\label{classKBookmarkManager_a5}


This will return the root bookmark. 

It is used to iterate through the bookmarks manually. It is mostly used internally.

\begin{Desc}
\item[Returns:]the root (top-level) bookmark \end{Desc}


Definition at line 255 of file kbookmarkmanager.cc.

Referenced by find\-By\-Address(), save\-As(), set\-Show\-NSBookmarks(), show\-NSBookmarks(), and toolbar().\index{KBookmarkManager@{KBookmark\-Manager}!toolbar@{toolbar}}
\index{toolbar@{toolbar}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KBookmark\-Group} KBookmark\-Manager::toolbar ()}\label{classKBookmarkManager_a6}


This returns the root of the toolbar menu. 

In the XML, this is the group with the attribute TOOLBAR=1

\begin{Desc}
\item[Returns:]the toolbar group \end{Desc}


Definition at line 260 of file kbookmarkmanager.cc.

References QFile::exists(), KBookmark\-Group::find\-Toolbar(), QString::from\-Latin1(), QFile\-Info::last\-Modified(), QFile::open(), root(), and QDom\-Document::set\-Content().

Referenced by KBookmark\-Bar::KBookmark\-Bar().\index{KBookmarkManager@{KBookmark\-Manager}!findByAddress@{findByAddress}}
\index{findByAddress@{findByAddress}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KBookmark KBookmark\-Manager::find\-By\-Address (const {\bf QString} \& {\em address}, bool {\em tolerate} = false)}\label{classKBookmarkManager_a7}


\begin{Desc}
\item[Returns:]the bookmark designated by {\tt address} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em tolerate}]when true tries to find the most tolerable bookmark position \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]KBookmark::address \end{Desc}


Definition at line 301 of file kbookmarkmanager.cc.

References KBookmark\-Group::first(), KBookmark\-Group::next(), KIO::number(), root(), QString\-List::split(), and QString::to\-UInt().

Referenced by KBookmark\-Menu::fill\-Bookmark\-Menu().\index{KBookmarkManager@{KBookmark\-Manager}!showNSBookmarks@{showNSBookmarks}}
\index{showNSBookmarks@{showNSBookmarks}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KBookmark\-Manager::show\-NSBookmarks () const}\label{classKBookmarkManager_a9}


\begin{Desc}
\item[Returns:]true if the NS bookmarks should be dynamically shown in the toplevel kactionmenu \end{Desc}


Definition at line 386 of file kbookmarkmanager.cc.

References root().

Referenced by KBookmark\-Menu::fill\-Bookmark\-Menu().\index{KBookmarkManager@{KBookmark\-Manager}!setShowNSBookmarks@{setShowNSBookmarks}}
\index{setShowNSBookmarks@{setShowNSBookmarks}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KBookmark\-Manager::set\-Show\-NSBookmarks (bool {\em show})}\label{classKBookmarkManager_a10}


Shows an extra menu for NS bookmarks. 

Set this to false, if you don't want this. 

Definition at line 392 of file kbookmarkmanager.cc.

References root().\index{KBookmarkManager@{KBookmark\-Manager}!managerForFile@{managerForFile}}
\index{managerForFile@{managerForFile}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KBookmark\-Manager} $\ast$ KBookmark\-Manager::manager\-For\-File (const {\bf QString} \& {\em bookmarks\-File}, bool {\em b\-Import\-Desktop\-Files} = true)\hspace{0.3cm}{\tt  [static]}}\label{classKBookmarkManager_e0}


This static function will return an instance of the KBookmark\-Manager, responsible for the given {\tt bookmarks\-File}. 

If you do not instantiate this class either natively or in a derived class, then it will return an object with the default behaviors. If you wish to use different behaviors, you {\em must\/} derive your own class and instantiate it before this method is ever called.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bookmarks\-File}]full path to the bookmarks file, Use $\sim$/.kde/share/apps/konqueror/bookmarks.xml for the konqueror bookmarks\item[{\em b\-Import\-Desktop\-Files}]if true, and if the bookmarks\-File doesn't already exist, import bookmarks from desktop files \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a pointer to an instance of the KBookmark\-Manager. \end{Desc}


Definition at line 40 of file kbookmarkmanager.cc.

References QPtr\-List$<$ KBookmark\-Manager $>$::append(), QPtr\-List\-Iterator::current(), KBookmark\-Manager(), and QPtr\-List$<$ KBookmark\-Manager $>$::set\-Auto\-Delete().\index{KBookmarkManager@{KBookmark\-Manager}!notifier@{notifier}}
\index{notifier@{notifier}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KBookmark\-Notifier}\& KBookmark\-Manager::notifier ()\hspace{0.3cm}{\tt  [inline]}}\label{classKBookmarkManager_a12}


Access to bookmark notifier, for emitting signals. 

We need this object to exist in one instance only, so we could connect\-DCOP to it by name. 

Definition at line 169 of file kbookmarkmanager.h.

Referenced by KBookmark\-Group::add\-Bookmark(), and KBookmark\-Group::create\-New\-Folder().\index{KBookmarkManager@{KBookmark\-Manager}!notifyCompleteChange@{notifyCompleteChange}}
\index{notifyCompleteChange@{notifyCompleteChange}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KBookmark\-Manager::notify\-Complete\-Change ({\bf QString} {\em caller})}\label{classKBookmarkManager_z0}


Reparse the whole bookmarks file and notify about the change (Called by the bookmark editor). 



Definition at line 355 of file kbookmarkmanager.cc.\index{KBookmarkManager@{KBookmark\-Manager}!notifyChanged@{notifyChanged}}
\index{notifyChanged@{notifyChanged}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KBookmark\-Manager::notify\-Changed ({\bf QString} {\em group\-Address})}\label{classKBookmarkManager_z1}


Emit the changed signal for the group whose address is given. 

\begin{Desc}
\item[See also:]KBookmark::address() Called by the instance of konqueror that saved the file after a small change (new bookmark or new folder). \end{Desc}


Definition at line 372 of file kbookmarkmanager.cc.\index{KBookmarkManager@{KBookmark\-Manager}!changed@{changed}}
\index{changed@{changed}!KBookmarkManager@{KBookmark\-Manager}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KBookmark\-Manager::changed (const {\bf QString} \& {\em group\-Address}, const {\bf QString} \& {\em caller})\hspace{0.3cm}{\tt  [signal]}}\label{classKBookmarkManager_l0}


Signals that the group with the address {\tt group\-Address} (e.g. 

\char`\"{}/4/5\char`\"{}) has been modified by the caller {\tt caller}. 

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kbookmarkmanager.h\item 
kbookmarkmanager.cc\end{CompactItemize}
