1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
/***************************************************************************
aimconfig.cpp - description
-------------------
begin : Sun Mar 17 2002
copyright : (C) 2002 by Vladimir Shutoff
email : vovan@shutoff.ru
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "aimconfig.h"
#include "icq.h"
#include "linklabel.h"
#include <qtimer.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qvalidator.h>
#include <qtabwidget.h>
#include <qcombobox.h>
using namespace SIM;
AIMConfig::AIMConfig(QWidget *parent, ICQClient *client, bool bConfig)
: AIMConfigBase(parent)
{
m_client = client;
m_bConfig = bConfig;
if (m_bConfig){
QTimer::singleShot(0, this, SLOT(changed()));
edtScreen->setText(m_client->data.owner.Screen.str());
edtPasswd->setText(m_client->getPassword());
connect(edtScreen, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
lnkReg->setText(i18n("Register new ScreenName"));
lnkReg->setUrl("http://my.screenname.aol.com/_cqr/login/login.psp?siteId=aimregistrationPROD&authLev=1&mcState=initialized&createSn=1&triedAimAuth=y");
}else{
tabConfig->removePage(tabAIM);
}
edtServer->setText(m_client->getServer());
edtPort->setValue(m_client->getPort());
connect(edtServer, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
connect(edtPort, SIGNAL(valueChanged(const QString&)), this, SLOT(changed(const QString&)));
chkHTTP->setChecked(client->getUseHTTP());
connect(chkAuto, SIGNAL(toggled(bool)), this, SLOT(autoToggled(bool)));
chkAuto->setChecked(client->getAutoHTTP());
chkKeepAlive->setChecked(client->getKeepAlive());
}
void AIMConfig::autoToggled(bool bState)
{
chkHTTP->setEnabled(!bState);
}
void AIMConfig::apply(Client*, void*)
{
}
void AIMConfig::apply()
{
if (m_bConfig){
m_client->setScreen(edtScreen->text().lower());
m_client->setPassword(edtPasswd->text());
}
m_client->setServer(edtServer->text());
m_client->setPort(edtPort->text().toUShort());
m_client->setUseHTTP(chkHTTP->isChecked());
m_client->setAutoHTTP(chkAuto->isChecked());
m_client->setKeepAlive(chkKeepAlive->isChecked());
}
void AIMConfig::changed(const QString&)
{
changed();
}
void AIMConfig::changed()
{
bool bOK = true;
bOK = !edtScreen->text().isEmpty() &&
!edtPasswd->text().isEmpty() &&
!edtServer->text().isEmpty() &&
edtPort->text().toUShort();
emit okEnabled(bOK);
}
#ifndef NO_MOC_INCLUDES
#include "aimconfig.moc"
#endif
|