mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-14 13:41:44 -05:00
Only edit entries on doubleclick (not single) or with enter key.
https://github.com/keepassx/keepassx/pull/19
This commit is contained in:
parent
5c84aa308d
commit
035271d469
@ -17,6 +17,8 @@
|
||||
|
||||
#include "EntryView.h"
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
|
||||
#include "gui/SortFilterHideProxyModel.h"
|
||||
|
||||
EntryView::EntryView(QWidget* parent)
|
||||
@ -42,12 +44,22 @@ 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(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
||||
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
|
||||
connect(m_model, SIGNAL(switchedToEntryListMode()), SLOT(switchToEntryListMode()));
|
||||
connect(m_model, SIGNAL(switchedToGroupMode()), SLOT(switchToGroupMode()));
|
||||
}
|
||||
|
||||
void EntryView::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) && currentIndex().isValid()) {
|
||||
Q_EMIT emitEntryActivated(currentIndex());
|
||||
}
|
||||
else {
|
||||
QTreeView::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void EntryView::setGroup(Group* group)
|
||||
{
|
||||
m_model->setGroup(group);
|
||||
|
@ -50,6 +50,9 @@ Q_SIGNALS:
|
||||
void entryActivated(Entry* entry, EntryModel::ModelColumn column);
|
||||
void entrySelectionChanged();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
|
||||
|
||||
private Q_SLOTS:
|
||||
void emitEntryActivated(const QModelIndex& index);
|
||||
void switchToEntryListMode();
|
||||
|
Loading…
x
Reference in New Issue
Block a user