Add method for marking a comic as reading without opening it first.

Usefull when closing the a comic in the last page to mark the next one and the next being readed.
This commit is contained in:
Luis Ángel San Martín 2018-05-20 14:49:07 +02:00
parent 45e44fa54f
commit 1503fe5383
2 changed files with 33 additions and 17 deletions

View File

@ -704,6 +704,21 @@ void DBHelper::updateProgress(qulonglong libraryId, const ComicInfo &comicInfo)
QSqlDatabase::removeDatabase(db.connectionName());
}
void DBHelper::setComicAsReading(qulonglong libraryId, const ComicInfo &comicInfo)
{
QString libraryPath = DBHelper::getLibraries().getPath(libraryId);
QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath+"/.yacreaderlibrary");
ComicDB comic = DBHelper::loadComic(comicInfo.id,db);
comic.info.hasBeenOpened = true;
comic.info.read = comic.info.read || comic.info.currentPage == comic.info.numPages;
DBHelper::updateReadingRemoteProgress(comic.info,db);
db.close();
QSqlDatabase::removeDatabase(db.connectionName());
}
void DBHelper::updateReadingRemoteProgress(const ComicInfo &comicInfo, QSqlDatabase &db)
{
QSqlQuery updateComicInfo(db);

View File

@ -68,6 +68,7 @@ public:
static void updateChildrenInfo(qulonglong folderId, QSqlDatabase & db);
static void updateChildrenInfo(QSqlDatabase & db);
static void updateProgress(qulonglong libraryId,const ComicInfo & comicInfo);
static void setComicAsReading(qulonglong libraryId, const ComicInfo &comicInfo);
static void updateReadingRemoteProgress(const ComicInfo & comicInfo, QSqlDatabase & db);
static void updateFromRemoteClient(qulonglong libraryId,const ComicInfo & comicInfo);
static void renameLabel(qulonglong id, const QString & name, QSqlDatabase & db);