kbookmarkimporter.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#include <kfiledialog.h>
00022
#include <kstringhandler.h>
00023
#include <klocale.h>
00024
#include <kdebug.h>
00025
#include <kcharsets.h>
00026
#include <qtextcodec.h>
00027
00028
#include <sys/types.h>
00029
#include <stddef.h>
00030
#include <dirent.h>
00031
#include <sys/stat.h>
00032
#include <assert.h>
00033
00034
#include "kbookmarkmanager.h"
00035
00036
#include "kbookmarkimporter_ns.h"
00037
#include "kbookmarkimporter_opera.h"
00038
#include "kbookmarkimporter_ie.h"
00039
00040
#include "kbookmarkimporter.h"
00041
00042
void KXBELBookmarkImporterImpl::parse()
00043 {
00044
00045
KBookmarkManager *manager =
KBookmarkManager::managerForFile(m_fileName);
00046
KBookmarkGroup root = manager->
root();
00047 traverse(root);
00048
00049
00050 }
00051
00052
void KXBELBookmarkImporterImpl::visit(
const KBookmark &bk)
00053 {
00054
00055
if (bk.isSeparator())
00056 emit
newSeparator();
00057
else
00058 emit
newBookmark(bk.fullText(), bk.url().url().utf8(),
"");
00059 }
00060
00061
void KXBELBookmarkImporterImpl::visitEnter(
const KBookmarkGroup &grp)
00062 {
00063
00064 emit
newFolder(grp.fullText(),
false,
"");
00065 }
00066
00067
void KXBELBookmarkImporterImpl::visitLeave(
const KBookmarkGroup &)
00068 {
00069
00070 emit
endFolder();
00071 }
00072
00073
void KBookmarkImporterBase::setupSignalForwards(
QObject *src,
QObject *dst)
00074 {
00075
connect(src, SIGNAL(
newBookmark(
const QString &,
const QCString &,
const QString & ) ),
00076 dst, SIGNAL(
newBookmark(
const QString &,
const QCString &,
const QString & ) ));
00077
connect(src, SIGNAL(
newFolder(
const QString &,
bool,
const QString & ) ),
00078 dst, SIGNAL(
newFolder(
const QString &,
bool,
const QString & ) ));
00079
connect(src, SIGNAL(
newSeparator() ),
00080 dst, SIGNAL(
newSeparator() ) );
00081
connect(src, SIGNAL(
endFolder() ),
00082 dst, SIGNAL(
endFolder() ) );
00083 }
00084
00085
KBookmarkImporterBase* KBookmarkImporterBase::factory(
const QString &type )
00086 {
00087
if (type ==
"netscape")
00088
return new KNSBookmarkImporterImpl;
00089
else if (type ==
"mozilla")
00090
return new KMozillaBookmarkImporterImpl;
00091
else if (type ==
"xbel")
00092
return new KXBELBookmarkImporterImpl;
00093
else if (type ==
"ie")
00094
return new KIEBookmarkImporterImpl;
00095
else if (type ==
"opera")
00096
return new KOperaBookmarkImporterImpl;
00097
else
00098
return 0;
00099 }
00100
00101
#include <kbookmarkimporter.moc>
This file is part of the documentation for kio Library Version 3.2.3.