Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pwentry.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  *            Kppp: A pppd front end for the KDE project
00004  *
00005  * $Id: pwentry.cpp,v 1.2 2003/08/09 17:14:56 kergoth Exp $
00006  *
00007  *            Copyright (C) 1997 Bernd Johannes Wuebben
00008  *                   wuebben@math.cornell.edu
00009  *
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2 of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Library General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Library General Public
00022  * License along with this program; if not, write to the Free
00023  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  */
00025 
00026 
00027 
00028 #include <stdio.h>
00029 #include <qapplication.h>
00030 #include "pwentry.h"
00031 
00032 PWEntry::PWEntry( QWidget *parent, const char *name )
00033         : QWidget(NULL, name) {
00034 
00035    if(parent){
00036 
00037      QPoint point = this->mapToGlobal (QPoint (0,0));
00038      QRect pos = this->geometry();
00039 
00040      setGeometry(point.x() + pos.width()/2  - 300/2,
00041                  point.y() + pos.height()/2 - 90/2,
00042                  300,
00043                  90);
00044    }
00045 //    else{
00046 //      int scnum = QApplication::desktop()->screenNumber(parent);
00047 //      QRect desk = QApplication::desktop()->screenGeometry(scnum);
00048 //      setGeometry( desk.center().x() - 150, desk.center().y() - 50, 300, 90 );
00049 //    }
00050 
00051    frame = new QGroupBox(name, this );
00052 
00053    this->setFocusPolicy( QWidget::StrongFocus );
00054 
00055    pw = new QLineEdit( this, "le" );
00056    pw->setEchoMode( QLineEdit::Password );
00057    connect( pw, SIGNAL(returnPressed()), this, SLOT(hide()) );
00058 
00059    isconsumed = TRUE;
00060 }
00061 
00062 QString PWEntry::text() { return (pw->text()); }
00063 
00064 void PWEntry::focusInEvent( QFocusEvent *){
00065 
00066     pw->setFocus();
00067 
00068 }
00069 
00070 void PWEntry::setEchoModeNormal() {
00071 
00072   pw->setEchoMode(QLineEdit::Normal);
00073 
00074 }
00075 
00076 void PWEntry::setEchoModePassword() {
00077 
00078   pw->setEchoMode(QLineEdit::Password);
00079 
00080 }
00081 
00082 void PWEntry::setPrompt(const QString &p) {
00083 
00084     frame->setTitle(p);
00085 
00086 }
00087 
00088 void PWEntry::resizeEvent(QResizeEvent* ){
00089 
00090     pw->setGeometry( 15,35, this->width() - 30, 25 );
00091     frame->setGeometry(5,5,this->width() - 10, this->height() - 10 );
00092 
00093 }
00094 
00095 
00096 void PWEntry::show() {
00097 
00098     pw->setText("");
00099     isconsumed = FALSE;
00100     QWidget::show();
00101 }
00102 
00103 bool PWEntry::Consumed() {
00104     return(isconsumed);
00105 }
00106 
00107 void PWEntry::setConsumed() {
00108     isconsumed = TRUE;
00109 }
00110 
00111 void PWEntry::hide() {
00112   QWidget::hide();
00113   return;
00114 }
00115 
00116 //#include "pwentry.moc"

Generated on Sat Nov 5 16:17:51 2005 for OPIE by  doxygen 1.4.2