summaryrefslogtreecommitdiffstats
path: root/kopete/kopete/contactlist/kopeteaddrbookexport.h
blob: 131dad96036ce10d0a16273631c3ff854c3f8173 (plain)
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
101
102
/*
    kopeteaddrbookexport.h - Kopete Online Status

    Logic for exporting data acquired from messaging systems to the 
    KDE address book

    Copyright (c) 2004 by Will Stephenson <lists@stevello.free-online.co.uk>

    Kopete    (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>

    *************************************************************************
    *                                                                       *
    * 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.                                   *
    *                                                                       *
    *************************************************************************
*/

#ifndef KOPETEADDRBOOKEXPORT_H
#define KOPETEADDRBOOKEXPORT_H

#include <kabc/stdaddressbook.h>
#include <kabc/addressee.h>

#include "kopetecontactproperty.h"

class AddressBookExportUI;
class KDialogBase;
class KListBox;
class KComboBox;

namespace Kopete
{
class Contact;
class MetaContact;
}

class KopeteAddressBookExport : public QObject
{
public:
	KopeteAddressBookExport( TQWidget *parent, Kopete::MetaContact *mc );
	~KopeteAddressBookExport();
	
	/** 
	 * Display the dialog
	 * @return a TQDialog return code
	 */
	int showDialog();
	/**
	 * Export the data to KABC if changed, omitting any duplicates
	 */
	void exportData();
	
protected:
	/**
	 * Initialise the GUI labels with labels from KABC
	 */
	void initLabels();
	/**
	 * Populate the GUI with data from KABC
	 */
	void fetchKABCData();
	/**
	 * Populate a listbox with a given type of phone number
	 */
	void fetchPhoneNumbers( KListBox * listBox, int type, uint& counter );
	/**
	 * Populate the GUI with data from IM systems
	 */
	void fetchIMData();
	/**
	 * Populate a combobox with a contact's IM data
	 */
	void populateIM( const Kopete::Contact *contact, const TQPixmap &icon, 
			TQComboBox *combo, const Kopete::ContactPropertyTmpl &property );
	/**
	 * Populate a listbox with a contact's IM data
	 */
	void populateIM( const Kopete::Contact *contact, const TQPixmap &icon, 
			KListBox *combo, const Kopete::ContactPropertyTmpl &property );
	
	/** Check the selected item is not the first (existing KABC) item, or the same as it */
	bool newValue( TQComboBox *combo );
	TQStringList newValues( KListBox *listBox, uint counter );
	
	// the GUI
	TQWidget *mParent;
	KDialogBase * mDialog;
	TQPixmap mAddrBookIcon;
	AddressBookExportUI *mUI;
	Kopete::MetaContact *mMetaContact;
	KABC::AddressBook *mAddressBook;
	KABC::Addressee mAddressee;
	
	// counters tracking the number of KABC values where multiple values are possible in a single key
	uint numEmails, numHomePhones, numWorkPhones, numMobilePhones;

};

#endif