X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=infodialog.cpp;h=378c77c2450b0598ba60c0617422bb5a99cd7a9b;hb=9d6624b77d5ce16de6f3f722fd500f1a8ff6418f;hp=e541cebda8e5095ca19926f252aa9a84b89c795e;hpb=6337ac23cc03c51054b8f208abf9eb832d65a39e;p=dorian diff --git a/infodialog.cpp b/infodialog.cpp index e541ceb..378c77c 100644 --- a/infodialog.cpp +++ b/infodialog.cpp @@ -3,11 +3,14 @@ #include "infodialog.h" #include "book.h" #include "library.h" +#include "trace.h" InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons): Dyalog(parent, showButtons), book(b) { - setWindowTitle(tr("Book Details")); + TRACE; + + setWindowTitle(tr("Book details")); if (book) { QLabel *title = new QLabel(book->title, this); @@ -43,18 +46,15 @@ InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons): addStretch(); } - QPushButton *read = new QPushButton(tr("Read"), this); - QPushButton *remove = new QPushButton(tr("Delete"), this); - connect(read, SIGNAL(clicked()), this, SLOT(onReadBook())); - connect(remove, SIGNAL(clicked()), this, SLOT(onRemoveBook())); - addButton(read, QDialogButtonBox::ActionRole); - addButton(remove, QDialogButtonBox::DestructiveRole); + addButton(tr("Read"), this, SLOT(onReadBook()), + QDialogButtonBox::ActionRole); + addButton(tr("Delete"), this, SLOT(onRemoveBook()), + QDialogButtonBox::DestructiveRole); } void InfoDialog::onReadBook() { - Library::instance()->setNowReading(Library::instance()->find(book)); - close(); + done(InfoDialog::Read); } void InfoDialog::onRemoveBook() @@ -63,7 +63,6 @@ void InfoDialog::onRemoveBook() QMessageBox::question(this, tr("Delete book"), tr("Delete book \"%1\" from library?").arg(book->shortName()), QMessageBox::Yes | QMessageBox::No)) { - Library::instance()->remove(Library::instance()->find(book)); - close(); + done(InfoDialog::Delete); } }