Close AutoTypeSelectDialog when there are no entries left.
This happens when the entries were deleted or the database has been closed.
This commit is contained in:
@@ -51,6 +51,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
|
||||
|
||||
connect(m_view, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
||||
connect(m_view, SIGNAL(clicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
||||
connect(m_view->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(entryRemoved()));
|
||||
layout->addWidget(m_view);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||
@@ -76,3 +77,10 @@ void AutoTypeSelectDialog::emitEntryActivated(const QModelIndex& index)
|
||||
accept();
|
||||
Q_EMIT entryActivated(entry, m_sequences[entry]);
|
||||
}
|
||||
|
||||
void AutoTypeSelectDialog::entryRemoved()
|
||||
{
|
||||
if (m_view->model()->rowCount() == 0) {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user