Open url when an entry is activated via its url column.

Closes #55
This commit is contained in:
Florian Geyer 2013-04-07 21:05:52 +02:00
parent 5786e2620a
commit bf906a7867
4 changed files with 21 additions and 6 deletions

View file

@ -43,7 +43,7 @@ EntryView::EntryView(QWidget* parent)
// QAbstractItemView::startDrag() uses this property as the default drag action
setDefaultDropAction(Qt::MoveAction);
connect(this, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
connect(this, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivationSignal(QModelIndex)));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
connect(m_model, SIGNAL(switchedToEntryListMode()), SLOT(switchToEntryListMode()));
connect(m_model, SIGNAL(switchedToGroupMode()), SLOT(switchToGroupMode()));
@ -66,9 +66,16 @@ bool EntryView::inEntryListMode()
return m_inEntryListMode;
}
void EntryView::emitEntryActivated(const QModelIndex& index)
void EntryView::emitEntryActivationSignal(const QModelIndex& index)
{
Q_EMIT entryActivated(entryFromIndex(index));
Entry* entry = entryFromIndex(index);
if (m_sortModel->mapToSource(index).column() == 3) {
Q_EMIT openUrl(entry);
}
else {
Q_EMIT entryActivated(entry);
}
}
void EntryView::setModel(QAbstractItemModel* model)