kio: slightly better exec extraction in KOpenWithDialog

the matching could try basename and possibly second argument match tho,
e.g. the Exec key value could be relative or full path and interpreter may
be the first argument with the actual program (or script rather) second
making the matching kinda hard to get right

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-12 14:40:26 +03:00
parent aee3b7b3da
commit 25d81b76b9

View file

@ -55,14 +55,11 @@
static QString simplifiedExecLineFromService(const QString& fullExec)
{
QString exec = fullExec;
exec.remove("%u", Qt::CaseInsensitive);
exec.remove("%f", Qt::CaseInsensitive);
exec.remove("-caption %c");
exec.remove("-caption \"%c\"");
exec.remove("%i");
exec.remove("%m");
return exec.simplified();
QStringList args = KShell::splitArgs(fullExec);
if (args.isEmpty()) {
return QString();
}
return args.first().simplified();
}
namespace KDEPrivate {