mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 07:49:50 -05:00
Merge branch 'release/2.1.3' into develop
This commit is contained in:
commit
1f6f7b614c
@ -21,6 +21,7 @@
|
||||
#include <QLockFile>
|
||||
#include <QSaveFile>
|
||||
#include <QTabWidget>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "autotype/AutoType.h"
|
||||
#include "core/Config.h"
|
||||
@ -158,21 +159,29 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
|
||||
// for now silently ignore if we can't create a lock file
|
||||
// due to lack of permissions
|
||||
if (lockFile->error() != QLockFile::PermissionError) {
|
||||
QMessageBox::StandardButton result = MessageBox::question(this, tr("Open database"),
|
||||
tr("The database you are trying to open is locked by another instance of KeePassXC.\n"
|
||||
"Do you want to open it anyway? Alternatively the database is opened read-only."),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("Database already opened"));
|
||||
msgBox.setText(tr("The database you are trying to open is locked by another instance of KeePassXC.\n\n"
|
||||
"Do you want to open it anyway?"));
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
msgBox.addButton(QMessageBox::Yes);
|
||||
msgBox.addButton(QMessageBox::No);
|
||||
auto readOnlyButton = msgBox.addButton(tr("Open read-only"), QMessageBox::AcceptRole);
|
||||
msgBox.setDefaultButton(readOnlyButton);
|
||||
msgBox.setEscapeButton(QMessageBox::No);
|
||||
auto result = msgBox.exec();
|
||||
|
||||
if (result == QMessageBox::No) {
|
||||
if (msgBox.clickedButton() == readOnlyButton) {
|
||||
dbStruct.readOnly = true;
|
||||
delete lockFile;
|
||||
lockFile = nullptr;
|
||||
}
|
||||
else {
|
||||
} else if (result == QMessageBox::Yes) {
|
||||
// take over the lock file if possible
|
||||
if (lockFile->removeStaleLockFile()) {
|
||||
lockFile->tryLock();
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void DatabaseWidget::createEntry()
|
||||
|
||||
void DatabaseWidget::setIconFromParent()
|
||||
{
|
||||
if (!config()->get("UseGroupIconOnEntryCreation", true).toBool()) {
|
||||
if (!config()->get("UseGroupIconOnEntryCreation").toBool()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1068,8 +1068,7 @@ void DatabaseWidget::reloadDatabaseFile()
|
||||
// Merge the old database into the new one
|
||||
m_db->setEmitModified(false);
|
||||
db->merge(m_db);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Since we are accepting the new file as-is, internally mark as unmodified
|
||||
// TODO: when saving is moved out of DatabaseTabWidget, this should be replaced
|
||||
m_databaseModified = false;
|
||||
@ -1093,16 +1092,10 @@ void DatabaseWidget::reloadDatabaseFile()
|
||||
restoreGroupEntryFocus(groupBeforeReload, entryBeforeReload);
|
||||
|
||||
}
|
||||
else {
|
||||
m_messageWidget->showMessage(
|
||||
tr("Could not parse or unlock the new database file while attempting"
|
||||
" to autoreload this database."), MessageWidget::Error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
m_messageWidget->showMessage(
|
||||
tr("Could not open the new database file while attempting to autoreload this database."),
|
||||
MessageWidget::Error);
|
||||
MessageWidget::Error);
|
||||
}
|
||||
|
||||
// Rewatch the database file
|
||||
|
Loading…
Reference in New Issue
Block a user