kpilot Library API Documentation

passworddialog.cc

00001 /* passworddialog.cc            KPilot
00002 **
00003 ** Copyright (C) is unclear. Given that the comments are
00004 ** in German, I don't think Dan wrote this. The .h file
00005 ** is (C) 1997 Micael Roth.
00006 **
00007 ** This file is part of the popmail conduit, a conduit for KPilot that
00008 ** synchronises the Pilot's email application with the outside world,
00009 ** which currently means:
00010 **  -- sendmail or SMTP for outgoing mail
00011 **  -- POP or mbox for incoming mail
00012 */
00013 
00014 /*
00015 ** This program is free software; you can redistribute it and/or modify
00016 ** it under the terms of the GNU General Public License as published by
00017 ** the Free Software Foundation; either version 2 of the License, or
00018 ** (at your option) any later version.
00019 **
00020 ** This program is distributed in the hope that it will be useful,
00021 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00023 ** GNU General Public License for more details.
00024 **
00025 ** You should have received a copy of the GNU General Public License
00026 ** along with this program in a file called COPYING; if not, write to
00027 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00028 ** MA 02111-1307, USA.
00029 */
00030 
00031 /*
00032 ** Bug reports and questions can be sent to kde-pim@kde.org
00033 */
00034 
00035 // This is an old trick so you can determine what revisions
00036 // make up a binary distribution.
00037 //
00038 //
00039 static const char *passworddialog_id="$Id: passworddialog.cc,v 1.15.4.1 2004/04/11 11:00:05 binner Exp $";
00040 
00041 
00042 
00043 
00044 
00045 #include <string.h>
00046 #include <stdio.h>
00047 
00048 #include <qapplication.h>
00049 #include <qlabel.h>
00050 #include <qlayout.h>
00051 #include <qdialog.h>
00052 #include <qaccel.h>
00053 #include <qmessagebox.h>
00054 #include <qcheckbox.h>
00055 
00056 #include "passworddialog.h"
00057 #include "passworddialog.moc"
00058 
00059 #include <klocale.h>
00060 #include <kapplication.h>
00061 #include <kstdguiitem.h>
00062 #include <kpushbutton.h>
00063 
00064 PasswordDialog::PasswordDialog(QString head, QWidget* parent, const char* name, bool modal, WFlags wflags)
00065    : QDialog(parent, name, modal, wflags)
00066 {
00067     
00068    _head = head;
00069 
00070    //
00071    // Bei Bedarf einen kleinen Kommentar als Label einfuegen
00072    //
00073    if (!_head.isEmpty())
00074    {
00075       QLabel *l;
00076       
00077       l = new QLabel(_head, this);
00078       l->setGeometry( 10, 10, 200, 20 );
00079    }
00080    
00081    //
00082    // Die eine oder zwei Zeile(n) mit der Passwortabfrage
00083    //
00084    QLabel *l_password = new QLabel(i18n("Password"), this);
00085    l_password->setGeometry( 10, 40, 80, 30 );
00086    
00087    _w_password = new QLineEdit( this );
00088    _w_password->setGeometry( 90, 40, 100, 30 );
00089    _w_password->setEchoMode( QLineEdit::Password );
00090    
00091    //
00092    // Connect vom LineEdit herstellen und Accelerator
00093    //
00094    QAccel *ac = new QAccel(this);
00095    ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) );
00096    
00097    connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) );
00098    
00099    //
00100    // Eine vertikale Linie erzeugen
00101    //
00102    QFrame *f = new QFrame(this);
00103    f->setLineWidth(1);
00104    f->setMidLineWidth(1);
00105    f->setFrameStyle( QFrame::HLine|QFrame::Raised);
00106    f->setGeometry( 10, 80, 180, 2 );
00107    
00108    //
00109    // Die Buttons "Ok" & "Cancel" erzeugen
00110    //
00111    QPushButton *b1, *b2;
00112    b1 = new KPushButton(KStdGuiItem::ok(), this);
00113    b1->setGeometry( 10, 90, 80, 30 );
00114    
00115    b2 = new KPushButton(KStdGuiItem::cancel(), this);
00116    b2->setGeometry( 110, 90, 80, 30 );
00117    
00118    // Buttons mit Funktionaliataet belegen
00119    connect( b1, SIGNAL(clicked()), SLOT(accept()) );
00120    connect( b2, SIGNAL(clicked()), SLOT(reject()) );
00121    
00122    // Fenstertitel
00123    setCaption(i18n("Password"));
00124    
00125    // Focus
00126    _w_password->setFocus();
00127    
00128    setGeometry( x(), y(), 200, 130 );
00129 
00130     (void) passworddialog_id;
00131 }
00132 
00133 const char * PasswordDialog::password()
00134 {
00135    if ( _w_password )
00136       return _w_password->text().latin1();
00137    else
00138       return "";
00139 }
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Apr 26 23:23:12 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003