mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Merge pull request #1116 from keepassxreboot/fix/view_menu
Remove view menu and disable save button
This commit is contained in:
commit
8f0e717404
@ -539,6 +539,16 @@ bool DatabaseTabWidget::readOnly(int index)
|
||||
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)
|
||||
{
|
||||
if (index == -1) {
|
||||
|
@ -78,6 +78,7 @@ public slots:
|
||||
void changeMasterKey();
|
||||
void changeDatabaseSettings();
|
||||
bool readOnly(int index = -1);
|
||||
bool canSave(int index = -1);
|
||||
bool isModified(int index = -1);
|
||||
void performGlobalAutoType();
|
||||
void lockDatabases();
|
||||
|
@ -124,12 +124,6 @@ MainWindow::MainWindow()
|
||||
|
||||
setWindowIcon(filePath()->applicationIcon());
|
||||
m_ui->globalMessageWidget->setHidden(true);
|
||||
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
|
||||
toggleViewAction->setText(tr("Show toolbar"));
|
||||
m_ui->menuView->addAction(toggleViewAction);
|
||||
bool showToolbar = config()->get("ShowToolbar").toBool();
|
||||
m_ui->toolBar->setVisible(showToolbar);
|
||||
connect(m_ui->toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveToolbarState(bool)));
|
||||
|
||||
m_clearHistoryAction = new QAction(tr("Clear history"), m_ui->menuFile);
|
||||
m_lastDatabasesActions = new QActionGroup(m_ui->menuRecentDatabases);
|
||||
@ -460,7 +454,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
m_ui->actionGroupEmptyRecycleBin->setEnabled(recycleBinSelected);
|
||||
m_ui->actionChangeMasterKey->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->actionExportCsv->setEnabled(true);
|
||||
m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1);
|
||||
@ -566,6 +560,7 @@ void MainWindow::updateWindowTitle()
|
||||
if (m_ui->tabWidget->readOnly(tabWidgetIndex)) {
|
||||
customWindowTitlePart.append(QString(" [%1]").arg(tr("read-only")));
|
||||
}
|
||||
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex));
|
||||
} else if (stackedWidgetIndex == 1) {
|
||||
customWindowTitlePart = tr("Settings");
|
||||
}
|
||||
|
@ -260,15 +260,9 @@
|
||||
<addaction name="actionPasswordGenerator"/>
|
||||
<addaction name="actionSettings"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEntries"/>
|
||||
<addaction name="menuGroups"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user