• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
kpassdlg.cpp
1 // vi: ts=8 sts=4 sw=4
2 /* This file is part of the KDE libraries
3  Copyright (C) 1998 Pietro Iglio <iglio@fub.it>
4  Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
5  Copyright (C) 2004,2005 Andrew Coles <andrew_coles@yahoo.co.uk>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License version 2 as published by the Free Software Foundation.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 #include <unistd.h>
22 
23 #include <tqwidget.h>
24 #include <tqlineedit.h>
25 #include <tqlabel.h>
26 #include <tqlayout.h>
27 #include <tqsize.h>
28 #include <tqevent.h>
29 #include <tqkeycode.h>
30 #include <tqcheckbox.h>
31 #include <tqregexp.h>
32 #include <tqhbox.h>
33 #include <tqwhatsthis.h>
34 #include <tqptrdict.h>
35 #include <tqtimer.h>
36 
37 #include <tdeglobal.h>
38 #include <kdebug.h>
39 #include <tdeapplication.h>
40 #include <tdelocale.h>
41 #include <kiconloader.h>
42 #include <tdemessagebox.h>
43 #include <tdeaboutdialog.h>
44 #include <tdeconfig.h>
45 #include <kstandarddirs.h>
46 #include <kprogress.h>
47 
48 #include <sys/time.h>
49 #include <sys/resource.h>
50 
51 #include "kpassdlg.h"
52 
53 #include "../tdesu/defaults.h"
54 
55 /*
56  * Password line editor.
57  */
58 
59 const int KPasswordEdit::PassLen = 200;
60 
61 class KPasswordDialog::KPasswordDialogPrivate
62 {
63  public:
64  KPasswordDialogPrivate()
65  : m_MatchLabel( 0 ), iconName( 0 ), allowEmptyPasswords( false ),
66  minimumPasswordLength(0), maximumPasswordLength(KPasswordEdit::PassLen - 1),
67  passwordStrengthWarningLevel(1), m_strengthBar(0),
68  reasonablePasswordLength(8)
69  {}
70  TQLabel *m_MatchLabel;
71  TQString iconName;
72  bool allowEmptyPasswords;
73  int minimumPasswordLength;
74  int maximumPasswordLength;
75  int passwordStrengthWarningLevel;
76  KProgress* m_strengthBar;
77  int reasonablePasswordLength;
78 };
79 
80 
81 KPasswordEdit::KPasswordEdit(TQWidget *parent, const char *name)
82  : TQLineEdit(parent, name)
83 {
84  init();
85 
86  TDEConfig* const cfg = TDEGlobal::config();
87  TDEConfigGroupSaver saver(cfg, "Passwords");
88 
89  const TQString val = cfg->readEntry("EchoMode", "OneStar");
90  if (val == "ThreeStars") {
91  setEchoMode(PasswordThreeStars);
92  }
93  else if (val == "NoEcho") {
94  setEchoMode(TQLineEdit::NoEcho);
95  }
96  else {
97  setEchoMode(TQLineEdit::Password);
98  }
99 
100  setInputMethodEnabled( true );
101 }
102 
103 KPasswordEdit::KPasswordEdit(TQWidget *parent, const char *name, int echoMode)
104  : TQLineEdit(parent, name)
105 {
106  setEchoMode((TQLineEdit::EchoMode)echoMode);
107  init();
108 }
109 
110 KPasswordEdit::KPasswordEdit(EchoMode echoMode, TQWidget *parent, const char *name)
111  : TQLineEdit(parent, name)
112 {
113  setEchoMode(echoMode);
114  init();
115 }
116 
117 KPasswordEdit::KPasswordEdit(EchoModes echoMode, TQWidget *parent, const char *name)
118  : TQLineEdit(parent, name)
119 {
120  if (echoMode == KPasswordEdit::NoEcho) {
121  setEchoMode(TQLineEdit::NoEcho);
122  }
123  else if (echoMode == KPasswordEdit::ThreeStars) {
124  setEchoMode(TQLineEdit::PasswordThreeStars);
125  }
126  else if (echoMode == KPasswordEdit::OneStar) {
127  setEchoMode(TQLineEdit::Password);
128  }
129  init();
130 }
131 
132 void KPasswordEdit::init()
133 {
134  setAcceptDrops(false);
135 }
136 
137 KPasswordEdit::~KPasswordEdit()
138 {
139 }
140 
141 const char *KPasswordEdit::password() const {
142  return text().ascii();
143 }
144 
145 void KPasswordEdit::erase()
146 {
147  setText("");
148 }
149 
150 void KPasswordEdit::setMaxPasswordLength(int newLength)
151 {
152  setMaxLength(newLength);
153 }
154 
155 int KPasswordEdit::maxPasswordLength() const
156 {
157  return maxLength();
158 }
159 
160 void KPasswordEdit::insert( const TQString &str) {
161  TQLineEdit::insert(str);
162 }
163 
164 void KPasswordEdit::keyPressEvent(TQKeyEvent *e) {
165  TQLineEdit::keyPressEvent(e);
166 }
167 
168 void KPasswordEdit::focusInEvent(TQFocusEvent *e) {
169  TQLineEdit::focusInEvent(e);
170 }
171 
172 bool KPasswordEdit::event(TQEvent *e) {
173  return TQLineEdit::event(e);
174 }
175 
176 /*
177  * Password dialog.
178  */
179 
180 KPasswordDialog::KPasswordDialog(Types type, bool enableKeep, int extraBttn,
181  TQWidget *parent, const char *name)
182  : KDialogBase(parent, name, true, "", Ok|Cancel|extraBttn,
183  Ok, true), m_Keep(enableKeep? 1 : 0), m_Type(type), m_keepWarnLbl(0), d(new KPasswordDialogPrivate)
184 {
185  d->iconName = "password";
186  init();
187 }
188 
189 KPasswordDialog::KPasswordDialog(Types type, bool enableKeep, int extraBttn, const TQString& icon,
190  TQWidget *parent, const char *name )
191  : KDialogBase(parent, name, true, "", Ok|Cancel|extraBttn,
192  Ok, true), m_Keep(enableKeep? 1 : 0), m_Type(type), m_keepWarnLbl(0), d(new KPasswordDialogPrivate)
193 {
194  if ( icon.stripWhiteSpace().isEmpty() )
195  d->iconName = "password";
196  else
197  d->iconName = icon;
198  init();
199 }
200 
201 KPasswordDialog::KPasswordDialog(int type, TQString prompt, bool enableKeep,
202  int extraBttn)
203  : KDialogBase(0L, "Password Dialog", true, "", Ok|Cancel|extraBttn,
204  Ok, true), m_Keep(enableKeep? 1 : 0), m_Type(type), m_keepWarnLbl(0), d(new KPasswordDialogPrivate)
205 {
206  d->iconName = "password";
207  init();
208  setPrompt(prompt);
209 }
210 
211 void KPasswordDialog::init()
212 {
213  m_Row = 0;
214 
215  TDEConfig* const cfg = TDEGlobal::config();
216  const TDEConfigGroupSaver saver(cfg, "Passwords");
217  bool def = ( qstrcmp( tqAppName(), "tdesu" ) == 0 ? defKeep : false );
218  if (m_Keep && cfg->readBoolEntry("Keep", def))
219  ++m_Keep;
220 
221  m_pMain = new TQWidget(this);
222  setMainWidget(m_pMain);
223  m_pGrid = new TQGridLayout(m_pMain, 10, 3, 0, 0);
224  m_pGrid->addColSpacing(1, 10);
225 
226  // Row 1: pixmap + prompt
227  TQLabel *lbl;
228  const TQPixmap pix( TDEGlobal::iconLoader()->loadIcon( d->iconName, TDEIcon::NoGroup, TDEIcon::SizeHuge, 0, 0, true));
229  if (!pix.isNull()) {
230  lbl = new TQLabel(m_pMain);
231  lbl->setPixmap(pix);
232  lbl->setAlignment(AlignHCenter|AlignVCenter);
233  lbl->setFixedSize(lbl->sizeHint());
234  m_pGrid->addWidget(lbl, 0, 0, (TQ_Alignment)AlignCenter);
235  }
236 
237  m_pHelpLbl = new TQLabel(m_pMain);
238  m_pHelpLbl->setAlignment(AlignLeft|AlignVCenter|WordBreak);
239  m_pGrid->addWidget(m_pHelpLbl, 0, 2, (TQ_Alignment)AlignLeft);
240  m_pGrid->addRowSpacing(1, 10);
241  m_pGrid->setRowStretch(1, 12);
242 
243  // Row 2+: space for 4 extra info lines
244  m_pGrid->addRowSpacing(6, 5);
245  m_pGrid->setRowStretch(6, 12);
246 
247  // Row 3: Password editor #1
248  lbl = new TQLabel(m_pMain);
249  lbl->setAlignment(AlignLeft|AlignVCenter);
250  lbl->setText(i18n("&Password:"));
251  lbl->setFixedSize(lbl->sizeHint());
252  m_pGrid->addWidget(lbl, 7, 0, (TQ_Alignment)AlignLeft);
253 
254  TQHBoxLayout *h_lay = new TQHBoxLayout();
255  m_pGrid->addLayout(h_lay, 7, 2);
256  m_pEdit = new KPasswordEdit(m_pMain);
257  m_pEdit2 = 0;
258  lbl->setBuddy(m_pEdit);
259  TQSize size = m_pEdit->sizeHint();
260  m_pEdit->setFixedHeight(size.height());
261  m_pEdit->setMinimumWidth(size.width());
262  h_lay->addWidget(m_pEdit);
263 
264  // Row 4: Password editor #2 or keep password checkbox
265 
266  if ((m_Type == Password) && m_Keep) {
267  m_pGrid->addRowSpacing(8, 10);
268  m_pGrid->setRowStretch(8, 12);
269  TQCheckBox* const cb = new TQCheckBox(i18n("&Keep password"), m_pMain);
270  cb->setFixedSize(cb->sizeHint());
271  m_keepWarnLbl = new TQLabel(m_pMain);
272  m_keepWarnLbl->setAlignment(AlignLeft|AlignVCenter|WordBreak);
273  if (m_Keep > 1) {
274  cb->setChecked(true);
275  m_keepWarnLbl->show();
276  }
277  else {
278  m_Keep = 0;
279  m_keepWarnLbl->hide();
280  }
281  connect(cb, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotKeep(bool)));
282  m_pGrid->addWidget(cb, 9, 2, (TQ_Alignment)(AlignLeft|AlignVCenter));
283 // m_pGrid->addWidget(m_keepWarnLbl, 13, 2, (TQ_Alignment)(AlignLeft|AlignVCenter));
284  m_pGrid->addMultiCellWidget(m_keepWarnLbl, 13, 13, 0, 3);
285  } else if (m_Type == NewPassword) {
286  m_pGrid->addRowSpacing(8, 10);
287  lbl = new TQLabel(m_pMain);
288  lbl->setAlignment(AlignLeft|AlignVCenter);
289  lbl->setText(i18n("&Verify:"));
290  lbl->setFixedSize(lbl->sizeHint());
291  m_pGrid->addWidget(lbl, 9, 0, (TQ_Alignment)AlignLeft);
292 
293  h_lay = new TQHBoxLayout();
294  m_pGrid->addLayout(h_lay, 9, 2);
295  m_pEdit2 = new KPasswordEdit(m_pMain);
296  lbl->setBuddy(m_pEdit2);
297  size = m_pEdit2->sizeHint();
298  m_pEdit2->setFixedHeight(size.height());
299  m_pEdit2->setMinimumWidth(size.width());
300  h_lay->addWidget(m_pEdit2);
301 
302  // Row 6: Password strength meter
303  m_pGrid->addRowSpacing(10, 10);
304  m_pGrid->setRowStretch(10, 12);
305 
306  TQHBox* const strengthBox = new TQHBox(m_pMain);
307  strengthBox->setSpacing(10);
308  m_pGrid->addMultiCellWidget(strengthBox, 11, 11, 0, 2);
309  TQLabel* const passStrengthLabel = new TQLabel(strengthBox);
310  passStrengthLabel->setAlignment(AlignLeft|AlignVCenter);
311  passStrengthLabel->setText(i18n("Password strength meter:"));
312  d->m_strengthBar = new KProgress(100, strengthBox, "PasswordStrengthMeter");
313  d->m_strengthBar->setPercentageVisible(false);
314 
315  const TQString strengthBarWhatsThis(i18n("The password strength meter gives an indication of the security "
316  "of the password you have entered. To improve the strength of "
317  "the password, try:\n"
318  " - using a longer password;\n"
319  " - using a mixture of upper- and lower-case letters;\n"
320  " - using numbers or symbols, such as #, as well as letters."));
321  TQWhatsThis::add(passStrengthLabel, strengthBarWhatsThis);
322  TQWhatsThis::add(d->m_strengthBar, strengthBarWhatsThis);
323 
324  // Row 6: Label saying whether the passwords match
325  m_pGrid->addRowSpacing(12, 10);
326  m_pGrid->setRowStretch(12, 12);
327 
328  d->m_MatchLabel = new TQLabel(m_pMain);
329  d->m_MatchLabel->setAlignment(AlignLeft|AlignVCenter|WordBreak);
330  m_pGrid->addMultiCellWidget(d->m_MatchLabel, 13, 13, 0, 2);
331  d->m_MatchLabel->setText(i18n("Passwords do not match"));
332 
333 
334  connect( m_pEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(enableOkBtn()) );
335  connect( m_pEdit2, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(enableOkBtn()) );
336  enableOkBtn();
337  }
338 
339  erase();
340 }
341 
342 
343 KPasswordDialog::~KPasswordDialog()
344 {
345  delete d;
346 }
347 
348 
349 void KPasswordDialog::clearPassword()
350 {
351  m_pEdit->erase();
352 }
353 
354 /* KDE 4: Make it const TQString & */
355 void KPasswordDialog::setPrompt(TQString prompt)
356 {
357  m_pHelpLbl->setText(prompt);
358  m_pHelpLbl->setFixedSize(275, m_pHelpLbl->heightForWidth(275));
359 }
360 
361 void KPasswordDialog::setKeepWarning(TQString warn)
362 {
363  if (m_keepWarnLbl) {
364  m_keepWarnLbl->setText(warn);
365  }
366 }
367 
368 
369 TQString KPasswordDialog::prompt() const
370 
371 {
372  return m_pHelpLbl->text();
373 }
374 
375 
376 /* KDE 4: Make them const TQString & */
377 void KPasswordDialog::addLine(TQString key, TQString value)
378 {
379  if (m_Row > 3)
380  return;
381 
382  TQLabel *lbl = new TQLabel(key, m_pMain);
383  lbl->setAlignment(AlignLeft|AlignTop);
384  lbl->setFixedSize(lbl->sizeHint());
385  m_pGrid->addWidget(lbl, m_Row+2, 0, (TQ_Alignment)AlignLeft);
386 
387  lbl = new TQLabel(value, m_pMain);
388  lbl->setAlignment(AlignTop|WordBreak);
389  lbl->setFixedSize(275, lbl->heightForWidth(275));
390  m_pGrid->addWidget(lbl, m_Row+2, 2, (TQ_Alignment)AlignLeft);
391  ++m_Row;
392 }
393 
394 
395 void KPasswordDialog::erase()
396 {
397  m_pEdit->erase();
398  m_pEdit->setFocus();
399  if (m_Type == NewPassword)
400  m_pEdit2->erase();
401 }
402 
403 
404 void KPasswordDialog::slotOk()
405 {
406  if (m_Type == NewPassword) {
407  if (strcmp(m_pEdit->password(), m_pEdit2->password())) {
408  KMessageBox::sorry(this, i18n("You entered two different "
409  "passwords. Please try again."));
410  erase();
411  return;
412  }
413  if (d->m_strengthBar && d->m_strengthBar->progress() < d->passwordStrengthWarningLevel) {
414  int retVal = KMessageBox::warningContinueCancel(this,
415  i18n( "The password you have entered has a low strength. "
416  "To improve the strength of "
417  "the password, try:\n"
418  " - using a longer password;\n"
419  " - using a mixture of upper- and lower-case letters;\n"
420  " - using numbers or symbols as well as letters.\n"
421  "\n"
422  "Would you like to use this password anyway?"),
423  i18n("Low Password Strength"));
424  if (retVal == KMessageBox::Cancel) return;
425  }
426  }
427  if (!checkPassword(m_pEdit->password())) {
428  erase();
429  return;
430  }
431  accept();
432 }
433 
434 
435 void KPasswordDialog::slotCancel()
436 {
437  reject();
438 }
439 
440 
441 void KPasswordDialog::slotKeep(bool keep)
442 {
443  if (m_keepWarnLbl->text() != "") {
444  if (keep) {
445  m_keepWarnLbl->show();
446  }
447  else {
448  m_keepWarnLbl->hide();
449  }
450  TQTimer::singleShot(0, this, SLOT(slotLayout()));
451  }
452 
453  m_Keep = keep;
454 }
455 
456 void KPasswordDialog::slotLayout()
457 {
458  resize(sizeHint());
459 }
460 
461 
462 // static . antlarr: KDE 4: Make it const TQString & prompt
463 int KPasswordDialog::getPassword(TQCString &password, TQString prompt,
464  int *keep)
465 {
466  const bool enableKeep = (keep && *keep);
467  KPasswordDialog* const dlg = new KPasswordDialog(int(Password), prompt, enableKeep);
468  const int ret = dlg->exec();
469  if (ret == Accepted) {
470  password = dlg->password();
471  if (enableKeep)
472  *keep = dlg->keep();
473  }
474  delete dlg;
475  return ret;
476 }
477 
478 
479 // static . antlarr: KDE 4: Make it const TQString & prompt
480 int KPasswordDialog::getNewPassword(TQCString &password, TQString prompt)
481 {
482  KPasswordDialog* const dlg = new KPasswordDialog(NewPassword, prompt);
483  const int ret = dlg->exec();
484  if (ret == Accepted)
485  password = dlg->password();
486  delete dlg;
487  return ret;
488 }
489 
490 
491 // static
492 void KPasswordDialog::disableCoreDumps()
493 {
494  struct rlimit rlim;
495  rlim.rlim_cur = rlim.rlim_max = 0;
496  setrlimit(RLIMIT_CORE, &rlim);
497 }
498 
499 void KPasswordDialog::virtual_hook( int id, void* data )
500 { KDialogBase::virtual_hook( id, data ); }
501 
502 void KPasswordDialog::enableOkBtn()
503 {
504  if (m_Type == NewPassword) {
505  const bool match = strcmp(m_pEdit->password(), m_pEdit2->password()) == 0
506  && (d->allowEmptyPasswords || m_pEdit->password()[0]);
507 
508  const TQString pass(m_pEdit->password());
509 
510  const int minPasswordLength = minimumPasswordLength();
511 
512  if ((int) pass.length() < minPasswordLength) {
513  enableButtonOK(false);
514  } else {
515  enableButtonOK( match );
516  }
517 
518  if ( match && d->allowEmptyPasswords && m_pEdit->password()[0] == 0 ) {
519  d->m_MatchLabel->setText( i18n("Password is empty") );
520  } else {
521  if ((int) pass.length() < minPasswordLength) {
522  d->m_MatchLabel->setText(i18n("Password must be at least 1 character long", "Password must be at least %n characters long", minPasswordLength));
523  } else {
524  d->m_MatchLabel->setText( match? i18n("Passwords match")
525  :i18n("Passwords do not match") );
526  }
527  }
528 
529  // Password strength calculator
530  // Based on code in the Master Password dialog in Firefox
531  // (pref-masterpass.js)
532  // Original code triple-licensed under the MPL, GPL, and LGPL
533  // so is license-compatible with this file
534 
535  const double lengthFactor = d->reasonablePasswordLength / 8.0;
536 
537 
538  int pwlength = (int) (pass.length() / lengthFactor);
539  if (pwlength > 5) pwlength = 5;
540 
541  const TQRegExp numRxp("[0-9]", true, false);
542  int numeric = (int) (pass.contains(numRxp) / lengthFactor);
543  if (numeric > 3) numeric = 3;
544 
545  const TQRegExp symbRxp("\\W", false, false);
546  int numsymbols = (int) (pass.contains(symbRxp) / lengthFactor);
547  if (numsymbols > 3) numsymbols = 3;
548 
549  const TQRegExp upperRxp("[A-Z]", true, false);
550  int upper = (int) (pass.contains(upperRxp) / lengthFactor);
551  if (upper > 3) upper = 3;
552 
553  int pwstrength=((pwlength*10)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
554 
555  if ( pwstrength < 0 ) {
556  pwstrength = 0;
557  }
558 
559  if ( pwstrength > 100 ) {
560  pwstrength = 100;
561  }
562  d->m_strengthBar->setProgress(pwstrength);
563 
564  }
565 }
566 
567 
568 void KPasswordDialog::setAllowEmptyPasswords(bool allowed) {
569  d->allowEmptyPasswords = allowed;
570  enableOkBtn();
571 }
572 
573 
574 bool KPasswordDialog::allowEmptyPasswords() const {
575  return d->allowEmptyPasswords;
576 }
577 
578 void KPasswordDialog::setMinimumPasswordLength(int minLength) {
579  d->minimumPasswordLength = minLength;
580  enableOkBtn();
581 }
582 
583 int KPasswordDialog::minimumPasswordLength() const {
584  return d->minimumPasswordLength;
585 }
586 
587 void KPasswordDialog::setMaximumPasswordLength(int maxLength) {
588 
589  if (maxLength < 0) maxLength = 0;
590  if (maxLength >= KPasswordEdit::PassLen) maxLength = KPasswordEdit::PassLen - 1;
591 
592  d->maximumPasswordLength = maxLength;
593 
594  m_pEdit->setMaxPasswordLength(maxLength);
595  if (m_pEdit2) m_pEdit2->setMaxPasswordLength(maxLength);
596 
597 }
598 
599 int KPasswordDialog::maximumPasswordLength() const {
600  return d->maximumPasswordLength;
601 }
602 
603 // reasonable password length code contributed by Steffen Mthing
604 
605 void KPasswordDialog::setReasonablePasswordLength(int reasonableLength) {
606 
607  if (reasonableLength < 1) reasonableLength = 1;
608  if (reasonableLength >= maximumPasswordLength()) reasonableLength = maximumPasswordLength();
609 
610  d->reasonablePasswordLength = reasonableLength;
611 
612 }
613 
614 int KPasswordDialog::reasonablePasswordLength() const {
615  return d->reasonablePasswordLength;
616 }
617 
618 
619 void KPasswordDialog::setPasswordStrengthWarningLevel(int warningLevel) {
620  if (warningLevel < 0) warningLevel = 0;
621  if (warningLevel > 99) warningLevel = 99;
622  d->passwordStrengthWarningLevel = warningLevel;
623 }
624 
625 int KPasswordDialog::passwordStrengthWarningLevel() const {
626  return d->passwordStrengthWarningLevel;
627 }
628 
629 #include "kpassdlg.moc"
TDEConfig
KPasswordDialog::setAllowEmptyPasswords
void setAllowEmptyPasswords(bool allowed)
Allow empty passwords? - Default: false.
Definition: kpassdlg.cpp:568
KPasswordDialog::prompt
TQString prompt() const
Returns the password prompt.
Definition: kpassdlg.cpp:369
KPasswordDialog::setPasswordStrengthWarningLevel
void setPasswordStrengthWarningLevel(int warningLevel)
Set the password strength level below which a warning is given Value is in the range 0 to 99...
Definition: kpassdlg.cpp:619
KPasswordDialog::NewPassword
The user is asked to enter a password and to confirm it a second time.
Definition: kpassdlg.h:180
KPasswordDialog::passwordStrengthWarningLevel
int passwordStrengthWarningLevel() const
Password strength level below which a warning is given.
Definition: kpassdlg.cpp:625
KPasswordDialog::~KPasswordDialog
virtual ~KPasswordDialog()
Destructs the password dialog.
Definition: kpassdlg.cpp:343
KDialogBase::Ok
Show Ok button.
Definition: kdialogbase.h:201
KPasswordDialog::addLine
void addLine(TQString key, TQString value)
Adds a line of information to the dialog.
Definition: kpassdlg.cpp:377
KPasswordEdit::setMaxPasswordLength
void setMaxPasswordLength(int newLength)
Set the current maximum password length.
Definition: kpassdlg.cpp:150
KPasswordDialog::getNewPassword
static int getNewPassword(TQCString &password, TQString prompt)
Pops up the dialog, asks the user for a password and returns it.
Definition: kpassdlg.cpp:480
KPasswordEdit
A safe password input widget.
Definition: kpassdlg.h:39
TDEConfigGroupSaver
KPasswordDialog::setPrompt
void setPrompt(TQString prompt)
Sets the password prompt.
Definition: kpassdlg.cpp:355
KDialogBase::enableButtonOK
void enableButtonOK(bool state)
Enable or disable (gray out) the OK button.
Definition: kdialogbase.cpp:848
KProgress
A progress indicator widget.
Definition: kprogress.h:46
KPasswordDialog::clearPassword
void clearPassword()
Clears the password input field.
Definition: kpassdlg.cpp:349
TDEGlobal::iconLoader
static TDEIconLoader * iconLoader()
KPasswordEdit::KPasswordEdit
KPasswordEdit(TQWidget *parent=0, const char *name=0)
Constructs a password input widget using the user&#39;s global "echo mode" setting.
Definition: kpassdlg.cpp:81
KPasswordDialog::reasonablePasswordLength
int reasonablePasswordLength() const
Password length that is expected to be reasonably safe.
Definition: kpassdlg.cpp:614
KPasswordDialog::disableCoreDumps
static void disableCoreDumps()
Static helper function that disables core dumps.
Definition: kpassdlg.cpp:492
KPasswordDialog::setMinimumPasswordLength
void setMinimumPasswordLength(int minLength)
Minimum acceptable password length.
Definition: kpassdlg.cpp:578
KMessageBox::sorry
static void sorry(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, int options=Notify)
Display an "Sorry" dialog.
Definition: tdemessagebox.cpp:825
KPasswordDialog::password
const char * password() const
Returns the password entered.
Definition: kpassdlg.h:333
KDialogBase::Cancel
Show Cancel-button.
Definition: kdialogbase.h:204
KPasswordDialog::setReasonablePasswordLength
void setReasonablePasswordLength(int reasonableLength)
Password length that is expected to be reasonably safe.
Definition: kpassdlg.cpp:605
TDEIcon::NoGroup
NoGroup
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KPasswordDialog::keep
bool keep() const
Returns true if the user wants to keep the password.
Definition: kpassdlg.h:345
KPasswordDialog::KPasswordDialog
KPasswordDialog(Types type, bool enableKeep, int extraBttn, TQWidget *parent=0, const char *name=0)
Constructs a password dialog.
Definition: kpassdlg.cpp:180
TDEIcon::SizeHuge
SizeHuge
KPasswordDialog::minimumPasswordLength
int minimumPasswordLength() const
Minimum acceptable password length.
Definition: kpassdlg.cpp:583
tdelocale.h
KPasswordEdit::maxPasswordLength
int maxPasswordLength() const
Returns the current maximum password length.
Definition: kpassdlg.cpp:155
KDialogBase::setMainWidget
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
Definition: kdialogbase.cpp:1431
TDEConfigBase::readBoolEntry
bool readBoolEntry(const TQString &pKey, bool bDefault=false) const
KPasswordEdit::erase
void erase()
Erases the current password.
Definition: kpassdlg.cpp:145
KPasswordDialog::Password
The user is asked to enter a password.
Definition: kpassdlg.h:173
KPasswordEdit::password
const char * password() const
Returns the password.
Definition: kpassdlg.cpp:141
KMessageBox::warningContinueCancel
static int warningContinueCancel(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const TQString &dontAskAgainName=TQString::null, int options=Notify)
Display a "warning" dialog.
Definition: tdemessagebox.cpp:585
KPasswordDialog::allowEmptyPasswords
bool allowEmptyPasswords() const
Allow empty passwords?
Definition: kpassdlg.cpp:574
KPasswordDialog
A password input dialog.
Definition: kpassdlg.h:160
KPasswordEdit::~KPasswordEdit
~KPasswordEdit()
Destructs the widget.
Definition: kpassdlg.cpp:137
KPasswordDialog::getPassword
static int getPassword(TQCString &password, TQString prompt, int *keep=0L)
Pops up the dialog, asks the user for a password, and returns it.
Definition: kpassdlg.cpp:463
KPasswordDialog::setMaximumPasswordLength
void setMaximumPasswordLength(int maxLength)
Maximum acceptable password length.
Definition: kpassdlg.cpp:587
KPasswordEdit::insert
virtual void insert(const TQString &)
Reimplementation.
Definition: kpassdlg.cpp:160
TDEGlobal::config
static TDEConfig * config()
KPasswordDialog::setKeepWarning
void setKeepWarning(TQString warn)
Sets the text to be dynamically displayed when the keep checkbox is checked.
Definition: kpassdlg.cpp:361
TDEConfigBase::readEntry
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
KPasswordDialog::checkPassword
virtual bool checkPassword(const char *)
Virtual function that can be overridden to provide password checking in derived classes.
Definition: kpassdlg.h:391
KPasswordDialog::maximumPasswordLength
int maximumPasswordLength() const
Maximum acceptable password length.
Definition: kpassdlg.cpp:599
KPasswordDialog::Types
Types
This enum distinguishes the two operation modes of this dialog:
Definition: kpassdlg.h:169

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.11
This website is maintained by Timothy Pearson.