sqlitedbservice: Only add non-empty outline entries
This commit is contained in:
parent
fc510b4376
commit
d4868f05fc
@ -260,17 +260,24 @@ bool SqliteDbService::insertOutline(QSqlDatabase &db, int fileid, const QVector<
|
|||||||
outlineQuery.addBindValue(fileid);
|
outlineQuery.addBindValue(fileid);
|
||||||
for(const DocumentOutlineEntry &outline : outlines)
|
for(const DocumentOutlineEntry &outline : outlines)
|
||||||
{
|
{
|
||||||
outlineQuery.bindValue(1, outline.text.toLower());
|
QString text = outline.text.trimmed();
|
||||||
outlineQuery.bindValue(2, outline.destinationPage);
|
if(text.length() > 0)
|
||||||
if(!outlineQuery.exec())
|
|
||||||
{
|
{
|
||||||
Logger::error() << "Failed outline insertion " << outlineQuery.lastError() << Qt::endl;
|
text = text.toLower();
|
||||||
return false;
|
|
||||||
}
|
outlineQuery.bindValue(1, text);
|
||||||
if(!insertOutline(db, fileid, outline.children))
|
outlineQuery.bindValue(2, outline.destinationPage);
|
||||||
{
|
if(!outlineQuery.exec())
|
||||||
Logger::error() << "Failed outline insertion (children)) " << outlineQuery.lastError() << Qt::endl;
|
{
|
||||||
return false;
|
Logger::error() << "Failed outline insertion " << outlineQuery.lastError() << Qt::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
outlineQuery.finish();
|
||||||
|
if(!insertOutline(db, fileid, outline.children))
|
||||||
|
{
|
||||||
|
Logger::error() << "Failed outline insertion (children)) " << outlineQuery.lastError() << Qt::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user