X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=bookmarkinfodialog.cpp;h=b10482125a8b9ad417c3c118fa9897ba01adb5e5;hb=8da14662d87f4fe9ad691b77b57dc81d4f2ecaba;hp=f3a9d5d8480895276e73495895736a0fb7ad2e4d;hpb=a19dd9d0cc0263e5fe354a2df63e82f30f30faf5;p=dorian diff --git a/bookmarkinfodialog.cpp b/bookmarkinfodialog.cpp index f3a9d5d..b104821 100644 --- a/bookmarkinfodialog.cpp +++ b/bookmarkinfodialog.cpp @@ -4,26 +4,31 @@ #include "book.h" BookmarkInfoDialog::BookmarkInfoDialog(Book *b, int i, QWidget *parent): - Dialog(parent), + Dyalog(parent, true), book(b), index(i) { setWindowTitle(tr("Bookmark Details")); Book::Bookmark bookmark = book->bookmarks()[index]; - QString contentId = book->toc[bookmark.part]; - QString contentTitle = book->content[contentId].name; - QLabel *info = new QLabel(contentTitle + "\nAt " + - QString::number((int)(bookmark.pos*100)) + "%", this); + QString label("At "); + label += QString::number((int)(100 * book-> + getProgress(bookmark.part, bookmark.pos))) + "%"; + if (!bookmark.note.isEmpty()) { + label += ": " + bookmark.note; + } + label += "\n"; + int chapterIndex = book->chapterFromPart(bookmark.part); + if (chapterIndex != -1) { + QString chapterId = book->chapters[chapterIndex]; + label += "In\"" + book->content[chapterId].name + "\""; + } + QLabel *info = new QLabel(label, this); addWidget(info); addStretch(); - - QPushButton *read = new QPushButton(tr("Go to"), this); - QPushButton *remove = new QPushButton(tr("Delete"), this); - connect(read, SIGNAL(clicked()), this, SLOT(onRead())); - connect(remove, SIGNAL(clicked()), this, SLOT(onRemove())); - addButton(read, QDialogButtonBox::ActionRole); - addButton(remove, QDialogButtonBox::DestructiveRole); + addButton(tr("Go to"), this, SLOT(onRead()), QDialogButtonBox::ActionRole); + addButton(tr("Delete"), this, SLOT(onRemove()), + QDialogButtonBox::DestructiveRole); } void BookmarkInfoDialog::onRead()