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 2003/03/08 01:43:05 waba Exp $";
00040 
00041 
00042 
00043 
00044 
00045 #include <string.h>
00046 #include <stdio.h>
00047 
00048 #include <qapplication.h>
00049 #include <qpushbutton.h>
00050 #include <qlabel.h>
00051 #include <qlayout.h>
00052 #include <qdialog.h>
00053 #include <qaccel.h>
00054 #include <qmessagebox.h>
00055 #include <qcheckbox.h>
00056 
00057 #include "passworddialog.h"
00058 #include "passworddialog.moc"
00059 
00060 #include <klocale.h>
00061 #include <kapplication.h>
00062 
00063 PasswordDialog::PasswordDialog(QString head, QWidget* parent, const char* name, bool modal, WFlags wflags)
00064    : QDialog(parent, name, modal, wflags)
00065 {
00066     
00067    _head = head;
00068 
00069    //
00070    // Bei Bedarf einen kleinen Kommentar als Label einfuegen
00071    //
00072    if (!_head.isEmpty())
00073    {
00074       QLabel *l;
00075       
00076       l = new QLabel(_head, this);
00077       l->setGeometry( 10, 10, 200, 20 );
00078    }
00079    
00080    //
00081    // Die eine oder zwei Zeile(n) mit der Passwortabfrage
00082    //
00083    QLabel *l_password = new QLabel(i18n("Password"), this);
00084    l_password->setGeometry( 10, 40, 80, 30 );
00085    
00086    _w_password = new QLineEdit( this );
00087    _w_password->setGeometry( 90, 40, 100, 30 );
00088    _w_password->setEchoMode( QLineEdit::Password );
00089    
00090    //
00091    // Connect vom LineEdit herstellen und Accelerator
00092    //
00093    QAccel *ac = new QAccel(this);
00094    ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) );
00095    
00096    connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) );
00097    
00098    //
00099    // Eine vertikale Linie erzeugen
00100    //
00101    QFrame *f = new QFrame(this);
00102    f->setLineWidth(1);
00103    f->setMidLineWidth(1);
00104    f->setFrameStyle( QFrame::HLine|QFrame::Raised);
00105    f->setGeometry( 10, 80, 180, 2 );
00106    
00107    //
00108    // Die Buttons "Ok" & "Cancel" erzeugen
00109    //
00110    QPushButton *b1, *b2;
00111    b1 = new QPushButton(i18n("OK"), this);
00112    b1->setGeometry( 10, 90, 80, 30 );
00113    
00114    b2 = new QPushButton(i18n("Cancel"), this);
00115    b2->setGeometry( 110, 90, 80, 30 );
00116    
00117    // Buttons mit Funktionaliataet belegen
00118    connect( b1, SIGNAL(clicked()), SLOT(accept()) );
00119    connect( b2, SIGNAL(clicked()), SLOT(reject()) );
00120    
00121    // Fenstertitel
00122    setCaption(i18n("Password"));
00123    
00124    // Focus
00125    _w_password->setFocus();
00126    
00127    setGeometry( x(), y(), 200, 130 );
00128 
00129     (void) passworddialog_id;
00130 }
00131 
00132 const char * PasswordDialog::password()
00133 {
00134    if ( _w_password )
00135       return _w_password->text().latin1();
00136    else
00137       return "";
00138 }
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 Sat May 1 11:36:48 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003