• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
passworddialog.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #include "passworddialog.h"
19 
20 #include <QCheckBox>
21 #include <QLabel>
22 #include <QLayout>
23 #include <QTextDocument>
24 #include <QTextLayout>
25 
26 #include <kconfig.h>
27 #include <klocale.h>
28 
29 using namespace KIO;
30 
31 PasswordDialog::PasswordDialog( const QString& prompt, const QString& user,
32  bool enableKeep, bool modal, QWidget* parent )
33  :KPasswordDialog( parent , enableKeep ? (ShowUsernameLine | ShowKeepPassword) : ShowUsernameLine )
34 {
35  setModal( modal );
36  setPrompt(prompt);
37  setUsername( user );
38 }
39 
40 PasswordDialog::~PasswordDialog()
41 {
42 }
43 
44 
45 int PasswordDialog::getNameAndPassword( QString& user, QString& pass, bool* keep,
46  const QString& prompt, bool readOnly,
47  const QString& caption,
48  const QString& comment,
49  const QString& label )
50 {
51  PasswordDialog* dlg;
52  dlg = new PasswordDialog( prompt, user, keep );
53 
54  if ( !caption.isEmpty() )
55  dlg->setCaption( caption );
56  else
57  dlg->setCaption( i18n("Authorization Dialog") );
58 
59  if ( !comment.isEmpty() )
60  dlg->addCommentLine( label, comment );
61 
62  if ( readOnly )
63  dlg->setUsernameReadOnly( readOnly );
64 
65  if ( keep )
66  dlg->setKeepPassword( *keep );
67 
68  int ret = dlg->exec();
69  if ( ret == Accepted )
70  {
71  user = dlg->username();
72  pass = dlg->password();
73  if ( keep ) { (*keep) = dlg->keepPassword(); }
74  }
75  delete dlg;
76  return ret;
77  }
78 
79 
80 #include "passworddialog.moc"
KPasswordDialog::setUsername
void setUsername(const QString &)
i18n
QString i18n(const char *text)
QWidget
QDialog::setModal
void setModal(bool modal)
KIO::PasswordDialog::PasswordDialog
PasswordDialog(const QString &prompt, const QString &user, bool enableKeep=false, bool modal=true, QWidget *parent=0)
Create a password dialog.
Definition: passworddialog.cpp:31
KPasswordDialog::keepPassword
bool keepPassword() const
kconfig.h
KPasswordDialog::setKeepPassword
void setKeepPassword(bool b)
QDialog::exec
int exec()
klocale.h
KPasswordDialog::password
QString password() const
KIO::PasswordDialog
dialog for requesting login and password from the end user
Definition: passworddialog.h:37
KPasswordDialog::setUsernameReadOnly
void setUsernameReadOnly(bool readOnly)
KIO::PasswordDialog::~PasswordDialog
~PasswordDialog()
Destructor.
Definition: passworddialog.cpp:40
QString::isEmpty
bool isEmpty() const
KPasswordDialog::username
QString username() const
KPasswordDialog::addCommentLine
void addCommentLine(const QString &label, const QString &comment)
QString
KIO::PasswordDialog::getNameAndPassword
static int getNameAndPassword(QString &user, QString &pass, bool *keep, const QString &prompt=QString(), bool readOnly=false, const QString &caption=QString(), const QString &comment=QString(), const QString &label=QString())
A convienence static method for obtaining authorization information from the end user.
Definition: passworddialog.cpp:45
passworddialog.h
KPasswordDialog
KPasswordDialog::setPrompt
void setPrompt(const QString &prompt)
QWidget::setCaption
void setCaption(const QString &c)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal