[PATCH] Allow autostart-condition setting without a grout (Was: [Kde-pim] KPilot Developer's notes for July 9th)
Reinhold Kainhofer
reinhold at kainhofer.com
Mon Jul 21 22:47:47 BST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm cc'ing kde-core-devel on this, since I'd like to apply the attached patch.
See below for a description.
On Monday 21 July 2003 17:35, Derek Broughton wrote:
> From: "Reinhold Kainhofer" <reinhold at kainhofer.com>
> > That's what the
> > X-KDE-autostart-condition=kpilotrc:...:StartDaemonAtLogin:false
> > should be about.
>
> false?? Uh-oh. I was treating it as 'start if condition in
> kpilotrc:...:StartDaemonAtLogin' = condition.
No, the last entry is just the fallback value if no entry exists. See e.g. the
readme:
http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kinit/README.autostart?rev=1.1&content-type=text/x-cvsweb-markup
> It doesn't make a difference though, since I always had a condition and it
> wasn't honored.
yes, that is due to the fact that the autostart setting needs to have the
config entry inside a group. The relevant code is in
kdelibs/kinit/autostart.cpp:
static bool startCondition(const QString &condition)
{
if (condition.isEmpty())
return true;
QStringList list = QStringList::split(':', condition);
if (list.count() < 4)
return true;
KConfig config(list[0]);
config.setGroup(list[1]);
bool defaultValue = (list[3].lower() == "true");
return config.readBoolEntry(list[2], defaultValue);
}
Now, the problem is that split without a third argument does not allow empty
entries, setGroup however needs an empty entry to allow the use of config
entries that are not in a config group.
> Yeah, what I meant was "what would be the default when no configGroup is
> specified". Still haven't found it. I tried Default (since these look
> like Windows .ini files, and _they_ default to Default) and General (since
> other apps use that - but it's always explicit)
Nope, there simply is no possibility to achieve this at the moment. Attached
is a patch that allows an empty group so the autostart setting can also be
X-KDE-autostart-condition=kpilotrc::StartDaemonAtLogin:false
Question to kde-core-devel): Is it okay to apply the patch to kdelibs/kdeinit?
Thanks,
Reinhold
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/HF+GTqjEwhXvPN0RAmrUAJ442VetQT1AxjLIYr/EwlhUfqx/RACfb+eC
yXlC0OAHWgCbR67f9SyYPKk=
=sHqf
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autostart.patch
Type: text/x-diff
Size: 1487 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030721/ec98d148/attachment.patch>
More information about the kde-core-devel
mailing list