Remove option to hide application name from titlebar
ClosedPublic

Authored by EspadaV8 on Nov 20 2018, 1:46 PM.

Details

Summary

Since the application name is added by Qt, it is no longer
possible to remove the trailing '- Konsole' so the GUI
option is obsolete.

BUG: 364391
FIXED-IN: 19.03

Test Plan

Change settings for existing Konsole and notice that the checkbox
doesn't change anything. After applying this the checkbox should
be removed.

Diff Detail

Repository
R319 Konsole
Branch
364391-remove-option-to-hide-application-name-in-titlebar
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5182
Build 5200: arc lint + arc unit
EspadaV8 created this revision.Nov 20 2018, 1:46 PM
Restricted Application added a project: Konsole. · View Herald TranscriptNov 20 2018, 1:46 PM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
EspadaV8 requested review of this revision.Nov 20 2018, 1:46 PM
hindenburg retitled this revision from Remove option to hide application names from titlebar to Remove option to hide application name from titlebar.Nov 22 2018, 2:59 PM
hindenburg edited the summary of this revision. (Show Details)
hindenburg edited the test plan for this revision. (Show Details)
hindenburg edited the summary of this revision. (Show Details)
hindenburg accepted this revision.Nov 22 2018, 3:05 PM
This revision is now accepted and ready to land.Nov 22 2018, 3:05 PM
This revision was automatically updated to reflect the committed changes.

I set the prompt so that it displays the machine name and the current working directory in the title bar. Having " - Konsole" appended to the end is annoying and wastes space that I could better use for showing more of the current working directory. Looking at the documentation for the applicationDisplayName property it seems as if setting that to an empty string would have the desired effect. Has anybody confirmed that it is really not possible to get Qt to not append the application name to the title bar ?

@glenncoombs I just had a look at doing that and it doesn't work out well. You can remove it but to do it I needed to remove the details from the KAboutData section (first and second lines below). Replacing konsole on the first line and Konsole for the @title does remove the suffix, but the about screen then loses the information. Calling app->setApplicationDisplayName(QString("")); after that (or before) doesn't do anything.

main.cpp:113

KAboutData about(QStringLiteral("konsole"),
                 i18nc("@title", "Konsole"),
                 QStringLiteral(KONSOLE_VERSION),
                 i18nc("@title", "Terminal emulator"),
                 KAboutLicense::GPL_V2,
                 i18nc("@info:credit", "(c) 1997-2017, The Konsole Developers"),
                 QString(),
                 QStringLiteral("https://konsole.kde.org/"));

I made a change locally to the updateWindowCaption() function in
MainWindow.cpp:

void MainWindow::updateWindowCaption()
{

if (_pluggedController.isNull()) {
    return;
}

const QString &title = _pluggedController->title();
const QString &userTitle = _pluggedController->userTitle();

// use tab title as caption by default
QString caption = title;

// use window title as caption when this setting is enabled
// if the userTitle is empty, use a blank space (using an empty string
// removes the dash — before the application name; leaving the dash
// looks better)
if (KonsoleSettings::showWindowTitleOnTitleBar()) {
    !userTitle.isEmpty() ? caption = userTitle : caption =

QStringLiteral(" ");

}

if (KonsoleSettings::showAppNameOnTitleBar()) {
    QApplication::setApplicationDisplayName("Konsole");
    setCaption(caption);
} else {
    QApplication::setApplicationDisplayName("");
    setPlainCaption(caption);
}

}

which seems to work for me. I have to restart Konsole after changing the
showWindowOnTitleBar setting but it does correctly hide/show the " -
Konsole" string.

That looks like a hack and not really the intended use of the application name. Restarting to make the change also seems hacky. If @hindenburg is happy with that change perhaps open a new revision?