void EntriesWindow::entrySelected(const QModelIndex &index) {
Entry *e = qVariantValue<Entry *>(index.data());
- ContentWindow *w = new ContentWindow(this, e);
- w->show();
+ current_row = index.row();
+
+ content = new ContentWindow(this, e);
+
+ connect(content, SIGNAL(showNextEntry()), SLOT(showNextEntry()));
+ connect(content, SIGNAL(showPrevEntry()), SLOT(showPrevEntry()));
+
+ content->show();
+}
+
+void EntriesWindow::showNextEntry() {
+ QAbstractListModel *model = static_cast<QAbstractListModel *>(list->model());
+ if(current_row + 1 < model->rowCount()) {
+ current_row++;
+ content->showEntry(qVariantValue<Entry *>(model->index(current_row).data()));
+ }
+}
+
+void EntriesWindow::showPrevEntry() {
+ QAbstractListModel *model = static_cast<QAbstractListModel *>(list->model());
+ if(current_row > 0) {
+ current_row--;
+ content->showEntry(qVariantValue<Entry *>(model->index(current_row).data()));
+ }
}
int EntryListModel::rowCount(const QModelIndex &) const {