3 #include "chaptersdialog.h"
6 ChaptersDialog::ChaptersDialog(Book *b, QWidget *parent):
7 QMainWindow(parent), book(b)
10 setAttribute(Qt::WA_Maemo5StackedWindow, true);
12 setWindowTitle(tr("Bookmarks"));
14 QFrame *frame = new QFrame(this);
15 setCentralWidget(frame);
16 QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
17 frame->setLayout(horizontalLayout);
19 list = new QListWidget(this);
20 list->setSelectionMode(QAbstractItemView::SingleSelection);
21 foreach (QString id, book->toc) {
22 QString contentTitle = book->content[id].name;
23 (void)new QListWidgetItem(contentTitle, list);
25 horizontalLayout->addWidget(list);
26 connect(list, SIGNAL(itemActivated(QListWidgetItem*)),
27 this, SLOT(onItemActivated(QListWidgetItem*)));
30 QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Vertical);
31 QPushButton *closeButton = buttonBox->addButton(QDialogButtonBox::Close);
32 connect(closeButton, SIGNAL(clicked()), this, SLOT(onClose()));
33 horizontalLayout->addWidget(buttonBox);
34 #endif // Q_WS_MAEMO_5
37 void ChaptersDialog::onItemActivated(QListWidgetItem *item)
39 emit goToChapter(list->row(item));
43 void ChaptersDialog::onClose()