<commit_before>/***************************************************************************
                            description
                             -------------------
    begin                :
    copyright            : (C) 2002 by nbetcher
    email                : <EMAIL>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "ui_aimaddcontactui.h"
#include "aimaddcontactpage.h"

#include "kopeteaccount.h"

#include <qlayout.h>
#include <qlineedit.h>
//Added by qt3to4:
#include <QLabel>
#include <klocale.h>
#include <kmessagebox.h>

AIMAddContactPage::AIMAddContactPage(bool connected, QWidget *parent)
	: AddContactPage(parent)
{
    m_gui = 0;
	if(connected)
	{
		m_gui = new Ui::aimAddContactUI();
		m_gui->setupUi(this);
		connect( m_gui->icqRadioButton, SIGNAL(toggled(bool)), m_gui->icqEdit, SLOT(setEnabled(bool)) );
		connect( m_gui->aimRadioButton, SIGNAL(toggled(bool)), m_gui->aimEdit, SLOT(setEnabled(bool)) );
		canadd = true;
	}
	else
	{
		new QLabel(i18n("You need to be connected to be able to add contacts.\nConnect to the AIM network and try again."), this);
		canadd = false;
	}
}


AIMAddContactPage::~AIMAddContactPage()
{
	delete m_gui;
}

bool AIMAddContactPage::validateData()
{
    if ( !canadd )
        return false;

    if ( !m_gui )
        return false;

	if ( m_gui->icqRadioButton->isChecked() )
	{
		ulong uin = m_gui->icqEdit->text().toULong();
		if ( uin < 1000 )
		{
			KMessageBox::sorry( this, i18n("You must enter a valid ICQ number."), i18n("ICQ Plugin") );
			return false;
		}
		return true;
	}
	else if ( m_gui->aimRadioButton->isChecked() )
	{<commit_msg>Fix layout of AIM add contact dialog when we aren't connected.<commit_after>/***************************************************************************
                            description
                             -------------------
    begin                :
    copyright            : (C) 2002 by nbetcher
    email                : <EMAIL>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "ui_aimaddcontactui.h"
#include "aimaddcontactpage.h"

#include "kopeteaccount.h"

#include <qlayout.h>
#include <qlineedit.h>
//Added by qt3to4:
#include <QLabel>
#include <klocale.h>
#include <kmessagebox.h>

AIMAddContactPage::AIMAddContactPage(bool connected, QWidget *parent)
	: AddContactPage(parent)
{
    m_gui = 0;
	if(connected)
	{
		m_gui = new Ui::aimAddContactUI();
		m_gui->setupUi(this);
		connect( m_gui->icqRadioButton, SIGNAL(toggled(bool)), m_gui->icqEdit, SLOT(setEnabled(bool)) );
		connect( m_gui->aimRadioButton, SIGNAL(toggled(bool)), m_gui->aimEdit, SLOT(setEnabled(bool)) );
		canadd = true;
	}
	else
	{
		QVBoxLayout *layout = new QVBoxLayout( this );
		layout->setContentsMargins( 0, 0, 0, 0 );

		layout->addWidget( new QLabel(i18n("You need to be connected to be able to add contacts.\nConnect to the AIM network and try again."), this) );
		canadd = false;
	}
}


AIMAddContactPage::~AIMAddContactPage()
{
	delete m_gui;
}

bool AIMAddContactPage::validateData()
{
    if ( !canadd )
        return false;

    if ( !m_gui )
        return false;

	if ( m_gui->icqRadioButton->isChecked() )
	{
		ulong uin = m_gui->icqEdit->text().toULong();
		if ( uin < 1000 )
		{
			KMessageBox::sorry( this, i18n("You must enter a valid ICQ number."), i18n("ICQ Plugin") );
			return false;
		}
		return true;
	}
	else if ( m_gui->aimRadioButton->isChecked() )
	{
{'fraction_non_alphanumeric': 0.23355960967331355, 'fraction_numerical': 0.00848536274925753, 'mean_word_length': 2.53978978978979, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6335584', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1324, 'n_words': 333}