KIO
Go to the documentation of this file.
28 #include <qtextcodec.h>
29 #include <QtGui/QApplication>
31 #include <sys/types.h>
41 if(!file.open(QIODevice::ReadOnly)) {
45 QTextCodec * codec = QTextCodec::codecForName(
"UTF-8");
52 QTextStream stream(&file);
53 stream.setCodec(codec);
54 while(! stream.atEnd()) {
56 QString line = stream.readLine().trimmed();
60 if (line.toLower().startsWith(QLatin1String(
"options:"))) {
61 foreach(
const QString &ba, line.mid(8).split(
',')) {
62 const int pos = ba.indexOf(
'=');
65 const QString key = ba.left(pos).trimmed().toLower();
66 const QString value = ba.mid(pos+1).trimmed();
79 else if ( type ==
"URL")
81 else if (type ==
"FOLDER" )
87 }
else if (line ==
"-") {
93 if ( tag =
'#', line.startsWith( tag ) )
94 type = line.remove( 0, tag.length() );
95 else if ( tag =
"NAME=", line.startsWith( tag ) )
96 name = line.remove(0, tag.length());
97 else if ( tag =
"URL=", line.startsWith( tag ) )
98 url = line.remove(0, tag.length());
120 QString(QDir::homePath() +
"/.opera"),
121 i18n(
"*.adr|Opera Bookmark Files (*.adr)"),
122 QApplication::activeWindow() )
124 QString(QDir::homePath() +
"/.opera"),
125 i18n(
"*.adr|Opera Bookmark Files (*.adr)"),
126 QApplication::activeWindow() );
144 OperaExporter::OperaExporter() : m_out(&m_string,
QIODevice::WriteOnly) {
145 m_out <<
"Opera Hotlist version 2.0" << endl;
146 m_out <<
"Options: encoding = utf8, version=3" << endl;
149 void OperaExporter::visit(
const KBookmark &bk ) {
151 m_out <<
"#URL" << endl;
152 m_out <<
"\tNAME=" << bk.
fullText() << endl;
153 m_out <<
"\tURL=" << bk.
url().
url().toUtf8() << endl;
159 m_out <<
"#FOLDER" << endl;
160 m_out <<
"\tNAME="<< grp.
fullText() << endl;
166 m_out <<
"-" << endl;
171 OperaExporter exporter;
172 QString content = exporter.generate( parent );
174 if (!file.open(QIODevice::WriteOnly)) {
175 kError(7043) <<
"Can't write to file " <<
m_fileName << endl;
178 QTextStream fstream(&file);
179 fstream.setCodec(QTextCodec::codecForName(
"UTF-8"));
183 #include "kbookmarkimporter_opera_p.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Wed Mar 20 2013 07:19:32 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.