Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:aualin:kde
kdebase3
kdebase-pardus-port-klineedit-from-kde4.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kdebase-pardus-port-klineedit-from-kde4.patch of Package kdebase3
From c51c81adc527b3fdb2e483b5d60df7afaa75ca4d Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ozan=20=C3=87a=C4=9Flayan?= <ozan@pardus.org.tr> Date: Mon, 27 Jun 2011 05:31:42 +0000 Subject: [PATCH] kdm: Backport KLineEdit stuff from KDE4 Backport KLineEdit stuff from KDE4 to fix the usage of non ASCII characters in passwords, etc. --- kdmlib/kgreet_classic.cpp | 55 +++++++++++++++++++++++++++++++------------- kdmlib/kgreet_classic.h | 4 +- kdmlib/kgreet_winbind.cpp | 49 ++++++++++++++++++++++++++++----------- kdmlib/kgreet_winbind.h | 3 +- 4 files changed, 77 insertions(+), 34 deletions(-) diff --git a/kdmlib/kgreet_classic.cpp b/kdmlib/kgreet_classic.cpp index b38e979..d83b5c9 100644 --- a/kdmlib/kgreet_classic.cpp +++ b/kdmlib/kgreet_classic.cpp @@ -26,21 +26,30 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "themer/kdmthemer.h" #include "themer/kdmitem.h" +#include <kglobal.h> #include <klocale.h> #include <klineedit.h> -#include <kpassdlg.h> +//#include <kpassdlg.h> #include <kuser.h> #include <qregexp.h> #include <qlayout.h> #include <qlabel.h> -class KDMPasswordEdit : public KPasswordEdit { +class KDMPasswordEdit : public KLineEdit { public: - KDMPasswordEdit( QWidget *parent ) : KPasswordEdit( parent, 0 ) {} - KDMPasswordEdit( KPasswordEdit::EchoModes echoMode, QWidget *parent ) : KPasswordEdit( echoMode, parent, 0 ) {} + KDMPasswordEdit( QWidget *parent ) : KLineEdit( parent ) + { + setEchoMode(QLineEdit::Password); + } + + KDMPasswordEdit( QLineEdit::EchoMode echoMode, QWidget *parent ) : KLineEdit( parent ) + { + setEchoMode(echoMode); + } + protected: - virtual void contextMenuEvent( QContextMenuEvent * ) {} + virtual void contextMenuEvent( QContextMenuEvent * ) {} }; static int echoMode; @@ -106,8 +115,7 @@ KClassicGreeter::KClassicGreeter( KGreeterPluginHandler *_handler, if (echoMode == -1) passwdEdit = new KDMPasswordEdit( parent ); else - passwdEdit = new KDMPasswordEdit( (KPasswordEdit::EchoModes)echoMode, - parent ); + passwdEdit = new KDMPasswordEdit( (QLineEdit::EchoMode)echoMode, parent ); connect( passwdEdit, SIGNAL(textChanged( const QString & )), SLOT(slotActivity()) ); connect( passwdEdit, SIGNAL(lostFocus()), SLOT(slotActivity()) ); @@ -134,8 +142,8 @@ KClassicGreeter::KClassicGreeter( KGreeterPluginHandler *_handler, } if (func != Authenticate) { if (echoMode == -1) { - passwd1Edit = new KDMPasswordEdit( (KPasswordEdit::EchoModes)echoMode, parent ); - passwd2Edit = new KDMPasswordEdit( (KPasswordEdit::EchoModes)echoMode, parent ); + passwd1Edit = new KDMPasswordEdit( (QLineEdit::EchoMode)echoMode, parent ); + passwd2Edit = new KDMPasswordEdit( (QLineEdit::EchoMode)echoMode, parent ); } else { passwd1Edit = new KDMPasswordEdit( parent ); passwd2Edit = new KDMPasswordEdit( parent ); @@ -239,16 +247,16 @@ KClassicGreeter::returnData() KGreeterPluginHandler::IsUser ); break; case 1: - handler->gplugReturnText( passwdEdit->password(), + handler->gplugReturnText( passwdEdit->text().utf8(), KGreeterPluginHandler::IsPassword | KGreeterPluginHandler::IsSecret ); break; case 2: - handler->gplugReturnText( passwd1Edit->password(), + handler->gplugReturnText( passwd1Edit->text().utf8(), KGreeterPluginHandler::IsSecret ); break; default: // case 3: - handler->gplugReturnText( passwd2Edit->password(), + handler->gplugReturnText( passwd2Edit->text().utf8(), KGreeterPluginHandler::IsNewPassword | KGreeterPluginHandler::IsSecret ); break; @@ -397,11 +405,11 @@ KClassicGreeter::revive() // assert( !running ); setActive2( true ); if (authTok) { - passwd1Edit->erase(); - passwd2Edit->erase(); + passwd1Edit->clear(); + passwd2Edit->clear(); passwd1Edit->setFocus(); } else { - passwdEdit->erase(); + passwdEdit->clear(); if (loginEdit && loginEdit->isEnabled()) passwdEdit->setEnabled( true ); else { @@ -418,7 +426,7 @@ void // virtual KClassicGreeter::clear() { // assert( !running && !passwd1Edit ); - passwdEdit->erase(); + passwdEdit->clear(); if (loginEdit) { loginEdit->clear(); loginEdit->setFocus(); @@ -477,6 +485,21 @@ static bool init( const QString &, void *ctx ) { echoMode = getConf( ctx, "EchoMode", QVariant( -1 ) ).toInt(); + switch (echoMode) + { + case (0): + case (1): + echoMode = QLineEdit::Password; + break; + + case (2): + echoMode = QLineEdit::NoEcho; + break; + + default: + echoMode = QLineEdit::Password; + } + KGlobal::locale()->insertCatalogue( "kgreet_classic" ); return true; } diff --git a/kdmlib/kgreet_classic.h b/kdmlib/kgreet_classic.h index 64d3979..fa9e6cb 100644 --- a/kdmlib/kgreet_classic.h +++ b/kdmlib/kgreet_classic.h @@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <qobject.h> class KLineEdit; -class KPasswordEdit; +//class KPasswordEdit; class KSimpleConfig; class QGridLayout; class QLabel; @@ -75,7 +75,7 @@ class KClassicGreeter : public QObject, public KGreeterPlugin { QLabel *loginLabel, *passwdLabel, *passwd1Label, *passwd2Label; KLineEdit *loginEdit; - KPasswordEdit *passwdEdit, *passwd1Edit, *passwd2Edit; + KLineEdit *passwdEdit, *passwd1Edit, *passwd2Edit; KSimpleConfig *stsFile; QString fixedUser, curUser; Function func; diff --git a/kdmlib/kgreet_winbind.cpp b/kdmlib/kgreet_winbind.cpp index eeef08b..1196007 100644 --- a/kdmlib/kgreet_winbind.cpp +++ b/kdmlib/kgreet_winbind.cpp @@ -26,11 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "themer/kdmthemer.h" #include "themer/kdmitem.h" +#include <kglobal.h> #include <klocale.h> #include <kdebug.h> #include <kcombobox.h> #include <klineedit.h> -#include <kpassdlg.h> #include <kuser.h> #include <kprocio.h> @@ -40,10 +40,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <stdlib.h> -class KDMPasswordEdit : public KPasswordEdit { +class KDMPasswordEdit : public KLineEdit { public: - KDMPasswordEdit( QWidget *parent ) : KPasswordEdit( parent, 0 ) {} - KDMPasswordEdit( KPasswordEdit::EchoModes echoMode, QWidget *parent ) : KPasswordEdit( echoMode, parent, 0 ) {} + KDMPasswordEdit( QWidget *parent ) : KLineEdit( parent ) + { + setEchoMode(QLineEdit::Password); + } + KDMPasswordEdit( QLineEdit::EchoMode echoMode, QWidget *parent ) : KLineEdit( parent ) + { + setEchoMode(echoMode); + } protected: virtual void contextMenuEvent( QContextMenuEvent * ) {} }; @@ -149,7 +155,7 @@ KWinbindGreeter::KWinbindGreeter( KGreeterPluginHandler *_handler, if (echoMode == -1) passwdEdit = new KDMPasswordEdit( parent ); else - passwdEdit = new KDMPasswordEdit( (KPasswordEdit::EchoModes)echoMode, + passwdEdit = new KDMPasswordEdit( (QLineEdit::EchoMode)echoMode, parent ); connect( passwdEdit, SIGNAL(textChanged( const QString & )), SLOT(slotActivity()) ); @@ -179,8 +185,8 @@ KWinbindGreeter::KWinbindGreeter( KGreeterPluginHandler *_handler, } if (func != Authenticate) { if (echoMode == -1) { - passwd1Edit = new KDMPasswordEdit( (KPasswordEdit::EchoModes)echoMode, parent ); - passwd2Edit = new KDMPasswordEdit( (KPasswordEdit::EchoModes)echoMode, parent ); + passwd1Edit = new KDMPasswordEdit( (QLineEdit::EchoMode)echoMode, parent ); + passwd2Edit = new KDMPasswordEdit( (QLineEdit::EchoMode)echoMode, parent ); } else { passwd1Edit = new KDMPasswordEdit( parent ); passwd2Edit = new KDMPasswordEdit( parent ); @@ -320,16 +326,16 @@ KWinbindGreeter::returnData() KGreeterPluginHandler::IsUser ); break; case 1: - handler->gplugReturnText( passwdEdit->password(), + handler->gplugReturnText( passwdEdit->text().utf8(), KGreeterPluginHandler::IsPassword | KGreeterPluginHandler::IsSecret ); break; case 2: - handler->gplugReturnText( passwd1Edit->password(), + handler->gplugReturnText( passwd1Edit->text().utf8(), KGreeterPluginHandler::IsSecret ); break; default: // case 3: - handler->gplugReturnText( passwd2Edit->password(), + handler->gplugReturnText( passwd2Edit->text().utf8(), KGreeterPluginHandler::IsNewPassword | KGreeterPluginHandler::IsSecret ); break; @@ -478,11 +484,11 @@ KWinbindGreeter::revive() // assert( !running ); setActive2( true ); if (authTok) { - passwd1Edit->erase(); - passwd2Edit->erase(); + passwd1Edit->clear(); + passwd2Edit->clear(); passwd1Edit->setFocus(); } else { - passwdEdit->erase(); + passwdEdit->clear(); if (loginEdit && loginEdit->isEnabled()) passwdEdit->setEnabled( true ); else { @@ -499,7 +505,7 @@ void // virtual KWinbindGreeter::clear() { // assert( !running && !passwd1Edit ); - passwdEdit->erase(); + passwdEdit->clear(); if (loginEdit) { domainCombo->setCurrentItem( defaultDomain ); slotChangedDomain( defaultDomain ); @@ -624,6 +630,21 @@ static bool init( const QString &, void *ctx ) { echoMode = getConf( ctx, "EchoMode", QVariant( -1 ) ).toInt(); + switch (echoMode) + { + case (0): + case (1): + echoMode = QLineEdit::Password; + break; + + case (2): + echoMode = QLineEdit::NoEcho; + break; + + default: + echoMode = QLineEdit::Password; + } + staticDomains = QStringList::split( ':', getConf( ctx, "winbind.Domains", QVariant( "" ) ).toString() ); if (!staticDomains.contains("<local>")) staticDomains << "<local>"; diff --git a/kdmlib/kgreet_winbind.h b/kdmlib/kgreet_winbind.h index 7fc6a1c..9592bab 100644 --- a/kdmlib/kgreet_winbind.h +++ b/kdmlib/kgreet_winbind.h @@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class KComboBox; class KLineEdit; -class KPasswordEdit; class KSimpleConfig; class QGridLayout; class QLabel; @@ -84,7 +83,7 @@ class KWinbindGreeter : public QObject, public KGreeterPlugin { QLabel *domainLabel, *loginLabel, *passwdLabel, *passwd1Label, *passwd2Label; KComboBox *domainCombo; KLineEdit *loginEdit; - KPasswordEdit *passwdEdit, *passwd1Edit, *passwd2Edit; + KLineEdit *passwdEdit, *passwd1Edit, *passwd2Edit; KSimpleConfig *stsFile; QString fixedDomain, fixedUser, curUser; QStringList allUsers, mDomainListing; -- 1.6.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor