sqlitedbservice: Only add non-empty outline entries
This commit is contained in:
parent
fc510b4376
commit
d4868f05fc
@ -260,19 +260,26 @@ 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();
|
||||||
|
if(text.length() > 0)
|
||||||
|
{
|
||||||
|
text = text.toLower();
|
||||||
|
|
||||||
|
outlineQuery.bindValue(1, text);
|
||||||
outlineQuery.bindValue(2, outline.destinationPage);
|
outlineQuery.bindValue(2, outline.destinationPage);
|
||||||
if(!outlineQuery.exec())
|
if(!outlineQuery.exec())
|
||||||
{
|
{
|
||||||
Logger::error() << "Failed outline insertion " << outlineQuery.lastError() << Qt::endl;
|
Logger::error() << "Failed outline insertion " << outlineQuery.lastError() << Qt::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
outlineQuery.finish();
|
||||||
if(!insertOutline(db, fileid, outline.children))
|
if(!insertOutline(db, fileid, outline.children))
|
||||||
{
|
{
|
||||||
Logger::error() << "Failed outline insertion (children)) " << outlineQuery.lastError() << Qt::endl;
|
Logger::error() << "Failed outline insertion (children)) " << outlineQuery.lastError() << Qt::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user