#include "trace.h"
BookmarksDialog::BookmarksDialog(Book *book_, QWidget *parent):
- ListWindow(parent), book(book_)
+ ListWindow(tr("(No bookmarks)\n"), parent), book(book_)
{
setWindowTitle(tr("Bookmarks"));
if (!book) {
return;
}
- addButton(tr("Add bookmark"), this, SLOT(onAdd()), "add");
-
// Build and set bookmark model
// FIXME: Localize me
foreach (Book::Bookmark bookmark, book_->bookmarks()) {
QStringListModel *model = new QStringListModel(data, this);
setModel(model);
- // FIXME
- // connect(list, SIGNAL(activated(const QModelIndex &)),
- // this, SLOT(onItemActivated(const QModelIndex &)));
+ addButton(tr("Add bookmark"), this, SLOT(onAdd()), "add");
+
+ connect(this, SIGNAL(activated(const QModelIndex &)),
+ this, SLOT(onItemActivated(const QModelIndex &)));
}
void BookmarksDialog::onGo()
{
TRACE;
- // FIXME
- // QModelIndex current = list->currentIndex();
- // if (current.isValid()) {
- // emit goToBookmark(current.row());
- // close();
- // }
+ QModelIndex current = currentItem();
+ if (current.isValid()) {
+ emit goToBookmark(current.row());
+ close();
+ }
}
void BookmarksDialog::onItemActivated(const QModelIndex &index)
void BookmarksDialog::onDelete(bool really)
{
- QModelIndex current = list->currentIndex();
+ QModelIndex current = currentItem();
if (!current.isValid()) {
return;
}
}
}
int row = current.row();
- list->model()->removeRow(row);
+ model()->removeRow(row);
book->deleteBookmark(row);
}