diff options
Diffstat (limited to 'lib/bookmarks')
-rw-r--r-- | lib/bookmarks/formats/ffjson.cpp | 7 | ||||
-rw-r--r-- | lib/bookmarks/formats/xbel.cpp | 17 |
2 files changed, 13 insertions, 11 deletions
diff --git a/lib/bookmarks/formats/ffjson.cpp b/lib/bookmarks/formats/ffjson.cpp index f9e0866..f95d0d8 100644 --- a/lib/bookmarks/formats/ffjson.cpp +++ b/lib/bookmarks/formats/ffjson.cpp @@ -8,11 +8,12 @@ #include "ffjson.h" #include "bookmarkitem.h" +#include <QDateTime> +#include <QDebug> +#include <QIODevice> +#include <QJsonArray> #include <QJsonDocument> #include <QJsonObject> -#include <QJsonArray> -#include <QDebug> -#include <QDateTime> inline auto asDate(const QJsonValue &v) { diff --git a/lib/bookmarks/formats/xbel.cpp b/lib/bookmarks/formats/xbel.cpp index 7ff79a9..a0a553f 100644 --- a/lib/bookmarks/formats/xbel.cpp +++ b/lib/bookmarks/formats/xbel.cpp @@ -15,28 +15,28 @@ inline void readChildElements(QXmlStreamReader &reader, BookmarkItem *parent) { while(reader.readNextStartElement()) { - if(reader.name() == "title") { + if(reader.name() == QLatin1String("title")) { parent->setData(BookmarkItem::Title, reader.readElementText()); - } else if(reader.name() == "dateAdded") { + } else if(reader.name() == QLatin1String("dateAdded")) { parent->setData(BookmarkItem::DateAdded, QDateTime::fromString(reader.readElementText(), Qt::RFC2822Date)); - } else if(reader.name() == "lastModified") { + } else if(reader.name() == QLatin1String("lastModified")) { parent->setData(BookmarkItem::LastModified, QDateTime::fromString(reader.readElementText(), Qt::RFC2822Date)); - } else if(reader.name() == "tags") { + } else if(reader.name() == QLatin1String("tags")) { parent->setData(BookmarkItem::Tags, reader.readElementText().split(";")); - } else if(reader.name() == "description") { + } else if(reader.name() == QLatin1String("description")) { parent->setData(BookmarkItem::Description, reader.readElementText()); - } else if(reader.name() == "folder") { + } else if(reader.name() == QLatin1String("folder")) { auto *item = new BookmarkItem({}, BookmarkItem::Folder, parent); item->setExpanded(!(reader.attributes().value("folded") == QLatin1String("yes"))); parent->appendChild(item); readChildElements(reader, item); - } else if(reader.name() == "bookmark") { + } else if(reader.name() == QLatin1String("bookmark")) { auto *item = new BookmarkItem({}, BookmarkItem::Bookmark, parent); item->setData(BookmarkItem::Href, reader.attributes().value("href").toString()); parent->appendChild(item); @@ -53,7 +53,8 @@ void Xbel::read(QIODevice *device, BookmarkItem *item) QXmlStreamReader qXmlStreamReader(device); if(qXmlStreamReader.readNextStartElement()) { - if(!(qXmlStreamReader.name() == "xbel" && qXmlStreamReader.attributes().value("version") == "1.0")) { + if(!(qXmlStreamReader.name() == QLatin1String("xbel") + && qXmlStreamReader.attributes().value("version") == QLatin1String("1.0"))) { return; } |