Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting window title as modified #11542

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6218,6 +6218,10 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
<source>Toggle Show Group Panel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Password Generator</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ManageDatabase</name>
Expand Down
15 changes: 5 additions & 10 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,28 +1033,23 @@ void MainWindow::updateWindowTitle()

if (stackedWidgetIndex == DatabaseTabScreen && tabWidgetIndex != -1) {
customWindowTitlePart = m_ui->tabWidget->tabName(tabWidgetIndex);
if (isModified) {
// remove asterisk '*' from title
if (isModified && customWindowTitlePart.endsWith("*")) {
customWindowTitlePart.remove(customWindowTitlePart.size() - 1, 1);
droidmonkey marked this conversation as resolved.
Show resolved Hide resolved
}
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex));
droidmonkey marked this conversation as resolved.
Show resolved Hide resolved
} else if (stackedWidgetIndex == 1) {
} else if (stackedWidgetIndex == StackedWidgetIndex::SettingsScreen) {
customWindowTitlePart = tr("Settings");
} else if (stackedWidgetIndex == StackedWidgetIndex::PasswordGeneratorScreen) {
customWindowTitlePart = tr("Password Generator");
}

QString windowTitle;
if (customWindowTitlePart.isEmpty()) {
windowTitle = BaseWindowTitle;
windowTitle = QString("%1[*]").arg(BaseWindowTitle);
} else {
windowTitle = QString("%1[*] - %2").arg(customWindowTitlePart, BaseWindowTitle);
}

if (customWindowTitlePart.isEmpty() || stackedWidgetIndex == 1) {
setWindowFilePath("");
} else {
setWindowFilePath(m_ui->tabWidget->databaseWidgetFromIndex(tabWidgetIndex)->database()->filePath());
}

setWindowTitle(windowTitle);
setWindowModified(isModified);

Expand Down
Loading