kdecore: drop unused startup condition feature

there are other conditions that are checked tho like the allowed
environment but this one is Katana specific and unused so

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-12 05:02:58 +03:00
parent ccb945dbce
commit 1ac69ccc74
5 changed files with 5 additions and 50 deletions

View file

@ -130,35 +130,9 @@ bool KAutostart::autostarts(const QString& environment, Conditions check) const
starts = starts && d->df->tryExec();
}
if (check & CheckCondition) {
starts = starts && checkStartCondition();
}
return starts;
}
bool KAutostart::checkStartCondition() const
{
QString condition = d->df->desktopGroup().readEntry("X-KDE-autostart-condition");
if (condition.isEmpty())
return true;
const QStringList list = condition.split(QLatin1Char(':'));
if (list.count() < 4) {
return true;
}
if (list[0].isEmpty() || list[2].isEmpty()) {
return true;
}
KConfig config(list[0], KConfig::NoGlobals);
KConfigGroup cg(&config, list[1]);
const bool defaultValue = (list[3].toLower() == QLatin1String("true"));
return cg.readEntry(list[2], defaultValue);
}
bool KAutostart::checkAllowedEnvironment(const QString& environment) const
{
const QStringList allowed = allowedEnvironments();

View file

@ -84,11 +84,6 @@ class KDECORE_EXPORT KAutostart : public QObject
* an executable that is checked for existence by name
*/
CheckCommand = 0x1,
/**
* autostart condition will be checked too (KDE-specific)
* @since 4.3
*/
CheckCondition = 0x2,
/**
* all necessary conditions will be checked
* @since 4.3
@ -271,7 +266,6 @@ class KDECORE_EXPORT KAutostart : public QObject
bool checkAllowedEnvironment( const QString& environment ) const;
private:
bool checkStartCondition() const;
class Private;
Private* const d;
};

View file

@ -15,19 +15,6 @@ application's .desktop file must be located in a KDE autostart directory such
as $KDEDIR/share/autostart or $KDEHOME/share/autostart. The .desktop file can
contain the following optional entries to control its autostart:
X-KDE-autostart-condition = rcfile:group:entry:default
rcfile = name of a config file (including path if necessary)
group = name of a group within the config file
entry = name of a boolean entry within the group
default = true or false
Starts the application only if the specified boolean entry in the
specified config file has the value 'true'. If the specified entry is
missing from the config file, the application will only be started if
'default' is 'true'.
If the entry is not within a group, the group entry can be left empty.
X-KDE-autostart-phase = phase
phase = 1 or 2

View file

@ -256,7 +256,7 @@ void KLauncherAdaptor::autoStart(int phase)
}
}
void KLauncherAdaptor::exec_blind(const QString &name, const QStringList &arg_list)
void KLauncherAdaptor::exec_blind(const QString &name, const QStringList &args)
{
const QString appexe = findExe(name);
if (appexe.isEmpty()) {
@ -265,17 +265,17 @@ void KLauncherAdaptor::exec_blind(const QString &name, const QStringList &arg_li
}
const QStringList envlist = m_environment.toStringList();
kDebug() << "blind starting" << appexe << arg_list << envlist;
kDebug() << "blind starting" << appexe << args << envlist;
const QString envexe = findExe("env");
if (envexe.isEmpty()) {
kWarning() << "env program not found";
QProcess::startDetached(appexe, arg_list);
QProcess::startDetached(appexe, args);
return;
}
QStringList envargs = envlist;
envargs += appexe;
envargs += arg_list;
envargs += args;
QProcess::startDetached(envexe, envargs);
}

View file

@ -73,7 +73,7 @@ public Q_SLOTS:
void autoStart(int phase);
// used by plasma-desktop and klauncher itself
void exec_blind(const QString &name, const QStringList &arg_list);
void exec_blind(const QString &name, const QStringList &args);
void cleanup();
// used by KToolInvocation