mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
Merge b05c73a708 into d9be1b0682
This commit is contained in:
commit
aca6b64bd5
3 changed files with 27 additions and 4 deletions
|
|
@ -1902,7 +1902,7 @@ void DatabaseWidget::onDatabaseNonDataChanged()
|
|||
{
|
||||
// Force mark the database modified if we are not auto-saving non-data changes
|
||||
if (!config()->get(Config::AutoSaveNonDataChanges).toBool()) {
|
||||
m_db->markAsModified();
|
||||
emit databaseNonDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1041,7 +1041,11 @@ void MainWindow::updateMenuActionState()
|
|||
m_ui->actionGroupDownloadFavicons->setEnabled(groupSelected && groupHasEntries && !inRecycleBin);
|
||||
|
||||
// Database Menu
|
||||
m_ui->actionDatabaseSave->setEnabled(databaseUnlocked && m_ui->tabWidget->canSave());
|
||||
bool enableSave = databaseUnlocked
|
||||
&& (m_ui->tabWidget->canSave()
|
||||
|| (dbWidget && dbWidget->database() && dbWidget->database()->hasNonDataChanges()
|
||||
&& !config()->get(Config::AutoSaveNonDataChanges).toBool()));
|
||||
m_ui->actionDatabaseSave->setEnabled(enableSave);
|
||||
m_ui->actionDatabaseSaveAs->setEnabled(databaseUnlocked);
|
||||
m_ui->actionDatabaseSaveBackup->setEnabled(databaseUnlocked);
|
||||
m_ui->actionDatabaseClose->setEnabled(dbWidget);
|
||||
|
|
@ -1094,7 +1098,12 @@ void MainWindow::updateWindowTitle()
|
|||
if (isModified && customWindowTitlePart.endsWith("*")) {
|
||||
customWindowTitlePart.remove(customWindowTitlePart.size() - 1, 1);
|
||||
}
|
||||
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex));
|
||||
auto dbWidget = m_ui->tabWidget->databaseWidgetFromIndex(tabWidgetIndex);
|
||||
bool enableSave = (dbWidget && !dbWidget->isLocked())
|
||||
&& (m_ui->tabWidget->canSave(tabWidgetIndex)
|
||||
|| (dbWidget->database() && dbWidget->database()->hasNonDataChanges()
|
||||
&& !config()->get(Config::AutoSaveNonDataChanges).toBool()));
|
||||
m_ui->actionDatabaseSave->setEnabled(enableSave);
|
||||
} else if (stackedWidgetIndex == StackedWidgetIndex::SettingsScreen) {
|
||||
customWindowTitlePart = tr("Settings");
|
||||
} else if (stackedWidgetIndex == StackedWidgetIndex::PasswordGeneratorScreen) {
|
||||
|
|
@ -2270,8 +2279,21 @@ bool MainWindowEventFilter::eventFilter(QObject* watched, QEvent* event)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
} else if (eventType == QEvent::KeyPress) {
|
||||
auto keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if (keyEvent->key() == Qt::Key_Alt) {
|
||||
m_altKeyAlone = (keyEvent->modifiers() == Qt::AltModifier);
|
||||
} else {
|
||||
m_altKeyAlone = false;
|
||||
}
|
||||
return QObject::eventFilter(watched, event);
|
||||
} else if (eventType == QEvent::KeyRelease && watched == mainWindow) {
|
||||
auto keyEvent = dynamic_cast<QKeyEvent*>(event);
|
||||
|
||||
if (keyEvent->key() != Qt::Key_Alt) {
|
||||
m_altKeyAlone = false;
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
// Windows translates AltGr into CTRL + ALT, this breaks using AltGr when the menubar is hidden
|
||||
// Prevent this by activating the ALT cooldown to ignore the next key event which will be an ALT key
|
||||
|
|
@ -2281,7 +2303,7 @@ bool MainWindowEventFilter::eventFilter(QObject* watched, QEvent* event)
|
|||
return false;
|
||||
}
|
||||
#endif
|
||||
if (keyEvent->key() == Qt::Key_Alt && !keyEvent->modifiers() && config()->get(Config::GUI_HideMenubar).toBool()
|
||||
if (keyEvent->key() == Qt::Key_Alt && m_altKeyAlone && config()->get(Config::GUI_HideMenubar).toBool()
|
||||
&& !m_altCoolDown.isActive()) {
|
||||
auto menubar = mainWindow->m_ui->menubar;
|
||||
menubar->setMaximumHeight(menubar->maximumHeight() > 0 ? 0 : QWIDGETSIZE_MAX);
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ public:
|
|||
private:
|
||||
QTimer m_menubarTimer;
|
||||
QTimer m_altCoolDown;
|
||||
bool m_altKeyAlone = false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue