X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=infodialog.cpp;h=904eb79f9f4281501ff7df2ea378d569673569e1;hb=b843ed247e4cbaa89d81c528902f0b5d7080c216;hp=d6dee936f9fd59d6ee8d90f6a3505a9fc3910b7e;hpb=cf5242cde0ade17a4a308074ad6034d98ca69c8a;p=dorian diff --git a/infodialog.cpp b/infodialog.cpp index d6dee93..904eb79 100644 --- a/infodialog.cpp +++ b/infodialog.cpp @@ -10,52 +10,70 @@ InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons): { TRACE; - setWindowTitle(tr("Book Details")); + setWindowTitle(tr("Book details")); if (book) { QLabel *title = new QLabel(book->title, this); + title->setWordWrap(true); addWidget(title); if (book->subject != "") { QLabel *subject = new QLabel(book->subject, this); + subject->setWordWrap(true); addWidget(subject); } if (book->creators.size()) { QLabel *creators = new QLabel(this); - QString c = "By " + book->creators[0]; - for (int i = 1; i < book->creators.size(); i++) { - c += ", " + book->creators[i]; - } - creators->setText(c); + creators->setWordWrap(true); + creators->setText(book->creators.join(", ")); addWidget(creators); } QLabel *path = new QLabel("File: " + book->path(), this); + path->setWordWrap(true); addWidget(path); if (book->publisher != "") { QLabel *publisher = new QLabel("Published by " + book->publisher, this); + publisher->setWordWrap(true); addWidget(publisher); } if (book->source != "") { QLabel *source = new QLabel("Source: " + book->source, this); + source->setWordWrap(true); addWidget(source); } if (book->rights != "") { QLabel *rights = new QLabel(book->rights, this); + rights->setWordWrap(true); addWidget(rights); } + if (book->dateAdded.isValid()) { + QLabel *added = new QLabel("Added to library: " + + book->dateAdded.toLocalTime().toString(Qt::SystemLocaleShortDate), + this); + added->setWordWrap(true); + addWidget(added); + } + if (book->dateOpened.isValid()) { + QLabel *opened = new QLabel("Last read: " + + book->dateOpened.toLocalTime().toString(Qt::SystemLocaleShortDate), + this); + opened->setWordWrap(true); + addWidget(opened); + } addStretch(); } addButton(tr("Read"), this, SLOT(onReadBook()), QDialogButtonBox::ActionRole); +#ifndef Q_OS_SYMBIAN addButton(tr("Delete"), this, SLOT(onRemoveBook()), QDialogButtonBox::DestructiveRole); +#endif } void InfoDialog::onReadBook() { - Library::instance()->setNowReading(Library::instance()->find(book)); - close(); + done(InfoDialog::Read); } void InfoDialog::onRemoveBook() @@ -64,7 +82,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); } }