summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/addressbooklinkwidget.h
blob: 09574193d2b0784c3f22c20490a99f6e7dbce203 (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
/*
    AddressBookLinkWidget

    A compact widget for showing and changing which address book item a
    particular Kopete::MetaContact is related to.

    Comprises a label showing the contact's name, a Clear button, and a Change
    button that usually invokes the AddressBookSelectorWidget.

    Copyright (c) 2006 by Will Stephenson <wstephenson@kde.org>

    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 ADDRESSBOOKLINKWIDGET_H
#define ADDRESSBOOKLINKWIDGET_H

#include <kabc/addressee.h>

#include "addressbooklinkwidget_base.h"

namespace Kopete {
class MetaContact;

namespace UI {

/** 
 * A compact widget for showing and changing which address book item a
 * particular Kopete::MetaContact is related to.
 *
 * Comprises a label showing the contact's name, a Clear button, and a Change
 * button that usually invokes the AddressBookSelectorWidget.
 */
class AddressBookLinkWidget : public AddressBookLinkWidgetBase
{
Q_OBJECT
  
public:
	AddressBookLinkWidget( TQWidget * parent, const char * name );
	~AddressBookLinkWidget() {}
	/**
	 * Set the currently selected addressee
	 */
	void setAddressee( const KABC::Addressee& addr );
	/**
	 * Set the current metacontact so that the selector dialog may be preselected
	 */
	void setMetaContact( const Kopete::MetaContact * );
	/**
	 * Return the selected addressbook UID.
	 */
	TQString uid() const;
signals:
	/**
	 * Emitted when the selected addressee changed.  addr is the KABC::Addressee that was selected. If addr.isEmpty() is empty, the clear button was clicked.
	 */
	void addresseeChanged( const KABC::Addressee& addr );
	
	/**
	 * Provided so you can perform your own actions instead of opening the AddressBookSelectorWidget.
	 * To do so, TQObject::disconnect() btnSelectAddressee and connect your own slot to this signal
	 */
	void selectAddresseeClicked();
protected slots:
	void slotClearAddressee();
	void slotSelectAddressee();
private:
	const Kopete::MetaContact * mMetaContact;
	TQString mSelectedUid;
};
} // end namespace UI
} // end namespace Kopete
#endif