mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
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:
parent
ccb945dbce
commit
1ac69ccc74
5 changed files with 5 additions and 50 deletions
|
@ -130,35 +130,9 @@ bool KAutostart::autostarts(const QString& environment, Conditions check) const
|
||||||
starts = starts && d->df->tryExec();
|
starts = starts && d->df->tryExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check & CheckCondition) {
|
|
||||||
starts = starts && checkStartCondition();
|
|
||||||
}
|
|
||||||
|
|
||||||
return starts;
|
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
|
bool KAutostart::checkAllowedEnvironment(const QString& environment) const
|
||||||
{
|
{
|
||||||
const QStringList allowed = allowedEnvironments();
|
const QStringList allowed = allowedEnvironments();
|
||||||
|
|
|
@ -84,11 +84,6 @@ class KDECORE_EXPORT KAutostart : public QObject
|
||||||
* an executable that is checked for existence by name
|
* an executable that is checked for existence by name
|
||||||
*/
|
*/
|
||||||
CheckCommand = 0x1,
|
CheckCommand = 0x1,
|
||||||
/**
|
|
||||||
* autostart condition will be checked too (KDE-specific)
|
|
||||||
* @since 4.3
|
|
||||||
*/
|
|
||||||
CheckCondition = 0x2,
|
|
||||||
/**
|
/**
|
||||||
* all necessary conditions will be checked
|
* all necessary conditions will be checked
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
|
@ -271,7 +266,6 @@ class KDECORE_EXPORT KAutostart : public QObject
|
||||||
bool checkAllowedEnvironment( const QString& environment ) const;
|
bool checkAllowedEnvironment( const QString& environment ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkStartCondition() const;
|
|
||||||
class Private;
|
class Private;
|
||||||
Private* const d;
|
Private* const d;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
as $KDEDIR/share/autostart or $KDEHOME/share/autostart. The .desktop file can
|
||||||
contain the following optional entries to control its autostart:
|
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
|
X-KDE-autostart-phase = phase
|
||||||
|
|
||||||
phase = 1 or 2
|
phase = 1 or 2
|
||||||
|
|
|
@ -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);
|
const QString appexe = findExe(name);
|
||||||
if (appexe.isEmpty()) {
|
if (appexe.isEmpty()) {
|
||||||
|
@ -265,17 +265,17 @@ void KLauncherAdaptor::exec_blind(const QString &name, const QStringList &arg_li
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList envlist = m_environment.toStringList();
|
const QStringList envlist = m_environment.toStringList();
|
||||||
kDebug() << "blind starting" << appexe << arg_list << envlist;
|
kDebug() << "blind starting" << appexe << args << envlist;
|
||||||
const QString envexe = findExe("env");
|
const QString envexe = findExe("env");
|
||||||
if (envexe.isEmpty()) {
|
if (envexe.isEmpty()) {
|
||||||
kWarning() << "env program not found";
|
kWarning() << "env program not found";
|
||||||
QProcess::startDetached(appexe, arg_list);
|
QProcess::startDetached(appexe, args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList envargs = envlist;
|
QStringList envargs = envlist;
|
||||||
envargs += appexe;
|
envargs += appexe;
|
||||||
envargs += arg_list;
|
envargs += args;
|
||||||
QProcess::startDetached(envexe, envargs);
|
QProcess::startDetached(envexe, envargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public Q_SLOTS:
|
||||||
void autoStart(int phase);
|
void autoStart(int phase);
|
||||||
|
|
||||||
// used by plasma-desktop and klauncher itself
|
// 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();
|
void cleanup();
|
||||||
|
|
||||||
// used by KToolInvocation
|
// used by KToolInvocation
|
||||||
|
|
Loading…
Add table
Reference in a new issue