Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorPatrick Klein <42714034+libklein@users.noreply.github.com>2022-01-29 05:26:53 +0300
committerGitHub <noreply@github.com>2022-01-29 05:26:53 +0300
commitbce8c84c26edb1de7fbd31527a3906639aee096f (patch)
tree7c2a29879bb6f7f532ef583e4e22051cbf5e9f57 /src/gui
parentc914c116e438b481f1185b3b85d0cade79539b1e (diff)
Remove obsolete read only state from database. (#7324)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/DatabaseOpenWidget.cpp2
-rw-r--r--src/gui/DatabaseTabWidget.cpp20
-rw-r--r--src/gui/DatabaseTabWidget.h1
-rw-r--r--src/gui/DatabaseWidget.cpp9
4 files changed, 4 insertions, 28 deletions
diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp
index f0d494b27..1d51b5ebe 100644
--- a/src/gui/DatabaseOpenWidget.cpp
+++ b/src/gui/DatabaseOpenWidget.cpp
@@ -202,7 +202,7 @@ void DatabaseOpenWidget::openDatabase()
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_ui->passwordFormFrame->setEnabled(false);
QCoreApplication::processEvents();
- bool ok = m_db->open(m_filename, databaseKey, &error, false);
+ bool ok = m_db->open(m_filename, databaseKey, &error);
QApplication::restoreOverrideCursor();
m_ui->passwordFormFrame->setEnabled(true);
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index 74ecc0a60..02affe6fa 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -513,20 +513,6 @@ void DatabaseTabWidget::showDatabaseSettings()
currentDatabaseWidget()->switchToDatabaseSettings();
}
-bool DatabaseTabWidget::isReadOnly(int index) const
-{
- if (count() == 0) {
- return false;
- }
-
- if (index == -1) {
- index = currentIndex();
- }
-
- auto db = databaseWidgetFromIndex(index)->database();
- return db && db->isReadOnly();
-}
-
bool DatabaseTabWidget::isModified(int index) const
{
if (count() == 0) {
@@ -543,7 +529,7 @@ bool DatabaseTabWidget::isModified(int index) const
bool DatabaseTabWidget::canSave(int index) const
{
- return !isReadOnly(index) && isModified(index);
+ return isModified(index);
}
bool DatabaseTabWidget::hasLockableDatabases() const
@@ -601,10 +587,6 @@ QString DatabaseTabWidget::tabName(int index)
tabName = tr("%1 [Locked]", "Database tab name modifier").arg(tabName);
}
- if (db->isReadOnly()) {
- tabName = tr("%1 [Read-only]", "Database tab name modifier").arg(tabName);
- }
-
if (db->isModified()) {
tabName.append("*");
}
diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h
index ffcd9748f..8432116ed 100644
--- a/src/gui/DatabaseTabWidget.h
+++ b/src/gui/DatabaseTabWidget.h
@@ -41,7 +41,6 @@ public:
DatabaseWidget* currentDatabaseWidget();
DatabaseWidget* databaseWidgetFromIndex(int index) const;
- bool isReadOnly(int index = -1) const;
bool canSave(int index = -1) const;
bool isModified(int index = -1) const;
bool hasLockableDatabases() const;
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 5fe758caa..b97aaf973 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -1201,10 +1201,6 @@ void DatabaseWidget::unlockDatabase(bool accepted)
db = m_databaseOpenWidget->database();
}
replaceDatabase(db);
- if (db->isReadOnly()) {
- showMessage(
- tr("This database is opened in read-only mode. Autosave is disabled."), MessageWidget::Warning, false, -1);
- }
restoreGroupEntryFocus(m_groupBeforeLock, m_entryBeforeLock);
m_groupBeforeLock = QUuid();
@@ -1466,7 +1462,7 @@ void DatabaseWidget::onGroupChanged()
void DatabaseWidget::onDatabaseModified()
{
- if (!m_blockAutoSave && config()->get(Config::AutoSaveAfterEveryChange).toBool() && !m_db->isReadOnly()) {
+ if (!m_blockAutoSave && config()->get(Config::AutoSaveAfterEveryChange).toBool()) {
save();
} else {
// Only block once, then reset
@@ -1900,7 +1896,7 @@ bool DatabaseWidget::save()
}
// Read-only and new databases ask for filename
- if (m_db->isReadOnly() || m_db->filePath().isEmpty()) {
+ if (m_db->filePath().isEmpty()) {
return saveAs();
}
@@ -2056,7 +2052,6 @@ bool DatabaseWidget::saveBackup()
if (!newFilePath.isEmpty()) {
// Ensure we don't recurse back into this function
- m_db->setReadOnly(false);
m_db->setFilePath(newFilePath);
m_saveAttempts = 0;