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

KIO

passworddialog.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 #include "passworddialog.h"
00019 
00020 #include <QCheckBox>
00021 #include <QLabel>
00022 #include <QLayout>
00023 #include <QTextDocument>
00024 #include <QTextLayout>
00025 
00026 #include <kconfig.h>
00027 #include <klocale.h>
00028 
00029 using namespace KIO;
00030 
00031 PasswordDialog::PasswordDialog( const QString& prompt, const QString& user,
00032                                 bool enableKeep, bool modal, QWidget* parent )
00033    :KPasswordDialog( parent , enableKeep ? (ShowUsernameLine | ShowKeepPassword) : ShowUsernameLine )
00034 {
00035     setModal( modal );
00036     setPrompt(prompt);
00037     setUsername( user );
00038 }
00039 
00040 PasswordDialog::~PasswordDialog()
00041 {
00042 }
00043 
00044 
00045 int PasswordDialog::getNameAndPassword( QString& user, QString& pass, bool* keep,
00046                                         const QString& prompt, bool readOnly,
00047                                         const QString& caption,
00048                                         const QString& comment,
00049                                         const QString& label )
00050 {
00051     PasswordDialog* dlg;
00052     dlg = new PasswordDialog( prompt, user, keep );
00053 
00054     if ( !caption.isEmpty() )
00055         dlg->setCaption( caption );
00056     else
00057         dlg->setCaption( i18n("Authorization Dialog") );
00058 
00059     if ( !comment.isEmpty() )
00060         dlg->addCommentLine( label, comment );
00061 
00062     if ( readOnly )
00063         dlg->setUsernameReadOnly( readOnly );
00064 
00065     if ( keep )
00066         dlg->setKeepPassword( *keep );
00067 
00068     int ret = dlg->exec();
00069     if ( ret == Accepted )
00070     {
00071         user = dlg->username();
00072         pass = dlg->password();
00073         if ( keep ) { (*keep) = dlg->keepPassword(); }
00074     }
00075     delete dlg;
00076     return ret;
00077  }
00078 
00079 
00080 #include "passworddialog.moc"

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal