Changeset View
Changeset View
Standalone View
Standalone View
kcms/componentchooser/componentchooserbrowser.cpp
Show All 25 Lines | |||||
26 | 26 | | |||
27 | #include <QUrl> | 27 | #include <QUrl> | ||
28 | 28 | | |||
29 | CfgBrowser::CfgBrowser(QWidget *parent) | 29 | CfgBrowser::CfgBrowser(QWidget *parent) | ||
30 | : QWidget(parent), Ui::BrowserConfig_UI(),CfgPlugin() | 30 | : QWidget(parent), Ui::BrowserConfig_UI(),CfgPlugin() | ||
31 | { | 31 | { | ||
32 | setupUi(this); | 32 | setupUi(this); | ||
33 | connect(lineExec, &KLineEdit::textChanged, this, &CfgBrowser::configChanged); | 33 | connect(lineExec, &KLineEdit::textChanged, this, &CfgBrowser::configChanged); | ||
34 | connect(radioKIO, &QRadioButton::toggled, this, &CfgBrowser::configChanged); | | |||
35 | connect(radioService, &QRadioButton::toggled, this, &CfgBrowser::selectBrowserApp); | 34 | connect(radioService, &QRadioButton::toggled, this, &CfgBrowser::selectBrowserApp); | ||
36 | connect(browserCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this, &CfgBrowser::selectBrowserApp); | 35 | connect(browserCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this, &CfgBrowser::selectBrowserApp); | ||
37 | connect(radioExec, &QRadioButton::toggled, this, &CfgBrowser::configChanged); | 36 | connect(radioExec, &QRadioButton::toggled, this, &CfgBrowser::configChanged); | ||
38 | connect(btnSelectApplication, &QToolButton::clicked, this, &CfgBrowser::selectBrowser); | 37 | connect(btnSelectApplication, &QToolButton::clicked, this, &CfgBrowser::selectBrowser); | ||
39 | } | 38 | } | ||
40 | 39 | | |||
41 | CfgBrowser::~CfgBrowser() { | 40 | CfgBrowser::~CfgBrowser() { | ||
42 | } | 41 | } | ||
Show All 16 Lines | 57 | { | |||
59 | load(nullptr); | 58 | load(nullptr); | ||
60 | } | 59 | } | ||
61 | 60 | | |||
62 | void CfgBrowser::load(KConfig *) | 61 | void CfgBrowser::load(KConfig *) | ||
63 | { | 62 | { | ||
64 | const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General") ); | 63 | const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General") ); | ||
65 | const QString exec = config.readPathEntry( QStringLiteral("BrowserApplication"), QString() ); | 64 | const QString exec = config.readPathEntry( QStringLiteral("BrowserApplication"), QString() ); | ||
66 | if (exec.isEmpty()) { | 65 | if (exec.isEmpty()) { | ||
67 | radioKIO->setChecked(true); | 66 | radioService->setChecked(true); | ||
68 | m_browserExec = exec; | 67 | if (browserCombo->count() > 0) { | ||
69 | m_browserService = nullptr; | 68 | const QString &storageId = browserCombo->currentData().toString(); | ||
dfaure: This will lead to rather confusing user experience, btw.
On a freshly installed system… | |||||
69 | m_browserService = KService::serviceByStorageId(storageId); | ||||
m_browserService is initialised after this. It won't set the correct index. davidedmundson: m_browserService is initialised after this.
It won't set the correct index. | |||||
70 | m_browserExec.clear(); | ||||
71 | } | ||||
70 | } else { | 72 | } else { | ||
71 | radioExec->setChecked(true); | 73 | radioExec->setChecked(true); | ||
72 | if (exec.startsWith('!')) { | 74 | if (exec.startsWith('!')) { | ||
73 | m_browserExec = exec.mid(1); | 75 | m_browserExec = exec.mid(1); | ||
74 | m_browserService = nullptr; | 76 | m_browserService = nullptr; | ||
75 | } else { | 77 | } else { | ||
76 | m_browserService = KService::serviceByStorageId( exec ); | 78 | m_browserService = KService::serviceByStorageId( exec ); | ||
77 | if (m_browserService) { | 79 | if (m_browserService) { | ||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |
This will lead to rather confusing user experience, btw.
On a freshly installed system [without distro hacks], BrowserApplication is empty.
In practice that means KRun::setEnableExternalBrowser will pick the entry x-scheme-handler/https in the user's mimeapps.list, if any. And if that isn't set either, then well, the current behaviour in KRun, AFAICS, *will* be to use KIO to find out the mimetype.
Then the user opens this KCM, and it says "your default browser is firefox" (or whichever is first in the list). "What?" says the user... "that's not what I'm experiencing..."
If you want to change the default behaviour, you need to actually change the default behaviour (in KRun), not just what the KCM shows by default.
The default behaviour of KRun and the default settings shown by this KCM have to match.
This investigation shows that this is already buggy before this patch (the fallback to x-scheme-handler/https in the user's mimeapps.list is missing here), but this patch makes it much worse, as is.