kcminit: use KGlobalSettings::isMultiHead() instead of checking for hidden config key

as the comment says - there is no interface for it, there isn't one for
what KGlobalSettings::isMultiHead() checks for but it checks for
environment variable. now the klauncher KDE_MULTIHEAD environment variable
will match the global envionment variable

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-05 12:26:23 +03:00
parent 8558409838
commit 77d1beda87

View file

@ -38,6 +38,7 @@
#include <klocale.h>
#include <ktoolinvocation.h>
#include <kservicetypetrader.h>
#include <kglobalsettings.h>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
@ -168,18 +169,9 @@ KCMInit::KCMInit( KCmdLineArgs* args )
list = KServiceTypeTrader::self()->query( "KCModuleInit" );
}
// This key has no GUI apparently
KConfig _config( "kcmdisplayrc" );
KConfigGroup config(&_config, "X11");
#ifdef Q_WS_X11
bool multihead = !config.readEntry( "disableMultihead", false) &&
(ScreenCount(QX11Info::display()) > 1);
#else
bool multihead = false;
#endif
// Pass env. var to klauncher.
QString name = "KDE_MULTIHEAD";
QString value = multihead ? "true" : "false";
QString value = KGlobalSettings::isMultiHead() ? "true" : "false";
KToolInvocation::setLaunchEnv(name, value);
setenv( name.toLatin1().constData(), value.toLatin1().constData(), 1 ); // apply effect also to itself