summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/metacontactselectorwidget.h
blob: fb0f1e178ee0bffbc74924183d851302ca9bdcb3 (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
103
104
105
/*
    MetaContactSelectorWidget

    Copyright (c) 2005 by Duncan Mac-Vicar Prett <duncan@kde.org>

    Kopete    (c) 2002-2005 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 MetaContactSelectorWidget_H
#define MetaContactSelectorWidget_H

#include <kdemacros.h>
#include <tqwidget.h>
#include "kopetelistviewitem.h"
#include "kopete_export.h"

class Kopete::MetaContact;

namespace Kopete
{
namespace UI
{

/**
 * @author Duncan Mac-Vicar Prett <duncan@kde.org>
 * This class provides a widget which allows easy selection
 * of available Kopete metacontacts.
 */
class KOPETE_EXPORT MetaContactSelectorWidget : public TQWidget
{
	Q_OBJECT
  
public:
	MetaContactSelectorWidget( TQWidget *parent = 0, const char *name  = 0 );
	~MetaContactSelectorWidget();
	Kopete::MetaContact* metaContact();
	/**
	 * sets the widget label message
	 * example: Please select a contact
	 * or, Choose a contact to delete
	 */
	void setLabelMessage( const TQString &msg );
	/**
	 * pre-selects a contact
	 */
	void selectMetaContact( Kopete::MetaContact *mc );
	/**
	 * excludes a metacontact from being shown in the list
	* if the metacontact is already excluded, do nothing
	 */
	void excludeMetaContact( Kopete::MetaContact *mc );
	/**
	 * @return true if there is a contact selected
	 */
	bool metaContactSelected();
protected slots:
	/**
	 * Utility function, populates the metacontact list
	 */
	void slotLoadMetaContacts();
signals:
	void metaContactListClicked( TQListViewItem *mc );
private:
	class Private;
	Private *d;
};

/**
 * @author Duncan Mac-Vicar Prett <duncan@kde.org>
 */

class MetaContactSelectorWidgetLVI : public Kopete::UI::ListView::Item
{
	Q_OBJECT
  
public:
	MetaContactSelectorWidgetLVI(Kopete::MetaContact *mc, TQListView *parent, TQObject *owner = 0, const char *name = 0 );
	Kopete::MetaContact* metaContact();
	virtual TQString text ( int column ) const;
protected slots:
	void slotPhotoChanged();
	void slotDisplayNameChanged();
	void buildVisualComponents();
	void slotUpdateContactBox();
private:
	class Private;
	Private *d;
};

} // namespace UI
} // namespace Kopete

#endif

// vim: set noet ts=4 sts=4 sw=4: