Fixed move between the shelves

This commit is contained in:
Slava Monich 2015-07-06 19:07:27 +03:00
parent 74ff222bf1
commit e92df4c0a3

View file

@ -566,7 +566,7 @@ void BooksShelf::onBookFound(BooksBook* aBook)
{
if (iLoadTask && iLoadTask == sender()) {
beginInsertRows(QModelIndex(), iList.count(), iList.count());
iList.append(new Data(this, aBook->retain(), true));
iList.append(new Data(this, aBook->retain(), false));
endInsertRows();
Q_EMIT bookAdded(aBook);
Q_EMIT countChanged();
@ -947,10 +947,15 @@ void BooksShelf::onBookCopyingOutChanged()
void BooksShelf::onBookMovedAway()
{
int row = bookIndex(qobject_cast<BooksBook*>(sender()));
if (row >= 0) {
HDEBUG(iList.at(row)->name());
remove(row);
BooksBook* book = qobject_cast<BooksBook*>(sender());
HASSERT(book);
if (book) {
const int row = bookIndex(book);
HDEBUG(book->title() << row);
if (row >= 0) {
HDEBUG(iList.at(row)->name());
remove(row);
}
}
}