1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

FirefoxImporter: Allow to import bookmarks with empty name

Url will be used as title in this case.

Closes #2431
This commit is contained in:
David Rosca 2017-10-08 14:10:11 +02:00
parent 48d18a3b35
commit 71ef1cefd0

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* Falkon - Qt web browser * QupZilla - Qt web browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -89,7 +89,7 @@ BookmarkItem* FirefoxImporter::importBookmarks()
root->setTitle("Firefox Import"); root->setTitle("Firefox Import");
QSqlQuery query(QSqlDatabase::database(CONNECTION)); QSqlQuery query(QSqlDatabase::database(CONNECTION));
query.exec("SELECT id, parent, type, title, fk FROM moz_bookmarks WHERE title != '' OR type = 3"); query.exec("SELECT id, parent, type, title, fk FROM moz_bookmarks WHERE fk NOT NULL OR type = 3");
while (query.next()) { while (query.next()) {
Item item; Item item;
@ -128,7 +128,7 @@ BookmarkItem* FirefoxImporter::importBookmarks()
foreach (const Item &item, items) { foreach (const Item &item, items) {
BookmarkItem* parent = hash.value(item.parent); BookmarkItem* parent = hash.value(item.parent);
BookmarkItem* bookmark = new BookmarkItem(item.type, parent ? parent : root); BookmarkItem* bookmark = new BookmarkItem(item.type, parent ? parent : root);
bookmark->setTitle(item.title); bookmark->setTitle(item.title.isEmpty() ? item.url.toString() : item.title);
bookmark->setUrl(item.url); bookmark->setUrl(item.url);
hash.insert(item.id, bookmark); hash.insert(item.id, bookmark);