• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
  • ui
kopetewidgets.cpp
Go to the documentation of this file.
1 
6 #include <qwidgetplugin.h>
7 #include <QPixmap>
8 
9 #include <kcomponentdata.h>
10 #include <addressbooklinkwidget.h>
11 #include <kopetelistview.h>
12 #include <kopetelistviewsearchline.h>
13 #ifndef EMBED_IMAGES
14 #include <kstandarddirs.h>
15 #endif
16 
17 class KopeteWidgets : public QWidgetPlugin
18 {
19 public:
20  KopeteWidgets();
21 
22  virtual ~KopeteWidgets();
23 
24  virtual QStringList keys() const
25  {
26  QStringList result;
27  for (WidgetInfos::ConstIterator it = m_widgets.begin(); it != m_widgets.end(); ++it)
28  result << it.key();
29  return result;
30  }
31 
32  virtual QWidget *create(const QString &key, QWidget *parent = 0, const char *name = 0);
33 
34  virtual QIcon iconSet(const QString &key) const
35  {
36 #ifdef EMBED_IMAGES
37  QPixmap pix(m_widgets[key].iconSet);
38 #else
39  QPixmap pix(KStandardDirs::locate( "data",
40  QLatin1String("kopetewidgets/pics/") + m_widgets[key].iconSet));
41 #endif
42  return QIcon(pix);
43  }
44 
45  virtual bool isContainer(const QString &key) const { return m_widgets[key].isContainer; }
46 
47  virtual QString group(const QString &key) const { return m_widgets[key].group; }
48 
49  virtual QString includeFile(const QString &key) const { return m_widgets[key].includeFile; }
50 
51  virtual QString toolTip(const QString &key) const { return m_widgets[key].toolTip; }
52 
53  virtual QString whatsThis(const QString &key) const { return m_widgets[key].whatsThis; }
54 private:
55  struct WidgetInfo
56  {
57  QString group;
58 #ifdef EMBED_IMAGES
59  QPixmap iconSet;
60 #else
61  QString iconSet;
62 #endif
63  QString includeFile;
64  QString toolTip;
65  QString whatsThis;
66  bool isContainer;
67  };
68  typedef QMap<QString, WidgetInfo> WidgetInfos;
69  WidgetInfos m_widgets;
70 };
71 KopeteWidgets::KopeteWidgets()
72 {
73  WidgetInfo widget;
74 
75  widget.group = QLatin1String("Input (Kopete)");
76 #ifdef EMBED_IMAGES
77  widget.iconSet = QPixmap(kopete__ui__addressbooklinkwidget_xpm);
78 #else
79  widget.iconSet = QLatin1String("kopete__ui__addressbooklinkwidget.png");
80 #endif
81  widget.includeFile = QLatin1String("addressbooklinkwidget.h");
82  widget.toolTip = QLatin1String("Address Book Link Widget (Kopete)");
83  widget.whatsThis = QLatin1String("KABC::Addressee display/selector");
84  widget.isContainer = false;
85  m_widgets.insert(QLatin1String("Kopete::UI::AddressBookLinkWidget"), widget);
86 
87  widget.group = QLatin1String("Views (Kopete)");
88 #ifdef EMBED_IMAGES
89  widget.iconSet = QPixmap(kopete__ui__listview__listview_xpm);
90 #else
91  widget.iconSet = QLatin1String("kopete__ui__listview__listview.png");
92 #endif
93  widget.includeFile = QLatin1String("kopetelistview.h");
94  widget.toolTip = QLatin1String("List View (Kopete)");
95  widget.whatsThis = QLatin1String("A component capable list view widget.");
96  widget.isContainer = false;
97  m_widgets.insert(QLatin1String("Kopete::UI::ListView::ListView"), widget);
98 
99  widget.group = QLatin1String("Input (Kopete)");
100 #ifdef EMBED_IMAGES
101  widget.iconSet = QPixmap(kopete__ui__listview__searchline_xpm);
102 #else
103  widget.iconSet = QLatin1String("kopete__ui__listview__searchline.png");
104 #endif
105  widget.includeFile = QLatin1String("kopetelistviewsearchline.h");
106  widget.toolTip = QLatin1String("List View Search Line (Kopete)");
107  widget.whatsThis = QLatin1String("Search line able to use Kopete custom list View.");
108  widget.isContainer = false;
109  m_widgets.insert(QLatin1String("Kopete::UI::ListView::SearchLine"), widget);
110 
111  KComponentData("kopetewidgets"); // if it's the only KComponentData object then it stays as
112  // KGlobal::mainComponent()
113 }
114 KopeteWidgets::~KopeteWidgets()
115 {
116 
117 }
118 QWidget *KopeteWidgets::create(const QString &key, QWidget *parent, const char *name)
119 {
120 
121  if (key == QLatin1String("Kopete::UI::AddressBookLinkWidget"))
122  return new Kopete::UI::AddressBookLinkWidget(parent, name);
123 
124  if (key == QLatin1String("Kopete::UI::ListView::ListView"))
125  return new Kopete::UI::ListView::ListView(parent, name);
126 
127  if (key == QLatin1String("Kopete::UI::ListView::SearchLine"))
128  return new Kopete::UI::ListView::SearchLine(parent, 0, name);
129 
130  return 0;
131 }
132 KDE_Q_EXPORT_PLUGIN(KopeteWidgets)
133 
QWidget
kopetelistview.h
Kopete::UI::ListView::SearchLine
Definition: kopetelistviewsearchline.h:30
QMap< QString, WidgetInfo >
Kopete::UI::ListView::ListView
Definition: kopetelistview.h:37
addressbooklinkwidget.h
kopetelistviewsearchline.h
QString
QStringList
QPixmap
QLatin1String
Kopete::UI::AddressBookLinkWidget
A compact widget for showing and changing which address book item a particular Kopete::MetaContact is...
Definition: addressbooklinkwidget.h:44
QMap< QString, WidgetInfo >::ConstIterator
typedef ConstIterator
QIcon
name
const char * name
Definition: kopeteonlinestatus.cpp:104
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal