Commit 26fb5ec2 authored by Nate Graham's avatar Nate Graham 🔩

[Componentchooser KCM] Make default browser app choice work even when combobox is not used

Summary:
BUG: 350663
FIXED-IN: 5.12.8

When choosing a default browser app using the app list combobox, the choice was only being saved after the combobox was used, because its signal was connected to an inline function that saved the choice, while the radio button that enabled the combobox was not. As a result, if you clicked on that radio button and didn't need to use the combobox because it was already showing your preferred browser, that action was not actually getting saved.

This patch fixes the situation my moving the inline function into a real explicit slot function and connecting the radio button to it as well.

Test Plan:
- Go to the component chooser KCM's default browser module
- Reset to defaults, then leave the KCM and open it again
- Click the {nav in the following application} radio button
- Do NOT touch the combobox
- Click {nav Apply}
- Leave the KCM and come back

With this patch, the radio button's state is preserved and the correct browser is selected in the combobox.

Reviewers: #plasma, cfeck, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17181
parent e12e3cad
......@@ -32,13 +32,8 @@ CfgBrowser::CfgBrowser(QWidget *parent)
setupUi(this);
connect(lineExec, &KLineEdit::textChanged, this, &CfgBrowser::configChanged);
connect(radioKIO, &QRadioButton::toggled, this, &CfgBrowser::configChanged);
connect(radioService, &QRadioButton::toggled, this, &CfgBrowser::configChanged);
connect(browserCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this, [this](int index) {
const QString &storageId = browserCombo->itemData(index).toString();
m_browserService = KService::serviceByStorageId(storageId);
m_browserExec.clear();
emit configChanged();
});
connect(radioService, &QRadioButton::toggled, this, &CfgBrowser::selectBrowserApp);
connect(browserCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this, &CfgBrowser::selectBrowserApp);
connect(radioExec, &QRadioButton::toggled, this, &CfgBrowser::configChanged);
connect(btnSelectApplication, &QToolButton::clicked, this, &CfgBrowser::selectBrowser);
}
......@@ -46,6 +41,14 @@ CfgBrowser::CfgBrowser(QWidget *parent)
CfgBrowser::~CfgBrowser() {
}
void CfgBrowser::selectBrowserApp()
{
const QString &storageId = browserCombo->currentData().toString();
m_browserService = KService::serviceByStorageId(storageId);
m_browserExec.clear();
configChanged();
}
void CfgBrowser::configChanged()
{
emit changed(true);
......
......@@ -32,6 +32,7 @@ public:
protected Q_SLOTS:
void selectBrowser();
void configChanged();
void selectBrowserApp();
Q_SIGNALS:
void changed(bool);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment