Add search.

Refs #24
This commit is contained in:
Florian Geyer 2012-05-12 13:22:41 +02:00
parent f836629dda
commit 6b6c109903
13 changed files with 224 additions and 35 deletions

View file

@ -40,6 +40,8 @@ EntryView::EntryView(QWidget* parent)
connect(this, SIGNAL(activated(const QModelIndex&)), SLOT(emitEntryActivated(const QModelIndex&)));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
connect(m_model, SIGNAL(switchedToSearch()), this, SLOT(switchToSearch()));
connect(m_model, SIGNAL(switchedToView()), this, SLOT(switchToView()));
sortByColumn(0, Qt::AscendingOrder);
}
@ -50,6 +52,12 @@ void EntryView::setGroup(Group* group)
Q_EMIT entrySelectionChanged();
}
void EntryView::search(QList<Entry*> entries)
{
m_model->setEntries(entries);
Q_EMIT entrySelectionChanged();
}
void EntryView::emitEntryActivated(const QModelIndex& index)
{
Q_EMIT entryActivated(entryFromIndex(index));
@ -86,3 +94,13 @@ Entry* EntryView::entryFromIndex(const QModelIndex& index)
return 0;
}
}
void EntryView::switchToSearch()
{
showColumn(0);
}
void EntryView::switchToView()
{
hideColumn(0);
}