From 6e19b08678cb19364894445fcad68dbdffb38b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Mon, 9 Jun 2014 22:13:45 +0200 Subject: [PATCH] fixed complete read status after finishing a comic --- YACReaderLibrary/db/tablemodel.cpp | 1 + YACReaderLibrary/db_helper.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/YACReaderLibrary/db/tablemodel.cpp b/YACReaderLibrary/db/tablemodel.cpp index 7898f3d4..52092ce8 100644 --- a/YACReaderLibrary/db/tablemodel.cpp +++ b/YACReaderLibrary/db/tablemodel.cpp @@ -569,6 +569,7 @@ void TableModel::reload(const ComicDB & comic) if(item->data(TableModel::Id).toULongLong() == comic.id) { found = true; + item->setData(TableModel::ReadColumn,comic.info.read); item->setData(TableModel::CurrentPage,comic.info.currentPage); item->setData(TableModel::HasBeenOpened,true); break; diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index 54bcbc0f..ced6acd4 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -252,7 +252,8 @@ void DBHelper::update(ComicInfo * comicInfo, QSqlDatabase & db) updateComicInfo.bindValue(":characters",comicInfo->characters); updateComicInfo.bindValue(":notes",comicInfo->notes); - updateComicInfo.bindValue(":read", comicInfo->read?1:0); + bool read = comicInfo->read || comicInfo->currentPage == comicInfo->numPages.toInt(); //if current page is the las page, the comic is read(completed) + updateComicInfo.bindValue(":read", read?1:0); updateComicInfo.bindValue(":id", comicInfo->id); updateComicInfo.bindValue(":edited", comicInfo->edited?1:0);