summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/kopetewidgets.cpp
blob: 093ee48e01a9094a0865b33527a50914854c799d (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* This file was autogenerated by makekdewidgets. Any changes will be lost!
* The generated code in this file is licensed under the same license that the
* input file.
*/
#include <qwidgetplugin.h>

#include <kinstance.h>
#include <addressbooklinkwidget.h>
#include <kopetelistview.h>
#include <kopetelistviewsearchline.h>
#ifndef EMBED_IMAGES
#include <kstandarddirs.h>
#endif

class KopeteWidgets : public QWidgetPlugin
{
public:
	KopeteWidgets();
	
	virtual ~KopeteWidgets();
	
	virtual QStringList keys() const
	{
		QStringList result;
		for (WidgetInfos::ConstIterator it = m_widgets.begin(); it != m_widgets.end(); ++it)
			result << it.key();
		return result;
	}
	
	virtual QWidget *create(const QString &key, QWidget *parent = 0, const char *name = 0);
	
	virtual QIconSet iconSet(const QString &key) const
	{
#ifdef EMBED_IMAGES
		QPixmap pix(m_widgets[key].iconSet);
#else
		QPixmap pix(locate( "data", 
			QString::fromLatin1("kopetewidgets/pics/") + m_widgets[key].iconSet));
#endif
		return QIconSet(pix);
	}
	
	virtual bool isContainer(const QString &key) const { return m_widgets[key].isContainer; }
	
	virtual QString group(const QString &key) const { return m_widgets[key].group; }
	
	virtual QString includeFile(const QString &key) const { return m_widgets[key].includeFile; }
	
	virtual QString toolTip(const QString &key) const { return m_widgets[key].toolTip; }
	
	virtual QString whatsThis(const QString &key) const { return m_widgets[key].whatsThis; }
private:
	struct WidgetInfo
	{
		QString group;
#ifdef EMBED_IMAGES
		QPixmap iconSet;
#else
		QString iconSet;
#endif
		QString includeFile;
		QString toolTip;
		QString whatsThis;
		bool isContainer;
	};
	typedef QMap<QString, WidgetInfo> WidgetInfos;
	WidgetInfos m_widgets;
};
KopeteWidgets::KopeteWidgets()
{
        WidgetInfo widget;

	widget.group = QString::fromLatin1("Input (Kopete)");
#ifdef EMBED_IMAGES
	widget.iconSet = QPixmap(kopete__ui__addressbooklinkwidget_xpm);
#else
	widget.iconSet = QString::fromLatin1("kopete__ui__addressbooklinkwidget.png");
#endif
	widget.includeFile = QString::fromLatin1("addressbooklinkwidget.h");
	widget.toolTip = QString::fromLatin1("Address Book Link Widget (Kopete)");
	widget.whatsThis = QString::fromLatin1("KABC::Addressee display/selector");
	widget.isContainer = false;
	m_widgets.insert(QString::fromLatin1("Kopete::UI::AddressBookLinkWidget"), widget);

	widget.group = QString::fromLatin1("Views (Kopete)");
#ifdef EMBED_IMAGES
	widget.iconSet = QPixmap(kopete__ui__listview__listview_xpm);
#else
	widget.iconSet = QString::fromLatin1("kopete__ui__listview__listview.png");
#endif
	widget.includeFile = QString::fromLatin1("kopetelistview.h");
	widget.toolTip = QString::fromLatin1("List View (Kopete)");
	widget.whatsThis = QString::fromLatin1("A component capable list view widget.");
	widget.isContainer = false;
	m_widgets.insert(QString::fromLatin1("Kopete::UI::ListView::ListView"), widget);

	widget.group = QString::fromLatin1("Input (Kopete)");
#ifdef EMBED_IMAGES
	widget.iconSet = QPixmap(kopete__ui__listview__searchline_xpm);
#else
	widget.iconSet = QString::fromLatin1("kopete__ui__listview__searchline.png");
#endif
	widget.includeFile = QString::fromLatin1("kopetelistviewsearchline.h");
	widget.toolTip = QString::fromLatin1("List View Search Line (Kopete)");
	widget.whatsThis = QString::fromLatin1("Search line able to use Kopete custom list View.");
	widget.isContainer = false;
	m_widgets.insert(QString::fromLatin1("Kopete::UI::ListView::SearchLine"), widget);

	new KInstance("kopetewidgets");
}
KopeteWidgets::~KopeteWidgets()
{
	
}
QWidget *KopeteWidgets::create(const QString &key, QWidget *parent, const char *name)
{

         if (key == QString::fromLatin1("Kopete::UI::AddressBookLinkWidget"))
                return new Kopete::UI::AddressBookLinkWidget(parent, name);

         if (key == QString::fromLatin1("Kopete::UI::ListView::ListView"))
                return new Kopete::UI::ListView::ListView(parent, name);

         if (key == QString::fromLatin1("Kopete::UI::ListView::SearchLine"))
                return new Kopete::UI::ListView::SearchLine(parent, 0, name);

	return 0;
}
KDE_Q_EXPORT_PLUGIN(KopeteWidgets)