X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=infodialog.cpp;h=4a92fe453fafdb798aa1fdb3840892d4ddc44d40;hb=92d9469812331fe1d3bcb5ef33c31b7fa559c4db;hp=eadc6471e4e7c030af4d7ad236fe192c413f541b;hpb=3ce29c18fb643d34b86baab846bce2804479db48;p=dorian diff --git a/infodialog.cpp b/infodialog.cpp index eadc647..4a92fe4 100644 --- a/infodialog.cpp +++ b/infodialog.cpp @@ -3,43 +3,61 @@ #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); + 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.toString(Qt::SystemLocaleShortDate), this); + added->setWordWrap(true); + addWidget(added); + } + if (book->dateOpened.isValid()) { + QLabel *opened = new QLabel("Last read: " + + book->dateOpened.toString(Qt::SystemLocaleShortDate), this); + opened->setWordWrap(true); + addWidget(opened); + } addStretch(); } @@ -51,8 +69,7 @@ InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons): void InfoDialog::onReadBook() { - Library::instance()->setNowReading(Library::instance()->find(book)); - close(); + done(InfoDialog::Read); } void InfoDialog::onRemoveBook() @@ -61,7 +78,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); } }