summaryrefslogtreecommitdiffstats
path: root/kopete/kopete/kopeteeditglobalidentitywidget.h
blob: 49a4e56427037491f3a9bd2ca08e52c8388fdd9a (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
/*
    kopeteeditglobalidentitywidget.h  -  Kopete Edit Global Identity widget

    Copyright (c) 2005      by Michaël Larouche       <michael.larouche@kdemail.net>

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

#include <tqwidget.h>
#include <tqlabel.h>

/**
 * This is a simple widget added to a toolbar in KopeteWindow.
 *
 * It can edit the global photo and the global nickname. 
 * When either the photo or the nickname change, it's set the source to Custom.
 * When well connected(signal/slot), it react to the toolbar icon size change.
 *
 * @author Michaël Larouche
 */
class KopeteEditGlobalIdentityWidget : public QWidget
{
	Q_OBJECT
public:
	KopeteEditGlobalIdentityWidget(TQWidget *parent = 0, const char *name = 0);
	virtual ~KopeteEditGlobalIdentityWidget();

public slots:
	/**
	 * This slot is called when the "parent" toolbar change its icon size.
	 */
	void iconSizeChanged();
	/**
	 * This slot is called to first set the icon size.
	 */
	void setIconSize(int size);

private:
	/**
	 * Create the internal widgets and signal/slots connections
	 */
	void createGUI();

private slots:
	/**
	 * When a global identity key is changed, update the GUI.
	 */
	void updateGUI(const TQString &key, const TQVariant &value);
	/**
	 * The photo label was clicked, show a ImageFileDialog.
	 */
	void photoClicked();
	/**
	 * The nickname was changed, display the text in red to display the change.
	 */
	void lineNicknameTextChanged(const TQString &text);
	/**
	 * User press Return/Enter in the KLineEdit, commit the new nickname.
	 */
	void changeNickname();

private:
	class Private;
	Private *d;
};

class TQMouseEvent;
/**
 * This is a special label that react to click. 
 * Also display a "hand" when hovered.
 *
 * @author Michaël Larouche
 */
class ClickableLabel : public QLabel
{
	Q_OBJECT	
public:
	ClickableLabel(TQWidget *parent = 0, const char *name = 0);

signals:
	void clicked();

protected:
	void mouseReleaseEvent(TQMouseEvent *event);
};

#endif