• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/bookmarks
 

tdeio/bookmarks

kbookmarkdombuilder.cc

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 <kbookmarkmanager.h>
00022 #include <kdebug.h>
00023 
00024 #include "kbookmarkdombuilder.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 TQObject *importer) {
00039    connect(importer, TQT_SIGNAL( newBookmark(const TQString &, const TQCString &, const TQString &) ),
00040                      TQT_SLOT( newBookmark(const TQString &, const TQCString &, const TQString &) ));
00041    connect(importer, TQT_SIGNAL( newFolder(const TQString &, bool, const TQString &) ),
00042                      TQT_SLOT( newFolder(const TQString &, bool, const TQString &) ));
00043    connect(importer, TQT_SIGNAL( newSeparator() ),
00044                      TQT_SLOT( newSeparator() ) );
00045    connect(importer, TQT_SIGNAL( endFolder() ),
00046                      TQT_SLOT( endFolder() ) );
00047 }
00048 
00049 void KBookmarkDomBuilder::newBookmark(
00050    const TQString &text, const TQCString &url, const TQString &additionalInfo
00051 ) {
00052    KBookmark bk = m_stack.top().addBookmark(
00053                                     m_manager, text,
00054                                     KURL( TQString::fromUtf8(url), 106 /*utf8*/ ),
00055                                     TQString::null, false);
00056    // store additional info
00057    bk.internalElement().setAttribute("netscapeinfo", additionalInfo);
00058 }
00059 
00060 void KBookmarkDomBuilder::newFolder(
00061    const TQString & text, bool open, const TQString & 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(m_manager, text, false);
00065    m_list.append(gp);
00066    m_stack.push(m_list.last());
00067    // store additional info
00068    TQDomElement 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"

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/bookmarks by doxygen 1.7.1
This website is maintained by Timothy Pearson.