mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Refactor updateWindowTitle function.
This commit is contained in:
parent
a77c426b2d
commit
8748c76de2
@ -335,23 +335,23 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||||||
|
|
||||||
void MainWindow::updateWindowTitle()
|
void MainWindow::updateWindowTitle()
|
||||||
{
|
{
|
||||||
QString windowTitle;
|
QString customWindowTitlePart;
|
||||||
int stackedWidgetIndex = m_ui->stackedWidget->currentIndex();
|
int stackedWidgetIndex = m_ui->stackedWidget->currentIndex();
|
||||||
if (stackedWidgetIndex == 0) {
|
|
||||||
int tabWidgetIndex = m_ui->tabWidget->currentIndex();
|
int tabWidgetIndex = m_ui->tabWidget->currentIndex();
|
||||||
if (tabWidgetIndex == -1) {
|
if (stackedWidgetIndex == 0 && tabWidgetIndex != -1) {
|
||||||
windowTitle = BaseWindowTitle;
|
customWindowTitlePart = m_ui->tabWidget->tabText(tabWidgetIndex);
|
||||||
} else {
|
|
||||||
windowTitle = m_ui->tabWidget->tabText(tabWidgetIndex);
|
|
||||||
if (m_ui->tabWidget->readOnly(tabWidgetIndex)) {
|
if (m_ui->tabWidget->readOnly(tabWidgetIndex)) {
|
||||||
windowTitle.append(" [").append(tr("read-only")).append("]");
|
customWindowTitlePart.append(" [%1]").arg(tr("read-only"));
|
||||||
}
|
|
||||||
windowTitle.append(" - ").append(BaseWindowTitle);
|
|
||||||
}
|
}
|
||||||
} else if (stackedWidgetIndex == 1) {
|
} else if (stackedWidgetIndex == 1) {
|
||||||
windowTitle = QString("%1 - %2").arg(tr("Settings")).arg(BaseWindowTitle);
|
customWindowTitlePart = tr("Settings");
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
QString windowTitle;
|
||||||
|
if (customWindowTitlePart.isEmpty()) {
|
||||||
windowTitle = BaseWindowTitle;
|
windowTitle = BaseWindowTitle;
|
||||||
|
} else {
|
||||||
|
windowTitle = QString("%1 - %2").arg(customWindowTitlePart).arg(BaseWindowTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
setWindowTitle(windowTitle);
|
setWindowTitle(windowTitle);
|
||||||
|
Loading…
Reference in New Issue
Block a user