mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Merge pull request #1881 from louib/disable_merge_when_locked
Disable merge button when db is locked.
This commit is contained in:
commit
d06819eb6c
@ -421,8 +421,20 @@ void MainWindow::openDatabase(const QString& fileName, const QString& pw, const
|
||||
void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
{
|
||||
int currentIndex = m_ui->stackedWidget->currentIndex();
|
||||
|
||||
bool inDatabaseTabWidget = (currentIndex == DatabaseTabScreen);
|
||||
bool inWelcomeWidget = (currentIndex == WelcomeScreen);
|
||||
bool inDatabaseTabWidgetOrWelcomeWidget = inDatabaseTabWidget || inWelcomeWidget;
|
||||
|
||||
m_ui->actionDatabaseMerge->setEnabled(inDatabaseTabWidget);
|
||||
|
||||
m_ui->actionDatabaseNew->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->actionDatabaseOpen->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->menuRecentDatabases->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->menuImport->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->actionRepairDatabase->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
|
||||
m_ui->actionLockDatabases->setEnabled(m_ui->tabWidget->hasLockableDatabases());
|
||||
|
||||
if (inDatabaseTabWidget && m_ui->tabWidget->currentIndex() != -1) {
|
||||
DatabaseWidget* dbWidget = m_ui->tabWidget->currentDatabaseWidget();
|
||||
@ -535,16 +547,6 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
m_searchWidgetAction->setEnabled(false);
|
||||
}
|
||||
|
||||
bool inDatabaseTabWidgetOrWelcomeWidget = inDatabaseTabWidget || inWelcomeWidget;
|
||||
m_ui->actionDatabaseNew->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->actionDatabaseOpen->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->menuRecentDatabases->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->menuImport->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
m_ui->actionDatabaseMerge->setEnabled(inDatabaseTabWidget);
|
||||
m_ui->actionRepairDatabase->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
|
||||
|
||||
m_ui->actionLockDatabases->setEnabled(m_ui->tabWidget->hasLockableDatabases());
|
||||
|
||||
if ((currentIndex == PasswordGeneratorScreen) != m_ui->actionPasswordGenerator->isChecked()) {
|
||||
bool blocked = m_ui->actionPasswordGenerator->blockSignals(true);
|
||||
m_ui->actionPasswordGenerator->toggle();
|
||||
|
@ -1042,6 +1042,11 @@ void TestGui::testDatabaseLocking()
|
||||
|
||||
QCOMPARE(m_tabWidget->tabText(0).remove('&'), origDbName + " [locked]");
|
||||
|
||||
QAction* actionDatabaseMerge = m_mainWindow->findChild<QAction*>("actionDatabaseMerge", Qt::FindChildrenRecursively);
|
||||
QCOMPARE(actionDatabaseMerge->isEnabled(), false);
|
||||
QAction* actionDatabaseSave = m_mainWindow->findChild<QAction*>("actionDatabaseSave", Qt::FindChildrenRecursively);
|
||||
QCOMPARE(actionDatabaseSave->isEnabled(), false);
|
||||
|
||||
QWidget* dbWidget = m_tabWidget->currentDatabaseWidget();
|
||||
QWidget* unlockDatabaseWidget = dbWidget->findChild<QWidget*>("unlockDatabaseWidget");
|
||||
QWidget* editPassword = unlockDatabaseWidget->findChild<QLineEdit*>("editPassword");
|
||||
@ -1051,6 +1056,9 @@ void TestGui::testDatabaseLocking()
|
||||
QTest::keyClick(editPassword, Qt::Key_Enter);
|
||||
|
||||
QCOMPARE(m_tabWidget->tabText(0).remove('&'), origDbName);
|
||||
|
||||
actionDatabaseMerge = m_mainWindow->findChild<QAction*>("actionDatabaseMerge", Qt::FindChildrenRecursively);
|
||||
QCOMPARE(actionDatabaseMerge->isEnabled(), true);
|
||||
}
|
||||
|
||||
void TestGui::testDragAndDropKdbxFiles()
|
||||
|
Loading…
Reference in New Issue
Block a user