diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index 44819fb2..d7f9911a 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -604,16 +604,21 @@ qulonglong DBHelper::insertReadingSubList(const QString &name, qulonglong parent void DBHelper::insertComicsInFavorites(const QList &comicsList, QSqlDatabase &db) { + QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) FROM comic_default_reading_list WHERE default_reading_list_id = 1;",db); + getNumComicsInFavoritesQuery.next(); + QSqlRecord record = getNumComicsInFavoritesQuery.record(); + int numComics = record.value(0).toInt(); + db.transaction(); QSqlQuery query(db); - query.prepare("INSERT INTO comic_default_reading_list (default_reading_list_id, comic_id) " - "VALUES (1, :comic_id)"); + query.prepare("INSERT INTO comic_default_reading_list (default_reading_list_id, comic_id, ordering) " + "VALUES (1, :comic_id, :ordering)"); foreach(ComicDB comic, comicsList) { query.bindValue(":comic_id", comic.id); - //query.bindValue(":order", numComics++); + query.bindValue(":ordering", numComics++); query.exec(); } @@ -622,16 +627,22 @@ void DBHelper::insertComicsInFavorites(const QList &comicsList, QSqlDat void DBHelper::insertComicsInLabel(const QList &comicsList, qulonglong labelId, QSqlDatabase &db) { + QSqlQuery getNumComicsInFavoritesQuery(QString("SELECT count(*) FROM comic_label WHERE label_id = %1;").arg(labelId) ,db); + getNumComicsInFavoritesQuery.next(); + QSqlRecord record = getNumComicsInFavoritesQuery.record(); + int numComics = record.value(0).toInt(); + db.transaction(); QSqlQuery query(db); - query.prepare("INSERT INTO comic_label (label_id, comic_id) " - "VALUES (:label_id, :comic_id)"); + query.prepare("INSERT INTO comic_label (label_id, comic_id, ordering) " + "VALUES (:label_id, :comic_id, :ordering)"); foreach(ComicDB comic, comicsList) { query.bindValue(":label_id", labelId); query.bindValue(":comic_id", comic.id); + query.bindValue(":ordering", numComics++); query.exec(); } @@ -640,7 +651,7 @@ void DBHelper::insertComicsInLabel(const QList &comicsList, qulonglong void DBHelper::insertComicsInReadingList(const QList &comicsList, qulonglong readingListId, QSqlDatabase &db) { - QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) from comic_reading_list;",db); + QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) FROM comic_reading_list;",db); getNumComicsInFavoritesQuery.next(); QSqlRecord record = getNumComicsInFavoritesQuery.record(); int numComics = record.value(0).toInt(); diff --git a/YACReaderLibrary/qml/GridComicsView.qml b/YACReaderLibrary/qml/GridComicsView.qml index c1f9922d..d947546c 100644 --- a/YACReaderLibrary/qml/GridComicsView.qml +++ b/YACReaderLibrary/qml/GridComicsView.qml @@ -150,11 +150,14 @@ Rectangle { } onReleased: { - /*if(mouse.button != Qt.RightButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier)) + if(mouse.button == Qt.LeftButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier)) { - comicsSelectionHelper.setCurrentIndex(index) - grid.currentIndex = index; - }*/ + if(comicsSelectionHelper.isSelectedIndex(index)) + { + comicsSelectionHelper.setCurrentIndex(index) + grid.currentIndex = index; + } + } } } diff --git a/common/gl/yacreader_flow_gl.cpp b/common/gl/yacreader_flow_gl.cpp index 1309d0d9..6e80d1f7 100644 --- a/common/gl/yacreader_flow_gl.cpp +++ b/common/gl/yacreader_flow_gl.cpp @@ -1269,6 +1269,8 @@ void YACReaderComicFlowGL::updateImageData() return; } } + + delete[] indexes; } void YACReaderComicFlowGL::remove(int item) @@ -1405,6 +1407,8 @@ void YACReaderPageFlowGL::updateImageData() return; } } + + delete[] indexes; } void YACReaderPageFlowGL::populate(int n) diff --git a/common/gl_legacy/yacreader_flow_gl.cpp b/common/gl_legacy/yacreader_flow_gl.cpp index c585189b..0d3e7c1c 100644 --- a/common/gl_legacy/yacreader_flow_gl.cpp +++ b/common/gl_legacy/yacreader_flow_gl.cpp @@ -1243,6 +1243,7 @@ void YACReaderComicFlowGL::updateImageData() return; } } + delete[] indexes; } void YACReaderComicFlowGL::remove(int item) @@ -1369,6 +1370,7 @@ void YACReaderPageFlowGL::updateImageData() return; } } + delete[] indexes; } void YACReaderPageFlowGL::populate(int n)