3 #include "bookmarkinfodialog.h"
6 BookmarkInfoDialog::BookmarkInfoDialog(Book *b, int i, QWidget *parent):
11 setWindowTitle(tr("Bookmark Details"));
13 Book::Bookmark bookmark = book->bookmarks()[index];
15 label += QString::number((int)(100 * book->
16 getProgress(bookmark.part, bookmark.pos))) + "%";
17 int chapterIndex = book->chapterFromPart(bookmark.part);
18 if (chapterIndex != -1) {
19 QString chapterId = book->chapters[chapterIndex];
20 label += ", in\"" + book->content[chapterId].name + "\"";
22 if (!bookmark.note.isEmpty()) {
23 label += "\n" + bookmark.note;
25 QLabel *info = new QLabel(label, this);
28 addButton(tr("Go to"), this, SLOT(onRead()), QDialogButtonBox::ActionRole);
29 addButton(tr("Delete"), this, SLOT(onRemove()),
30 QDialogButtonBox::DestructiveRole);
33 void BookmarkInfoDialog::onRead()
38 void BookmarkInfoDialog::onRemove()
40 if (QMessageBox::Yes ==
41 QMessageBox::question(this, tr("Delete bookmark"),
42 tr("Delete bookmark?"),
43 QMessageBox::Yes | QMessageBox::No)) {