mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 23:44:52 -04:00
add to favorites is ready
This commit is contained in:
@ -797,6 +797,24 @@ void ComicModel::resetComicRating(const QModelIndex &mi)
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToFavorites(const QList<QModelIndex> & comicsList)
|
||||
{
|
||||
QList<ComicDB> comics = getComics(comicsList);
|
||||
|
||||
DBHelper::insertComicsInFavorites(comics, QSqlDatabase());
|
||||
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||
|
||||
db.transaction();
|
||||
|
||||
DBHelper::insertComicsInFavorites(comics,db);
|
||||
|
||||
db.commit();
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
|
||||
void ComicModel::updateRating(int rating, QModelIndex mi)
|
||||
{
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
void removeInTransaction(int row);
|
||||
void reload(const ComicDB & comic);
|
||||
void resetComicRating(const QModelIndex & mi);
|
||||
void addComicsToFavorites(const QList<QModelIndex> &comicsList);
|
||||
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
||||
|
@ -279,7 +279,8 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
|
||||
"default_reading_list_id INTEGER, "
|
||||
//"order INTEGER, " //order????
|
||||
"FOREIGN KEY(default_reading_list_id) REFERENCES default_reading_list(id) ON DELETE CASCADE, "
|
||||
"FOREIGN KEY(comic_id) REFERENCES comic(id) ON DELETE CASCADE)");
|
||||
"FOREIGN KEY(comic_id) REFERENCES comic(id) ON DELETE CASCADE,"
|
||||
"PRIMARY KEY(default_reading_list_id, comic_id))");
|
||||
success = success && queryComicDefaultReadingList.exec();
|
||||
|
||||
//INSERT DEFAULT READING LISTS
|
||||
|
Reference in New Issue
Block a user