While tinkering with kdDebug I noticed the following message in my xsession log:
KDE4 is running
Um, nope, that would be incorrect. :)
The message is found in tdelibs/kded/kded.cpp:165-171:
TQString version = getenv( "KDE_SESSION_VERSION" ); TQStringList blacklist; if ( version >= "4" ) { kdDebug(7020) << "KDE4 is running." << endl; blacklist << "mediamanager" << "medianotifier" << "kmilod" << "kwrited"; }
I'm no C++ coder but I believe the problem is 'version' is declared as a string but the test for the message is comparing a string to an integer. If I understand correctly, any non-zero value is treated as true. If KDE_SESSION_VERSION is empty then that value is not zero but null, which is a non-zero value?
Possibly the comparison test should change to:
if ( version != "" )
The KDE_SESSION_VERSION environment variable was introduced in KDE4 and did not exist in KDE3:
http://techbase.kde.org/KDE_System_Administration/Environment_Variables#KDE_...
KDE_SESSION_VERSION will be set to some value only on a KDE4/5/6 system. Otherwise the getenv function returns null/empty. All we need determine is whether the variable is set to some value.
Comments?
Darrell
On Wednesday 05 September 2012 22:04:58 Darrell Anderson wrote:
While tinkering with kdDebug I noticed the following message in my xsession log:
KDE4 is running
Um, nope, that would be incorrect. :)
The message is found in tdelibs/kded/kded.cpp:165-171:
TQString version = getenv( "KDE_SESSION_VERSION" ); TQStringList blacklist; if ( version >= "4" ) { kdDebug(7020) << "KDE4 is running." << endl; blacklist << "mediamanager" << "medianotifier" << "kmilod" << "kwrited"; }
I'm no C++ coder but I believe the problem is 'version' is declared as a string but the test for the message is comparing a string to an integer.
Nope, "version" is TQString and ">=" is perfect valid operator. For some reason, seems that "KDE_SESSION_VERSION" contains some string that is interpreted as "bigger" than "4". Are you sure that "KDE_SESSION_VERSION" is empty?
[...]
Nope, "version" is TQString and ">=" is perfect valid operator. For some reason, seems that "KDE_SESSION_VERSION" contains some string that is interpreted as "bigger" than "4". Are you sure that "KDE_SESSION_VERSION" is empty?
Yes, I checked. The variable does not exist. :-)
Darrell
On Wednesday 05 September 2012 22:24:52 Darrell Anderson wrote:
Nope, "version" is TQString and ">=" is perfect valid operator. For some reason, seems that "KDE_SESSION_VERSION" contains some string that is interpreted as "bigger" than "4". Are you sure that "KDE_SESSION_VERSION" is empty?
Yes, I checked. The variable does not exist. :-)
Darrell
Maybe is set later? Insert "kdDebug() << "KDE_SESSION_VERSION=" << version << endl;" before "TQStringList blacklist;", to check.
On Wednesday 05 September 2012 22:39:37 Darrell Anderson wrote:
Maybe is set later? Insert "kdDebug() << "KDE_SESSION_VERSION=" << version << endl;" before "TQStringList blacklist;", to check.
I already tried that. :-) The variable is empty.
Darrell
I just tested, seems that Qt think that QString::null is bigger than a non-null string.
Change the condition to
if ( !version.isNull() && version >= "4" )