diff options
Diffstat (limited to 'kcontrol/kdm/kdm-users.cpp')
-rw-r--r-- | kcontrol/kdm/kdm-users.cpp | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/kcontrol/kdm/kdm-users.cpp b/kcontrol/kdm/kdm-users.cpp index d8a540bd3..ce27f6498 100644 --- a/kcontrol/kdm/kdm-users.cpp +++ b/kcontrol/kdm/kdm-users.cpp @@ -20,14 +20,14 @@ #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 <tqstyle.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqtooltip.h> +#include <tqvalidator.h> +#include <tqwhatsthis.h> +#include <tqvgroupbox.h> +#include <tqpushbutton.h> #include <kfiledialog.h> #include <kimageio.h> @@ -45,8 +45,8 @@ extern KSimpleConfig *config; -KDMUsersWidget::KDMUsersWidget(QWidget *parent, const char *name) - : QWidget(parent, name) +KDMUsersWidget::KDMUsersWidget(TQWidget *parent, const char *name) + : TQWidget(parent, name) { #ifdef __linux__ struct stat st; @@ -76,130 +76,130 @@ KDMUsersWidget::KDMUsersWidget(QWidget *parent, const char *name) config->setGroup( "X-*-Greeter" ); m_userPixDir = config->readEntry( "FaceDir", KGlobal::dirs()->resourceDirs("data").last() + "kdm/faces" ) + '/'; m_notFirst = false; - QDir testDir( m_userPixDir ); + TQDir 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 ); + chmod( TQFile::encodeName( m_userPixDir ), 0755 ); m_defaultText = i18n("<default>"); - QString wtstr; + TQString 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." + minGroup = new TQGroupBox( 2, Horizontal, i18n("System U&IDs"), this ); + TQWhatsThis::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 ); + TQSizePolicy sp_ign_fix( TQSizePolicy::Ignored, TQSizePolicy::Fixed ); + TQValidator *valid = new TQIntValidator( 0, 999999, minGroup ); + TQLabel *minlab = new TQLabel( 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 ); + connect( leminuid, TQT_SIGNAL(textChanged( const TQString & )), TQT_SLOT(slotChanged()) ); + connect( leminuid, TQT_SIGNAL(textChanged( const TQString & )), TQT_SLOT(slotMinMaxChanged()) ); + TQLabel *maxlab = new TQLabel( 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," + connect(lemaxuid, TQT_SIGNAL(textChanged( const TQString & )), TQT_SLOT(slotChanged()) ); + connect(lemaxuid, TQT_SIGNAL(textChanged( const TQString & )), TQT_SLOT(slotMinMaxChanged()) ); + + usrGroup = new TQButtonGroup( 5, Qt::Vertical, i18n("Users"), this ); + connect( usrGroup, TQT_SIGNAL(clicked( int )), TQT_SLOT(slotShowOpts()) ); + connect( usrGroup, TQT_SIGNAL(clicked( int )), TQT_SLOT(slotChanged()) ); + cbshowlist = new TQCheckBox( i18n("Show list"), usrGroup ); + TQWhatsThis::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" + cbcomplete = new TQCheckBox( i18n("Autocompletion"), usrGroup ); + TQWhatsThis::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\"" + cbinverted = new TQCheckBox( i18n("Inverse selection"), usrGroup ); + TQWhatsThis::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." + cbusrsrt = new TQCheckBox( i18n("Sor&t users"), usrGroup ); + connect( cbusrsrt, TQT_SIGNAL(toggled( bool )), TQT_SLOT(slotChanged()) ); + TQWhatsThis::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 ); + wstack = new TQWidgetStack( this ); + s_label = new TQLabel( 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.") ); + optinlv->setResizeMode( TQListView::LastColumn ); + TQWhatsThis::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()) ); + connect( optinlv, TQT_SIGNAL(clicked( TQListViewItem * )), + TQT_SLOT(slotUpdateOptIn( TQListViewItem * )) ); + connect( optinlv, TQT_SIGNAL(clicked( TQListViewItem * )), + TQT_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.") ); + optoutlv->setResizeMode( TQListView::LastColumn ); + TQWhatsThis::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()) ); + connect( optoutlv, TQT_SIGNAL(clicked( TQListViewItem * )), + TQT_SLOT(slotUpdateOptOut( TQListViewItem * )) ); + connect( optoutlv, TQT_SIGNAL(clicked( TQListViewItem * )), + TQT_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." + faceGroup = new TQButtonGroup( 5, Qt::Vertical, i18n("User Image Source"), this ); + TQWhatsThis::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 ); + connect( faceGroup, TQT_SIGNAL(clicked( int )), TQT_SLOT(slotFaceOpts()) ); + connect( faceGroup, TQT_SIGNAL(clicked( int )), TQT_SLOT(slotChanged()) ); + rbadmonly = new TQRadioButton( i18n("Admin"), faceGroup ); + rbprefadm = new TQRadioButton( i18n("Admin, user"), faceGroup ); + rbprefusr = new TQRadioButton( i18n("User, admin"), faceGroup ); + rbusronly = new TQRadioButton( i18n("User"), faceGroup ); + + TQGroupBox *picGroup = new TQVGroupBox( i18n("User Images"), this ); + TQWidget *hlpw = new TQWidget( 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 ); + TQWhatsThis::add( usercombo, i18n("The user the image below belongs to.") ); + connect( usercombo, TQT_SIGNAL(activated( int )), + TQT_SLOT(slotUserSelected()) ); + TQLabel *userlabel = new TQLabel( usercombo, i18n("User:"), hlpw ); + userbutton = new TQPushButton( hlpw ); userbutton->setAcceptDrops( true ); userbutton->installEventFilter( this ); // for drag and drop - uint sz = style().pixelMetric( QStyle::PM_ButtonMargin ) * 2 + 48; + uint sz = style().pixelMetric( TQStyle::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" + connect( userbutton, TQT_SIGNAL(clicked()), + TQT_SLOT(slotUserButtonClicked()) ); + TQToolTip::add( userbutton, i18n("Click or drop an image here") ); + TQWhatsThis::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() ); + rstuserbutton = new TQPushButton( i18n("Unset"), hlpw ); + TQWhatsThis::add( rstuserbutton, i18n("Click this button to make KDM use the default image for the selected user.") ); + connect( rstuserbutton, TQT_SIGNAL(clicked()), + TQT_SLOT(slotUnsetUserPix()) ); + TQGridLayout *hlpl = new TQGridLayout( 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 ); + TQHBoxLayout *main = new TQHBoxLayout( this, 10 ); - QVBoxLayout *lLayout = new QVBoxLayout( main, 10 ); + TQVBoxLayout *lLayout = new TQVBoxLayout( main, 10 ); lLayout->addWidget( minGroup ); lLayout->addWidget( usrGroup ); lLayout->addStretch( 1 ); - QVBoxLayout *mLayout = new QVBoxLayout( main, 10 ); + TQVBoxLayout *mLayout = new TQVBoxLayout( main, 10 ); mLayout->addWidget( s_label ); mLayout->addWidget( wstack ); mLayout->setStretchFactor( wstack, 1 ); main->setStretchFactor( mLayout, 1 ); - QVBoxLayout *rLayout = new QVBoxLayout( main, 10 ); + TQVBoxLayout *rLayout = new TQVBoxLayout( main, 10 ); rLayout->addWidget( faceGroup ); rLayout->addWidget( picGroup ); rLayout->addStretch( 1 ); @@ -219,7 +219,7 @@ void KDMUsersWidget::makeReadOnly() rbprefusr->setEnabled(false); rbusronly->setEnabled(false); wstack->setEnabled(false); - disconnect( userbutton, SIGNAL(clicked()), this, SLOT(slotUserButtonClicked()) ); + disconnect( userbutton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUserButtonClicked()) ); userbutton->setAcceptDrops(false); rstuserbutton->setEnabled(false); } @@ -254,8 +254,8 @@ void KDMUsersWidget::slotFaceOpts() void KDMUsersWidget::slotUserSelected() { - QString user = usercombo->currentText(); - QImage p; + TQString user = usercombo->currentText(); + TQImage p; if (user != m_defaultText && p.load( m_userPixDir + user + ".face.icon" )) { rstuserbutton->setEnabled( !getuid() ); @@ -263,22 +263,22 @@ void KDMUsersWidget::slotUserSelected() p.load( m_userPixDir + ".default.face.icon" ); rstuserbutton->setEnabled( false ); } - userbutton->setPixmap( p.smoothScale( 48, 48, QImage::ScaleMin ) ); + userbutton->setPixmap( p.smoothScale( 48, 48, TQImage::ScaleMin ) ); } -void KDMUsersWidget::changeUserPix(const QString &pix) +void KDMUsersWidget::changeUserPix(const TQString &pix) { - QString user( usercombo->currentText() ); + TQString 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()) + if (KMessageBox::questionYesNo(this, i18n("Save image as default image?"),TQString::null,KStdGuiItem::save(),KStdGuiItem::cancel()) != KMessageBox::Yes) return; } - QImage p( pix ); + TQImage p( pix ); if (p.isNull()) { KMessageBox::sorry( this, i18n("There was an error loading the image\n" @@ -286,21 +286,21 @@ void KDMUsersWidget::changeUserPix(const QString &pix) return; } - p = p.smoothScale( 48, 48, QImage::ScaleMin ); - QString userpix = m_userPixDir + user + ".face.icon"; + p = p.smoothScale( 48, 48, TQImage::ScaleMin ); + TQString 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 ); + chmod( TQFile::encodeName( userpix ), 0644 ); slotUserSelected(); } void KDMUsersWidget::slotUserButtonClicked() { - KFileDialog dlg(m_notFirst ? QString::null : + KFileDialog dlg(m_notFirst ? TQString::null : KGlobal::dirs()->resourceDirs("data").last() + "kdm/pics/users", KImageIO::pattern( KImageIO::Reading ), this, 0, true); @@ -310,7 +310,7 @@ void KDMUsersWidget::slotUserButtonClicked() KImageFilePreview *ip = new KImageFilePreview( &dlg ); dlg.setPreviewWidget( ip ); - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; m_notFirst = true; @@ -319,33 +319,33 @@ void KDMUsersWidget::slotUserButtonClicked() void KDMUsersWidget::slotUnsetUserPix() { - QFile::remove( m_userPixDir + usercombo->currentText() + ".face.icon" ); + TQFile::remove( m_userPixDir + usercombo->currentText() + ".face.icon" ); slotUserSelected(); } -bool KDMUsersWidget::eventFilter(QObject *, QEvent *e) +bool KDMUsersWidget::eventFilter(TQObject *, TQEvent *e) { - if (e->type() == QEvent::DragEnter) { - QDragEnterEvent *ee = (QDragEnterEvent *) e; + if (e->type() == TQEvent::DragEnter) { + TQDragEnterEvent *ee = (TQDragEnterEvent *) e; ee->accept( KURLDrag::canDecode(ee) ); return true; } - if (e->type() == QEvent::Drop) { - userButtonDropEvent((QDropEvent *) e); + if (e->type() == TQEvent::Drop) { + userButtonDropEvent((TQDropEvent *) e); return true; } return false; } -KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg); +KURL *decodeImgDrop(TQDropEvent *e, TQWidget *wdg); -void KDMUsersWidget::userButtonDropEvent(QDropEvent *e) +void KDMUsersWidget::userButtonDropEvent(TQDropEvent *e) { KURL *url = decodeImgDrop(e, this); if (url) { - QString pixpath; + TQString pixpath; KIO::NetAccess::download(*url, pixpath, parentWidget()); changeUserPix( pixpath ); KIO::NetAccess::removeTempFile(pixpath); @@ -376,12 +376,12 @@ void KDMUsersWidget::save() } -void KDMUsersWidget::updateOptList( QListViewItem *item, QStringList &list ) +void KDMUsersWidget::updateOptList( TQListViewItem *item, TQStringList &list ) { if ( !item ) return; - QCheckListItem *itm = (QCheckListItem *)item; - QStringList::iterator it = list.find( itm->text() ); + TQCheckListItem *itm = (TQCheckListItem *)item; + TQStringList::iterator it = list.find( itm->text() ); if (itm->isOn()) { if (it == list.end()) list.append( itm->text() ); @@ -391,12 +391,12 @@ void KDMUsersWidget::updateOptList( QListViewItem *item, QStringList &list ) } } -void KDMUsersWidget::slotUpdateOptIn( QListViewItem *item ) +void KDMUsersWidget::slotUpdateOptIn( TQListViewItem *item ) { updateOptList( item, selectedUsers ); } -void KDMUsersWidget::slotUpdateOptOut( QListViewItem *item ) +void KDMUsersWidget::slotUpdateOptOut( TQListViewItem *item ) { updateOptList( item, hiddenUsers ); } @@ -409,14 +409,14 @@ void KDMUsersWidget::slotClearUsers() usercombo->insertItem( m_defaultText ); } -void KDMUsersWidget::slotAddUsers(const QMap<QString,int> &users) +void KDMUsersWidget::slotAddUsers(const TQMap<TQString,int> &users) { - QMapConstIterator<QString,int> it; + TQMapConstIterator<TQString,int> it; for (it = users.begin(); it != users.end(); ++it) { - const QString *name = &it.key(); - (new QCheckListItem(optinlv, *name, QCheckListItem::CheckBox))-> + const TQString *name = &it.key(); + (new TQCheckListItem(optinlv, *name, TQCheckListItem::CheckBox))-> setOn(selectedUsers.find(*name) != selectedUsers.end()); - (new QCheckListItem(optoutlv, *name, QCheckListItem::CheckBox))-> + (new TQCheckListItem(optoutlv, *name, TQCheckListItem::CheckBox))-> setOn(hiddenUsers.find(*name) != hiddenUsers.end()); if ((*name)[0] != '@') usercombo->insertItem(*name); @@ -427,11 +427,11 @@ void KDMUsersWidget::slotAddUsers(const QMap<QString,int> &users) usercombo->listBox()->sort(); } -void KDMUsersWidget::slotDelUsers(const QMap<QString,int> &users) +void KDMUsersWidget::slotDelUsers(const TQMap<TQString,int> &users) { - QMapConstIterator<QString,int> it; + TQMapConstIterator<TQString,int> it; for (it = users.begin(); it != users.end(); ++it) { - const QString *name = &it.key(); + const TQString *name = &it.key(); if (usercombo->listBox()) delete usercombo->listBox()->findItem( *name, ExactMatch | CaseSensitive ); delete optinlv->findItem( *name, 0 ); @@ -441,7 +441,7 @@ void KDMUsersWidget::slotDelUsers(const QMap<QString,int> &users) void KDMUsersWidget::load() { - QString str; + TQString str; config->setGroup("X-*-Greeter"); @@ -456,12 +456,12 @@ void KDMUsersWidget::load() cbinverted->setChecked( config->readEntry( "ShowUsers" ) != "Selected" ); cbusrsrt->setChecked(config->readBoolEntry("SortUsers", true)); - QString ps = config->readEntry( "FaceSource" ); - if (ps == QString::fromLatin1("UserOnly")) + TQString ps = config->readEntry( "FaceSource" ); + if (ps == TQString::fromLatin1("UserOnly")) rbusronly->setChecked(true); - else if (ps == QString::fromLatin1("PreferUser")) + else if (ps == TQString::fromLatin1("PreferUser")) rbprefusr->setChecked(true); - else if (ps == QString::fromLatin1("PreferAdmin")) + else if (ps == TQString::fromLatin1("PreferAdmin")) rbprefadm->setChecked(true); else rbadmonly->setChecked(true); |