mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Added support for knowing if a comic is in favorites or not.
This commit is contained in:
@ -1155,6 +1155,19 @@ void ComicModel::deleteComicsFromModel(const QList<QModelIndex> &comicsList)
|
||||
emit isEmpty();
|
||||
}
|
||||
|
||||
bool ComicModel::isFavorite(const QModelIndex &index)
|
||||
{
|
||||
bool isFavorite;
|
||||
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||
|
||||
isFavorite = DBHelper::isFavoriteComic(_data[index.row()]->data(Id).toLongLong(),db);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
|
||||
return isFavorite;
|
||||
}
|
||||
|
||||
void ComicModel::updateRating(int rating, QModelIndex mi)
|
||||
{
|
||||
|
@ -81,6 +81,8 @@ public:
|
||||
|
||||
void deleteComicsFromModel(const QList<QModelIndex> &comicsList);
|
||||
|
||||
bool isFavorite(const QModelIndex &index);
|
||||
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
||||
enum Columns {
|
||||
|
Reference in New Issue
Block a user