diff options
Diffstat (limited to 'test/firefox-bookmarks-json-parser/main.cpp')
-rw-r--r-- | test/firefox-bookmarks-json-parser/main.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/firefox-bookmarks-json-parser/main.cpp b/test/firefox-bookmarks-json-parser/main.cpp new file mode 100644 index 0000000..54819a2 --- /dev/null +++ b/test/firefox-bookmarks-json-parser/main.cpp @@ -0,0 +1,35 @@ +#include <QFile> +#include "bookmarkformat.h" +#include <QTreeView> +#include <QApplication> +#include <QDebug> + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + + QFile f(qgetenv("FILE")); + + auto *model = new BookmarkModel; + + if(f.open(QIODevice::ReadOnly)) { + BookmarkFormat<FirefoxJsonFormat>(&f) >> model; + f.close(); + } else + return -1; + + auto *view = new QTreeView; + view->setModel(model); + + if(qgetenv("NOGUI") == "1") + return 0; + + QObject::connect(view, &QTreeView::activated, [model](const QModelIndex &index) { + const auto tags = model->data(index, BookmarkItem::Tags, Qt::DisplayRole).toStringList(); + qDebug() << tags.join(" || "); + }); + + + view->show(); + return app.exec(); +} |