Commit a960c028 authored by Alexander Lohnau's avatar Alexander Lohnau
Browse files

Bookmarks Runner: Fix extraction of firefox profile

BUG: 418526

The profile group with the value `Default=1` is not always the default profile, for example in the profiles.ini file from the bug report:



In the text you can see that the profile with `dun5pnnn.default` has the value `Default=1`,
but it is not  the default profile.
The correct default profile is in the `[Install11457493C5A56847]` group with the key `Default`.

Test Plan:
If you create a new profile it will be extracted as the default profile
(but the old value might still be cached see D28619).

Reviewers: #plasma, ngraham, bruns, broulik, meven

Reviewed By: meven

Subscribers: meven, plasma-devel

Tags: #plasma

Differential Revision:
parent 40b1a94a
......@@ -165,8 +165,7 @@ void Firefox::reloadConfiguration()
qCWarning(RUNNER_BOOKMARKS) << "SQLITE driver isn't available";
KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General"));
KConfigGroup grp = config;
KConfigGroup grp(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General"));
/* This allows the user to specify a profile database */
m_dbFile = grp.readEntry("dbfile", QString());
if (m_dbFile.isEmpty() || !QFile::exists(m_dbFile)) {
......@@ -175,15 +174,20 @@ void Firefox::reloadConfiguration()
QStringList profilesList = firefoxProfile.groupList();
profilesList = profilesList.filter(QRegularExpression(QStringLiteral("^Profile\\d+$")));
int size = profilesList.size();
QString profilePath;
if (size == 1) {
if (profilesList.size() == 1) {
// There is only 1 profile so we select it
KConfigGroup fGrp =;
profilePath = fGrp.readEntry("Path");
} else {
// There are multiple profiles, find the default one
const QStringList installConfig = firefoxProfile.groupList().filter(QRegularExpression("^Install.*"));
// The profile with Default=1 is not always the default profile, see BUG: 418526
// If there is only one Install* group it contains the default profile
if (installConfig.size() == 1) {
profilePath ="Default");
} else {
// There are multiple profiles, find the default one
for (const QString &profileName: qAsConst(profilesList)) {
KConfigGroup fGrp =;
if (fGrp.readEntry<int>("Default", 0)) {
......@@ -191,6 +195,7 @@ void Firefox::reloadConfiguration()
if (profilePath.isEmpty()) {
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