summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/userinfodialog.h
blob: 7df19f4fd7f283864f975ff5a11ff0c92af44a59 (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
/*
    userinfodialog.h

    Copyright (c) 2003 by Zack Rusin <zack@kde.org>

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

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef USERINFODIALOG_H
#define USERINFODIALOG_H

#include <kdialogbase.h>
#include <qstring.h>

#include "kopete_export.h"

class KLineEdit;

namespace Kopete {

	class KOPETE_EXPORT UserInfoDialog : public KDialogBase
	{
		Q_OBJECT
	public:
		UserInfoDialog( const QString& descr );
		virtual ~UserInfoDialog();


		/**
		 * Specifies the look of this dialog. If set to HTML only
		 * KHTMLPart will be in the dialog and it's look can be customized
		 * through setStyleSheet
		 * @see setStyleSheet
		 */
		enum DialogStyle { HTML, Widget };
		void setStyle( DialogStyle style );

		// The functions below set elements as specified in the name.
		// If an element is not set it won't be displayed.
		void setName( const QString& name );
		void setId( const QString& id );
		void setAwayMessage( const QString& msg );
		void setStatus( const QString& status );
		void setWarningLevel(const QString& level  );
		void setOnlineSince( const QString& since );
		void setInfo( const QString& info );
		void setAddress( const QString& addr );
		void setPhone( const QString& phone );

		void addCustomField( const QString& name, const QString& txt );
		void addHTMLText( const QString& str );

		///Shows the dialog
		virtual void show();
	protected:
		/**
		 * This function has to be called after setting all the fields.
		 * It builds the GUI for the dialog. By default show() calls it.
		 */
		virtual void create();
		//Fills the dialog HTML if DialogStyle is HTML
		virtual void fillHTML();
		//Fills the dialog with widgets if DialogStyle is Widget
		virtual void fillWidgets();

		/**
		 * If the DialogStyle is set to HTML one can customize the look of this
		 * dialog by setting the right stylesheet. The CSS id elements that can be
		 * customized include : "name", "id", "warningLevel", "onlineSince",
		 * "address", "phone", "status", "awayMessage" and "info".
		 */
		void setStyleSheet( const QString& css );

		QHBox* addLabelEdit( const QString& label, const QString& text, KLineEdit*& edit );

	private:
		struct UserInfoDialogPrivate;
		UserInfoDialogPrivate *d;
	};

}
#endif