summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/lockdlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdesktop/lock/lockdlg.cpp')
-rw-r--r--kdesktop/lock/lockdlg.cpp89
1 files changed, 52 insertions, 37 deletions
diff --git a/kdesktop/lock/lockdlg.cpp b/kdesktop/lock/lockdlg.cpp
index d4b456a9e..c8d82e8d9 100644
--- a/kdesktop/lock/lockdlg.cpp
+++ b/kdesktop/lock/lockdlg.cpp
@@ -21,6 +21,7 @@
#include <kpushbutton.h>
#include <kseparator.h>
#include <kstandarddirs.h>
+#include <ksimpleconfig.h>
#include <tdeglobalsettings.h>
#include <tdeconfig.h>
#include <kiconloader.h>
@@ -43,7 +44,10 @@
#include <tqlistview.h>
#include <tqheader.h>
#include <tqcheckbox.h>
+#ifdef WITH_TDEHWLIB
#include <tqfile.h>
+#include <tdecryptographiccarddevice.h>
+#endif
#include <ctype.h>
#include <unistd.h>
@@ -58,9 +62,6 @@
#include <X11/Xatom.h>
#include <fixx11h.h>
-#ifdef HAVE_KRB5
-#include <libtdeldap.h>
-#endif
#ifndef AF_LOCAL
# define AF_LOCAL AF_UNIX
@@ -101,6 +102,7 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDat
mPlugin( plugin ),
mCapsLocked(-1),
mUnlockingFailed(false),
+ validUserCardInserted(false),
showInfoMessages(true),
mCardLoginInProgress(false)
{
@@ -198,7 +200,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
if (!m_lockStartDT.isNull()) {
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
- frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop );
+ frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, TQt::AlignTop );
frameLayout->addWidget( greetLabel, 1, 1 );
frameLayout->addWidget( lockDTLabel, 2, 1 );
frameLayout->addItem( greet->getLayoutItem(), 3, 1 );
@@ -208,7 +210,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
}
else {
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
- frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop );
+ frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, TQt::AlignTop );
frameLayout->addWidget( greetLabel, 1, 1 );
frameLayout->addItem( greet->getLayoutItem(), 2, 1 );
frameLayout->addLayout( layStatus, 3, 1 );
@@ -218,7 +220,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
}
else {
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
- frameLayout->addMultiCellWidget( pixLabel, 0, 2, 0, 0, Qt::AlignTop );
+ frameLayout->addMultiCellWidget( pixLabel, 0, 2, 0, 0, TQt::AlignTop );
frameLayout->addWidget( greetLabel, 0, 1 );
frameLayout->addItem( greet->getLayoutItem(), 1, 1 );
frameLayout->addLayout( layStatus, 2, 1 );
@@ -235,12 +237,12 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
}
setTabOrder( mNewSessButton, mLayoutButton );
- connect(mLayoutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(layoutClicked()));
+ connect(mLayoutButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(layoutClicked()));
if (show_cancel_button) {
- connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject()));
+ connect(cancel, TQ_SIGNAL(clicked()), TQ_SLOT(reject()));
}
- connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK()));
- connect(mNewSessButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotSwitchUser()));
+ connect(ok, TQ_SIGNAL(clicked()), TQ_SLOT(slotOK()));
+ connect(mNewSessButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotSwitchUser()));
if (!DM().isSwitchable() || !kapp->authorize("switch_user")) {
mNewSessButton->hide();
@@ -251,7 +253,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
mFailedTimerId = 0;
mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT);
- connect(tqApp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) );
+ connect(tqApp, TQ_SIGNAL(activity()), TQ_SLOT(slotActivity()) );
greet->setInfoMessageDisplay(showInfoMessages);
greet->start();
@@ -327,12 +329,12 @@ void PasswordDlg::setLayoutText( const TQString &txt )
void PasswordDlg::updateLabel()
{
if (mUnlockingFailed) {
- mStatusLabel->setPaletteForegroundColor(Qt::black);
+ mStatusLabel->setPaletteForegroundColor(TQt::black);
mStatusLabel->setText(i18n("<b>Unlocking failed</b>"));
// mStatusLabel->show();
}
else if (mCapsLocked) {
- mStatusLabel->setPaletteForegroundColor(Qt::red);
+ mStatusLabel->setPaletteForegroundColor(TQt::red);
mStatusLabel->setText(i18n("<b>Warning: Caps Lock on</b>"));
// mStatusLabel->show();
}
@@ -479,6 +481,7 @@ void PasswordDlg::reapVerify()
switch (WEXITSTATUS(status)) {
case AuthOk:
{
+#ifdef WITH_TDEHWLIB
KUser userinfo;
TQString fileName = userinfo.homeDir() + "/.tde_card_login_state";
TQFile flagFile(fileName);
@@ -493,6 +496,7 @@ void PasswordDlg::reapVerify()
// Card was not used to log in
flagFile.remove();
}
+#endif
// Signal success
greet->succeeded();
@@ -555,6 +559,7 @@ void PasswordDlg::handleVerify()
setFixedSize( sizeHint().width(), sizeHint().height() + 1 );
setFixedSize( sizeHint() );
+#ifdef WITH_TDEHWLIB
// Check if cryptographic card login is being used
if (mCardLoginInProgress) {
// Attempt authentication if configured
@@ -563,11 +568,12 @@ void PasswordDlg::handleVerify()
TQString autoPIN = cdevice->autoPIN();
if (autoPIN != TQString::null) {
greet->setPassword(autoPIN);
- TQTimer::singleShot(0, this, SLOT(slotOK()));
+ TQTimer::singleShot(0, this, TQ_SLOT(slotOK()));
}
}
mCardLoginInProgress = false;
}
+#endif
}
else {
greet->textPrompt( arr, false, false );
@@ -706,12 +712,12 @@ void PasswordDlg::gplugMsgBox( TQMessageBox::Icon type, const TQString &text )
KPushButton *button = new KPushButton( KStdGuiItem::ok(), winFrame );
button->setDefault( true );
button->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ) );
- connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( accept() ) );
+ connect( button, TQ_SIGNAL( clicked() ), TQ_SLOT( accept() ) );
TQGridLayout *grid = new TQGridLayout( winFrame, 2, 2, 10 );
- grid->addWidget( label1, 0, 0, Qt::AlignCenter );
- grid->addWidget( label2, 0, 1, Qt::AlignCenter );
- grid->addMultiCellWidget( button, 1,1, 0,1, Qt::AlignCenter );
+ grid->addWidget( label1, 0, 0, TQt::AlignCenter );
+ grid->addWidget( label2, 0, 1, TQt::AlignCenter );
+ grid->addMultiCellWidget( button, 1,1, 0,1, TQt::AlignCenter );
static_cast< LockProcess* >(parent())->execDialog( &dialog );
}
@@ -777,16 +783,16 @@ void PasswordDlg::slotStartNewSession()
TQLabel *label2 = new TQLabel( qt_text, winFrame );
KPushButton *okbutton = new KPushButton( KGuiItem(i18n("&Start New Session"), "fork"), winFrame );
okbutton->setDefault( true );
- connect( okbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( accept() ) );
+ connect( okbutton, TQ_SIGNAL( clicked() ), dialog, TQ_SLOT( accept() ) );
KPushButton *cbutton = new KPushButton( KStdGuiItem::cancel(), winFrame );
- connect( cbutton, TQT_SIGNAL( clicked() ), dialog, TQT_SLOT( reject() ) );
+ connect( cbutton, TQ_SIGNAL( clicked() ), dialog, TQ_SLOT( reject() ) );
TQBoxLayout *mbox = new TQVBoxLayout( winFrame, KDialog::marginHint(), KDialog::spacingHint() );
TQGridLayout *grid = new TQGridLayout( mbox, 2, 2, 2 * KDialog::spacingHint() );
grid->setMargin( KDialog::marginHint() );
- grid->addWidget( label1, 0, 0, Qt::AlignCenter );
- grid->addWidget( label2, 0, 1, Qt::AlignCenter );
+ grid->addWidget( label1, 0, 0, TQt::AlignCenter );
+ grid->addWidget( label2, 0, 1, TQt::AlignCenter );
TQCheckBox *cb = new TQCheckBox( i18n("&Do not ask again"), winFrame );
grid->addMultiCellWidget( cb, 1,1, 0,1 );
@@ -895,8 +901,8 @@ void PasswordDlg::slotSwitchUser()
SessList sess;
if (dm.localSessions( sess )) {
lv = new TQListView( winFrame );
- connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT(slotSessionActivated()) );
- connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), &dialog, TQT_SLOT(accept()) );
+ connect( lv, TQ_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), TQ_SLOT(slotSessionActivated()) );
+ connect( lv, TQ_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), &dialog, TQ_SLOT(accept()) );
lv->setAllColumnsShowFocus( true );
lv->addColumn( i18n("Session") );
lv->addColumn( i18n("Location") );
@@ -927,16 +933,16 @@ void PasswordDlg::slotSwitchUser()
vbox1->addWidget( lv );
btn = new KPushButton( KGuiItem(i18n("session", "&Activate"), "fork"), winFrame );
- connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotSessionActivated()) );
- connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) );
+ connect( btn, TQ_SIGNAL(clicked()), TQ_SLOT(slotSessionActivated()) );
+ connect( btn, TQ_SIGNAL(clicked()), &dialog, TQ_SLOT(accept()) );
vbox2->addWidget( btn );
vbox2->addStretch( 2 );
}
if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0) {
btn = new KPushButton( KGuiItem(i18n("Start &New Session"), "fork"), winFrame );
- connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotStartNewSession()) );
- connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) );
+ connect( btn, TQ_SIGNAL(clicked()), TQ_SLOT(slotStartNewSession()) );
+ connect( btn, TQ_SIGNAL(clicked()), &dialog, TQ_SLOT(accept()) );
if (!p)
btn->setEnabled( false );
vbox2->addWidget( btn );
@@ -944,7 +950,7 @@ void PasswordDlg::slotSwitchUser()
}
btn = new KPushButton( KStdGuiItem::cancel(), winFrame );
- connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(reject()) );
+ connect( btn, TQ_SIGNAL(clicked()), &dialog, TQ_SLOT(reject()) );
vbox2->addWidget( btn );
dialog.setFixedSize( dialog.sizeHint() );
@@ -974,16 +980,22 @@ void PasswordDlg::capsLocked()
}
void PasswordDlg::attemptCardLogin() {
-#ifdef HAVE_KRB5
- // Make sure card logins are enabled before attempting one
- if (!LDAPManager::pkcsLoginEnabled()) {
- return;
- }
-#else
+#ifdef WITH_TDEHWLIB
+#ifndef HAVE_KRB5
// Don't enable card-based logins if Kerberos integration was disabled
return;
#endif
+ // Make sure card logins are enabled before attempting one
+ KSimpleConfig *systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
+ systemconfig->setGroup(NULL);
+ bool enabled = systemconfig->readBoolEntry("EnablePKCS11Login", false);
+ delete systemconfig;
+ if (!enabled)
+ {
+ return;
+ }
+
if (mCardLoginInProgress) {
return;
}
@@ -1003,10 +1015,12 @@ void PasswordDlg::attemptCardLogin() {
// Bypass initial password prompt
greet->start();
greet->setPassword("");
- TQTimer::singleShot(0, this, SLOT(slotOK()));
+ TQTimer::singleShot(0, this, TQ_SLOT(slotOK()));
+#endif
}
void PasswordDlg::resetCardLogin() {
+#ifdef WITH_TDEHWLIB
validUserCardInserted = false;
greet->abort();
greet->clear();
@@ -1019,9 +1033,10 @@ void PasswordDlg::resetCardLogin() {
setFixedSize(sizeHint());
// Restore information message display settings
- greet->setInfoMessageDisplay(showInfoMessages);
+ greet->setInfoMessageDisplay(showInfoMessages);
mCardLoginInProgress = false;
+#endif
}
#include "lockdlg.moc"