<commit_before>/*
    AddressBookSelectorWidget

    Copyright (c) 2005 by <NAME> <<EMAIL>>

    Based on LinkAddressBookUI whose code was shamelessly stolen from
    kopete's add new contact wizard, used in Konversation, and then
    reappropriated by Kopete.

    LinkAddressBookUI:
    Copyright (c) 2004 by <NAME>           <<EMAIL>>
    Copyright (c) 2003-2005 by <NAME>   <<EMAIL>>
    Copyright (c) 2002 by <NAME>           <<EMAIL>>
    Copyright (c) 2002 by <NAME> <<EMAIL>>

    Kopete    (c) 2002-2004 by the Kopete developers  <<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 <qcheckbox.h>
#include <kconfig.h>
#include <klocale.h>
#include <kiconloader.h>

#include <kdeversion.h>
#include <kinputdialog.h>

#include <kpushbutton.h>
#include <k3activelabel.h>
#include <kdebug.h>
#include <k3listview.h>
#include <k3listviewsearchline.h>
#include <qlabel.h>


#include "addressbookselectorwidget.h"
#include <addresseeitem.h>
#include "kabcpersistence.h"

using namespace Kopete::UI;

namespace Kopete
{
namespace UI
{

AddressBookSelectorWidget::AddressBookSelectorWidget( QWidget *parent, const char *name )
		: QWidget(parent), Ui::AddressBookSelectorWidget_Base()
{
	setObjectName(name);
	setupUi(this);

	m_addressBook = Kopete::KABCPersistence::self()->addressBook();

	// Addressee validation connections
	connect( addAddresseeButton, SIGNAL( clicked() ), SLOT( slotAddAddresseeClicked() ) );
	connect( addAddresseeButton, SIGNAL( clicked() ), SIGNAL( addAddresseeClicked() ) );

	connect( addresseeListView, SIGNAL( clicked(Q3ListViewItem * ) ),
			SIGNAL( addresseeListClicked( Q3ListViewItem * ) ) );
	connect( addresseeListView, SIGNAL( selectionChanged( Q3ListViewItem * ) ),
			SIGNAL( addresseeListClicked( Q3ListViewItem * ) ) );
	connect( addresseeListView, SIGNAL( spacePressed( Q3ListViewItem * ) ),
			SIGNAL( addresseeListClicked( Q3ListViewItem * ) ) );

	connect( m_addressBook, SIGNAL( addressBookChanged( AddressBook * ) ), this, SLOT( slotLoadAddressees() ) );

	//We should add a clear KAction here.  But we can't really do that with a designer file :\  this sucks

	addresseeListView->setColumnText(2, KIcon(QLatin1String("email")), i18n("Email"));

	kListViewSearchLine->setListView(addresseeListView);
	slotLoadAddressees();

	addresseeListView->setColumnWidthMode(0, Q3ListView::Manual);
	addresseeListView->setColumnWidth(0, 63); //Photo is 60, and it's nice to have a small gap, imho
}


AddressBookSelectorWidget::~AddressBookSelectorWidget()
{
	disconnect( m_addressBook, SIGNAL( addressBookChanged( AddressBook * ) ), this, SLOT( slotLoadAddressees() ) );
}


KABC::Addressee AddressBookSelectorWidget::addressee()<commit_msg>Fix the email icon name in the Address Book Selector Widget.<commit_after>/*
    AddressBookSelectorWidget

    Copyright (c) 2005 by <NAME> <<EMAIL>>

    Based on LinkAddressBookUI whose code was shamelessly stolen from
    kopete's add new contact wizard, used in Konversation, and then
    reappropriated by Kopete.

    LinkAddressBookUI:
    Copyright (c) 2004 by <NAME>           <<EMAIL>>
    Copyright (c) 2003-2005 by <NAME>   <<EMAIL>>
    Copyright (c) 2002 by <NAME>           <<EMAIL>>
    Copyright (c) 2002 by <NAME> <<EMAIL>>

    Kopete    (c) 2002-2004 by the Kopete developers  <<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 <qcheckbox.h>
#include <kconfig.h>
#include <klocale.h>
#include <kiconloader.h>

#include <kdeversion.h>
#include <kinputdialog.h>

#include <kpushbutton.h>
#include <k3activelabel.h>
#include <kdebug.h>
#include <k3listview.h>
#include <k3listviewsearchline.h>
#include <qlabel.h>


#include "addressbookselectorwidget.h"
#include <addresseeitem.h>
#include "kabcpersistence.h"

using namespace Kopete::UI;

namespace Kopete
{
namespace UI
{

AddressBookSelectorWidget::AddressBookSelectorWidget( QWidget *parent, const char *name )
		: QWidget(parent), Ui::AddressBookSelectorWidget_Base()
{
	setObjectName(name);
	setupUi(this);

	m_addressBook = Kopete::KABCPersistence::self()->addressBook();

	// Addressee validation connections
	connect( addAddresseeButton, SIGNAL( clicked() ), SLOT( slotAddAddresseeClicked() ) );
	connect( addAddresseeButton, SIGNAL( clicked() ), SIGNAL( addAddresseeClicked() ) );

	connect( addresseeListView, SIGNAL( clicked(Q3ListViewItem * ) ),
			SIGNAL( addresseeListClicked( Q3ListViewItem * ) ) );
	connect( addresseeListView, SIGNAL( selectionChanged( Q3ListViewItem * ) ),
			SIGNAL( addresseeListClicked( Q3ListViewItem * ) ) );
	connect( addresseeListView, SIGNAL( spacePressed( Q3ListViewItem * ) ),
			SIGNAL( addresseeListClicked( Q3ListViewItem * ) ) );

	connect( m_addressBook, SIGNAL( addressBookChanged( AddressBook * ) ), this, SLOT( slotLoadAddressees() ) );

	//We should add a clear KAction here.  But we can't really do that with a designer file :\  this sucks

	addresseeListView->setColumnText(2, KIcon(QLatin1String("internet-mail")), i18n("Email"));

	kListViewSearchLine->setListView(addresseeListView);
	slotLoadAddressees();

	addresseeListView->setColumnWidthMode(0, Q3ListView::Manual);
	addresseeListView->setColumnWidth(0, 63); //Photo is 60, and it's nice to have a small gap, imho
}


AddressBookSelectorWidget::~AddressBookSelectorWidget()
{
	disconnect( m_addressBook, SIGNAL( addressBookChanged( AddressBook * ) ), this, SLOT( slotLoadAddressees() ) );
}


KABC::Addressee AddressBookSelectorWidget::addressee()
{'fraction_non_alphanumeric': 0.14906832298136646, 'fraction_numerical': 0.01605817300409029, 'mean_word_length': 3.78059377262853, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 73, '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': '3619431', 'n_tokens_mistral': 2107, 'n_tokens_neox': 1913, 'n_words': 509}