Added a bunch of key shortcuts.
[grr] / src / entrieswindow.cpp
index 02192bc..40e10cf 100644 (file)
@@ -63,8 +63,30 @@ void EntriesWindow::entriesUpdated() {
 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 {