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\n\"" + book->content[chapterId].name + "\"";
22 QLabel *info = new QLabel(label, this);
26 QPushButton *read = new QPushButton(tr("Go to"), this);
27 QPushButton *remove = new QPushButton(tr("Delete"), this);
28 connect(read, SIGNAL(clicked()), this, SLOT(onRead()));
29 connect(remove, SIGNAL(clicked()), this, SLOT(onRemove()));
30 addButton(read, QDialogButtonBox::ActionRole);
31 addButton(remove, 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)) {