Fix kinetic scrolling on Symbian. Fix timer handling.
[dorian] / bookmarkinfodialog.cpp
1 #include <QtGui>
2
3 #include "bookmarkinfodialog.h"
4 #include "book.h"
5
6 BookmarkInfoDialog::BookmarkInfoDialog(Book *b, int i, QWidget *parent):
7     Dyalog(parent, true),
8     book(b),
9     index(i)
10 {
11     setWindowTitle(tr("Bookmark Details"));
12
13     Book::Bookmark bookmark = book->bookmarks()[index];
14     QString label("At ");
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 + "\"";
21     }
22     QLabel *info = new QLabel(label, this);
23     addWidget(info);
24     addStretch();
25     addButton(tr("Go to"), this, SLOT(onRead()), QDialogButtonBox::ActionRole);
26     addButton(tr("Delete"), this, SLOT(onRemove()),
27               QDialogButtonBox::DestructiveRole);
28 }
29
30 void BookmarkInfoDialog::onRead()
31 {
32     done(GoTo);
33 }
34
35 void BookmarkInfoDialog::onRemove()
36 {
37     if (QMessageBox::Yes ==
38         QMessageBox::question(this, tr("Delete bookmark"),
39                               tr("Delete bookmark?"),
40                               QMessageBox::Yes | QMessageBox::No)) {
41         done(Delete);
42     }
43 }