mirror of
https://github.com/YACReader/yacreader
synced 2025-05-27 19:00:29 -04:00
Add method for updating reading comic information given a hash.
This commit is contained in:
parent
0e4ffb15a6
commit
6cfd09a8b8
@ -771,6 +771,41 @@ void DBHelper::updateFromRemoteClient(qulonglong libraryId,const ComicInfo & com
|
||||
QSqlDatabase::removeDatabase(db.connectionName());
|
||||
}
|
||||
|
||||
void DBHelper::updateFromRemoteClientWithHash(const ComicInfo & comicInfo)
|
||||
{
|
||||
YACReaderLibraries libraries = DBHelper::getLibraries();
|
||||
|
||||
QStringList names = libraries.getNames();
|
||||
|
||||
foreach (QString name, names) {
|
||||
QString libraryPath = DBHelper::getLibraries().getPath(libraries.getId(name));
|
||||
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath+"/.yacreaderlibrary");
|
||||
|
||||
ComicInfo info = loadComicInfo(comicInfo.hash, db);
|
||||
|
||||
if(comicInfo.currentPage > 0)
|
||||
{
|
||||
info.currentPage = comicInfo.currentPage;
|
||||
|
||||
if(info.currentPage == info.numPages)
|
||||
info.read = true;
|
||||
else
|
||||
info.lastTimeOpened = QDateTime::currentSecsSinceEpoch();
|
||||
|
||||
info.hasBeenOpened = true;
|
||||
}
|
||||
|
||||
if(comicInfo.rating > 0)
|
||||
info.rating = comicInfo.rating;
|
||||
|
||||
DBHelper::update(&info, db);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(db.connectionName());
|
||||
}
|
||||
}
|
||||
|
||||
void DBHelper::renameLabel(qulonglong id, const QString &name, QSqlDatabase &db)
|
||||
{
|
||||
QSqlQuery renameLabelQuery(db);
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
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 updateFromRemoteClientWithHash(const ComicInfo & comicInfo);
|
||||
static void renameLabel(qulonglong id, const QString & name, QSqlDatabase & db);
|
||||
static void renameList(qulonglong id, const QString & name, QSqlDatabase & db);
|
||||
static void reasignOrderToSublists(QList<qulonglong> ids, QSqlDatabase & db);
|
||||
|
Loading…
Reference in New Issue
Block a user