2
* Copyright (C) 2003 by Unai Garro <ugarro@users.sourceforge.net>
3
* Copyright (C) 2007 by Oswald Buddenhagen <ossi@kde.org>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "kdmbutton.h"
22
#include "kdmthemer.h"
28
#include <QPushButton>
30
KdmButton::KdmButton(QObject *parent, const QDomNode &node)
31
: KdmItem(parent, node)
37
const QString locale = KGlobal::locale()->language();
40
QDomNodeList childList = node.childNodes();
41
bool stockUsed = false;
42
for (int nod = 0; nod < childList.count(); nod++) {
43
QDomNode child = childList.item(nod);
44
QDomElement el = child.toElement();
45
QString tagName = el.tagName();
47
if (tagName == "text" && el.attributes().count() == 0 && !stockUsed) {
49
} else if (tagName == "text" && !stockUsed) {
50
QString lang = el.attribute("xml:lang", "");
53
} else if (tagName == "stock") {
54
text = KdmLabel::lookupStock(el.attribute("type", ""));
59
text.replace('\n', ' ').replace('_', '&');
63
KdmButton::doPlugActions(bool)
65
QWidget *w = themer()->widget();
68
QPushButton *btn = new QPushButton(text, w);
69
btn->setAutoDefault(false);
71
myWidget->hide(); // yes, really
72
setWidgetAttribs(myWidget);
73
connect(myWidget, SIGNAL(destroyed()), SLOT(widgetGone()));
74
connect(myWidget, SIGNAL(clicked()), SLOT(activate()));
83
KdmButton::widgetGone()
93
emit activated(objectName());
97
KdmButton::drawContents(QPainter *, const QRect &)
101
#include "kdmbutton.moc"