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

KIO

kbookmarkdombuilder.cc

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003    Copyright (C) 2002-2003 Alexander Kellett <lypanov@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This program 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 program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "kbookmarkdombuilder.h"
00022 
00023 #include <kbookmarkmanager.h>
00024 #include <kdebug.h>
00025 
00026 KBookmarkDomBuilder::KBookmarkDomBuilder(
00027    const KBookmarkGroup &bkGroup, KBookmarkManager *manager
00028 ) {
00029    m_manager = manager;
00030    m_stack.push(bkGroup);
00031 }
00032 
00033 KBookmarkDomBuilder::~KBookmarkDomBuilder() {
00034    m_list.clear();
00035    m_stack.clear();
00036 }
00037 
00038 void KBookmarkDomBuilder::connectImporter(const QObject *importer) {
00039    connect(importer, SIGNAL( newBookmark(const QString &, const QString &, const QString &) ),
00040                      SLOT( newBookmark(const QString &, const QString &, const QString &) ));
00041    connect(importer, SIGNAL( newFolder(const QString &, bool, const QString &) ),
00042                      SLOT( newFolder(const QString &, bool, const QString &) ));
00043    connect(importer, SIGNAL( newSeparator() ),
00044                      SLOT( newSeparator() ) );
00045    connect(importer, SIGNAL( endFolder() ),
00046                      SLOT( endFolder() ) );
00047 }
00048 
00049 void KBookmarkDomBuilder::newBookmark(
00050    const QString &text, const QString &url, const QString &additionalInfo
00051 ) {
00052    KBookmark bk = m_stack.top().addBookmark(
00053                                     text,
00054                                     KUrl( url ), // utf8
00055                                     QString());
00056    // store additional info
00057    bk.internalElement().setAttribute("netscapeinfo", additionalInfo);
00058 }
00059 
00060 void KBookmarkDomBuilder::newFolder(
00061    const QString & text, bool open, const QString & additionalInfo
00062 ) {
00063    // we use a qvaluelist so that we keep pointers to valid objects in the stack
00064    KBookmarkGroup gp = m_stack.top().createNewFolder(text);
00065    m_list.append(gp);
00066    m_stack.push(m_list.last());
00067    // store additional info
00068    QDomElement element = m_list.last().internalElement();
00069    element.setAttribute("netscapeinfo", additionalInfo);
00070    element.setAttribute("folded", (open?"no":"yes"));
00071 }
00072 
00073 void KBookmarkDomBuilder::newSeparator() {
00074    m_stack.top().createNewSeparator();
00075 }
00076 
00077 void KBookmarkDomBuilder::endFolder() {
00078    m_stack.pop();
00079 }
00080 
00081 #include "kbookmarkdombuilder.moc"

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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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