[Icon Applet] Don't copy application .desktop files to plasma_icons if run_desktop_files restriction is enforced

When this restriction is enabled, KIO will refuse to run desktop files outside system-known locations
essentially breaking the icon widgetin this case. Since we still want to be able to have shortcuts
in locked-down setups, let's just use the source desktop file in this case and rather lose the ability
to customize it (which isn't really possible with this restrition anyway)
wilder-5.14
Kai Uwe Broulik 9 years ago
parent 7b4609a4c4
commit f0e551925a
  1. 10
      applets/icon/iconapplet.cpp

@ -107,6 +107,16 @@ void IconApplet::populate()
// if desktop file just copy it over
if (KDesktopFile::isDesktopFile(localUrlString)) {
// if this restriction is set, KIO won't allow running desktop files from outside
// registered services, applications, and so on, in this case we'll use the original
// .desktop file and lose the ability to customize it
if (!KAuthorized::authorize(QStringLiteral("run_desktop_files"))) {
populateFromDesktopFile(localUrlString);
// we don't call setLocalPath here as we don't want to store localPath to be a system-location
// so that the fact that we cannot edit is re-evaluated every time
return;
}
if (!QFile::copy(localUrlString, backingDesktopFile)) {
setLaunchErrorMessage(i18n("Failed to copy icon widget desktop file from '%1' to '%2'", localUrlString, backingDesktopFile));
return;

Loading…
Cancel
Save