Bug 421294 - Dolphin settings not detecting executable scripts behaviourOnLaunch "open" value
Summary: Dolphin settings not detecting executable scripts behaviourOnLaunch "open" value
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 19.12.3
Platform: Kubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-10 16:13 UTC by Serhiy Zahoriya
Modified: 2020-07-05 15:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 20.04.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serhiy Zahoriya 2020-05-10 16:13:22 UTC
SUMMARY


STEPS TO REPRODUCE
1. Set Settings > Configure Dolphin > General > Confirmations > "When opening an executable file" to "Always ask"
2. Find an executable script and try to open it in Dolphin
3. Choose "Do not ask again" and select Open.
4. Open $XDG_CONFIG_HOME/kiorc and make sure it has "behaviourOnLaunch=open"
5. Open the aforementioned settings tab again.

OBSERVED RESULT
"When opening an executable file" is shown as "Always ask" when it's "open" in config.

EXPECTED RESULT
"open" value read as equivalent to behaviourOnLaunch=dontAsk

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 20.04
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Comment 1 Nate Graham 2020-05-12 16:21:00 UTC
It looks like the "dontAsk" and "open" behaviors are identical? I guess Dolphin should consider the "open" value to be the same as "Open in Application"

A secondary problem is that when Dolphin is configured to make KIO always ask, the dialog box still has an option to not ask anymore.
Comment 2 Wolfgang Bauer 2020-06-30 14:08:47 UTC
kio doesn't know about "dontAsk", it uses "open" for "Open in application".

But dolphin's settings incorrectly use "dontAsk" since https://phabricator.kde.org/D15147, I actually mentioned it there but got ignored...
Comment 3 Wolfgang Bauer 2020-06-30 15:01:35 UTC
(In reply to Wolfgang Bauer from comment #2)
> kio doesn't know about "dontAsk", it uses "open" for "Open in application".
To be more precise, it actually only knows "alwaysAsk" and "execute", all other values are mapped to "open".
This is the code that reads the setting (in src/widgets/krun.cpp):
        KConfigGroup cfgGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts");
        const QString value = cfgGroup.readEntry("behaviourOnLaunch", "alwaysAsk");

        if (value == QLatin1String("alwaysAsk")) {
            return true;
        } else {
            q->setRunExecutables(value == QLatin1String("execute"));
        }

It however does write the values "open" or "execute" though when ticking the "Don't ask again" checkbox:
   if (isDontAskAgainSet) {
        QString output = result == ExecutableFileOpenDialog::OpenFile ? QStringLiteral("open") : QStringLiteral("execute");
        KConfigGroup cfgGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts");
        cfgGroup.writeEntry("behaviourOnLaunch", output);
    }
Comment 4 Bug Janitor Service 2020-06-30 17:45:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/28
Comment 5 Bug Janitor Service 2020-06-30 17:52:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/29
Comment 6 Bug Janitor Service 2020-06-30 18:03:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/30
Comment 7 Elvis Angelaccio 2020-07-05 15:23:28 UTC
Git commit 7a6956da997a39a22c1f08138674459c3c3aa32b by Elvis Angelaccio, on behalf of Wolfgang Bauer.
Committed on 05/07/2020 at 15:22.
Pushed by elvisangelaccio into branch 'release/20.04'.

Write correct value for "Open in application" script execution setting

KIO actually uses "alwaysAsk", "execute", and "open" as possible values.

When reading the setting, map unknown values to "open" like KIO does.
That also provides compatibility with older dolphin versions.
FIXED-IN: 20.04.3

M  +5    -5    src/settings/general/confirmationssettingspage.cpp

https://invent.kde.org/system/dolphin/commit/7a6956da997a39a22c1f08138674459c3c3aa32b