+void LibraryDialog::onDelete()
+{
+ QModelIndex current = currentItem();
+ if (!current.isValid()) {
+ return;
+ }
+ QModelIndex libraryIndex = sortedLibrary->mapToSource(current);
+ Book *book = Library::instance()->book(libraryIndex);
+ if (QMessageBox::Yes !=
+ QMessageBox::question(this, tr("Delete book"),
+ tr("Delete book \"%1\"?").arg(book->shortName()),
+ QMessageBox::Yes | QMessageBox::No)) {
+ return;
+ }
+ Library::instance()->remove(libraryIndex);
+}
+