/*! @file

    @id $Id$
*/
//       1         2         3         4         5         6         7         8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890

#ifndef __AUTHENTICATION_HXX__
#define __AUTHENTICATION_HXX__

#include <ui_authentication.h>
#include <QtGui/QDialog>
#include <QtNetwork/QAuthenticator>

class Authentication: public QDialog, protected Ui::Authentication {
    Q_OBJECT;
  public:
    Authentication(QAuthenticator* auth, QWidget* p=0):
        QDialog(p), _auth(auth) {
      setupUi(this);
      _realm->setText(_auth->realm());
      _user->setText(_auth->user());
      _password->setText(_auth->password());
    }
  public Q_SLOTS:
    virtual void accept() {
      _auth->setUser(_user->text());
      _auth->setPassword(_password->text());
      QDialog::accept();
    }
    virtual void reject() {
      _auth->setUser(QString());
      _auth->setPassword(QString());
      QDialog::reject();
    }
  private:
    QAuthenticator* _auth;
};

#endif
