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 if (!bookmark.note.isEmpty()) {
18 label += ": " + bookmark.note;
21 int chapterIndex = book->chapterFromPart(bookmark.part);
22 if (chapterIndex != -1) {
23 QString chapterId = book->chapters[chapterIndex];
24 label += "In\"" + book->content[chapterId].name + "\"";
26 QLabel *info = new QLabel(label, this);
29 addButton(tr("Go to"), this, SLOT(onRead()), QDialogButtonBox::ActionRole);
30 addButton(tr("Delete"), this, SLOT(onRemove()),
31 QDialogButtonBox::DestructiveRole);
34 void BookmarkInfoDialog::onRead()
39 void BookmarkInfoDialog::onRemove()
41 if (QMessageBox::Yes ==
42 QMessageBox::question(this, tr("Delete bookmark"),
43 tr("Delete bookmark?"),
44 QMessageBox::Yes | QMessageBox::No)) {