Ignore same source when import from file (#619)
Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
This commit is contained in:
parent
9934786c8c
commit
689403ad4e
1 changed files with 18 additions and 0 deletions
|
@ -358,6 +358,24 @@ bool StandardServiceRoot::mergeImportExportModel(FeedsImportExportModel* model,
|
||||||
}
|
}
|
||||||
else if (source_item->kind() == RootItem::Kind::Feed) {
|
else if (source_item->kind() == RootItem::Kind::Feed) {
|
||||||
auto* source_feed = qobject_cast<StandardFeed*>(source_item);
|
auto* source_feed = qobject_cast<StandardFeed*>(source_item);
|
||||||
|
const auto items = target_root_node->childItems();
|
||||||
|
bool already_exists = false;
|
||||||
|
for (auto i : items) {
|
||||||
|
auto feed = qobject_cast<StandardFeed*>(i);
|
||||||
|
if (feed == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (feed->source() == source_feed->source()) {
|
||||||
|
already_exists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (already_exists) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto* new_feed = new StandardFeed(*source_feed);
|
auto* new_feed = new StandardFeed(*source_feed);
|
||||||
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());
|
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue