logpass.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Tomeu Borras                                    *
00003  *   tborras@conetxia.com                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <QLineEdit>
00022 #include <QString>
00023 #include <QLabel>
00024 
00025 #include "logpass.h"
00026 #include "funcaux.h"
00027 
00028 #include "postgresiface2.h"
00029 
00030 
00032 
00035 bool logpass::authOK() {
00036     _depura("logpass::authOK", 0);
00037     _depura("END logpass::authOK", 0);
00038     return m_authOK;
00039 }
00040 
00041 
00043 
00047 logpass::logpass(QWidget *parent, const char *name) : QDialog(parent) {
00048     _depura("logpass::logpass", 0);
00049     setWindowTitle(name);
00050     setupUi(this);
00051     grpAuthError->setVisible(TRUE);
00052     QObject::connect(pbValidar, SIGNAL(clicked()), this, SLOT(validar()));
00053     QObject::connect(pbCerrar, SIGNAL(clicked()), this, SLOT(close()));
00054     validar();
00055     _depura("END logpass::logpass", 0);
00056 }
00057 
00058 
00060 
00062 logpass::~logpass() {
00063     _depura("logpass::~logpass", 0);
00064     _depura("END logpass::~logpass", 0);
00065 }
00066 
00067 
00069 
00071 void logpass::validar() {
00072     _depura("logpass::validar");
00073     m_login->setText(postgresiface2::sanearCadena(m_login->text()));
00074     m_authOK = false;
00075 
00076     confpr->setValor(CONF_LOGIN_USER, m_login->text());
00077     confpr->setValor(CONF_PASSWORD_USER, m_password->text());
00078 
00080     metabase = new postgresiface2();
00081     if (!metabase->inicializa("bulmafact")) {
00082         m_authOK = true;
00083     } // end if
00084     delete metabase;
00085     if (!m_authOK) {
00086         metabase = new postgresiface2();
00087         if (!metabase->inicializa("bulmacont")) {
00088                 m_authOK = true;
00089         } // end if
00090         delete metabase;
00091     } // end if
00092     if (!m_authOK) {
00093         metabase = new postgresiface2();
00094         if (!metabase->inicializa("template1")) {
00095                 m_authOK = true;
00096         } // end if
00097         delete metabase;
00098     } // end if
00099 
00102     if (m_authOK) {
00103         grpAuthError->setVisible(FALSE);
00104         done(1);
00105     } else {
00106         grpAuthError->setVisible(TRUE);
00107         lblAuthError->setText(tr("Error: usuario y/o contrasenya incorrectos"));
00108         m_login->setText("");
00109         m_password->setText("");
00110         m_login->setFocus();
00111     } // end if
00112     _depura("END logpass::validar");
00113 }
00114 

Generated on Sat Dec 15 00:01:21 2007 for BulmaGes by  doxygen 1.5.1