summaryrefslogtreecommitdiffstats
path: root/tdmlib
diff options
context:
space:
mode:
Diffstat (limited to 'tdmlib')
-rw-r--r--tdmlib/kgreet_classic.cpp45
-rw-r--r--tdmlib/kgreet_classic.h4
-rw-r--r--tdmlib/kgreet_pam.cpp35
-rw-r--r--tdmlib/kgreet_pam.h3
-rw-r--r--tdmlib/kgreet_winbind.cpp35
-rw-r--r--tdmlib/kgreet_winbind.h3
-rw-r--r--tdmlib/kgreeterplugin.h6
7 files changed, 112 insertions, 19 deletions
diff --git a/tdmlib/kgreet_classic.cpp b/tdmlib/kgreet_classic.cpp
index 7eb983583..f99acfb3c 100644
--- a/tdmlib/kgreet_classic.cpp
+++ b/tdmlib/kgreet_classic.cpp
@@ -67,6 +67,7 @@ KClassicGreeter::KClassicGreeter( KGreeterPluginHandler *_handler,
exp( -1 ),
pExp( -1 ),
running( false ),
+ userEntryLocked(false),
suppressInfoMsg(false)
{
KdmItem *user_entry = 0, *pw_entry = 0;
@@ -224,6 +225,7 @@ KClassicGreeter::setUser( const TQString &user )
}
void KClassicGreeter::lockUserEntry( const bool lock ) {
+ userEntryLocked = lock;
loginEdit->setEnabled(!lock);
}
@@ -251,6 +253,23 @@ void KClassicGreeter::setInfoMessageDisplay(bool enable) {
suppressInfoMsg = !enable;
}
+void KClassicGreeter::setPasswordPrompt(const TQString &prompt) {
+ if (passwdLabel) {
+ passwdPromptCustomString = prompt;
+
+ if (prompt != TQString::null) {
+ passwdLabel->setText(prompt);
+ }
+ else {
+ passwdLabel->setText(passwordPrompt());
+ }
+ if (grid) {
+ grid->invalidate();
+ grid->activate();
+ }
+ }
+}
+
void // private
KClassicGreeter::returnData()
{
@@ -311,7 +330,9 @@ KClassicGreeter::textPrompt( const char *prompt, bool echo, bool nonBlocking )
passwdLabel->setText(prompt);
}
else {
- passwdLabel->setText(passwordPrompt());
+ if (passwdPromptCustomString == TQString::null) {
+ passwdLabel->setText(passwordPrompt());
+ }
}
if (grid) {
grid->invalidate();
@@ -349,8 +370,9 @@ KClassicGreeter::textPrompt( const char *prompt, bool echo, bool nonBlocking )
has = -1;
}
- if (has >= exp || nonBlocking)
+ if (has >= exp || nonBlocking) {
returnData();
+ }
}
bool // virtual
@@ -432,7 +454,7 @@ KClassicGreeter::succeeded()
void // virtual
KClassicGreeter::failed()
{
- if (passwdLabel) {
+ if (passwdLabel && (passwdPromptCustomString == TQString::null)) {
// reset password prompt
passwdLabel->setText(passwordPrompt());
if (grid) {
@@ -451,7 +473,7 @@ KClassicGreeter::failed()
void // virtual
KClassicGreeter::revive()
{
- if (passwdLabel) {
+ if (passwdLabel && (passwdPromptCustomString == TQString::null)) {
// reset password prompt
passwdLabel->setText(passwordPrompt());
if (grid) {
@@ -483,7 +505,7 @@ KClassicGreeter::revive()
void // virtual
KClassicGreeter::clear()
{
- if (passwdLabel) {
+ if (passwdLabel && (passwdPromptCustomString == TQString::null)) {
// reset password prompt
passwdLabel->setText(passwordPrompt());
if (grid) {
@@ -508,10 +530,17 @@ KClassicGreeter::clear()
void
KClassicGreeter::setActive( bool enable )
{
- if (loginEdit)
- loginEdit->setEnabled( enable );
- if (passwdEdit)
+ if (loginEdit) {
+ if (userEntryLocked) {
+ loginEdit->setEnabled( false );
+ }
+ else {
+ loginEdit->setEnabled( enable );
+ }
+ }
+ if (passwdEdit) {
passwdEdit->setEnabled( enable );
+ }
}
void
diff --git a/tdmlib/kgreet_classic.h b/tdmlib/kgreet_classic.h
index 4f023db02..3f36d5000 100644
--- a/tdmlib/kgreet_classic.h
+++ b/tdmlib/kgreet_classic.h
@@ -52,6 +52,7 @@ class KClassicGreeter : public TQObject, public KGreeterPlugin {
virtual void setUser( const TQString &user );
virtual void lockUserEntry( const bool lock );
virtual void setPassword( const TQString &pass );
+ virtual void setPasswordPrompt( const TQString &prompt );
virtual void setEnabled( bool on );
virtual void setInfoMessageDisplay( bool on );
virtual bool textMessage( const char *message, bool error );
@@ -86,7 +87,8 @@ class KClassicGreeter : public TQObject, public KGreeterPlugin {
Context ctx;
TQGridLayout* grid;
int exp, pExp, has;
- bool running, authTok, suppressInfoMsg;
+ bool running, authTok, userEntryLocked, suppressInfoMsg;
+ TQString passwdPromptCustomString;
};
#endif /* KGREET_CLASSIC_H */
diff --git a/tdmlib/kgreet_pam.cpp b/tdmlib/kgreet_pam.cpp
index 7fcfafc8b..2aea2ae04 100644
--- a/tdmlib/kgreet_pam.cpp
+++ b/tdmlib/kgreet_pam.cpp
@@ -89,6 +89,7 @@ KPamGreeter::KPamGreeter( KGreeterPluginHandler *_handler,
exp( -1 ),
pExp( -1 ),
running( false ),
+ userEntryLocked(false),
suppressInfoMsg(false)
{
ctx = Login;
@@ -265,6 +266,7 @@ KPamGreeter::setUser( const TQString &user )
}
void KPamGreeter::lockUserEntry( const bool lock ) {
+ userEntryLocked = lock;
loginEdit->setEnabled(!lock);
}
@@ -284,14 +286,32 @@ KPamGreeter::setEnabled(bool enable)
// loginLabel->setEnabled( enable );
authEdit[0]->setEnabled( enable );
setActive( enable );
- if (enable)
+ if (enable) {
authEdit[0]->setFocus();
+ }
}
void KPamGreeter::setInfoMessageDisplay(bool enable) {
suppressInfoMsg = !enable;
}
+void KPamGreeter::setPasswordPrompt(const TQString &prompt) {
+#if 0
+ if (passwdLabel) {
+ if (prompt != TQString::null) {
+ passwdLabel->setText(prompt);
+ }
+ else {
+ passwdLabel->setText(passwordPrompt());
+ }
+ if (grid) {
+ grid->invalidate();
+ grid->activate();
+ }
+ }
+#endif
+}
+
void // private
KPamGreeter::returnData()
{
@@ -349,8 +369,9 @@ KPamGreeter::textPrompt( const char *prompt, bool echo, bool nonBlocking )
kg_debug("state is %d, authEdit.size is %d\n", state, authEdit.size());
if (state == 0 && echo) {
- if (loginLabel)
+ if (loginLabel) {
loginLabel->setText(TQString::fromUtf8(prompt));
+ }
else if (m_themer) {
KdmLabel *tdmlabel = static_cast<KdmLabel*>(m_themer->findNode("user-label"));
if (tdmlabel) {
@@ -612,8 +633,14 @@ KPamGreeter::clear()
void
KPamGreeter::setActive( bool enable )
{
- if (loginEdit)
- loginEdit->setEnabled( enable );
+ if (loginEdit) {
+ if (userEntryLocked) {
+ loginEdit->setEnabled( false );
+ }
+ else {
+ loginEdit->setEnabled( enable );
+ }
+ }
}
void
diff --git a/tdmlib/kgreet_pam.h b/tdmlib/kgreet_pam.h
index 79e92b33a..f579f9522 100644
--- a/tdmlib/kgreet_pam.h
+++ b/tdmlib/kgreet_pam.h
@@ -52,6 +52,7 @@ class KPamGreeter : public TQObject, public KGreeterPlugin {
virtual void setUser( const TQString &user );
virtual void lockUserEntry( const bool lock );
virtual void setPassword( const TQString &pass );
+ virtual void setPasswordPrompt( const TQString &prompt );
virtual void setEnabled( bool on );
virtual void setInfoMessageDisplay( bool on );
virtual bool textMessage( const char *message, bool error );
@@ -90,7 +91,7 @@ class KPamGreeter : public TQObject, public KGreeterPlugin {
Context ctx;
int exp, pExp, has;
unsigned state;
- bool running, authTok, suppressInfoMsg;
+ bool running, authTok, userEntryLocked, suppressInfoMsg;
};
#endif /* KGREET_CLASSIC_H */
diff --git a/tdmlib/kgreet_winbind.cpp b/tdmlib/kgreet_winbind.cpp
index 1efd170ba..cddb2866b 100644
--- a/tdmlib/kgreet_winbind.cpp
+++ b/tdmlib/kgreet_winbind.cpp
@@ -75,6 +75,7 @@ KWinbindGreeter::KWinbindGreeter( KGreeterPluginHandler *_handler,
exp( -1 ),
pExp( -1 ),
running( false ),
+ userEntryLocked(false),
suppressInfoMsg(false)
{
KdmItem *user_entry = 0, *pw_entry = 0, *domain_entry = 0;
@@ -299,6 +300,7 @@ KWinbindGreeter::setUser( const TQString &user )
}
void KWinbindGreeter::lockUserEntry( const bool lock ) {
+ userEntryLocked = lock;
loginEdit->setEnabled(!lock);
}
@@ -328,6 +330,23 @@ void KWinbindGreeter::setInfoMessageDisplay(bool enable) {
suppressInfoMsg = !enable;
}
+void KWinbindGreeter::setPasswordPrompt(const TQString &prompt) {
+#if 0
+ if (passwdLabel) {
+ if (prompt != TQString::null) {
+ passwdLabel->setText(prompt);
+ }
+ else {
+ passwdLabel->setText(passwordPrompt());
+ }
+ if (grid) {
+ grid->invalidate();
+ grid->activate();
+ }
+ }
+#endif
+}
+
void // private
KWinbindGreeter::returnData()
{
@@ -537,12 +556,20 @@ KWinbindGreeter::clear()
void
KWinbindGreeter::setActive( bool enable )
{
- if (domainCombo)
+ if (domainCombo) {
domainCombo->setEnabled( enable );
- if (loginEdit)
- loginEdit->setEnabled( enable );
- if (passwdEdit)
+ }
+ if (loginEdit) {
+ if (userEntryLocked) {
+ loginEdit->setEnabled( false );
+ }
+ else {
+ loginEdit->setEnabled( enable );
+ }
+ }
+ if (passwdEdit) {
passwdEdit->setEnabled( enable );
+ }
}
void
diff --git a/tdmlib/kgreet_winbind.h b/tdmlib/kgreet_winbind.h
index e21fce35b..85565628e 100644
--- a/tdmlib/kgreet_winbind.h
+++ b/tdmlib/kgreet_winbind.h
@@ -56,6 +56,7 @@ class KWinbindGreeter : public TQObject, public KGreeterPlugin {
virtual void setUser( const TQString &user );
virtual void lockUserEntry( const bool lock );
virtual void setPassword( const TQString &pass );
+ virtual void setPasswordPrompt( const TQString &prompt );
virtual void setEnabled( bool on );
virtual void setInfoMessageDisplay( bool on );
virtual bool textMessage( const char *message, bool error );
@@ -97,7 +98,7 @@ class KWinbindGreeter : public TQObject, public KGreeterPlugin {
Function func;
Context ctx;
int exp, pExp, has;
- bool running, authTok, suppressInfoMsg;
+ bool running, authTok, userEntryLocked, suppressInfoMsg;
};
#endif /* KGREET_WINBIND_H */
diff --git a/tdmlib/kgreeterplugin.h b/tdmlib/kgreeterplugin.h
index 029da236c..1dcd0233b 100644
--- a/tdmlib/kgreeterplugin.h
+++ b/tdmlib/kgreeterplugin.h
@@ -164,6 +164,12 @@ public:
virtual void setPassword( const TQString &pass ) = 0;
/**
+ * Set the talker's password prompt to a custom string
+ * @param prompt the password prompt to set, or TQString::null for default
+ */
+ virtual void setPasswordPrompt( const TQString &prompt ) = 0;
+
+ /**
* En-/disable any widgets contained in the talker.
* Will be called only when not running.
* @param on the state to set