mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-09 19:28:31 -05:00
Fix issues with locking database
* Fix #6593 - force close any modal dialogs associated with a database widget that is being locked. * Partial fix for #721 but doesn't address the problem of needing to save a modified entry or database while locking. * Also improves import dialog behavior if databases(s) lock while it is visible.
This commit is contained in:
parent
ffc72c896c
commit
505f338d28
@ -1755,9 +1755,17 @@ bool DatabaseWidget::lock()
|
|||||||
|
|
||||||
emit databaseLockRequested();
|
emit databaseLockRequested();
|
||||||
|
|
||||||
// ignore event if we are active and a modal dialog is still open (such as a message box or file dialog)
|
// Force close any modal widgets associated with this widget
|
||||||
if (isVisible() && QApplication::activeModalWidget()) {
|
auto modalWidget = QApplication::activeModalWidget();
|
||||||
return false;
|
if (modalWidget) {
|
||||||
|
auto parent = modalWidget->parentWidget();
|
||||||
|
while (parent) {
|
||||||
|
if (parent == this) {
|
||||||
|
modalWidget->close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parent = parent->parentWidget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard()->clearCopiedText();
|
clipboard()->clearCopiedText();
|
||||||
|
@ -1864,7 +1864,9 @@ void MainWindow::closeModalWindow()
|
|||||||
|
|
||||||
void MainWindow::lockDatabasesAfterInactivity()
|
void MainWindow::lockDatabasesAfterInactivity()
|
||||||
{
|
{
|
||||||
m_ui->tabWidget->lockDatabases();
|
if (!m_ui->tabWidget->lockDatabases()) {
|
||||||
|
m_inactivityTimer->activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::isTrayIconEnabled() const
|
bool MainWindow::isTrayIconEnabled() const
|
||||||
|
@ -126,11 +126,17 @@ void ImportWizardPageSelect::updateDatabaseChoices() const
|
|||||||
auto mainWindow = getMainWindow();
|
auto mainWindow = getMainWindow();
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
for (auto dbWidget : mainWindow->getOpenDatabases()) {
|
for (auto dbWidget : mainWindow->getOpenDatabases()) {
|
||||||
|
// Remove all connections
|
||||||
|
disconnect(dbWidget, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
// Skip over locked databases
|
// Skip over locked databases
|
||||||
if (dbWidget->isLocked()) {
|
if (dbWidget->isLocked()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(dbWidget, &DatabaseWidget::databaseLocked, this, &ImportWizardPageSelect::updateDatabaseChoices);
|
||||||
|
connect(dbWidget, &DatabaseWidget::databaseModified, this, &ImportWizardPageSelect::updateDatabaseChoices);
|
||||||
|
|
||||||
// Enable the selection of an existing database
|
// Enable the selection of an existing database
|
||||||
m_ui->existingDatabaseRadio->setEnabled(true);
|
m_ui->existingDatabaseRadio->setEnabled(true);
|
||||||
m_ui->existingDatabaseRadio->setToolTip("");
|
m_ui->existingDatabaseRadio->setToolTip("");
|
||||||
@ -161,6 +167,11 @@ void ImportWizardPageSelect::updateDatabaseChoices() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ui->existingDatabaseChoice->count() == 0) {
|
||||||
|
m_ui->existingDatabaseRadio->setEnabled(false);
|
||||||
|
m_ui->newDatabaseRadio->setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportWizardPageSelect::chooseImportFile()
|
void ImportWizardPageSelect::chooseImportFile()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user