X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=infodialog.cpp;h=eadc6471e4e7c030af4d7ad236fe192c413f541b;hb=1e18404f04c033c518c7017cac0d9dc2ae8236b2;hp=03dcbf4e1563875e3884c0d388a4ce277d3a8016;hpb=1b137f849036e5926a389552196428306a06958d;p=dorian diff --git a/infodialog.cpp b/infodialog.cpp index 03dcbf4..eadc647 100644 --- a/infodialog.cpp +++ b/infodialog.cpp @@ -4,7 +4,8 @@ #include "book.h" #include "library.h" -InfoDialog::InfoDialog(Book *b, QWidget *parent): Dialog(parent), book(b) +InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons): + Dyalog(parent, showButtons), book(b) { setWindowTitle(tr("Book Details")); @@ -42,12 +43,10 @@ InfoDialog::InfoDialog(Book *b, QWidget *parent): Dialog(parent), book(b) 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() @@ -59,10 +58,9 @@ void InfoDialog::onReadBook() void InfoDialog::onRemoveBook() { if (QMessageBox::Yes == - QMessageBox::question(this, - tr("Delete book"), - "Delete book \"" + book->name() + "\"?", - QMessageBox::Yes | QMessageBox::No)) { + 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(); }