Only insert session types into menu for which the binary is installed.

Okayed by rikkus.

svn path=/trunk/kdebase/konsole/; revision=183534
wilder-portage
Stephan Binner 24 years ago
parent 0fc661dfa3
commit 5bf01554c1
  1. 17
      konsole/konsole.cpp

@ -2274,11 +2274,26 @@ void Konsole::addSessionCommand(const QString &path)
co->setDesktopGroup();
QString typ = co->readEntry("Type");
QString txt = co->readEntry("Name");
if (typ.isEmpty() || txt.isEmpty() || typ != "KonsoleApplication")
// try to locate the binary
QString exec= co->readEntry("Exec");
if (exec.startsWith("su -c \'")) {
exec = exec.mid(7,exec.length()-8);
}
int pos = exec.find(' ');
if (pos > 0) {
exec = exec.left(pos);
}
QString pexec = KGlobal::dirs()->findExe(exec);
if (typ.isEmpty() || txt.isEmpty() || typ != "KonsoleApplication"
|| ( !exec.isEmpty() && pexec.isEmpty() ) )
{
if (!path.isEmpty())
delete co;
return; // ignore
}
QString icon = co->readEntry("Icon", "openterm");
m_toolbarSessionsCommands->insertItem( SmallIconSet( icon ), txt, ++cmd_serial );

Loading…
Cancel
Save