From 37333bf25ad9a4c538250f5af2f9f1d666362883 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdeadmin@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kuser/pwddlg.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 kuser/pwddlg.cpp (limited to 'kuser/pwddlg.cpp') diff --git a/kuser/pwddlg.cpp b/kuser/pwddlg.cpp new file mode 100644 index 0000000..3c8f9cd --- /dev/null +++ b/kuser/pwddlg.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1998 Denis Perchine + * Copyright (c) 2004 Szombathelyi György + * Former maintainer: Adriaan de Groot + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License version 2 as published by the Free Software Foundation. + * + * This library 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 + * Library 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 + +#include + +#include "pwddlg.h" +#include "misc.h" + +pwddlg::pwddlg( QWidget* parent, const char* name ) + : KDialogBase(parent, name, true, i18n("Enter Password"), Ok | Cancel, Ok, true) +{ + QGrid *page = makeGridMainWidget(2, QGrid::Horizontal); + + QLabel* lb1 = new QLabel(page, "lb1"); + lb1->setText(i18n("Password:")); + lb1->setMinimumSize(lb1->sizeHint()); + lb1->setAlignment(AlignRight|AlignVCenter); + + lepw1 = new KLineEdit(page, "LineEdit_1"); + + // ensure it fits at least 12 characters + lepw1->setText( "XXXXXXXXXXXX" ); + lepw1->setMinimumSize(lepw1->sizeHint()); + + // clear text + lepw1->clear(); + lepw1->setFocus(); + lepw1->setEchoMode(KLineEdit::Password); + + QLabel* lb2 = new QLabel(page, "lb2"); + lb2->setText(i18n("Verify:")); + lb2->setMinimumSize(lb2->sizeHint()); + lb2->setAlignment(AlignRight|AlignVCenter); + + lepw2 = new KLineEdit(page, "LineEdit_2"); + + // ensure it fits at least 12 characters + lepw2->setText( "XXXXXXXXXXXX" ); + lepw2->setMinimumSize(lepw2->sizeHint()); + + // clear text + lepw2->clear(); + lepw2->setEchoMode(KLineEdit::Password); +} + +pwddlg::~pwddlg() +{ + delete lepw1; + delete lepw2; +} + +void pwddlg::slotOk() +{ + if ( lepw1->text() != lepw2->text() ) { + KMessageBox::sorry( 0, i18n("Passwords are not identical.\nTry again.") ); + lepw1->clear(); + lepw2->clear(); + lepw1->setFocus(); + } else { + accept(); + } +} + +QString pwddlg::getPassword() const +{ + return lepw1->text(); +} + +#include "pwddlg.moc" -- cgit v1.2.1