Facelift bookmarks dialog. Add Maemo-friendly dialog box class.
[dorian] / bookmarkinfodialog.cpp
diff --git a/bookmarkinfodialog.cpp b/bookmarkinfodialog.cpp
new file mode 100644 (file)
index 0000000..83b6568
--- /dev/null
@@ -0,0 +1,37 @@
+#include <QtGui>
+
+#include "bookmarkinfodialog.h"
+#include "book.h"
+
+BookmarkInfoDialog::BookmarkInfoDialog(Book *b, int i, QWidget *parent):
+    Dialog(parent),
+    book(b),
+    index(i)
+{
+    setWindowTitle(tr("Bookmark Details"));
+
+    Book::Bookmark bookmark = book->bookmarks()[index];
+    QString contentId = book->toc[bookmark.chapter];
+    QString contentTitle = book->content[contentId].name;
+    QLabel *info = new QLabel(contentTitle + "\nAt " +
+        QString::number((int)(bookmark.pos*100)) + "%", 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::ActionRole);
+}
+
+void BookmarkInfoDialog::onRead()
+{
+    done(GoTo);
+}
+
+void BookmarkInfoDialog::onRemove()
+{
+    done(Delete);
+}