mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-23 08:20:45 -05:00
disable the save button if there isn't anything to save
This commit is contained in:
parent
ca59ae4f4f
commit
4076b37378
3 changed files with 13 additions and 1 deletions
|
|
@ -539,6 +539,16 @@ bool DatabaseTabWidget::readOnly(int index)
|
||||||
return indexDatabaseManagerStruct(index).readOnly;
|
return indexDatabaseManagerStruct(index).readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DatabaseTabWidget::canSave(int index)
|
||||||
|
{
|
||||||
|
if (index == -1) {
|
||||||
|
index = currentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
const DatabaseManagerStruct& dbStruct = indexDatabaseManagerStruct(index);
|
||||||
|
return !dbStruct.saveToFilename || (dbStruct.modified && !dbStruct.readOnly);
|
||||||
|
}
|
||||||
|
|
||||||
bool DatabaseTabWidget::isModified(int index)
|
bool DatabaseTabWidget::isModified(int index)
|
||||||
{
|
{
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ public slots:
|
||||||
void changeMasterKey();
|
void changeMasterKey();
|
||||||
void changeDatabaseSettings();
|
void changeDatabaseSettings();
|
||||||
bool readOnly(int index = -1);
|
bool readOnly(int index = -1);
|
||||||
|
bool canSave(int index = -1);
|
||||||
bool isModified(int index = -1);
|
bool isModified(int index = -1);
|
||||||
void performGlobalAutoType();
|
void performGlobalAutoType();
|
||||||
void lockDatabases();
|
void lockDatabases();
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||||
m_ui->actionGroupEmptyRecycleBin->setEnabled(recycleBinSelected);
|
m_ui->actionGroupEmptyRecycleBin->setEnabled(recycleBinSelected);
|
||||||
m_ui->actionChangeMasterKey->setEnabled(true);
|
m_ui->actionChangeMasterKey->setEnabled(true);
|
||||||
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
||||||
m_ui->actionDatabaseSave->setEnabled(true);
|
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave());
|
||||||
m_ui->actionDatabaseSaveAs->setEnabled(true);
|
m_ui->actionDatabaseSaveAs->setEnabled(true);
|
||||||
m_ui->actionExportCsv->setEnabled(true);
|
m_ui->actionExportCsv->setEnabled(true);
|
||||||
m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1);
|
m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1);
|
||||||
|
|
@ -560,6 +560,7 @@ void MainWindow::updateWindowTitle()
|
||||||
if (m_ui->tabWidget->readOnly(tabWidgetIndex)) {
|
if (m_ui->tabWidget->readOnly(tabWidgetIndex)) {
|
||||||
customWindowTitlePart.append(QString(" [%1]").arg(tr("read-only")));
|
customWindowTitlePart.append(QString(" [%1]").arg(tr("read-only")));
|
||||||
}
|
}
|
||||||
|
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex));
|
||||||
} else if (stackedWidgetIndex == 1) {
|
} else if (stackedWidgetIndex == 1) {
|
||||||
customWindowTitlePart = tr("Settings");
|
customWindowTitlePart = tr("Settings");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue