Commit 1d60f46f authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

let KRun do its job in peace

parent 6629094b
......@@ -32,11 +32,9 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
KDELibs4Support
DBusAddons
KCMUtils
Plasma
)
find_package(X11 REQUIRED OPTIONAL_COMPONENTS Xtst)
find_package(LibKWorkspace CONFIG REQUIRED)
if(X11_FOUND)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras )
......
......@@ -16,7 +16,6 @@ kcoreaddons_desktop_to_json(kded_khotkeys khotkeys.desktop)
target_link_libraries(kded_khotkeys
khotkeysprivate
PW::KWorkspace
KF5::DBusAddons
KF5::KDELibs4Support)
......
......@@ -72,7 +72,6 @@ set(khotkeysprivate_SRCS
add_library(khotkeysprivate SHARED ${khotkeysprivate_SRCS})
# Not exported, so just make all links PUBLIC
target_link_libraries(khotkeysprivate PUBLIC
PW::KWorkspace
Qt5::X11Extras
KF5::GlobalAccel
KF5::I18n
......
......@@ -28,8 +28,8 @@
#include <KRun>
#include <KService>
#include <KUriFilter>
#include <kworkspace.h>
#include <QApplication>
#include <QDebug>
#include <QUrl>
......@@ -86,69 +86,9 @@ const QString CommandUrlAction::description() const
void CommandUrlAction::execute()
{
qDebug();
if( command_url().isEmpty())
return;
KUriFilterData uri;
QString cmd = command_url();
static bool sm_ready = false;
if( !sm_ready )
{
KWorkSpace::propagateSessionManager();
sm_ready = true;
}
// int space_pos = command_url().find( ' ' );
// if( command_url()[ 0 ] != '\'' && command_url()[ 0 ] != '"' && space_pos > -1
// && command_url()[ space_pos - 1 ] != '\\' )
// cmd = command_url().left( space_pos ); // get first 'word'
uri.setData( cmd );
KUriFilter::self()->filterUri( uri );
if( uri.uri().isLocalFile() && !uri.uri().hasFragment() )
cmd = uri.uri().toLocalFile();
else
cmd = uri.uri().url();
switch( uri.uriType())
{
case KUriFilterData::LocalFile:
case KUriFilterData::LocalDir:
case KUriFilterData::NetProtocol:
case KUriFilterData::Help:
{
( void ) new KRun( uri.uri(),0L);
break;
}
case KUriFilterData::Executable:
{
if (!KAuthorized::authorizeKAction("shell_access"))
return;
if( !uri.hasArgsAndOptions())
{
KService::Ptr service = KService::serviceByDesktopName( cmd );
if( service )
{
auto *job = new KIO::ApplicationLauncherJob(service);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->start();
break;
}
}
// fall though
}
case KUriFilterData::Shell:
{
if (!KAuthorized::authorizeKAction("shell_access"))
return;
const QString exec = cmd + ( uri.hasArgsAndOptions() ? uri.argsAndOptions() : QString() );
auto *job = new KIO::CommandLauncherJob(exec);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->setExecutable(cmd);
job->setIcon(uri.iconName());
job->start();
break;
}
default: // error
return;
}
new KRun(QUrl(command_url()), QApplication::activeWindow());
}
......
......@@ -11,7 +11,6 @@ add_executable(khotkeys_standalone ${khotkeys_standalone_PART_SRCS})
add_dependencies(khotkeys_standalone kded_khotkeys)
target_link_libraries(khotkeys_standalone
khotkeysprivate
PW::KWorkspace
KF5::DBusAddons
KF5::KDELibs4Support)
......
  • I recently upgraded my Plasma desktop and some of my custom shortcuts stopped working with a message "Malformed URL...". I have just figured out that if I revert this commit they start working again. It seems only valid QUrl is allowed in systemsettings -> Shortcuts -> Custom Shortcuts when this commit is in place. If I change my command to file:/// then it mostly works. I still cannot pass arguments to the command. Is passing arguments to a command ever be supported again?

  • Looking at the code and the UI I'm not sure whether that was an intentional feature or by accident. Reverting just 1d60f46f might fix it.

  • I vote for a revert for the time being.

  • mentioned in commit 8ba8a29c

    Toggle commit list
  • Reverted in 8ba8a29c.

  • mentioned in commit 5f622844

    Toggle commit list
  • mentioned in merge request !7 (merged)

    Toggle commit list
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