summaryrefslogtreecommitdiffstats
path: root/kcontrol/kdm
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/kdm
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/kdm')
-rw-r--r--kcontrol/kdm/AUTHORS6
-rw-r--r--kcontrol/kdm/ChangeLog16
-rw-r--r--kcontrol/kdm/Makefile.am19
-rw-r--r--kcontrol/kdm/background.cpp111
-rw-r--r--kcontrol/kdm/background.h50
-rw-r--r--kcontrol/kdm/kbackedcombobox.cpp40
-rw-r--r--kcontrol/kdm/kbackedcombobox.h38
-rw-r--r--kcontrol/kdm/kdm-appear.cpp516
-rw-r--r--kcontrol/kdm/kdm-appear.h95
-rw-r--r--kcontrol/kdm/kdm-conv.cpp362
-rw-r--r--kcontrol/kdm/kdm-conv.h84
-rw-r--r--kcontrol/kdm/kdm-font.cpp134
-rw-r--r--kcontrol/kdm/kdm-font.h57
-rw-r--r--kcontrol/kdm/kdm-shut.cpp227
-rw-r--r--kcontrol/kdm/kdm-shut.h64
-rw-r--r--kcontrol/kdm/kdm-users.cpp500
-rw-r--r--kcontrol/kdm/kdm-users.h106
-rw-r--r--kcontrol/kdm/kdm.desktop243
-rw-r--r--kcontrol/kdm/main.cpp336
-rw-r--r--kcontrol/kdm/main.h83
20 files changed, 3087 insertions, 0 deletions
diff --git a/kcontrol/kdm/AUTHORS b/kcontrol/kdm/AUTHORS
new file mode 100644
index 000000000..61d720a4d
--- /dev/null
+++ b/kcontrol/kdm/AUTHORS
@@ -0,0 +1,6 @@
+KDM - The KDE Display Manager - written by Steffen Hansen <[email protected]>
+
+The KDE Display Manager Configuration module -
+written by Thomas Tanghus <[email protected]>
+
+Currently maintend by Oswald Buddenhagen <[email protected]>
diff --git a/kcontrol/kdm/ChangeLog b/kcontrol/kdm/ChangeLog
new file mode 100644
index 000000000..d49bb2548
--- /dev/null
+++ b/kcontrol/kdm/ChangeLog
@@ -0,0 +1,16 @@
+2002-07-11 Oswald Buddenhagen <[email protected]>
+ * Reworked "Users" and "Convenience" tabs
+
+2001-01-15 Oswald Buddenhagen <[email protected]>
+ * Several new fields in different tabs for some new features
+
+2000-12-06 Oswald Buddenhagen <[email protected]>
+ * New "Convenience" tab supporting the new automation features
+ * Some changes to the "Users" tab
+ * Few bug fixes
+
+1998-04-28 Thomas Tanghus <[email protected]>
+ * Improved geometry management.
+
+1998-05-14 Thomas Tanghus <[email protected]>
+ * Fixed bug with "ShutDownButton=...".
diff --git a/kcontrol/kdm/Makefile.am b/kcontrol/kdm/Makefile.am
new file mode 100644
index 000000000..2a210a1b9
--- /dev/null
+++ b/kcontrol/kdm/Makefile.am
@@ -0,0 +1,19 @@
+kde_module_LTLIBRARIES = kcm_kdm.la
+
+# _don't_ add a theme configurator!!
+kcm_kdm_la_SOURCES = background.cpp kdm-appear.cpp kdm-font.cpp kdm-shut.cpp \
+ kdm-users.cpp kdm-conv.cpp main.cpp kbackedcombobox.cpp
+
+kcm_kdm_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -module -avoid-version -no-undefined
+kcm_kdm_la_LIBADD = $(top_builddir)/kcontrol/background/libkcmbgnd.la $(top_builddir)/kcontrol/background/libbgnd.la $(LIB_KIO) $(LIB_KNEWSTUFF)
+
+AM_CPPFLAGS= -I$(top_builddir)/kcontrol/background \
+ -I$(top_srcdir)/kcontrol/background \
+ -I$(top_srcdir)/kdesktop $(all_includes)
+
+METASOURCES = AUTO
+
+messages:
+ $(XGETTEXT) $(kcm_kdm_la_SOURCES) -o $(podir)/kdmconfig.pot
+
+xdg_apps_DATA = kdm.desktop
diff --git a/kcontrol/kdm/background.cpp b/kcontrol/kdm/background.cpp
new file mode 100644
index 000000000..19c962a1d
--- /dev/null
+++ b/kcontrol/kdm/background.cpp
@@ -0,0 +1,111 @@
+/* vi: ts=8 sts=4 sw=4
+ *
+ * This file is part of the KDE project, module kcmdisplay.
+ * Copyright (C) 1999 Geert Jansen <[email protected]>
+ *
+ * Modified 2000.07.14 by Brad Hughes <[email protected]>
+ * Improve layout and consistency with KDesktop's background selection
+ *
+ * Based on old backgnd.cpp:
+ *
+ * Copyright (c) Martin R. Jones 1996
+ * Converted to a kcc module by Matthias Hoelzer 1997
+ * Gradient backgrounds by Mark Donohoe 1997
+ * Pattern backgrounds by Stephan Kulow 1998
+ * Randomizing & dnd & new display modes by Matej Koss 1998
+ *
+ * You can Freely distribute this program under the GNU General Public
+ * License. See the file "COPYING" for the exact licensing terms.
+ */
+
+#include <config.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qwhatsthis.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <dcopclient.h>
+#include "../background/bgsettings.h"
+#include "../background/bgdialog.h"
+#include "background.h"
+#include <qcheckbox.h>
+#include <ksimpleconfig.h>
+#include <kdialog.h>
+
+extern KSimpleConfig *config;
+
+KBackground::KBackground(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+
+ // Enabling checkbox
+ m_pCBEnable = new QCheckBox( i18n("E&nable background"), this );
+ QWhatsThis::add( m_pCBEnable,
+ i18n("If this is checked, KDM will use the settings below for the background."
+ " If it is disabled, you have to look after the background yourself."
+ " This is done by running some program (possibly xsetroot) in the script"
+ " specified in the Setup= option in kdmrc (usually Xsetup).") );
+ config->setGroup( "X-*-Greeter" );
+ m_simpleConf=new KSimpleConfig(config->readEntry( "BackgroundCfg",KDE_CONFDIR "/kdm/backgroundrc" ) );
+ m_background = new BGDialog( this, m_simpleConf, false );
+
+ connect(m_background, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
+
+ // Top layout
+ QVBoxLayout *top = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint() );
+ top->addWidget(m_pCBEnable);
+ top->addWidget(m_background);
+ top->addStretch();
+ connect( m_pCBEnable, SIGNAL(toggled( bool )), SLOT(slotEnableChanged()) );
+}
+
+KBackground::~KBackground()
+{
+ delete m_simpleConf;
+}
+
+void KBackground::slotEnableChanged()
+{
+ bool en = m_pCBEnable->isChecked();
+ m_background->setEnabled( en );
+ emit changed ( true );
+}
+
+void KBackground::makeReadOnly()
+{
+ m_pCBEnable->setEnabled(false);
+ m_background->makeReadOnly();
+}
+
+void KBackground::load()
+{
+ m_pCBEnable->setChecked( config->readBoolEntry( "UseBackground", true ) );
+ m_background->load(false);
+ slotEnableChanged();
+ emit changed(false);
+}
+
+
+void KBackground::save()
+{
+ kdDebug() << "Saving stuff..." << endl;
+ config->writeEntry( "UseBackground", m_pCBEnable->isChecked() );
+ m_background->save();
+ emit changed(false);
+}
+
+
+void KBackground::defaults()
+{
+ m_pCBEnable->setChecked( true );
+ slotEnableChanged();
+ m_background->defaults();
+ emit changed(true);
+}
+
+#include "background.moc"
diff --git a/kcontrol/kdm/background.h b/kcontrol/kdm/background.h
new file mode 100644
index 000000000..bc1e48213
--- /dev/null
+++ b/kcontrol/kdm/background.h
@@ -0,0 +1,50 @@
+/* vi: ts=8 sts=4 sw=4
+ *
+ * This file is part of the KDE project, module kcmdisplay.
+ * Copyright (C) 1999 Geert Jansen <[email protected]>
+ *
+ * You can Freely distribute this program under the GNU General Public
+ * License. See the file "COPYING" for the exact licensing terms.
+ */
+
+#ifndef __Bgnd_h_Included__
+#define __Bgnd_h_Included__
+
+#include <qobject.h>
+#include <qwidget.h>
+
+
+class KSimpleConfig;
+class BGDialog;
+class KGlobalBackgroundSettings;
+class QCheckBox;
+class QLabel;
+
+class KBackground: public QWidget
+{
+ Q_OBJECT
+public:
+ KBackground(QWidget *parent=0, const char *name=0);
+ ~KBackground();
+
+ void load();
+ void save();
+ void defaults();
+ void makeReadOnly();
+signals:
+ void changed(bool);
+
+private slots:
+ void slotEnableChanged();
+private:
+ void init();
+ void apply();
+
+ QCheckBox *m_pCBEnable;
+ QLabel *m_pMLabel;
+ KSimpleConfig *m_simpleConf;
+ BGDialog *m_background;
+};
+
+
+#endif // __Bgnd_h_Included__
diff --git a/kcontrol/kdm/kbackedcombobox.cpp b/kcontrol/kdm/kbackedcombobox.cpp
new file mode 100644
index 000000000..97759db5a
--- /dev/null
+++ b/kcontrol/kdm/kbackedcombobox.cpp
@@ -0,0 +1,40 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 2004-2005 Oswald Buddenhagen <[email protected]>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kbackedcombobox.h"
+
+void KBackedComboBox::insertItem( const QString &id, const QString &name )
+{
+ id2name[id] = name;
+ name2id[name] = id;
+ KComboBox::insertItem( name );
+}
+
+void KBackedComboBox::setCurrentId( const QString &id )
+{
+ if (id2name.contains( id ))
+ setCurrentItem( id2name[id] );
+ else
+ setCurrentItem( 0 );
+}
+
+const QString &KBackedComboBox::currentId() const
+{
+ return name2id[currentText()];
+}
diff --git a/kcontrol/kdm/kbackedcombobox.h b/kcontrol/kdm/kbackedcombobox.h
new file mode 100644
index 000000000..3b006f23f
--- /dev/null
+++ b/kcontrol/kdm/kbackedcombobox.h
@@ -0,0 +1,38 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 2004-2005 Oswald Buddenhagen <[email protected]>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KBACKEDCOMBOBOX_H
+#define KBACKEDCOMBOBOX_H
+
+#include <kcombobox.h>
+
+class KBackedComboBox : public KComboBox {
+
+public:
+ KBackedComboBox( QWidget *parent ) : KComboBox( false, parent ) {}
+ void insertItem( const QString &id, const QString &name );
+ void setCurrentId( const QString &id );
+ const QString &currentId() const;
+
+private:
+ QMap<QString,QString> id2name, name2id;
+
+};
+
+#endif // KBACKEDCOMBOBOX_H
diff --git a/kcontrol/kdm/kdm-appear.cpp b/kcontrol/kdm/kdm-appear.cpp
new file mode 100644
index 000000000..684371d74
--- /dev/null
+++ b/kcontrol/kdm/kdm-appear.cpp
@@ -0,0 +1,516 @@
+/*
+ This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997-1998 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+#include <unistd.h>
+#include <sys/types.h>
+
+
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qwhatsthis.h>
+#include <qvalidator.h>
+#include <qstylefactory.h>
+#include <qstyle.h>
+
+#include <klocale.h>
+#include <klineedit.h>
+#include <kimageio.h>
+#include <kcombobox.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <kio/netaccess.h>
+#include <kiconloader.h>
+#include <kurldrag.h>
+#include <kimagefilepreview.h>
+
+#include "kdm-appear.h"
+#include "kbackedcombobox.h"
+
+extern KSimpleConfig *config;
+
+
+KDMAppearanceWidget::KDMAppearanceWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ QString wtstr;
+
+ QVBoxLayout *vbox = new QVBoxLayout(this, KDialog::marginHint(),
+ KDialog::spacingHint(), "vbox");
+ QGroupBox *group = new QGroupBox(i18n("Appearance"), this);
+ vbox->addWidget(group);
+
+ QGridLayout *grid = new QGridLayout( group, 5, 2, KDialog::marginHint(),
+ KDialog::spacingHint(), "grid");
+ grid->addRowSpacing(0, group->fontMetrics().height());
+ grid->setColStretch(0, 1);
+ grid->setColStretch(1, 1);
+
+ QHBoxLayout *hlay = new QHBoxLayout( KDialog::spacingHint() );
+ grid->addMultiCellLayout(hlay, 1,1, 0,1);
+ greetstr_lined = new KLineEdit(group);
+ QLabel *label = new QLabel(greetstr_lined, i18n("&Greeting:"), group);
+ hlay->addWidget(label);
+ connect(greetstr_lined, SIGNAL(textChanged(const QString&)),
+ SLOT(changed()));
+ hlay->addWidget(greetstr_lined);
+ wtstr = i18n("This is the \"headline\" for KDM's login window. You may want to "
+ "put some nice greeting or information about the operating system here.<p>"
+ "KDM will substitute the following character pairs with the "
+ "respective contents:<br><ul>"
+ "<li>%d -> current display</li>"
+ "<li>%h -> host name, possibly with domain name</li>"
+ "<li>%n -> node name, most probably the host name without domain name</li>"
+ "<li>%s -> the operating system</li>"
+ "<li>%r -> the operating system's version</li>"
+ "<li>%m -> the machine (hardware) type</li>"
+ "<li>%% -> a single %</li>"
+ "</ul>" );
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( greetstr_lined, wtstr );
+
+
+ QGridLayout *hglay = new QGridLayout( 3, 4, KDialog::spacingHint() );
+ grid->addMultiCellLayout(hglay, 2,4, 0,0);
+
+ label = new QLabel(i18n("Logo area:"), group);
+ hglay->addWidget(label, 0, 0);
+ QVBoxLayout *vlay = new QVBoxLayout( KDialog::spacingHint() );
+ hglay->addMultiCellLayout(vlay, 0,0, 1,2);
+ noneRadio = new QRadioButton( i18n("logo area", "&None"), group );
+ clockRadio = new QRadioButton( i18n("Show cloc&k"), group );
+ logoRadio = new QRadioButton( i18n("Sho&w logo"), group );
+ QButtonGroup *buttonGroup = new QButtonGroup( group );
+ label->setBuddy( buttonGroup );
+ connect( buttonGroup, SIGNAL(clicked(int)), SLOT(slotAreaRadioClicked(int)) );
+ connect( buttonGroup, SIGNAL(clicked(int)), SLOT(changed()) );
+ buttonGroup->hide();
+ buttonGroup->insert(noneRadio, KdmNone);
+ buttonGroup->insert(clockRadio, KdmClock);
+ buttonGroup->insert(logoRadio, KdmLogo);
+ vlay->addWidget(noneRadio);
+ vlay->addWidget(clockRadio);
+ vlay->addWidget(logoRadio);
+ wtstr = i18n("You can choose to display a custom logo (see below), a clock or no logo at all.");
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( noneRadio, wtstr );
+ QWhatsThis::add( logoRadio, wtstr );
+ QWhatsThis::add( clockRadio, wtstr );
+
+ logoLabel = new QLabel(i18n("&Logo:"), group);
+ logobutton = new QPushButton(group);
+ logoLabel->setBuddy( logobutton );
+ logobutton->setAutoDefault(false);
+ logobutton->setAcceptDrops(true);
+ logobutton->installEventFilter(this); // for drag and drop
+ connect(logobutton, SIGNAL(clicked()), SLOT(slotLogoButtonClicked()));
+ hglay->addWidget(logoLabel, 1, 0);
+ hglay->addWidget(logobutton, 1, 1, AlignCenter);
+ hglay->addRowSpacing(1, 110);
+ wtstr = i18n("Click here to choose an image that KDM will display. "
+ "You can also drag and drop an image onto this button "
+ "(e.g. from Konqueror).");
+ QWhatsThis::add( logoLabel, wtstr );
+ QWhatsThis::add( logobutton, wtstr );
+ hglay->addRowSpacing( 2, KDialog::spacingHint());
+ hglay->setColStretch( 3, 1);
+
+
+ hglay = new QGridLayout( 2, 3, KDialog::spacingHint() );
+ grid->addLayout(hglay, 2, 1);
+
+ label = new QLabel(i18n("Position:"), group);
+ hglay->addMultiCellWidget(label, 0,1, 0,0, AlignVCenter);
+ QValidator *posValidator = new QIntValidator(0, 100, group);
+ QLabel *xLineLabel = new QLabel(i18n("&X:"), group);
+ hglay->addWidget(xLineLabel, 0, 1);
+ xLineEdit = new QLineEdit (group);
+ connect( xLineEdit, SIGNAL( textChanged(const QString&) ), SLOT( changed() ));
+ hglay->addWidget(xLineEdit, 0, 2);
+ xLineLabel->setBuddy(xLineEdit);
+ xLineEdit->setValidator(posValidator);
+ QLabel *yLineLabel = new QLabel(i18n("&Y:"), group);
+ hglay->addWidget(yLineLabel, 1, 1);
+ yLineEdit = new QLineEdit (group);
+ connect( yLineEdit, SIGNAL( textChanged(const QString&) ), SLOT( changed() ));
+ hglay->addWidget(yLineEdit, 1, 2);
+ yLineLabel->setBuddy(yLineEdit);
+ yLineEdit->setValidator(posValidator);
+ wtstr = i18n("Here you specify the relative coordinates (in percent) of the login dialog's <em>center</em>.");
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( xLineLabel, wtstr );
+ QWhatsThis::add( xLineEdit, wtstr );
+ QWhatsThis::add( yLineLabel, wtstr );
+ QWhatsThis::add( yLineEdit, wtstr );
+ hglay->setColStretch( 3, 1);
+ hglay->setRowStretch( 2, 1);
+
+
+ hglay = new QGridLayout( 2, 3, KDialog::spacingHint() );
+ grid->addLayout(hglay, 3, 1);
+ hglay->setColStretch(3, 1);
+
+ guicombo = new KBackedComboBox(group);
+ guicombo->insertItem( "", i18n("<default>") );
+ loadGuiStyles(guicombo);
+ guicombo->listBox()->sort();
+ label = new QLabel(guicombo, i18n("GUI s&tyle:"), group);
+ connect(guicombo, SIGNAL(activated(int)), SLOT(changed()));
+ hglay->addWidget(label, 0, 0);
+ hglay->addWidget(guicombo, 0, 1);
+ wtstr = i18n("You can choose a basic GUI style here that will be "
+ "used by KDM only.");
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( guicombo, wtstr );
+
+ colcombo = new KBackedComboBox(group);
+ colcombo->insertItem( "", i18n("<default>") );
+ loadColorSchemes(colcombo);
+ colcombo->listBox()->sort();
+ label = new QLabel(colcombo, i18n("&Color scheme:"), group);
+ connect(colcombo, SIGNAL(activated(int)), SLOT(changed()));
+ hglay->addWidget(label, 1, 0);
+ hglay->addWidget(colcombo, 1, 1);
+ wtstr = i18n("You can choose a basic Color Scheme here that will be "
+ "used by KDM only.");
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( colcombo, wtstr );
+
+ echocombo = new KBackedComboBox(group);
+ echocombo->insertItem("NoEcho", i18n("No Echo"));
+ echocombo->insertItem("OneStar", i18n("One Star"));
+ echocombo->insertItem("ThreeStars", i18n("Three Stars"));
+ label = new QLabel(echocombo, i18n("Echo &mode:"), group);
+ connect(echocombo, SIGNAL(activated(int)), SLOT(changed()));
+ hglay->addWidget(label, 2, 0);
+ hglay->addWidget(echocombo, 2, 1);
+ wtstr = i18n("You can choose whether and how KDM shows your password when you type it.");
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( echocombo, wtstr );
+
+
+ // The Language group box
+ group = new QGroupBox(0, Vertical, i18n("Locale"), this);
+ vbox->addWidget(group);
+
+ langcombo = new KLanguageButton(group);
+ loadLanguageList(langcombo);
+ connect(langcombo, SIGNAL(activated(const QString &)), SLOT(changed()));
+ label = new QLabel(langcombo, i18n("Languag&e:"), group);
+ QGridLayout *hbox = new QGridLayout( group->layout(), 2, 2, KDialog::spacingHint() );
+ hbox->setColStretch(1, 1);
+ hbox->addWidget(label, 1, 0);
+ hbox->addWidget(langcombo, 1, 1);
+ wtstr = i18n("Here you can choose the language used by KDM. This setting does not affect"
+ " a user's personal settings; that will take effect after login.");
+ QWhatsThis::add( label, wtstr );
+ QWhatsThis::add( langcombo, wtstr );
+
+
+ vbox->addStretch(1);
+
+}
+
+void KDMAppearanceWidget::makeReadOnly()
+{
+ disconnect( logobutton, SIGNAL(clicked()),
+ this, SLOT(slotLogoButtonClicked()) );
+ logobutton->setAcceptDrops(false);
+ greetstr_lined->setReadOnly(true);
+ noneRadio->setEnabled(false);
+ clockRadio->setEnabled(false);
+ logoRadio->setEnabled(false);
+ xLineEdit->setEnabled(false);
+ yLineEdit->setEnabled(false);
+ guicombo->setEnabled(false);
+ colcombo->setEnabled(false);
+ echocombo->setEnabled(false);
+ langcombo->setEnabled(false);
+}
+
+void KDMAppearanceWidget::loadLanguageList(KLanguageButton *combo)
+{
+ QStringList langlist = KGlobal::dirs()->findAllResources("locale",
+ QString::fromLatin1("*/entry.desktop"));
+ langlist.sort();
+ for ( QStringList::ConstIterator it = langlist.begin();
+ it != langlist.end(); ++it )
+ {
+ QString fpath = (*it).left((*it).length() - 14);
+ int index = fpath.findRev('/');
+ QString nid = fpath.mid(index + 1);
+
+ KSimpleConfig entry(*it);
+ entry.setGroup(QString::fromLatin1("KCM Locale"));
+ QString name = entry.readEntry(QString::fromLatin1("Name"), i18n("without name"));
+ combo->insertLanguage(nid, name, QString::fromLatin1("l10n/"), QString::null);
+ }
+}
+
+void KDMAppearanceWidget::loadColorSchemes(KBackedComboBox *combo)
+{
+ // XXX: Global + local schemes
+ QStringList list = KGlobal::dirs()->
+ findAllResources("data", "kdisplay/color-schemes/*.kcsrc", false, true);
+ for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
+ {
+ KSimpleConfig config(*it, true);
+ config.setGroup("Color Scheme");
+
+ QString str;
+ if (!(str = config.readEntry("Name")).isEmpty() ||
+ !(str = config.readEntry("name")).isEmpty())
+ {
+ QString str2 = (*it).mid( (*it).findRev( '/' ) + 1 ); // strip off path
+ str2.setLength( str2.length() - 6 ); // strip off ".kcsrc
+ combo->insertItem( str2, str );
+ }
+ }
+}
+
+void KDMAppearanceWidget::loadGuiStyles(KBackedComboBox *combo)
+{
+ // XXX: Global + local schemes
+ QStringList list = KGlobal::dirs()->
+ findAllResources("data", "kstyle/themes/*.themerc", false, true);
+ for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
+ {
+ KSimpleConfig config(*it, true);
+
+ if (!(config.hasGroup("KDE") && config.hasGroup("Misc")))
+ continue;
+
+ config.setGroup("Desktop Entry");
+ if (config.readBoolEntry("Hidden", false))
+ continue;
+
+ config.setGroup("KDE");
+ QString str2 = config.readEntry("WidgetStyle");
+ if (str2.isNull())
+ continue;
+
+ config.setGroup("Misc");
+ combo->insertItem( str2, config.readEntry("Name") );
+ }
+}
+
+bool KDMAppearanceWidget::setLogo(QString logo)
+{
+ QString flogo = logo.isEmpty() ?
+ locate("data", QString::fromLatin1("kdm/pics/kdelogo.png") ) :
+ logo;
+ QImage p(flogo);
+ if (p.isNull())
+ return false;
+ if (p.width() > 100 || p.height() > 100)
+ p = p.smoothScale(100, 100, QImage::ScaleMin);
+ logobutton->setPixmap(p);
+ uint bd = style().pixelMetric( QStyle::PM_ButtonMargin ) * 2;
+ logobutton->setFixedSize(p.width() + bd, p.height() + bd);
+ logopath = logo;
+ return true;
+}
+
+
+void KDMAppearanceWidget::slotLogoButtonClicked()
+{
+ KImageIO::registerFormats();
+ KFileDialog dialogue(locate("data", QString::fromLatin1("kdm/pics/")),
+ KImageIO::pattern( KImageIO::Reading ),
+ this, 0, true);
+ dialogue.setOperationMode( KFileDialog::Opening );
+ dialogue.setMode( KFile::File | KFile::LocalOnly );
+
+ KImageFilePreview* imagePreview = new KImageFilePreview( &dialogue );
+ dialogue.setPreviewWidget( imagePreview );
+ if (dialogue.exec() == QDialog::Accepted) {
+ if ( setLogo(dialogue.selectedFile()) ) {
+ changed();
+ }
+ }
+}
+
+
+void KDMAppearanceWidget::slotAreaRadioClicked(int id)
+{
+ logobutton->setEnabled( id == KdmLogo );
+ logoLabel->setEnabled( id == KdmLogo );
+}
+
+
+bool KDMAppearanceWidget::eventFilter(QObject *, QEvent *e)
+{
+ if (e->type() == QEvent::DragEnter) {
+ iconLoaderDragEnterEvent((QDragEnterEvent *) e);
+ return true;
+ }
+
+ if (e->type() == QEvent::Drop) {
+ iconLoaderDropEvent((QDropEvent *) e);
+ return true;
+ }
+
+ return false;
+}
+
+void KDMAppearanceWidget::iconLoaderDragEnterEvent(QDragEnterEvent *e)
+{
+ e->accept(KURLDrag::canDecode(e));
+}
+
+
+KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg);
+
+void KDMAppearanceWidget::iconLoaderDropEvent(QDropEvent *e)
+{
+ KURL pixurl;
+ bool istmp;
+
+ KURL *url = decodeImgDrop(e, this);
+ if (url) {
+
+ // we gotta check if it is a non-local file and make a tmp copy at the hd.
+ if(!url->isLocalFile()) {
+ pixurl.setPath(KGlobal::dirs()->resourceDirs("data").last() +
+ "kdm/pics/" + url->fileName());
+ KIO::NetAccess::copy(*url, pixurl, parentWidget());
+ istmp = true;
+ } else {
+ pixurl = *url;
+ istmp = false;
+ }
+
+ // By now url should be "file:/..."
+ if (!setLogo(pixurl.path())) {
+ KIO::NetAccess::del(pixurl, parentWidget());
+ QString msg = i18n("There was an error loading the image:\n"
+ "%1\n"
+ "It will not be saved.")
+ .arg(pixurl.path());
+ KMessageBox::sorry(this, msg);
+ }
+
+ delete url;
+ }
+}
+
+
+void KDMAppearanceWidget::save()
+{
+ config->setGroup("X-*-Greeter");
+
+ config->writeEntry("GreetString", greetstr_lined->text());
+
+ config->writeEntry("LogoArea", noneRadio->isChecked() ? "None" :
+ logoRadio->isChecked() ? "Logo" : "Clock" );
+
+ config->writeEntry("LogoPixmap", KGlobal::iconLoader()->iconPath(logopath, KIcon::Desktop, true));
+
+ config->writeEntry("GUIStyle", guicombo->currentId());
+
+ config->writeEntry("ColorScheme", colcombo->currentId());
+
+ config->writeEntry("EchoMode", echocombo->currentId());
+
+ config->writeEntry("GreeterPos", xLineEdit->text() + ',' + yLineEdit->text());
+
+ config->writeEntry("Language", langcombo->current());
+}
+
+
+void KDMAppearanceWidget::load()
+{
+ config->setGroup("X-*-Greeter");
+
+ // Read the greeting string
+ greetstr_lined->setText(config->readEntry("GreetString", i18n("Welcome to %s at %n")));
+
+ // Regular logo or clock
+ QString logoArea = config->readEntry("LogoArea", "Logo" );
+ if (logoArea == "Clock") {
+ clockRadio->setChecked(true);
+ slotAreaRadioClicked(KdmClock);
+ } else if (logoArea == "Logo") {
+ logoRadio->setChecked(true);
+ slotAreaRadioClicked(KdmLogo);
+ } else {
+ noneRadio->setChecked(true);
+ slotAreaRadioClicked(KdmNone);
+ }
+
+ // See if we use alternate logo
+ setLogo(config->readEntry("LogoPixmap"));
+
+ // Check the GUI type
+ guicombo->setCurrentId(config->readEntry("GUIStyle"));
+
+ // Check the Color Scheme
+ colcombo->setCurrentId(config->readEntry("ColorScheme"));
+
+ // Check the echo mode
+ echocombo->setCurrentId(config->readEntry("EchoMode", "OneStar"));
+
+ QStringList sl = config->readListEntry( "GreeterPos" );
+ if (sl.count() != 2) {
+ xLineEdit->setText( "50" );
+ yLineEdit->setText( "50" );
+ } else {
+ xLineEdit->setText( sl.first() );
+ yLineEdit->setText( sl.last() );
+ }
+
+ // get the language
+ langcombo->setCurrentItem(config->readEntry("Language", "C"));
+}
+
+
+void KDMAppearanceWidget::defaults()
+{
+ greetstr_lined->setText( i18n("Welcome to %s at %n") );
+ logoRadio->setChecked( true );
+ slotAreaRadioClicked( KdmLogo );
+ setLogo( "" );
+ guicombo->setCurrentId( "" );
+ colcombo->setCurrentId( "" );
+ echocombo->setCurrentItem( "OneStar" );
+
+ xLineEdit->setText( "50" );
+ yLineEdit->setText( "50" );
+
+ langcombo->setCurrentItem( "en_US" );
+}
+
+QString KDMAppearanceWidget::quickHelp() const
+{
+ return i18n("<h1>KDM - Appearance</h1> Here you can configure the basic appearance"
+ " of the KDM login manager, i.e. a greeting string, an icon etc.<p>"
+ " For further refinement of KDM's appearance, see the \"Font\" and \"Background\" "
+ " tabs.");
+}
+
+
+void KDMAppearanceWidget::changed()
+{
+ emit changed(true);
+}
+
+#include "kdm-appear.moc"
diff --git a/kcontrol/kdm/kdm-appear.h b/kcontrol/kdm/kdm-appear.h
new file mode 100644
index 000000000..991b6e4e0
--- /dev/null
+++ b/kcontrol/kdm/kdm-appear.h
@@ -0,0 +1,95 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+#ifndef __KDMAPPEAR_H__
+#define __KDMAPPEAR_H__
+
+
+#include <qdir.h>
+#include <qimage.h>
+#include <qfileinfo.h>
+#include <qpushbutton.h>
+
+#include <kcolorbutton.h>
+#include <kurl.h>
+#include <kfiledialog.h>
+
+
+#include "klanguagebutton.h"
+
+class QComboBox;
+class KBackedComboBox;
+class QLabel;
+class QRadioButton;
+class QLineEdit;
+class KLineEdit;
+
+
+class KDMAppearanceWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KDMAppearanceWidget(QWidget *parent, const char *name=0);
+
+ void load();
+ void save();
+ void defaults();
+ void makeReadOnly();
+ QString quickHelp() const;
+
+ void loadColorSchemes(KBackedComboBox *combo);
+ void loadGuiStyles(KBackedComboBox *combo);
+ void loadLanguageList(KLanguageButton *combo);
+
+ bool eventFilter(QObject *, QEvent *);
+
+signals:
+ void changed( bool state );
+
+protected:
+ void iconLoaderDragEnterEvent(QDragEnterEvent *event);
+ void iconLoaderDropEvent(QDropEvent *event);
+ bool setLogo(QString logo);
+
+private slots:
+ void slotAreaRadioClicked(int id);
+ void slotLogoButtonClicked();
+ void changed();
+
+private:
+ enum { KdmNone, KdmClock, KdmLogo };
+ QLabel *logoLabel;
+ QPushButton *logobutton;
+ KLineEdit *greetstr_lined;
+ QString logopath;
+ QRadioButton *noneRadio;
+ QRadioButton *clockRadio;
+ QRadioButton *logoRadio;
+ QLineEdit *xLineEdit;
+ QLineEdit *yLineEdit;
+ KBackedComboBox *guicombo;
+ KBackedComboBox *colcombo;
+ KBackedComboBox *echocombo;
+ KLanguageButton *langcombo;
+
+};
+
+#endif
diff --git a/kcontrol/kdm/kdm-conv.cpp b/kcontrol/kdm/kdm-conv.cpp
new file mode 100644
index 000000000..71d292c5f
--- /dev/null
+++ b/kcontrol/kdm/kdm-conv.cpp
@@ -0,0 +1,362 @@
+/* This file is part of the KDE Display Manager Configuration package
+
+ Copyright (C) 2000 Oswald Buddenhagen <[email protected]>
+ Based on several other files.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <unistd.h>
+#include <sys/types.h>
+
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qhgroupbox.h>
+#include <qvgroupbox.h>
+#include <qvbuttongroup.h>
+#include <qwhatsthis.h>
+#include <qheader.h>
+
+#include <kdialog.h>
+#include <ksimpleconfig.h>
+#include <klocale.h>
+
+#include "kdm-conv.h"
+
+extern KSimpleConfig *config;
+
+KDMConvenienceWidget::KDMConvenienceWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ QString wtstr;
+
+ QLabel *paranoia = new QLabel( i18n("<qt><center><font color=red><big><b>Attention!<br>Read help!</b></big></font></center></qt>"), this );
+
+ QSizePolicy vpref( QSizePolicy::Minimum, QSizePolicy::Fixed );
+
+ alGroup = new QVGroupBox( i18n("Enable Au&to-Login"), this );
+ alGroup->setCheckable( true );
+ alGroup->setSizePolicy( vpref );
+
+ QWhatsThis::add( alGroup, i18n("Turn on the auto-login feature."
+ " This applies only to KDM's graphical login."
+ " Think twice before enabling this!") );
+ connect(alGroup, SIGNAL(toggled(bool)), SLOT(slotChanged()));
+
+ QWidget *hlpw1 = new QWidget( alGroup );
+ userlb = new KComboBox( hlpw1 );
+ u_label = new QLabel( userlb, i18n("Use&r:"), hlpw1 );
+ QGridLayout *hlpl1 = new QGridLayout(hlpw1, 2, 2, 0, KDialog::spacingHint());
+ hlpl1->setColStretch(2, 1);
+ hlpl1->addWidget(u_label, 0, 0);
+ hlpl1->addWidget(userlb, 0, 1);
+ connect(userlb, SIGNAL(highlighted(int)), SLOT(slotChanged()));
+ wtstr = i18n("Select the user to be logged in automatically.");
+ QWhatsThis::add( u_label, wtstr );
+ QWhatsThis::add( userlb, wtstr );
+ delaysb = new QSpinBox( 0, 3600, 5, hlpw1 );
+ delaysb->setSpecialValueText( i18n("delay", "none") );
+ delaysb->setSuffix( i18n("seconds", " s") );
+ d_label = new QLabel( delaysb, i18n("D&elay:"), hlpw1 );
+ hlpl1->addWidget(d_label, 1, 0);
+ hlpl1->addWidget(delaysb, 1, 1);
+ connect(delaysb, SIGNAL(valueChanged(int)), SLOT(slotChanged()));
+ wtstr = i18n("The delay (in seconds) before the automatic login kicks in. "
+ "This feature is also known as \"timed login\".");
+ QWhatsThis::add( d_label, wtstr );
+ QWhatsThis::add( delaysb, wtstr );
+ againcb = new QCheckBox( i18n("P&ersistent"), alGroup );
+ connect( againcb, SIGNAL(toggled(bool)), SLOT(slotChanged()) );
+ QWhatsThis::add( againcb, i18n("Normally, automatic login is performed only "
+ "when KDM starts up. If this is checked, automatic login will kick in "
+ "after finishing a session as well.") );
+ autoLockCheck = new QCheckBox( i18n("Loc&k session"), alGroup );
+ connect( autoLockCheck, SIGNAL(toggled(bool)), SLOT(slotChanged()) );
+ QWhatsThis::add( autoLockCheck, i18n("If checked, the automatically started session "
+ "will be locked immediately (provided it is a KDE session). This can "
+ "be used to obtain a super-fast login restricted to one user.") );
+
+
+ puGroup = new QVButtonGroup(i18n("Preselect User"), this );
+ puGroup->setSizePolicy( vpref );
+
+ connect(puGroup, SIGNAL(clicked(int)), SLOT(slotPresChanged()));
+ connect(puGroup, SIGNAL(clicked(int)), SLOT(slotChanged()));
+ npRadio = new QRadioButton(i18n("preselected user", "&None"), puGroup);
+ ppRadio = new QRadioButton(i18n("Prev&ious"), puGroup);
+ QWhatsThis::add( ppRadio, i18n("Preselect the user that logged in previously. "
+ "Use this if this computer is usually used several consecutive times by one user.") );
+ spRadio = new QRadioButton(i18n("Specif&y"), puGroup);
+ QWhatsThis::add( spRadio, i18n("Preselect the user specified in the combo box below. "
+ "Use this if this computer is predominantly used by a certain user.") );
+ QWidget *hlpw = new QWidget(puGroup);
+ puserlb = new KComboBox(true, hlpw);
+ pu_label = new QLabel(puserlb, i18n("Us&er:"), hlpw);
+ connect(puserlb, SIGNAL(textChanged(const QString &)), SLOT(slotChanged()));
+ wtstr = i18n("Select the user to be preselected for login. "
+ "This box is editable, so you can specify an arbitrary non-existent "
+ "user to mislead possible attackers.");
+ QWhatsThis::add( pu_label, wtstr );
+ QWhatsThis::add( puserlb, wtstr );
+ QBoxLayout *hlpl = new QHBoxLayout(hlpw, 0, KDialog::spacingHint());
+ hlpl->addWidget(pu_label);
+ hlpl->addWidget(puserlb);
+ hlpl->addStretch( 1 );
+ cbjumppw = new QCheckBox(i18n("Focus pass&word"), puGroup);
+ QWhatsThis::add( cbjumppw, i18n("When this option is on, KDM will place the cursor "
+ "in the password field instead of the user field after preselecting a user. "
+ "Use this to save one key press per login, if the preselection usually does not need to "
+ "be changed.") );
+ connect(cbjumppw, SIGNAL(toggled(bool)), SLOT(slotChanged()));
+
+ npGroup = new QVGroupBox(i18n("Enable Password-&Less Logins"), this );
+ npGroup->setCheckable( true );
+
+ QWhatsThis::add( npGroup, i18n("When this option is checked, the checked users from"
+ " the list below will be allowed to log in without entering their"
+ " password. This applies only to KDM's graphical login."
+ " Think twice before enabling this!") );
+
+ connect(npGroup, SIGNAL(toggled(bool)), SLOT(slotChanged()));
+
+ pl_label = new QLabel(i18n("No password re&quired for:"), npGroup);
+ npuserlv = new KListView(npGroup);
+ pl_label->setBuddy(npuserlv);
+ npuserlv->addColumn(QString::null);
+ npuserlv->header()->hide();
+ npuserlv->setResizeMode(QListView::LastColumn);
+ QWhatsThis::add(npuserlv, i18n("Check all users you want to allow a password-less login for."
+ " Entries denoted with '@' are user groups. Checking a group is like checking all users in that group."));
+ connect( npuserlv, SIGNAL(clicked( QListViewItem * )),
+ SLOT(slotChanged()) );
+
+ btGroup = new QVGroupBox( i18n("Miscellaneous"), this );
+
+ cbarlen = new QCheckBox(i18n("Automatically log in again after &X server crash"), btGroup);
+ QWhatsThis::add( cbarlen, i18n("When this option is on, a user will be"
+ " logged in again automatically when their session is interrupted by an"
+ " X server crash; note that this can open a security hole: if you use"
+ " a screen locker than KDE's integrated one, this will make"
+ " circumventing a password-secured screen lock possible.") );
+ connect(cbarlen, SIGNAL(toggled(bool)), SLOT(slotChanged()));
+
+ QGridLayout *main = new QGridLayout(this, 5, 2, 10);
+ main->addWidget(paranoia, 0, 0);
+ main->addWidget(alGroup, 1, 0);
+ main->addWidget(puGroup, 2, 0);
+ main->addMultiCellWidget(npGroup, 0,3, 1,1);
+ main->addMultiCellWidget(btGroup, 4,4, 0,1);
+ main->setColStretch(0, 1);
+ main->setColStretch(1, 2);
+ main->setRowStretch(3, 1);
+
+ connect( userlb, SIGNAL(activated( const QString & )),
+ SLOT(slotSetAutoUser( const QString & )) );
+ connect( puserlb, SIGNAL(textChanged( const QString & )),
+ SLOT(slotSetPreselUser( const QString & )) );
+ connect( npuserlv, SIGNAL(clicked( QListViewItem * )),
+ SLOT(slotUpdateNoPassUser( QListViewItem * )) );
+
+}
+
+void KDMConvenienceWidget::makeReadOnly()
+{
+ ((QWidget*)alGroup->child("qt_groupbox_checkbox"))->setEnabled(false);
+ userlb->setEnabled(false);
+ delaysb->setEnabled(false);
+ againcb->setEnabled(false);
+ autoLockCheck->setEnabled(false);
+ ((QWidget*)npGroup->child("qt_groupbox_checkbox"))->setEnabled(false);
+ npuserlv->setEnabled(false);
+ cbarlen->setEnabled(false);
+ npRadio->setEnabled(false);
+ ppRadio->setEnabled(false);
+ spRadio->setEnabled(false);
+ puserlb->setEnabled(false);
+ cbjumppw->setEnabled(false);
+}
+
+void KDMConvenienceWidget::slotPresChanged()
+{
+ bool en = spRadio->isChecked();
+ pu_label->setEnabled(en);
+ puserlb->setEnabled(en);
+ cbjumppw->setEnabled(!npRadio->isChecked());
+}
+
+void KDMConvenienceWidget::save()
+{
+ config->setGroup("X-:0-Core");
+ config->writeEntry( "AutoLoginEnable", alGroup->isChecked() );
+ config->writeEntry( "AutoLoginUser", userlb->currentText() );
+ config->writeEntry( "AutoLoginDelay", delaysb->value() );
+ config->writeEntry( "AutoLoginAgain", againcb->isChecked() );
+ config->writeEntry( "AutoLoginLocked", autoLockCheck->isChecked() );
+
+ config->setGroup("X-:*-Core");
+ config->writeEntry( "NoPassEnable", npGroup->isChecked() );
+ config->writeEntry( "NoPassUsers", noPassUsers );
+
+ config->setGroup("X-*-Core");
+ config->writeEntry( "AutoReLogin", cbarlen->isChecked() );
+
+ config->setGroup("X-:*-Greeter");
+ config->writeEntry( "PreselectUser", npRadio->isChecked() ? "None" :
+ ppRadio->isChecked() ? "Previous" :
+ "Default" );
+ config->writeEntry( "DefaultUser", puserlb->currentText() );
+ config->writeEntry( "FocusPasswd", cbjumppw->isChecked() );
+}
+
+
+void KDMConvenienceWidget::load()
+{
+ config->setGroup("X-:0-Core");
+ bool alenable = config->readBoolEntry( "AutoLoginEnable", false);
+ autoUser = config->readEntry( "AutoLoginUser" );
+ delaysb->setValue( config->readNumEntry( "AutoLoginDelay", 0 ) );
+ againcb->setChecked( config->readBoolEntry( "AutoLoginAgain", false ) );
+ autoLockCheck->setChecked( config->readBoolEntry( "AutoLoginLocked", false ) );
+ if (autoUser.isEmpty())
+ alenable=false;
+ alGroup->setChecked( alenable );
+
+ config->setGroup("X-:*-Core");
+ npGroup->setChecked(config->readBoolEntry( "NoPassEnable", false) );
+ noPassUsers = config->readListEntry( "NoPassUsers");
+
+ config->setGroup("X-*-Core");
+ cbarlen->setChecked(config->readBoolEntry( "AutoReLogin", false) );
+
+ config->setGroup("X-:*-Greeter");
+ QString presstr = config->readEntry( "PreselectUser", "None" );
+ if (presstr == "Previous")
+ ppRadio->setChecked(true);
+ else if (presstr == "Default")
+ spRadio->setChecked(true);
+ else
+ npRadio->setChecked(true);
+ preselUser = config->readEntry( "DefaultUser" );
+ cbjumppw->setChecked(config->readBoolEntry( "FocusPasswd", false) );
+
+ slotPresChanged();
+}
+
+
+void KDMConvenienceWidget::defaults()
+{
+ alGroup->setChecked(false);
+ delaysb->setValue(0);
+ againcb->setChecked(false);
+ autoLockCheck->setChecked(false);
+ npRadio->setChecked(true);
+ npGroup->setChecked(false);
+ cbarlen->setChecked(false);
+ cbjumppw->setChecked(false);
+ autoUser = "";
+ preselUser = "";
+ noPassUsers.clear();
+
+ slotPresChanged();
+}
+
+
+void KDMConvenienceWidget::slotChanged()
+{
+ emit changed(true);
+}
+
+void KDMConvenienceWidget::slotSetAutoUser( const QString &user )
+{
+ autoUser = user;
+}
+
+void KDMConvenienceWidget::slotSetPreselUser( const QString &user )
+{
+ preselUser = user;
+}
+
+void KDMConvenienceWidget::slotUpdateNoPassUser( QListViewItem *item )
+{
+ if ( !item )
+ return;
+ QCheckListItem *itm = (QCheckListItem *)item;
+ QStringList::iterator it = noPassUsers.find( itm->text() );
+ if (itm->isOn()) {
+ if (it == noPassUsers.end())
+ noPassUsers.append( itm->text() );
+ } else {
+ if (it != noPassUsers.end())
+ noPassUsers.remove( it );
+ }
+}
+
+void KDMConvenienceWidget::slotClearUsers()
+{
+ userlb->clear();
+ puserlb->clear();
+ npuserlv->clear();
+ if (!autoUser.isEmpty())
+ userlb->insertItem(autoUser);
+ if (!preselUser.isEmpty())
+ puserlb->insertItem(preselUser);
+}
+
+void KDMConvenienceWidget::slotAddUsers(const QMap<QString,int> &users)
+{
+ QMapConstIterator<QString,int> it;
+ for (it = users.begin(); it != users.end(); ++it) {
+ if (it.data() > 0) {
+ if (it.key() != autoUser)
+ userlb->insertItem(it.key());
+ if (it.key() != preselUser)
+ puserlb->insertItem(it.key());
+ }
+ if (it.data() != 0)
+ (new QCheckListItem(npuserlv, it.key(), QCheckListItem::CheckBox))->
+ setOn(noPassUsers.find(it.key()) != noPassUsers.end());
+ }
+
+ if (userlb->listBox())
+ userlb->listBox()->sort();
+
+ if (puserlb->listBox())
+ puserlb->listBox()->sort();
+
+ npuserlv->sort();
+ userlb->setCurrentItem(autoUser);
+ puserlb->setCurrentItem(preselUser);
+}
+
+void KDMConvenienceWidget::slotDelUsers(const QMap<QString,int> &users)
+{
+ QMapConstIterator<QString,int> it;
+ for (it = users.begin(); it != users.end(); ++it) {
+ if (it.data() > 0) {
+ if (it.key() != autoUser && userlb->listBox())
+ delete userlb->listBox()->
+ findItem( it.key(), ExactMatch | CaseSensitive );
+ if (it.key() != preselUser && puserlb->listBox())
+ delete puserlb->listBox()->
+ findItem( it.key(), ExactMatch | CaseSensitive );
+ }
+ if (it.data() != 0)
+ delete npuserlv->findItem( it.key(), 0 );
+ }
+}
+
+#include "kdm-conv.moc"
diff --git a/kcontrol/kdm/kdm-conv.h b/kcontrol/kdm/kdm-conv.h
new file mode 100644
index 000000000..c00128629
--- /dev/null
+++ b/kcontrol/kdm/kdm-conv.h
@@ -0,0 +1,84 @@
+/* This file is part of the KDE Display Manager Configuration package
+
+ Copyright (C) 2000 Oswald Buddenhagen <[email protected]>
+ Based on several other files.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __KDMCONV_H__
+#define __KDMCONV_H__
+
+#include <qptrlist.h>
+#include <qstring.h>
+#include <qimage.h>
+#include <qgroupbox.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+
+#include <klistbox.h>
+#include <kcombobox.h>
+#include <kcolorbutton.h>
+#include <klistview.h>
+#include <kurl.h>
+
+#include <pwd.h>
+
+
+class KDMConvenienceWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KDMConvenienceWidget(QWidget *parent=0, const char *name=0);
+
+ void load();
+ void save();
+ void defaults();
+ void makeReadOnly();
+
+public slots:
+ void slotClearUsers();
+ void slotAddUsers(const QMap<QString,int> &);
+ void slotDelUsers(const QMap<QString,int> &);
+
+
+signals:
+ void changed( bool state );
+
+private slots:
+ void slotPresChanged();
+ void slotChanged();
+ void slotSetAutoUser( const QString &user );
+ void slotSetPreselUser( const QString &user );
+ void slotUpdateNoPassUser( QListViewItem *item );
+
+private:
+ QGroupBox *alGroup, *puGroup, *npGroup, *btGroup;
+ QCheckBox *againcb, *cbarlen, *cbjumppw, *autoLockCheck;
+ QRadioButton *npRadio, *ppRadio, *spRadio;
+ KComboBox *userlb, *puserlb;
+ QSpinBox *delaysb;
+ KListView *npuserlv;
+ QLabel *u_label, *d_label, *pu_label, *w_label, *n_label, *pl_label;
+ QString autoUser, preselUser;
+ QStringList noPassUsers;
+};
+
+#endif
+
+
diff --git a/kcontrol/kdm/kdm-font.cpp b/kcontrol/kdm/kdm-font.cpp
new file mode 100644
index 000000000..da67e5eaa
--- /dev/null
+++ b/kcontrol/kdm/kdm-font.cpp
@@ -0,0 +1,134 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <unistd.h>
+#include <sys/types.h>
+
+
+#include <qapplication.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qwhatsthis.h>
+
+#include <kdialog.h>
+#include <ksimpleconfig.h>
+#include <kfontrequester.h>
+#include <klocale.h>
+
+#include "kdm-font.h"
+
+
+extern KSimpleConfig *config;
+
+KDMFontWidget::KDMFontWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ QGridLayout *ml = new QGridLayout(this, 5, 2, KDialog::marginHint(), KDialog::spacingHint());
+ QLabel *label = new QLabel(i18n("&General:"), this);
+ stdFontChooser = new KFontRequester(this);
+ label->setBuddy(stdFontChooser);
+ QWhatsThis::add( stdFontChooser, i18n("This changes the font which is used for all the text in the login manager except for the greeting and failure messages.") );
+ connect(stdFontChooser, SIGNAL(fontSelected(const QFont&)),this,SLOT(configChanged()));
+ ml->addWidget(label, 1, 0);
+ ml->addWidget(stdFontChooser, 1, 1);
+
+ label = new QLabel(i18n("&Failures:"), this);
+ failFontChooser = new KFontRequester(this);
+ label->setBuddy(failFontChooser);
+ QWhatsThis::add( failFontChooser, i18n("This changes the font which is used for failure messages in the login manager.") );
+ connect(failFontChooser, SIGNAL(fontSelected(const QFont&)),this,SLOT(configChanged()));
+ ml->addWidget(label, 2, 0);
+ ml->addWidget(failFontChooser, 2, 1);
+
+ label = new QLabel(i18n("Gree&ting:"), this);
+ greetingFontChooser = new KFontRequester(this);
+ label->setBuddy(greetingFontChooser);
+ QWhatsThis::add( greetingFontChooser, i18n("This changes the font which is used for the login manager's greeting.") );
+ connect(greetingFontChooser, SIGNAL(fontSelected(const QFont&)),this,SLOT(configChanged()));
+ ml->addWidget(label, 3, 0);
+ ml->addWidget(greetingFontChooser, 3, 1);
+
+ aacb = new QCheckBox (i18n("Use anti-aliasing for fonts"), this);
+ QWhatsThis::add( aacb, i18n("If you check this box and your X-Server has the Xft extension, "
+ "fonts will be antialiased (smoothed) in the login dialog.") );
+ connect(aacb, SIGNAL(toggled ( bool )),this,SLOT(configChanged()));
+ ml->addMultiCellWidget(aacb, 4, 4, 0, 1);
+ ml->setRowStretch(5, 10);
+}
+
+void KDMFontWidget::makeReadOnly()
+{
+ stdFontChooser->button()->setEnabled(false);
+ failFontChooser->button()->setEnabled(false);
+ greetingFontChooser->button()->setEnabled(false);
+ aacb->setEnabled(false);
+}
+
+void KDMFontWidget::configChanged()
+{
+ emit changed(true);
+}
+
+void KDMFontWidget::set_def()
+{
+ stdFontChooser->setFont(QFont("Sans Serif", 10));
+ failFontChooser->setFont(QFont("Sans Serif", 10, QFont::Bold));
+ greetingFontChooser->setFont(QFont("Serif", 20));
+}
+
+void KDMFontWidget::save()
+{
+ config->setGroup("X-*-Greeter");
+
+ // write font
+ config->writeEntry("StdFont", stdFontChooser->font());
+ config->writeEntry("GreetFont", greetingFontChooser->font());
+ config->writeEntry("FailFont", failFontChooser->font());
+ config->writeEntry("AntiAliasing", aacb->isChecked());
+}
+
+
+void KDMFontWidget::load()
+{
+ set_def();
+
+ config->setGroup("X-*-Greeter");
+
+ // Read the fonts
+ QFont font = stdFontChooser->font();
+ stdFontChooser->setFont(config->readFontEntry("StdFont", &font));
+ font = failFontChooser->font();
+ failFontChooser->setFont(config->readFontEntry("FailFont", &font));
+ font = greetingFontChooser->font();
+ greetingFontChooser->setFont(config->readFontEntry("GreetFont", &font));
+
+ aacb->setChecked(config->readBoolEntry("AntiAliasing"));
+}
+
+
+void KDMFontWidget::defaults()
+{
+ set_def();
+ aacb->setChecked(false);
+}
+
+#include "kdm-font.moc"
diff --git a/kcontrol/kdm/kdm-font.h b/kcontrol/kdm/kdm-font.h
new file mode 100644
index 000000000..232db3cb4
--- /dev/null
+++ b/kcontrol/kdm/kdm-font.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __KDMFONT_H__
+#define __KDMFONT_H__
+
+#include <qwidget.h>
+
+class KFontRequester;
+class QCheckBox;
+
+class KDMFontWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KDMFontWidget(QWidget *parent=0, const char *name=0);
+
+ void load();
+ void save();
+ void defaults();
+ void makeReadOnly();
+
+signals:
+ void changed( bool state );
+
+protected slots:
+ void configChanged();
+ void set_def();
+
+private:
+ QCheckBox *aacb;
+ KFontRequester *greetingFontChooser;
+ KFontRequester *failFontChooser;
+ KFontRequester *stdFontChooser;
+};
+
+
+#endif
+
+
diff --git a/kcontrol/kdm/kdm-shut.cpp b/kcontrol/kdm/kdm-shut.cpp
new file mode 100644
index 000000000..c958e1464
--- /dev/null
+++ b/kcontrol/kdm/kdm-shut.cpp
@@ -0,0 +1,227 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997-1998 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <unistd.h>
+#include <sys/types.h>
+
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qwhatsthis.h>
+
+#include <ksimpleconfig.h>
+#include <karrowbutton.h>
+#include <klineedit.h>
+#include <klocale.h>
+#include <kdialog.h>
+#include <kurlrequester.h>
+
+#include "kdm-shut.h"
+#include "kbackedcombobox.h"
+
+extern KSimpleConfig *config;
+
+
+KDMSessionsWidget::KDMSessionsWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ QString wtstr;
+
+
+ QGroupBox *group0 = new QGroupBox( i18n("Allow Shutdown"), this );
+
+ sdlcombo = new QComboBox( FALSE, group0 );
+ sdllabel = new QLabel (sdlcombo, i18n ("&Local:"), group0);
+ sdlcombo->insertItem(i18n("Everybody"), SdAll);
+ sdlcombo->insertItem(i18n("Only Root"), SdRoot);
+ sdlcombo->insertItem(i18n("Nobody"), SdNone);
+ connect(sdlcombo, SIGNAL(activated(int)), SLOT(changed()));
+ sdrcombo = new QComboBox( FALSE, group0 );
+ sdrlabel = new QLabel (sdrcombo, i18n ("&Remote:"), group0);
+ sdrcombo->insertItem(i18n("Everybody"), SdAll);
+ sdrcombo->insertItem(i18n("Only Root"), SdRoot);
+ sdrcombo->insertItem(i18n("Nobody"), SdNone);
+ connect(sdrcombo, SIGNAL(activated(int)), SLOT(changed()));
+ QWhatsThis::add( group0, i18n("Here you can select who is allowed to shutdown"
+ " the computer using KDM. You can specify different values for local (console) and remote displays. "
+ "Possible values are:<ul>"
+ " <li><em>Everybody:</em> everybody can shutdown the computer using KDM</li>"
+ " <li><em>Only root:</em> KDM will only allow shutdown after the user has entered the root password</li>"
+ " <li><em>Nobody:</em> nobody can shutdown the computer using KDM</li></ul>") );
+
+
+ QGroupBox *group1 = new QGroupBox( i18n("Commands"), this );
+
+ shutdown_lined = new KURLRequester(group1);
+ QLabel *shutdown_label = new QLabel(shutdown_lined, i18n("H&alt:"), group1);
+ connect(shutdown_lined, SIGNAL(textChanged(const QString&)),
+ SLOT(changed()));
+ wtstr = i18n("Command to initiate the system halt. Typical value: /sbin/halt");
+ QWhatsThis::add( shutdown_label, wtstr );
+ QWhatsThis::add( shutdown_lined, wtstr );
+
+ restart_lined = new KURLRequester(group1);
+ QLabel *restart_label = new QLabel(restart_lined, i18n("Reb&oot:"), group1);
+ connect(restart_lined, SIGNAL(textChanged(const QString&)),
+ SLOT(changed()));
+ wtstr = i18n("Command to initiate the system reboot. Typical value: /sbin/reboot");
+ QWhatsThis::add( restart_label, wtstr );
+ QWhatsThis::add( restart_lined, wtstr );
+
+
+ QGroupBox *group4 = new QGroupBox( i18n("Miscellaneous"), this );
+
+ bm_combo = new KBackedComboBox( group4 );
+ bm_combo->insertItem("None", i18n("boot manager", "None"));
+ bm_combo->insertItem("Grub", i18n("Grub"));
+#if defined(__linux__) && ( defined(__i386__) || defined(__amd64__) )
+ bm_combo->insertItem("Lilo", i18n("Lilo"));
+#endif
+ QLabel *bm_label = new QLabel( bm_combo, i18n("Boot manager:"), group4 );
+ connect(bm_combo, SIGNAL(activated(int)), SLOT(changed()));
+ wtstr = i18n("Enable boot options in the \"Shutdown...\" dialog.");
+ QWhatsThis::add( bm_label, wtstr );
+ QWhatsThis::add( bm_combo, wtstr );
+
+ QBoxLayout *main = new QVBoxLayout( this, 10 );
+ QGridLayout *lgroup0 = new QGridLayout( group0, 1, 1, 10);
+ QGridLayout *lgroup1 = new QGridLayout( group1, 1, 1, 10);
+ QGridLayout *lgroup4 = new QGridLayout( group4, 1, 1, 10);
+
+ main->addWidget(group0);
+ main->addWidget(group1);
+ main->addWidget(group4);
+ main->addStretch();
+
+ lgroup0->addRowSpacing(0, group0->fontMetrics().height()/2);
+ lgroup0->addColSpacing(2, KDialog::spacingHint() * 2);
+ lgroup0->setColStretch(1, 1);
+ lgroup0->setColStretch(4, 1);
+ lgroup0->addWidget(sdllabel, 1, 0);
+ lgroup0->addWidget(sdlcombo, 1, 1);
+ lgroup0->addWidget(sdrlabel, 1, 3);
+ lgroup0->addWidget(sdrcombo, 1, 4);
+
+ lgroup1->addRowSpacing(0, group1->fontMetrics().height()/2);
+ lgroup1->addColSpacing(2, KDialog::spacingHint() * 2);
+ lgroup1->setColStretch(1, 1);
+ lgroup1->setColStretch(4, 1);
+ lgroup1->addWidget(shutdown_label, 1, 0);
+ lgroup1->addWidget(shutdown_lined, 1, 1);
+ lgroup1->addWidget(restart_label, 1, 3);
+ lgroup1->addWidget(restart_lined, 1, 4);
+
+ lgroup4->addRowSpacing(0, group4->fontMetrics().height()/2);
+ lgroup4->addWidget(bm_label, 1, 0);
+ lgroup4->addWidget(bm_combo, 1, 1);
+ lgroup4->setColStretch(2, 1);
+
+ main->activate();
+
+}
+
+void KDMSessionsWidget::makeReadOnly()
+{
+ sdlcombo->setEnabled(false);
+ sdrcombo->setEnabled(false);
+
+ restart_lined->lineEdit()->setReadOnly(true);
+ restart_lined->button()->setEnabled(false);
+ shutdown_lined->lineEdit()->setReadOnly(true);
+ shutdown_lined->button()->setEnabled(false);
+
+ bm_combo->setEnabled(false);
+}
+
+void KDMSessionsWidget::writeSD(QComboBox *combo)
+{
+ QString what;
+ switch (combo->currentItem()) {
+ case SdAll: what = "All"; break;
+ case SdRoot: what = "Root"; break;
+ default: what = "None"; break;
+ }
+ config->writeEntry( "AllowShutdown", what);
+}
+
+void KDMSessionsWidget::save()
+{
+ config->setGroup("X-:*-Core");
+ writeSD(sdlcombo);
+
+ config->setGroup("X-*-Core");
+ writeSD(sdrcombo);
+
+ config->setGroup("Shutdown");
+ config->writeEntry("HaltCmd", shutdown_lined->url(), true);
+ config->writeEntry("RebootCmd", restart_lined->url(), true);
+
+ config->writeEntry("BootManager", bm_combo->currentId());
+}
+
+void KDMSessionsWidget::readSD(QComboBox *combo, QString def)
+{
+ QString str = config->readEntry("AllowShutdown", def);
+ SdModes sdMode;
+ if(str == "All")
+ sdMode = SdAll;
+ else if(str == "Root")
+ sdMode = SdRoot;
+ else
+ sdMode = SdNone;
+ combo->setCurrentItem(sdMode);
+}
+
+void KDMSessionsWidget::load()
+{
+ config->setGroup("X-:*-Core");
+ readSD(sdlcombo, "All");
+
+ config->setGroup("X-*-Core");
+ readSD(sdrcombo, "Root");
+
+ config->setGroup("Shutdown");
+ restart_lined->setURL(config->readEntry("RebootCmd", "/sbin/reboot"));
+ shutdown_lined->setURL(config->readEntry("HaltCmd", "/sbin/halt"));
+
+ bm_combo->setCurrentId(config->readEntry("BootManager", "None"));
+}
+
+
+
+void KDMSessionsWidget::defaults()
+{
+ restart_lined->setURL("/sbin/reboot");
+ shutdown_lined->setURL("/sbin/halt");
+
+ sdlcombo->setCurrentItem(SdAll);
+ sdrcombo->setCurrentItem(SdRoot);
+
+ bm_combo->setCurrentId("None");
+}
+
+
+void KDMSessionsWidget::changed()
+{
+ emit changed(true);
+}
+
+#include "kdm-shut.moc"
diff --git a/kcontrol/kdm/kdm-shut.h b/kcontrol/kdm/kdm-shut.h
new file mode 100644
index 000000000..8bad7d5a0
--- /dev/null
+++ b/kcontrol/kdm/kdm-shut.h
@@ -0,0 +1,64 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __KDMSESS_H__
+#define __KDMSESS_H__
+
+
+#include <qstring.h>
+
+class QComboBox;
+class QCheckBox;
+class KURLRequester;
+class KBackedComboBox;
+
+class KDMSessionsWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KDMSessionsWidget(QWidget *parent=0, const char *name=0);
+
+ void load();
+ void save();
+ void defaults();
+ void makeReadOnly();
+
+ enum SdModes { SdAll, SdRoot, SdNone };
+
+signals:
+ void changed( bool state );
+
+protected slots:
+ void changed();
+
+private:
+ void readSD (QComboBox *, QString);
+ void writeSD (QComboBox *);
+
+ QComboBox *sdlcombo, *sdrcombo;
+ QLabel *sdllabel, *sdrlabel;
+ KURLRequester *restart_lined, *shutdown_lined;
+ KBackedComboBox *bm_combo;
+};
+
+
+#endif
+
+
diff --git a/kcontrol/kdm/kdm-users.cpp b/kcontrol/kdm/kdm-users.cpp
new file mode 100644
index 000000000..d8a540bd3
--- /dev/null
+++ b/kcontrol/kdm/kdm-users.cpp
@@ -0,0 +1,500 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <qstyle.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qtooltip.h>
+#include <qvalidator.h>
+#include <qwhatsthis.h>
+#include <qvgroupbox.h>
+#include <qpushbutton.h>
+
+#include <kfiledialog.h>
+#include <kimageio.h>
+#include <kimagefilepreview.h>
+#include <kio/netaccess.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+#include <kurldrag.h>
+
+#include "kdm-users.h"
+
+#include <sys/stat.h>
+
+
+extern KSimpleConfig *config;
+
+KDMUsersWidget::KDMUsersWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+#ifdef __linux__
+ struct stat st;
+ if (!stat( "/etc/debian_version", &st )) { /* debian */
+ defminuid = "1000";
+ defmaxuid = "29999";
+ } else if (!stat( "/usr/portage", &st )) { /* gentoo */
+ defminuid = "1000";
+ defmaxuid = "65000";
+ } else if (!stat( "/etc/mandrake-release", &st )) { /* mandrake - check before redhat! */
+ defminuid = "500";
+ defmaxuid = "65000";
+ } else if (!stat( "/etc/redhat-release", &st )) { /* redhat */
+ defminuid = "100";
+ defmaxuid = "65000";
+ } else /* if (!stat( "/etc/SuSE-release", &st )) */ { /* suse */
+ defminuid = "500";
+ defmaxuid = "65000";
+ }
+#else
+ defminuid = "1000";
+ defmaxuid = "65000";
+#endif
+
+ // We assume that $kde_datadir/kdm exists, but better check for pics/ and pics/users,
+ // and create them if necessary.
+ config->setGroup( "X-*-Greeter" );
+ m_userPixDir = config->readEntry( "FaceDir", KGlobal::dirs()->resourceDirs("data").last() + "kdm/faces" ) + '/';
+ m_notFirst = false;
+ QDir testDir( m_userPixDir );
+ if ( !testDir.exists() && !testDir.mkdir( testDir.absPath() ) && !geteuid() )
+ KMessageBox::sorry( this, i18n("Unable to create folder %1").arg( testDir.absPath() ) );
+ chmod( QFile::encodeName( m_userPixDir ), 0755 );
+
+ m_defaultText = i18n("<default>");
+
+ QString wtstr;
+
+ minGroup = new QGroupBox( 2, Horizontal, i18n("System U&IDs"), this );
+ QWhatsThis::add( minGroup, i18n("Users with a UID (numerical user identification) outside this range will not be listed by KDM and this setup dialog."
+ " Note that users with the UID 0 (typically root) are not affected by this and must be"
+ " explicitly hidden in \"Not hidden\" mode."));
+ QSizePolicy sp_ign_fix( QSizePolicy::Ignored, QSizePolicy::Fixed );
+ QValidator *valid = new QIntValidator( 0, 999999, minGroup );
+ QLabel *minlab = new QLabel( i18n("Below:"), minGroup );
+ leminuid = new KLineEdit( minGroup );
+ minlab->setBuddy( leminuid );
+ leminuid->setSizePolicy( sp_ign_fix );
+ leminuid->setValidator( valid );
+ connect( leminuid, SIGNAL(textChanged( const QString & )), SLOT(slotChanged()) );
+ connect( leminuid, SIGNAL(textChanged( const QString & )), SLOT(slotMinMaxChanged()) );
+ QLabel *maxlab = new QLabel( i18n("Above:"), minGroup );
+ lemaxuid = new KLineEdit( minGroup );
+ maxlab->setBuddy( lemaxuid );
+ lemaxuid->setSizePolicy( sp_ign_fix );
+ lemaxuid->setValidator( valid );
+ connect(lemaxuid, SIGNAL(textChanged( const QString & )), SLOT(slotChanged()) );
+ connect(lemaxuid, SIGNAL(textChanged( const QString & )), SLOT(slotMinMaxChanged()) );
+
+ usrGroup = new QButtonGroup( 5, Qt::Vertical, i18n("Users"), this );
+ connect( usrGroup, SIGNAL(clicked( int )), SLOT(slotShowOpts()) );
+ connect( usrGroup, SIGNAL(clicked( int )), SLOT(slotChanged()) );
+ cbshowlist = new QCheckBox( i18n("Show list"), usrGroup );
+ QWhatsThis::add( cbshowlist, i18n("If this option is checked, KDM will show a list of users,"
+ " so users can click on their name or image rather than typing in their login.") );
+ cbcomplete = new QCheckBox( i18n("Autocompletion"), usrGroup );
+ QWhatsThis::add( cbcomplete, i18n("If this option is checked, KDM will automatically complete"
+ " user names while they are typed in the line edit.") );
+ cbinverted = new QCheckBox( i18n("Inverse selection"), usrGroup );
+ QWhatsThis::add( cbinverted, i18n("This option specifies how the users for \"Show list\" and \"Autocompletion\""
+ " are selected in the \"Select users and groups\" list: "
+ "If not checked, select only the checked users. "
+ "If checked, select all non-system users, except the checked ones."));
+ cbusrsrt = new QCheckBox( i18n("Sor&t users"), usrGroup );
+ connect( cbusrsrt, SIGNAL(toggled( bool )), SLOT(slotChanged()) );
+ QWhatsThis::add( cbusrsrt, i18n("If this is checked, KDM will alphabetically sort the user list."
+ " Otherwise users are listed in the order they appear in the password file.") );
+
+ wstack = new QWidgetStack( this );
+ s_label = new QLabel( wstack, i18n("S&elect users and groups:"), this );
+ optinlv = new KListView( this );
+ optinlv->addColumn( i18n("Selected Users") );
+ optinlv->setResizeMode( QListView::LastColumn );
+ QWhatsThis::add( optinlv, i18n("KDM will show all checked users. Entries denoted with '@' are user groups. Checking a group is like checking all users in that group.") );
+ wstack->addWidget( optinlv );
+ connect( optinlv, SIGNAL(clicked( QListViewItem * )),
+ SLOT(slotUpdateOptIn( QListViewItem * )) );
+ connect( optinlv, SIGNAL(clicked( QListViewItem * )),
+ SLOT(slotChanged()) );
+ optoutlv = new KListView( this );
+ optoutlv->addColumn( i18n("Hidden Users") );
+ optoutlv->setResizeMode( QListView::LastColumn );
+ QWhatsThis::add( optoutlv, i18n("KDM will show all non-checked non-system users. Entries denoted with '@' are user groups. Checking a group is like checking all users in that group.") );
+ wstack->addWidget( optoutlv );
+ connect( optoutlv, SIGNAL(clicked( QListViewItem * )),
+ SLOT(slotUpdateOptOut( QListViewItem * )) );
+ connect( optoutlv, SIGNAL(clicked( QListViewItem * )),
+ SLOT(slotChanged()) );
+
+ faceGroup = new QButtonGroup( 5, Qt::Vertical, i18n("User Image Source"), this );
+ QWhatsThis::add( faceGroup, i18n("Here you can specify where KDM will obtain the images that represent users."
+ " \"Admin\" represents the global folder; these are the pictures you can set below."
+ " \"User\" means that KDM should read the user's $HOME/.face.icon file."
+ " The two selections in the middle define the order of preference if both sources are available.") );
+ connect( faceGroup, SIGNAL(clicked( int )), SLOT(slotFaceOpts()) );
+ connect( faceGroup, SIGNAL(clicked( int )), SLOT(slotChanged()) );
+ rbadmonly = new QRadioButton( i18n("Admin"), faceGroup );
+ rbprefadm = new QRadioButton( i18n("Admin, user"), faceGroup );
+ rbprefusr = new QRadioButton( i18n("User, admin"), faceGroup );
+ rbusronly = new QRadioButton( i18n("User"), faceGroup );
+
+ QGroupBox *picGroup = new QVGroupBox( i18n("User Images"), this );
+ QWidget *hlpw = new QWidget( picGroup );
+ usercombo = new KComboBox( hlpw );
+ QWhatsThis::add( usercombo, i18n("The user the image below belongs to.") );
+ connect( usercombo, SIGNAL(activated( int )),
+ SLOT(slotUserSelected()) );
+ QLabel *userlabel = new QLabel( usercombo, i18n("User:"), hlpw );
+ userbutton = new QPushButton( hlpw );
+ userbutton->setAcceptDrops( true );
+ userbutton->installEventFilter( this ); // for drag and drop
+ uint sz = style().pixelMetric( QStyle::PM_ButtonMargin ) * 2 + 48;
+ userbutton->setFixedSize( sz, sz );
+ connect( userbutton, SIGNAL(clicked()),
+ SLOT(slotUserButtonClicked()) );
+ QToolTip::add( userbutton, i18n("Click or drop an image here") );
+ QWhatsThis::add( userbutton, i18n("Here you can see the image assigned to the user selected in the combo box above. Click on the image button to select from a list"
+ " of images or drag and drop your own image on to the button (e.g. from Konqueror).") );
+ rstuserbutton = new QPushButton( i18n("Unset"), hlpw );
+ QWhatsThis::add( rstuserbutton, i18n("Click this button to make KDM use the default image for the selected user.") );
+ connect( rstuserbutton, SIGNAL(clicked()),
+ SLOT(slotUnsetUserPix()) );
+ QGridLayout *hlpl = new QGridLayout( hlpw, 3, 2, 0, KDialog::spacingHint() );
+ hlpl->addWidget( userlabel, 0, 0 );
+// hlpl->addSpacing( KDialog::spacingHint() );
+ hlpl->addWidget( usercombo, 0, 1 );
+ hlpl->addMultiCellWidget( userbutton, 1,1, 0,1, AlignHCenter );
+ hlpl->addMultiCellWidget( rstuserbutton, 2,2, 0,1, AlignHCenter );
+
+ QHBoxLayout *main = new QHBoxLayout( this, 10 );
+
+ QVBoxLayout *lLayout = new QVBoxLayout( main, 10 );
+ lLayout->addWidget( minGroup );
+ lLayout->addWidget( usrGroup );
+ lLayout->addStretch( 1 );
+
+ QVBoxLayout *mLayout = new QVBoxLayout( main, 10 );
+ mLayout->addWidget( s_label );
+ mLayout->addWidget( wstack );
+ mLayout->setStretchFactor( wstack, 1 );
+ main->setStretchFactor( mLayout, 1 );
+
+ QVBoxLayout *rLayout = new QVBoxLayout( main, 10 );
+ rLayout->addWidget( faceGroup );
+ rLayout->addWidget( picGroup );
+ rLayout->addStretch( 1 );
+
+}
+
+void KDMUsersWidget::makeReadOnly()
+{
+ leminuid->setReadOnly(true);
+ lemaxuid->setReadOnly(true);
+ cbshowlist->setEnabled(false);
+ cbcomplete->setEnabled(false);
+ cbinverted->setEnabled(false);
+ cbusrsrt->setEnabled(false);
+ rbadmonly->setEnabled(false);
+ rbprefadm->setEnabled(false);
+ rbprefusr->setEnabled(false);
+ rbusronly->setEnabled(false);
+ wstack->setEnabled(false);
+ disconnect( userbutton, SIGNAL(clicked()), this, SLOT(slotUserButtonClicked()) );
+ userbutton->setAcceptDrops(false);
+ rstuserbutton->setEnabled(false);
+}
+
+void KDMUsersWidget::slotShowOpts()
+{
+ bool en = cbshowlist->isChecked() || cbcomplete->isChecked();
+ cbinverted->setEnabled( en );
+ cbusrsrt->setEnabled( en );
+ wstack->setEnabled( en );
+ wstack->raiseWidget( cbinverted->isChecked() ? optoutlv : optinlv );
+ en = cbshowlist->isChecked();
+ faceGroup->setEnabled( en );
+ if (!en) {
+ usercombo->setEnabled( false );
+ userbutton->setEnabled( false );
+ rstuserbutton->setEnabled( false );
+ } else
+ slotFaceOpts();
+}
+
+void KDMUsersWidget::slotFaceOpts()
+{
+ bool en = !rbusronly->isChecked();
+ usercombo->setEnabled( en );
+ userbutton->setEnabled( en );
+ if (en)
+ slotUserSelected();
+ else
+ rstuserbutton->setEnabled( false );
+}
+
+void KDMUsersWidget::slotUserSelected()
+{
+ QString user = usercombo->currentText();
+ QImage p;
+ if (user != m_defaultText &&
+ p.load( m_userPixDir + user + ".face.icon" )) {
+ rstuserbutton->setEnabled( !getuid() );
+ } else {
+ p.load( m_userPixDir + ".default.face.icon" );
+ rstuserbutton->setEnabled( false );
+ }
+ userbutton->setPixmap( p.smoothScale( 48, 48, QImage::ScaleMin ) );
+}
+
+
+void KDMUsersWidget::changeUserPix(const QString &pix)
+{
+ QString user( usercombo->currentText() );
+ if (user == m_defaultText)
+ {
+ user = ".default";
+ if (KMessageBox::questionYesNo(this, i18n("Save image as default image?"),QString::null,KStdGuiItem::save(),KStdGuiItem::cancel())
+ != KMessageBox::Yes)
+ return;
+ }
+
+ QImage p( pix );
+ if (p.isNull()) {
+ KMessageBox::sorry( this,
+ i18n("There was an error loading the image\n"
+ "%1").arg( pix ) );
+ return;
+ }
+
+ p = p.smoothScale( 48, 48, QImage::ScaleMin );
+ QString userpix = m_userPixDir + user + ".face.icon";
+ if (!p.save( userpix, "PNG" ))
+ KMessageBox::sorry(this,
+ i18n("There was an error saving the image:\n%1")
+ .arg( userpix ) );
+ else
+ chmod( QFile::encodeName( userpix ), 0644 );
+
+ slotUserSelected();
+}
+
+void KDMUsersWidget::slotUserButtonClicked()
+{
+ KFileDialog dlg(m_notFirst ? QString::null :
+ KGlobal::dirs()->resourceDirs("data").last() + "kdm/pics/users",
+ KImageIO::pattern( KImageIO::Reading ),
+ this, 0, true);
+ dlg.setOperationMode( KFileDialog::Opening );
+ dlg.setCaption( i18n("Choose Image") );
+ dlg.setMode( KFile::File | KFile::LocalOnly );
+
+ KImageFilePreview *ip = new KImageFilePreview( &dlg );
+ dlg.setPreviewWidget( ip );
+ if (dlg.exec() != QDialog::Accepted)
+ return;
+ m_notFirst = true;
+
+ changeUserPix( dlg.selectedFile() );
+}
+
+void KDMUsersWidget::slotUnsetUserPix()
+{
+ QFile::remove( m_userPixDir + usercombo->currentText() + ".face.icon" );
+ slotUserSelected();
+}
+
+bool KDMUsersWidget::eventFilter(QObject *, QEvent *e)
+{
+ if (e->type() == QEvent::DragEnter) {
+ QDragEnterEvent *ee = (QDragEnterEvent *) e;
+ ee->accept( KURLDrag::canDecode(ee) );
+ return true;
+ }
+
+ if (e->type() == QEvent::Drop) {
+ userButtonDropEvent((QDropEvent *) e);
+ return true;
+ }
+
+ return false;
+}
+
+KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg);
+
+void KDMUsersWidget::userButtonDropEvent(QDropEvent *e)
+{
+ KURL *url = decodeImgDrop(e, this);
+ if (url) {
+ QString pixpath;
+ KIO::NetAccess::download(*url, pixpath, parentWidget());
+ changeUserPix( pixpath );
+ KIO::NetAccess::removeTempFile(pixpath);
+ delete url;
+ }
+}
+
+void KDMUsersWidget::save()
+{
+ config->setGroup( "X-*-Greeter" );
+
+ config->writeEntry( "MinShowUID", leminuid->text() );
+ config->writeEntry( "MaxShowUID", lemaxuid->text() );
+
+ config->writeEntry( "UserList", cbshowlist->isChecked() );
+ config->writeEntry( "UserCompletion", cbcomplete->isChecked() );
+ config->writeEntry( "ShowUsers",
+ cbinverted->isChecked() ? "NotHidden" : "Selected" );
+ config->writeEntry( "SortUsers", cbusrsrt->isChecked() );
+
+ config->writeEntry( "HiddenUsers", hiddenUsers );
+ config->writeEntry( "SelectedUsers", selectedUsers );
+
+ config->writeEntry( "FaceSource",
+ rbadmonly->isChecked() ? "AdminOnly" :
+ rbprefadm->isChecked() ? "PreferAdmin" :
+ rbprefusr->isChecked() ? "PreferUser" : "UserOnly" );
+}
+
+
+void KDMUsersWidget::updateOptList( QListViewItem *item, QStringList &list )
+{
+ if ( !item )
+ return;
+ QCheckListItem *itm = (QCheckListItem *)item;
+ QStringList::iterator it = list.find( itm->text() );
+ if (itm->isOn()) {
+ if (it == list.end())
+ list.append( itm->text() );
+ } else {
+ if (it != list.end())
+ list.remove( it );
+ }
+}
+
+void KDMUsersWidget::slotUpdateOptIn( QListViewItem *item )
+{
+ updateOptList( item, selectedUsers );
+}
+
+void KDMUsersWidget::slotUpdateOptOut( QListViewItem *item )
+{
+ updateOptList( item, hiddenUsers );
+}
+
+void KDMUsersWidget::slotClearUsers()
+{
+ optinlv->clear();
+ optoutlv->clear();
+ usercombo->clear();
+ usercombo->insertItem( m_defaultText );
+}
+
+void KDMUsersWidget::slotAddUsers(const QMap<QString,int> &users)
+{
+ QMapConstIterator<QString,int> it;
+ for (it = users.begin(); it != users.end(); ++it) {
+ const QString *name = &it.key();
+ (new QCheckListItem(optinlv, *name, QCheckListItem::CheckBox))->
+ setOn(selectedUsers.find(*name) != selectedUsers.end());
+ (new QCheckListItem(optoutlv, *name, QCheckListItem::CheckBox))->
+ setOn(hiddenUsers.find(*name) != hiddenUsers.end());
+ if ((*name)[0] != '@')
+ usercombo->insertItem(*name);
+ }
+ optinlv->sort();
+ optoutlv->sort();
+ if (usercombo->listBox())
+ usercombo->listBox()->sort();
+}
+
+void KDMUsersWidget::slotDelUsers(const QMap<QString,int> &users)
+{
+ QMapConstIterator<QString,int> it;
+ for (it = users.begin(); it != users.end(); ++it) {
+ const QString *name = &it.key();
+ if (usercombo->listBox())
+ delete usercombo->listBox()->findItem( *name, ExactMatch | CaseSensitive );
+ delete optinlv->findItem( *name, 0 );
+ delete optoutlv->findItem( *name, 0 );
+ }
+}
+
+void KDMUsersWidget::load()
+{
+ QString str;
+
+ config->setGroup("X-*-Greeter");
+
+ selectedUsers = config->readListEntry( "SelectedUsers");
+ hiddenUsers = config->readListEntry( "HiddenUsers");
+
+ leminuid->setText(config->readEntry("MinShowUID", defminuid));
+ lemaxuid->setText(config->readEntry("MaxShowUID", defmaxuid));
+
+ cbshowlist->setChecked( config->readBoolEntry( "UserList", true ) );
+ cbcomplete->setChecked( config->readBoolEntry( "UserCompletion", false ) );
+ cbinverted->setChecked( config->readEntry( "ShowUsers" ) != "Selected" );
+ cbusrsrt->setChecked(config->readBoolEntry("SortUsers", true));
+
+ QString ps = config->readEntry( "FaceSource" );
+ if (ps == QString::fromLatin1("UserOnly"))
+ rbusronly->setChecked(true);
+ else if (ps == QString::fromLatin1("PreferUser"))
+ rbprefusr->setChecked(true);
+ else if (ps == QString::fromLatin1("PreferAdmin"))
+ rbprefadm->setChecked(true);
+ else
+ rbadmonly->setChecked(true);
+
+ slotUserSelected();
+
+ slotShowOpts();
+ slotFaceOpts();
+}
+
+void KDMUsersWidget::defaults()
+{
+ leminuid->setText( defminuid );
+ lemaxuid->setText( defmaxuid );
+ cbshowlist->setChecked( true );
+ cbcomplete->setChecked( false );
+ cbinverted->setChecked( true );
+ cbusrsrt->setChecked( true );
+ rbadmonly->setChecked( true );
+ hiddenUsers.clear();
+ selectedUsers.clear();
+ slotShowOpts();
+ slotFaceOpts();
+}
+
+void KDMUsersWidget::slotMinMaxChanged()
+{
+ emit setMinMaxUID( leminuid->text().toInt(), lemaxuid->text().toInt() );
+}
+
+void KDMUsersWidget::slotChanged()
+{
+ emit changed(true);
+}
+
+#include "kdm-users.moc"
diff --git a/kcontrol/kdm/kdm-users.h b/kcontrol/kdm/kdm-users.h
new file mode 100644
index 000000000..b54d96ff8
--- /dev/null
+++ b/kcontrol/kdm/kdm-users.h
@@ -0,0 +1,106 @@
+/* This file is part of the KDE Display Manager Configuration package
+ Copyright (C) 1997 Thomas Tanghus ([email protected])
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __KDMUSERS_H__
+#define __KDMUSERS_H__
+
+#include <qwidget.h>
+#include <qptrlist.h>
+#include <qstring.h>
+#include <qimage.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qwidgetstack.h>
+
+#include <klineedit.h>
+#include <klistview.h>
+#include <kcombobox.h>
+#include <kurl.h>
+
+#include <pwd.h>
+
+
+class KDMUsersWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KDMUsersWidget( QWidget *parent = 0, const char *name = 0 );
+
+ void load();
+ void save();
+ void defaults();
+ void makeReadOnly();
+
+ bool eventFilter( QObject *o, QEvent *e );
+
+public slots:
+ void slotClearUsers();
+ void slotAddUsers( const QMap<QString,int> & );
+ void slotDelUsers( const QMap<QString,int> & );
+
+signals:
+ void changed( bool state );
+ void setMinMaxUID( int, int );
+
+private slots:
+ void slotMinMaxChanged();
+ void slotShowOpts();
+ void slotUpdateOptIn( QListViewItem *item );
+ void slotUpdateOptOut( QListViewItem *item );
+ void slotUserSelected();
+ void slotUnsetUserPix();
+ void slotFaceOpts();
+ void slotUserButtonClicked();
+ void slotChanged();
+
+private:
+ void updateOptList( QListViewItem *item, QStringList &list );
+ void userButtonDropEvent( QDropEvent *e );
+ void changeUserPix( const QString & );
+
+ QGroupBox *minGroup; // top left
+ QLineEdit *leminuid, *lemaxuid;
+
+ QButtonGroup *usrGroup; // right below
+ QCheckBox *cbshowlist, *cbcomplete, *cbinverted, *cbusrsrt;
+
+ QLabel *s_label; // middle
+ QWidgetStack *wstack;
+ KListView *optoutlv, *optinlv;
+
+ QButtonGroup *faceGroup; // right
+ QRadioButton *rbadmonly, *rbprefadm, *rbprefusr, *rbusronly;
+
+ KComboBox *usercombo; // right below
+ QPushButton *userbutton;
+ QPushButton *rstuserbutton;
+
+ QString m_userPixDir;
+ QString m_defaultText;
+ QStringList hiddenUsers, selectedUsers;
+ QString defminuid, defmaxuid;
+
+ bool m_notFirst;
+};
+
+#endif
+
+
diff --git a/kcontrol/kdm/kdm.desktop b/kcontrol/kdm/kdm.desktop
new file mode 100644
index 000000000..c3f85d4b7
--- /dev/null
+++ b/kcontrol/kdm/kdm.desktop
@@ -0,0 +1,243 @@
+[Desktop Entry]
+Exec=kcmshell kdm
+Icon=kdmconfig
+Type=Application
+DocPath=kdm/index.html#configuring-kdm
+
+X-KDE-SubstituteUID=true
+
+X-KDE-Library=kdm
+X-KDE-RootOnly=true
+
+X-KDE-ParentApp=kcontrol
+
+Name=Login Manager
+Name[af]=Aanteken Bestuurder
+Name[ar]=مسيير تسجيل الدخول
+Name[az]=İclas Açma İdarəcisi
+Name[be]=Кіраўнік уваходу
+Name[bg]=Вход в системата
+Name[bn]=লগ-ইন ম্যানেজার
+Name[br]=Merour ereañ
+Name[bs]=Login menadžer
+Name[ca]=Gestor d'accés
+Name[cs]=Správce přihlášení
+Name[csb]=Menedżer logòwaniô
+Name[cy]=Rheolydd Mewngofnodi
+Name[da]=Login-håndtering
+Name[de]=Anmeldungsmanager
+Name[el]=Διαχειριστής σύνδεσης
+Name[eo]=Salutilo
+Name[es]=Gestor de acceso
+Name[et]=Sisselogimise haldur
+Name[eu]=Saio-hasieraren kudeatzailea
+Name[fa]=مدیر ورود
+Name[fi]=Sisäänkirjautumisasetukset
+Name[fr]=Gestionnaire de connexion
+Name[fy]=Oanmeldskerm
+Name[ga]=Bainisteoir Logála Isteach
+Name[gl]=Xestor de Login
+Name[he]=מנהל הכניסה למערכת
+Name[hi]=लॉगइन प्रबंधक
+Name[hr]=Upravljanje prijavljivanjem
+Name[hu]=Bejelentkező felület (KDM)
+Name[id]=Manajer Login
+Name[is]=Innstimplunarstjóri
+Name[it]=Gestione degli accessi
+Name[ja]=ログインマネージャ
+Name[ka]=შესვლის მენეჯერი
+Name[kk]=Жүйеге кіруді басқару
+Name[km]=កម្មវិធី​គ្រប់គ្រង​ការ​ចូល
+Name[ko]=로그인 관리자
+Name[lo]=ຈັດການລັອກອິນ
+Name[lt]=Registravimosi tvarkyklė
+Name[lv]=Pieteikšanās Menedžeris
+Name[mk]=Менаџер на најави
+Name[mn]=Нэвтрэлт удирдагч
+Name[ms]=Pengurus Login
+Name[mt]=Manager tal-Login
+Name[nb]=Innloggingsbehandler
+Name[nds]=Anmellen-Schirm
+Name[ne]=लगइन प्रबन्धक
+Name[nl]=Aanmeldscherm
+Name[nn]=Innloggingshandsamar
+Name[nso]=Molaodi wa Tseno
+Name[oc]=Gestionari de connexion
+Name[pa]=ਲਾਗ ਮੈਨੇਜਰ
+Name[pl]=Menedżer logowania
+Name[pt]=Gestor de Autenticação
+Name[pt_BR]=Gerenciador de Login
+Name[ro]=Managerul de logare
+Name[ru]=Менеджер входа в систему
+Name[rw]=Mugenga w'Ifashayinjira
+Name[se]=Sisačálihangieđahalli
+Name[sk]=Správca prihlásenia
+Name[sl]=Upravitelj prijav
+Name[sr]=Менаџер пријављивања
+Name[sr@Latn]=Menadžer prijavljivanja
+Name[sv]=Inloggningshanterare
+Name[ta]=நுழைவு மேலாளர்
+Name[te]=లాగిన్ అభికర్త
+Name[tg]=Мудири вуруд
+Name[th]=ตัวจัดการการล็อกอิน
+Name[tr]=Giriş Yöneticisi
+Name[tt]=Kerü İdäçese
+Name[uk]=Менеджер реєстрації
+Name[uz]=Kirish boshqaruvchisi
+Name[uz@cyrillic]=Кириш бошқарувчиси
+Name[ven]=Mulanguli wa u loga
+Name[vi]=Trình quản lí Đăng nhập
+Name[wa]=Manaedjeu d' elodjaedje
+Name[xh]=Umphathi Wegama elithile
+Name[zh_CN]=登录管理器
+Name[zh_TW]=登錄管理程式
+Name[zu]=Imenenja yokungena ngaphakathi
+
+Comment=Configure the login manager (KDM)
+Comment[af]=Konfigureer die aanteken bestuurder (Kdm)
+Comment[ar]=إعداد مسيير الدخول (KDM)
+Comment[az]=Giriş İdarəçisi (KDM) Qurğuları
+Comment[be]=Настаўленні кіраўніка ўваходу (KDM)
+Comment[bg]=Настройване на графичната системата за вход
+Comment[bn]=লগ-ইন ম্যানেজার কনফিগার করুন
+Comment[br]=Kefluniañ ar merour ereañ (KDM)
+Comment[bs]=Podesite menadžer prijavom (KDM)
+Comment[ca]=Configura el gestor d'accés (KDM)
+Comment[cs]=Nastavení správce přihlášení (KDM)
+Comment[csb]=Kònfigùracëjô menedżera logòwaniô (KDM)
+Comment[cy]=Ffurfweddu y rheolydd mewngofnodi (KDM)
+Comment[da]=Indstil indlogningshåndtering (KDM)
+Comment[de]=Anmeldungsmanager KDM einrichten
+Comment[el]=Ρυθμίστε το διαχειριστή σύνδεσης (KDM)
+Comment[eo]=Agordu la salutadminstrilon (KDM)
+Comment[es]=Configura el gestor de acceso (KDM)
+Comment[et]=Sisselogimise halduri seadistamine (KDM)
+Comment[eu]=Konfiguratu saio-hasieraren kudeatzailea (KDM)
+Comment[fa]=پیکربندی مدیر ورود (KDM)
+Comment[fi]=Sisäänkirjautumisasetukset
+Comment[fr]=Configuration du gestionnaire de connexion (KDM)
+Comment[fy]=Hjir kinne jo it oanmeldskerm ynstelle (KDM)
+Comment[ga]=Cumraigh an bainisteoir logála isteach (KDM)
+Comment[gl]=Configurar o xestor de início (KDM)
+Comment[he]=שינוי הגדרות מנהל הכניסה למערכת (KDM)
+Comment[hi]=लॉगइन प्रबंधक कॉन्फ़िगर करें (केडीएम)
+Comment[hr]=Konfiguriranje upravljanja prijavljivanja (KDM)
+Comment[hu]=A KDE grafikus bejelentkező felületének beállításai
+Comment[is]=Stilla innstimplunarstjórann (KDM)
+Comment[it]=Configurazione della gestione degli accessi (KDM)
+Comment[ja]=ログインマネージャ (KDM) の設定
+Comment[ka]=შევლის მენეჯერის კონფიგურირება (KDM)
+Comment[kk]=Жүйеге кіруді басқаруын (KDM) баптау
+Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​កម្មវិធី​គ្រប់គ្រង​ការ​ចូល (KDM)
+Comment[ko]=로그인 관리자 KDM 설정
+Comment[lo]=ປັບແຕ່ງປລັກອິນແລະການເຊື່ອມ ຕໍ່ສຳລັບລະບົບ KDB
+Comment[lt]=Konfigūruoti registravimos tvarkyklę (KDM)
+Comment[lv]=Konfigure pieteiksanās menedžeri KDM
+Comment[mk]=Конфигурирајте го менаџерот на најави (KDM)
+Comment[mn]=Нэвтрэлт удирдагч KDM тохируулах
+Comment[ms]=Konfigur pengurus login (KDM)
+Comment[mt]=Ikkonfigura l-manager tal-logins (KDM)
+Comment[nb]=Tilpass innlogin­gsbehandler (KDM)
+Comment[nds]=Den Anmellen-Schirm instellen (KDM)
+Comment[ne]=लगइन प्रबन्धक (KDM) कन्फिगर गर्नुहोस्
+Comment[nl]=Hier kunt u het aanmeldscherm (KDM) instellen
+Comment[nn]=Set opp innloggingshandsamaren (KDM)
+Comment[nso]=Beakanya molaodoi wa tseno (KDM)
+Comment[pa]=ਲਾਗਆਨ ਮੈਨੇਜਰ ਸੰਰਚਨਾ(KDM)
+Comment[pl]=Konfiguracja menedżera logowania (KDM)
+Comment[pt]=Configuração do gestor de autenticação (KDM)
+Comment[pt_BR]=Configura o gerenciador de login (KDM)
+Comment[ro]=Configurează managerul de logare grafică (KDM)
+Comment[ru]=Настройка менеджера входа в систему (KDM)
+Comment[rw]=Kuboneza mugenga w'ifashayinjira (KDM)
+Comment[se]=Heivet sisačálihangieđahalli (KDM)
+Comment[sk]=Nastavenie správcu prihlásenia (KDM)
+Comment[sl]=Nastavitve upravitelja prijav (KDM)
+Comment[sr]=Подешавање менаџера за пријављивање (KDM)
+Comment[sr@Latn]=Podešavanje menadžera za prijavljivanje (KDM)
+Comment[sv]=Anpassa inloggningshanteraren (KDM)
+Comment[ta]=புகுபதிகை மேலாளரை அமை (KDM)
+Comment[tg]=Танзими мудири вуруд (KDM)
+Comment[th]=ปรับแต่งเครื่องมือจัดการการล็อกอิน (KDM)
+Comment[tr]=Giriş yöneticisini yapılandır (KDM)
+Comment[tt]=Kerü idäräçen caylaw urını (KDM)
+Comment[uk]=Налаштування менеджера реєстрації (KDM)
+Comment[uz]=Tizimga kirish boshqaruvchisini (KDM) moslash
+Comment[uz@cyrillic]=Тизимга кириш бошқарувчисини (KDM) мослаш
+Comment[ven]=Ni nga dzudzanya mulanguli wau loga (KDM)
+Comment[vi]=Cấu hình trình đăng nhập (KDM)
+Comment[wa]=Apontyî l' manaedjeu d' elodjaedje (KDM)
+Comment[xh]=Qwalasela umphathi wegama elithile (KDM)
+Comment[zh_CN]=配置登录管理器(KDM)
+Comment[zh_TW]=設定登入管理程式 (KDM)
+Comment[zu]=Hlanganisela imenenja yokungena ngaphakathi (KDM)
+
+Keywords=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart
+Keywords[ar]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,مدير العرض,المستخدمون مستخدمون,المستخدمين,مستخدمين,دخول,الدخول,تحية,التحية,اللغة,المظهر, البلد,الخطوط,الخط,خطوط,خط,خلفية,ورق حائط,جلسات,اغلاق,اعادة تشغيل
+Keywords[az]=kdm,görünüş idarəçi,xdm,istifadəçilər,iclas açma,qarşılama,loqo,tərzlər,dil,ölkə,yazı növləri,arxa plan,divar kağızları,iclaslar,qapat,təkrar başlat
+Keywords[be]=кіраўнік дысплея,кіраўнік уваходу,карыстальнікі,уваход,запрашэнне,лагатып,стылі,стыль,мова,краіна,шрыфты,фон,шпалеры,сесіі,сесія,выключэнне,перазагрузка,kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart
+Keywords[bg]=графична, система, вход, влизане, включване, потребител, kdm, display manager, xdm, users, login, greeting, Logo, styles, language, country, fonts, background, wallpapers, sessions, shutdown, restart
+Keywords[ca]=kdm,administrador de la pantalla,xdm,usuaris,accés,salutació,Logo,estils,llengua,país,lletres,fons,tapissos,sessions,apagar,reiniciar
+Keywords[cs]=kdm,Správce obrazovky,xdm,Uživatelé,Přihlášení,Uvítání,Logo,Styly,Jazyk,Země,Písma,pozadí,Tapety,Relace,Sezení,Vypnutí,Restart
+Keywords[csb]=kdm,menedżer ekranu,xdm,brëkòwnicë,logòwanié,przëwitanié,Logò,sztéle,jãzëk,kraj,fòntë,spódk,tapetë,spòdlë,sesëje,zamkniãce systemë,resztart,zôczãce robòtë
+Keywords[cy]=kdm,rheolydd y dangosydd,xdm,defnyddwyr,mewngofnodi,cyfarchiad,Logo,arddulliau,iaith,gwlad,ffontiau,cefndir,papurau wal,sesiynau,cau,ailgychwyn
+Keywords[da]=kdm,skærmhåndtering,xdm,brugere,login,hilsen,Logo,stil, sprog,land,skrifttyper,baggrund,tapeter,sessioner,luk ned,genstart
+Keywords[de]=Kdm,Display Manager,Xdm,Benutzer,Login,Logo,Stile,Sprachen,Länder,Schriften,Hintergründe,Hintergrundbilder,Beenden,Neustart
+Keywords[el]=kdm,διαχειριστής οθόνης,xdm,χρήστες,σύνδεση,χαιρετισμός,Λογότυπο,στυλ,γλώσσα,χώρα,γραμματοσειρές,φόντο,ταπετσαρίες,συνεδρίες,τερματισμός,επανεκκίνηση
+Keywords[eo]=kdm,ekrano,,xdm,uzantoj,saluto,emblemo,stilo,lingvo,lando,tiparo,fono,tapeto,seanco,adaiaŭo,relanĉo
+Keywords[es]=kdm,gestor de pantalla,xdm,usuarios,entrada,acceso,saludo,Logo,estilos,idioma,país,tipos de letra,fondo,tapices,sesiones,apagar,reiniciar
+Keywords[et]=kdm,ekraanihaldur,xdm,kasutajad,sisselogimine,tervitus,logo,stiil,keel,riik,fondid,taust,taustapilt,seansid,töö lõpetamine,taaskäivitamine
+Keywords[eu]=kdm,pantaila kudeatzailea,xdm,erabiltzaileak,Saio hasiera,agurra,Logoa,estiloak,hizkuntza, herrialdea,letra-tipoak,atzeko planoa,horma-irudiak,saioak,itzali,berrabiarazi
+Keywords[fa]=kdm، مدیر نمایش، xdm، کاربران، ورود، تبریک، آرمِ، سبک، زبان، کشور، قلمها، زمینه، کاغذهای دیواری، نشستها، تعطیل، بازآغازی
+Keywords[fi]=kdm,näytönhallinta ,xdm,käyttäjät,sisäänkirjautuminen,tervehdys,Logo,tyylit,kieli,maa,kirjasimet,tausta,istunnot,sammutus,uudelleenkäynnistys
+Keywords[fr]=kdm,gestionnaire d'affichage,xdm,utilisateurs,login,connexion,bienvenue,message de bienvenue,Logo,styles,langue,pays,style,police,fond d'écran,papier peint,session,arrêt,logout,redémarrage,reboot
+Keywords[fy]=kdm,display manager,xdm,users,login,begroeting,oanmelde,brûkers,Oanmeldbehearder,logo,stylen,taal,language,country,lân,fonts,lettertypen,eftergrûn,wallpapers,behang,sesjes,shutdown,restart,ôfslute,opnij begjinne,oanmelde
+Keywords[ga]=kdm,bainisteoir scáileáin,xdm,úsáideoirí,logáil isteach,fáilte,Lógó,stíleanna,teanga,tír,clónna,clófhoirne,cúlra,cúlbhrait,seisiúin,múchadh,atosú
+Keywords[gl]=kdm,xestor de entrada,xdm,usuarios,identificación,Logo,estilos,lingua,país,fontes,fondo,papeis tapiz,sesións,apagado,reinício
+Keywords[he]=משתמשים,כניסה למערכת,כניסה,לוגו,סגנונות,שפה,מדינה,גופנים,רקע,טפטים,הפעלות,כיבוי,הפעלה,מחדש,מנהל,תצוגה,display,manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart
+Keywords[hi]=केडीएम,प्रकटन प्रबंधक,एक्स-डीएम,उपयोक्ता,लॉगइन,शुभकामनाएँ,लोगो,पृष्ठभूमि,वालपेपर्स,सत्र,बन्द, फिर से चालू
+Keywords[hr]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,upravljanje zaslona,korisnici,prijava,pozdrav,stilovi,jezik,država,zemlja,fontovi,pozadina,pozadina radne površine,sesije,gašenje,ponovno pokretanje
+Keywords[hu]=kdm,képernyőkezelő,xdm,felhasználók,bejelentkezés,üdvözlés,embléma,stílusok,nyelv,ország,betűtípusok,háttér,tapéták,munkafolyamatok,leállítás,újraindítás
+Keywords[is]=kdm,skjár,gluggastjóri,innskráning,innstimplun,snið,tungumál,land,letur,bakgrunnur,bakgrunnar,veggfóður,setur,slökkva,endurræsa
+Keywords[it]=kdm,display manager,gestione degli utenti,xdm,utenti,login,accesso,benvenuto,logo,stile,lingua,stato,paese,tipi di carattere,sfondo,immagine di sfondo,sessioni,riavvio,spegnimento,gestione degli accessi
+Keywords[ja]=kdm,ディスプレイマネージャ,xdm,ユーザ,ログイン,あいさつ,ロゴ,スタイル,言語,国,フォント,背景,壁紙,セッション,シャットダウン,再起動
+Keywords[km]=kdm,កម្មវិធី​គ្រប់គ្រង​ការ​បង្ហាញ,xdm,អ្នក​ប្រើ,ចូល,ស្វាគមន៍,រូបសញ្ញា,រចនាប័ទ្ម,ភាសា,ប្រទេស,ពុម្ពអក្សរ,ផ្ទៃ​ខាង​ក្រោយ,ក្រដាស​បិទ​ជញ្ជាំង,សម័យ,បិទ,ចាប់ផ្ដើម​ឡើង​វិញ
+Keywords[lt]=kdm,display manager,ekrano tvarkyklė,xdm,users,naudotojai,login,registracija,greeting,pasveikinimas,Logo, styles,stiliai,language,country,fonts,background,wallpapers,sessions, shutdown,restart
+Keywords[lv]=kdm,displeja menedžeris,xdm,lietotāji,pieteikšanās,apsveikums,Logo,stili,valoda,valsts,fonti,fons,tapetes,sesijas,nošaut,pārstartēt
+Keywords[mk]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,менаџер на екран,корисници,најава,поздрав,Лого,стилови,јазик,земја,фонтови,подлога,позадина,сесии,исклучување,рестартирање
+Keywords[mn]=Kdm,Display Manager,Xdm,Хэрэглэгч,Login,Logo,Хэлбэр,Хэл,Улс,Бичиг,Дэвсгэр,Дэвсгэр зураг,Дуусгах,Шинээр эхлүүлэх
+Keywords[mt]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,merħba,lingwa,pajjiż,sfond,itfi,irristartja
+Keywords[nb]=kdm,skjermbehandler,xdm,brukere,innlogging,velkomst,logo,stiler,språk,land,skrifttyper,bakgrunn,bakgrunnsbilde,økter,skru av,slå av,omstart
+Keywords[nds]=kdm,Startschirm,xdm,Bruker,anmellen,greeting,Logo,Stilen,Spraak,Land,Schriftoorden,Achtergrund,Tapeten,Törns,Utmaken,Nieg starten
+Keywords[ne]=kdm, प्रदर्शन प्रबन्धक, xdm, प्रयोगकर्ताहरू, लगइन, अभिवादन, परिचायक चिन्ह, शैलीहरू, भाषा, देश, फन्टहरू, पृष्ठभूमि,वालपेपरहरू, सत्र, बन्द गर्नुहोस्, फेरि सुरु गर्नुहोस्
+Keywords[nl]=kdm,display manager,xdm,users,login,begroeting,inloggen,gebruikers,loginbeheerder,logo,stijlen,taal,language,country,land,fonts,lettertypen,achtergrond,wallpapers,behang,sessies,shutdown,restart,afsluiten,herstarten,aanmelden,opstarten
+Keywords[nn]=kdm,xdm,brukarar,innlogging,helsing,logo,stil,språk,land,skrifttypar,bakgrunn,bakgrunnsbilete,økt,avslutt,slå av,omstart
+Keywords[nso]=kdm,molaodi wa pontsho,xdm,badirisi,tseno,madume,Logo,mekgwa,leleme,naga,difonto,bokamorago,di-wallpaper,ditiragalo,timo,thomaleswa
+Keywords[pa]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart, ਲੋਗੋ, ਭਾਸ਼ਾ, ਦੇਸ਼, ਫੋਂਟ, ਲਾਗਿੰਨ, ਉਪਭੋਗੀ,ਸ਼ੈਸ਼ਨ
+Keywords[pl]=kdm,menedżer ekranu,xdm,użytkownicy,logowanie,powitanie,Logo,style,jezyk,kraj,czcionki,tło,tapety,sesje,zamknięcie systemu,restart,rozpoczęcie pracy
+Keywords[pt]=kdm,gestor de 'logins',xdm,utilizadores,saudação,logótipo,estilos,língua,país,tipos de letra,fundo,papéis de parede,sessões,terminar,reiniciar
+Keywords[pt_BR]=kdm,gerenciador de tela, xdm,usuários,login,saudação,Logo,estilos,linguagem,país,fontes, papéis de parede,sessões,desligar,reiniciar
+Keywords[ro]=kdm,manager de ecran,xdm,utilizatori,logare,întîmpinare,logo,stiluri,limbaj,țară,fonturi,fundal,imagini de fundal,sesiuni,oprire,restartare
+Keywords[ru]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,перезагрузка,сеанс,шрифты,страна,фон,стили,обои
+Keywords[rw]=kdm,kwerekana umuyobozi,xdm,abakoresha,ifashayinjira,gusuhuza,ikirango,imisusire,ururimi,igihugu,imyandikire,mbuganyuma,impapurorukuta,imikoro,kuzimya,kongera gutangiza
+Keywords[se]=kdm,xdm,geavaheaddjit,sisačáliheapmi,dearvvuođat,logo,stiila,giella,riika, fonttat,duogáš,duogášgovva,bargovuorut,heaittihit,časkit eret,ođđasit álggahit
+Keywords[sk]=kdm,správca obrazovky,Login manažér,správca prihlásenia,xdm,používatelia,prihlásenie,login,privítanie,logo,štýly,jazyk,krajina,pozadie,tapety,sedenia,vypnutie,reset,reštart
+Keywords[sl]=kdm,upravitelj zaslona,upravljalnik,xdm,uporabniki,prijava,login,pozdrav,logo,slogi,jezik,država,pisave,ozadje,tapete,seje,ugasnitev,vnovičen zagon
+Keywords[sr]=kdm,display manager,xdm,users,login,greeting,Лого,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,менаџер,пријављивање,стил,језик,земља,фонтови,позадина,сесије,гашење
+Keywords[sr@Latn]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,menadžer,prijavljivanje,stil,jezik,zemlja,fontovi,pozadina,sesije,gašenje
+Keywords[sv]=kdm,display manager,xdm,användare,inloggning,välkomsttext,Logo,stilar,språk,land,teckensnitt,bakgrund,skrivbordsunderlägg,sessioner,stäng av,starta om
+Keywords[ta]=கேடிஎம்,காட்சி மேலாளர்,xdm,பயன்படுத்துபவர்,உள்நுழை,வாழ்த்து,சின்னம்,பாணிகள்,மொழி,நாடு,எழுத்துருக்கள்,பின்னணி,வால்பேப்பர்கள்,பகுதிகள்,முடித்தல்,தொடங்குதல்
+Keywords[th]=kdm,ตัวจัดการจอแสดงผล,xdm,ผู้ใช้,ล็อกอิน, ทักทาย,โลโก้,รูปแบบ,ภาษา,ประเทศ,แบบอักษร,พื้นหลัง, วอลล์เปเปอร์,วาระ,ปิด,เริ่มการทำงานใหม่
+Keywords[tr]=kdm,görüntü yönetici,xdm,kullanıcılar,oturum açma,karşılama,logo,stiller,dil,ülke,yazı tipleri,artalan,duvar kağıtları,oturumlar,kapat,tekrar başlat
+Keywords[uk]=kdm,менеджер дисплеїв,xdm,користувачі,реєстрація,привітання,логотип,стилі,мова,країна,шрифти,тло,шпалери,сеанси,вимикання,перезапуск
+Keywords[uz]=kdm,kirish boshqaruvchisi,xdm,foydalanuvchilar,kirish,salomlashish,Belgi,uslublar,til,davlat,shriftlar,orqa fon,seanslar,oʻchirish,oʻchirib-yoqish
+Keywords[uz@cyrillic]=kdm,кириш бошқарувчиси,xdm,фойдаланувчилар,кириш,саломлашиш,Белги,услублар,тил,давлат,шрифтлар,орқа фон,сеанслар,ўчириш,ўчириб-ёқиш
+Keywords[ven]=kdm,mulanguli wau vhonisa,xdm,vhashumisi,u loga,dzindumeliso,logo,zwitaela,luambo,shango,fontu,murahu,mabammbiri a luvhondoni,tshitenwa,thutha,thomolosa
+Keywords[vi]=kdm,quản lý hiển thị,xdm,người dùng,đăng nhập,chào hỏi,Biểu trưng,kiểu,ngôn ngữ,quốc gia,phông chữ,nền,ảnh nền,phiên đăng nhập,tắt máy,khởi động lại
+Keywords[wa]=kdm,manaedjeu d' håynaedje,xdm,uzeus,login,wilikom,greeting,Logo,styles,stîles,lingaedje,payi,fontes,fond,fond del waitroûle,sessions,distinde,dislodjî,elodjî,s' elodjî,renonder
+Keywords[xh]=kdm,umphathi womboniso,xdm,abasebenzisi,igama elithile,umbuliso,ilogo,iintlobo,ulwimi,ilizwe,ubungakanani bamagama, imvelaphi,amaphepha odonga,iintlanganiso,vala,qala kwakhona
+Keywords[zh_CN]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,显示管理器,用户,登录,欢迎辞,标志,风格,语言,国家,字体,背景,墙纸,会话,关机,重启动
+Keywords[zh_TW]=kdm,display manager,xdm,users,login,greeting,Logo,styles,language,country,fonts,background,wallpapers,sessions,shutdown,restart,顯示管理程式,使用者,登入,歡迎,風格,語言,國家,字型,背景,底圖,工作階段,關機,重新啟動
+Keywords[zu]=kdm,Imenenja yokuveza,xdm,abasebenzisi,ukungena ngaphakathi,isibingelelo,Isiqubulo,izitayela,ulimi,izwe,izinhlobo zamagama, inkundla yangemuva,emaphepha ezindonga,iziqendu,vala,phinda uqale
+
+Categories=Qt;KDE;X-KDE-settings-system;
diff --git a/kcontrol/kdm/main.cpp b/kcontrol/kdm/main.cpp
new file mode 100644
index 000000000..12c356e5c
--- /dev/null
+++ b/kcontrol/kdm/main.cpp
@@ -0,0 +1,336 @@
+/*
+ * main.cpp
+ *
+ * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <[email protected]>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+
+#include <qlayout.h>
+
+#include <kaboutdata.h>
+#include <kgenericfactory.h>
+#include <kimageio.h>
+#include <kmessagebox.h>
+#include <kurldrag.h>
+
+#include "kdm-appear.h"
+#include "kdm-font.h"
+#include "kdm-users.h"
+#include "kdm-shut.h"
+#include "kdm-conv.h"
+
+#include "main.h"
+#include "background.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <locale.h>
+#include <pwd.h>
+#include <grp.h>
+
+typedef KGenericFactory<KDModule, QWidget> KDMFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kdm, KDMFactory("kdmconfig") )
+
+KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg)
+{
+ KURL::List uris;
+
+ if (KURLDrag::decode(e, uris) && (uris.count() > 0)) {
+ KURL *url = new KURL(uris.first());
+
+ KImageIO::registerFormats();
+ if( KImageIO::canRead(KImageIO::type(url->fileName())) )
+ return url;
+
+ QStringList qs = QStringList::split('\n', KImageIO::pattern());
+ qs.remove(qs.begin());
+
+ QString msg = i18n( "%1 "
+ "does not appear to be an image file.\n"
+ "Please use files with these extensions:\n"
+ "%2")
+ .arg(url->fileName())
+ .arg(qs.join("\n"));
+ KMessageBox::sorry( wdg, msg);
+ delete url;
+ }
+ return 0;
+}
+
+KSimpleConfig *config;
+
+KDModule::KDModule(QWidget *parent, const char *name, const QStringList &)
+ : KCModule(KDMFactory::instance(), parent, name)
+ , minshowuid(0)
+ , maxshowuid(0)
+ , updateOK(false)
+{
+ KAboutData *about =
+ new KAboutData(I18N_NOOP("kcmkdm"), I18N_NOOP("KDE Login Manager Config Module"),
+ 0, 0, KAboutData::License_GPL,
+ I18N_NOOP("(c) 1996 - 2005 The KDM Authors"));
+
+ about->addAuthor("Thomas Tanghus", I18N_NOOP("Original author"), "[email protected]");
+ about->addAuthor("Steffen Hansen", 0, "[email protected]");
+ about->addAuthor("Oswald Buddenhagen", I18N_NOOP("Current maintainer"), "[email protected]");
+
+ setQuickHelp( i18n( "<h1>Login Manager</h1> In this module you can configure the "
+ "various aspects of the KDE Login Manager. This includes "
+ "the look and feel as well as the users that can be "
+ "selected for login. Note that you can only make changes "
+ "if you run the module with superuser rights. If you have not started the KDE "
+ "Control Center with superuser rights (which is absolutely the right thing to "
+ "do, by the way), click on the <em>Modify</em> button to acquire "
+ "superuser rights. You will be asked for the superuser password."
+ "<h2>Appearance</h2> On this tab page, you can configure how "
+ "the Login Manager should look, which language it should use, and which "
+ "GUI style it should use. The language settings made here have no influence on "
+ "the user's language settings."
+ "<h2>Font</h2>Here you can choose the fonts that the Login Manager should use "
+ "for various purposes like greetings and user names. "
+ "<h2>Background</h2>If you want to set a special background for the login "
+ "screen, this is where to do it."
+ "<h2>Shutdown</h2> Here you can specify who is allowed to shutdown/reboot the machine "
+ "and whether a boot manager should be used."
+ "<h2>Users</h2>On this tab page, you can select which users the Login Manager "
+ "will offer you for logging in."
+ "<h2>Convenience</h2> Here you can specify a user to be logged in automatically, "
+ "users not needing to provide a password to log in, and other convenience features.<br>"
+ "Note, that these settings are security holes by their nature, so use them very carefully."));
+
+ setAboutData( about );
+
+ setlocale( LC_COLLATE, "C" );
+
+ KGlobal::locale()->insertCatalogue("kcmbackground");
+
+ QStringList sl;
+ QMap<gid_t,QStringList> tgmap;
+ QMap<gid_t,QStringList>::Iterator tgmapi;
+ QMap<gid_t,QStringList>::ConstIterator tgmapci;
+ QMap<QString, QPair<int,QStringList> >::Iterator umapi;
+
+ struct passwd *ps;
+ for (setpwent(); (ps = getpwent()); ) {
+ QString un( QFile::decodeName( ps->pw_name ) );
+ if (usermap.find( un ) == usermap.end()) {
+ usermap.insert( un, QPair<int,QStringList>( ps->pw_uid, sl ) );
+ if ((tgmapi = tgmap.find( ps->pw_gid )) != tgmap.end())
+ (*tgmapi).append( un );
+ else
+ tgmap[ps->pw_gid] = un;
+ }
+ }
+ endpwent();
+
+ struct group *grp;
+ for (setgrent(); (grp = getgrent()); ) {
+ QString gn( QFile::decodeName( grp->gr_name ) );
+ bool delme = false;
+ if ((tgmapi = tgmap.find( grp->gr_gid )) != tgmap.end()) {
+ if ((*tgmapi).count() == 1 && (*tgmapi).first() == gn)
+ delme = true;
+ else
+ for (QStringList::ConstIterator it = (*tgmapi).begin();
+ it != (*tgmapi).end(); ++it)
+ usermap[*it].second.append( gn );
+ tgmap.remove( tgmapi );
+ }
+ if (!*grp->gr_mem ||
+ (delme && !grp->gr_mem[1] && gn == QFile::decodeName( *grp->gr_mem )))
+ continue;
+ do {
+ QString un( QFile::decodeName( *grp->gr_mem ) );
+ if ((umapi = usermap.find( un )) != usermap.end()) {
+ if ((*umapi).second.find( gn ) == (*umapi).second.end())
+ (*umapi).second.append( gn );
+ } else
+ kdWarning() << "group '" << gn << "' contains unknown user '" << un << "'" << endl;
+ } while (*++grp->gr_mem);
+ }
+ endgrent();
+
+ for (tgmapci = tgmap.begin(); tgmapci != tgmap.end(); ++tgmapci)
+ kdWarning() << "user(s) '" << tgmapci.data().join(",")
+ << "' have unknown GID " << tgmapci.key() << endl;
+
+ config = new KSimpleConfig( QString::fromLatin1( KDE_CONFDIR "/kdm/kdmrc" ));
+
+ QVBoxLayout *top = new QVBoxLayout(this);
+ tab = new QTabWidget(this);
+
+ // *****
+ // _don't_ add a theme configurator until the theming engine is _really_ done!!
+ // *****
+
+ appearance = new KDMAppearanceWidget(this);
+ tab->addTab(appearance, i18n("A&ppearance"));
+ connect(appearance, SIGNAL(changed(bool)), SIGNAL( changed(bool)));
+
+ font = new KDMFontWidget(this);
+ tab->addTab(font, i18n("&Font"));
+ connect(font, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
+
+ background = new KBackground(this);
+ tab->addTab(background, i18n("&Background"));
+ connect(background, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
+
+ sessions = new KDMSessionsWidget(this);
+ tab->addTab(sessions, i18n("&Shutdown"));
+ connect(sessions, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
+
+ users = new KDMUsersWidget(this, 0);
+ tab->addTab(users, i18n("&Users"));
+ connect(users, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
+ connect(users, SIGNAL(setMinMaxUID(int,int)), SLOT(slotMinMaxUID(int,int)));
+ connect(this, SIGNAL(addUsers(const QMap<QString,int> &)), users, SLOT(slotAddUsers(const QMap<QString,int> &)));
+ connect(this, SIGNAL(delUsers(const QMap<QString,int> &)), users, SLOT(slotDelUsers(const QMap<QString,int> &)));
+ connect(this, SIGNAL(clearUsers()), users, SLOT(slotClearUsers()));
+
+ convenience = new KDMConvenienceWidget(this, 0);
+ tab->addTab(convenience, i18n("Con&venience"));
+ connect(convenience, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
+ connect(this, SIGNAL(addUsers(const QMap<QString,int> &)), convenience, SLOT(slotAddUsers(const QMap<QString,int> &)));
+ connect(this, SIGNAL(delUsers(const QMap<QString,int> &)), convenience, SLOT(slotDelUsers(const QMap<QString,int> &)));
+ connect(this, SIGNAL(clearUsers()), convenience, SLOT(slotClearUsers()));
+
+ load();
+ if (getuid() != 0 || !config->checkConfigFilesWritable( true )) {
+ appearance->makeReadOnly();
+ font->makeReadOnly();
+ background->makeReadOnly();
+ users->makeReadOnly();
+ sessions->makeReadOnly();
+ convenience->makeReadOnly();
+ }
+ top->addWidget(tab);
+}
+
+KDModule::~KDModule()
+{
+ delete config;
+}
+
+void KDModule::load()
+{
+ appearance->load();
+ font->load();
+ background->load();
+ users->load();
+ sessions->load();
+ convenience->load();
+ propagateUsers();
+}
+
+
+void KDModule::save()
+{
+ appearance->save();
+ font->save();
+ background->save();
+ users->save();
+ sessions->save();
+ convenience->save();
+ config->sync();
+}
+
+
+void KDModule::defaults()
+{
+ if ( getuid() == 0 )
+ {
+ appearance->defaults();
+ font->defaults();
+ background->defaults();
+ users->defaults();
+ sessions->defaults();
+ convenience->defaults();
+ propagateUsers();
+ }
+}
+
+void KDModule::propagateUsers()
+{
+ groupmap.clear();
+ emit clearUsers();
+ QMap<QString,int> lusers;
+ QMapConstIterator<QString, QPair<int,QStringList> > it;
+ QStringList::ConstIterator jt;
+ QMap<QString,int>::Iterator gmapi;
+ for (it = usermap.begin(); it != usermap.end(); ++it) {
+ int uid = it.data().first;
+ if (!uid || (uid >= minshowuid && uid <= maxshowuid)) {
+ lusers[it.key()] = uid;
+ for (jt = it.data().second.begin(); jt != it.data().second.end(); ++jt)
+ if ((gmapi = groupmap.find( *jt )) == groupmap.end()) {
+ groupmap[*jt] = 1;
+ lusers['@' + *jt] = -uid;
+ } else
+ (*gmapi)++;
+ }
+ }
+ emit addUsers(lusers);
+ updateOK = true;
+}
+
+void KDModule::slotMinMaxUID(int min, int max)
+{
+ if (updateOK) {
+ QMap<QString,int> alusers, dlusers;
+ QMapConstIterator<QString, QPair<int,QStringList> > it;
+ QStringList::ConstIterator jt;
+ QMap<QString,int>::Iterator gmapi;
+ for (it = usermap.begin(); it != usermap.end(); ++it) {
+ int uid = it.data().first;
+ if (!uid) continue;
+ if ((uid >= minshowuid && uid <= maxshowuid) &&
+ !(uid >= min && uid <= max)) {
+ dlusers[it.key()] = uid;
+ for (jt = it.data().second.begin();
+ jt != it.data().second.end(); ++jt) {
+ gmapi = groupmap.find( *jt );
+ if (!--(*gmapi)) {
+ groupmap.remove( gmapi );
+ dlusers['@' + *jt] = -uid;
+ }
+ }
+ } else
+ if ((uid >= min && uid <= max) &&
+ !(uid >= minshowuid && uid <= maxshowuid)) {
+ alusers[it.key()] = uid;
+ for (jt = it.data().second.begin();
+ jt != it.data().second.end(); ++jt)
+ if ((gmapi = groupmap.find( *jt )) == groupmap.end()) {
+ groupmap[*jt] = 1;
+ alusers['@' + *jt] = -uid;
+ } else
+ (*gmapi)++;
+ }
+ }
+ emit delUsers(dlusers);
+ emit addUsers(alusers);
+ }
+ minshowuid = min;
+ maxshowuid = max;
+}
+
+#include "main.moc"
diff --git a/kcontrol/kdm/main.h b/kcontrol/kdm/main.h
new file mode 100644
index 000000000..5e8da66b8
--- /dev/null
+++ b/kcontrol/kdm/main.h
@@ -0,0 +1,83 @@
+/*
+ * main.h
+ *
+ * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <[email protected]>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __kdm_main_h
+#define __kdm_main_h
+
+#include <qtabwidget.h>
+#include <qmap.h>
+
+#include <kcmodule.h>
+
+class KDMAppearanceWidget;
+class KDMFontWidget;
+class KDMSessionsWidget;
+class KDMUsersWidget;
+class KDMConvenienceWidget;
+class KBackground;
+
+class KDModule : public KCModule
+{
+ Q_OBJECT
+
+public:
+
+ KDModule(QWidget *parent, const char *name, const QStringList &);
+ ~KDModule();
+
+ void load();
+ void save();
+ void defaults();
+
+public slots:
+
+ void slotMinMaxUID(int min, int max);
+
+signals:
+
+ void clearUsers();
+ void addUsers(const QMap<QString,int> &);
+ void delUsers(const QMap<QString,int> &);
+
+private:
+
+ QTabWidget *tab;
+
+ KDMAppearanceWidget *appearance;
+ KBackground *background;
+ KDMFontWidget *font;
+ KDMSessionsWidget *sessions;
+ KDMUsersWidget *users;
+ KDMConvenienceWidget *convenience;
+
+ QMap<QString, QPair<int,QStringList> > usermap;
+ QMap<QString,int> groupmap;
+ int minshowuid, maxshowuid;
+ bool updateOK;
+
+ void propagateUsers();
+
+};
+
+#endif
+