5
Copyright (C) 1997, 1998 Steffen Hansen <hansen@kde.org>
6
Copyright (C) 2000-2003 Oswald Buddenhagen <ossi@kde.org>
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#include "kdmconfig.h"
26
#include "kdm_greet.h"
29
#include <kconfiggroup.h>
36
#include <sys/utsname.h>
38
#define WANT_GREET_DEFS
52
return qString(getCfgStr(id));
56
getCfgQStrList(int id)
58
return qStringList(getCfgStrArr(id, 0));
61
// Based on kconfiggroupgui.cpp
63
str2Font(const QString &aValue)
65
QFont *aRetFont = new QFont();
67
QStringList sl = aValue.split(QString::fromLatin1(","), QString::SkipEmptyParts);
68
if (sl.count() == 1) {
70
aRetFont->setRawMode(true);
71
aRetFont->setRawName(aValue);
73
aRetFont->fromString(aValue);
75
aRetFont->setStyleStrategy((QFont::StyleStrategy)
77
(_antiAliasing ? QFont::PreferAntialias : QFont::NoAntialias)));
87
_isLocal = getCfgInt(C_isLocal);
88
_isReserve = _isLocal && getCfgInt(C_isReserve);
89
_hasConsole = _hasConsole && _isLocal && getCfgInt(C_hasConsole);
90
_authorized = getCfgInt(C_isAuthorized);
92
(_grabInputPre == GRAB_NEVER) ? 0 :
93
(_grabInputPre == GRAB_ALWAYS) ? 1 :
96
QByteArray dd = _dataDir.toUtf8();
97
if (access(dd.constData(), W_OK))
98
logError("Data directory %\"s not accessible: %m\n", dd.constData());
99
_stsFile = _dataDir + "/kdmsts";
102
char hostname[256], *ptr;
104
if (!gethostname(hostname, sizeof(hostname)))
105
hostname[sizeof(hostname)-1] = '\0';
106
struct utsname tuname;
108
QString gst = _greetString;
109
_greetString.clear();
110
int i, j, l = gst.length();
111
for (i = 0; i < l; i++) {
113
switch (gst[++i].cell()) {
114
case '%': _greetString += gst[i]; continue;
115
case 'd': ptr = dname; break;
116
case 'h': ptr = hostname; break;
117
case 'n': ptr = tuname.nodename;
118
for (j = 0; ptr[j]; j++)
124
case 's': ptr = tuname.sysname; break;
125
case 'r': ptr = tuname.release; break;
126
case 'm': ptr = tuname.machine; break;
127
default: _greetString += i18nc("@item:intext substitution for "
128
"an undefined %X placeholder wrongly "
129
"given in the config file 'kdmrc', "
130
"telling the user to fix it",
131
"[fix kdmrc]"); continue;
133
_greetString += QString::fromLocal8Bit(ptr);
135
_greetString += gst[i];
140
void initQAppConfig(void)
144
KConfigGroup cfg(KGlobal::config(), "General");
145
cfg.writeEntry("nopaletteChange", true);
146
cfg.writeEntry("font", *_normalFont);
147
if (!_GUIStyle.isEmpty())
148
cfg.writeEntry("widgetStyle", _GUIStyle);