2 * Copyright (C) 2007 Andriy Rysin (rysin@kde.org)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include <QHBoxLayout>
22 #include <KPluginFactory>
23 #include <KPluginLoader>
26 #include "kxkb_part.h"
27 #include "kxkbwidget.h"
31 K_PLUGIN_FACTORY(KxkbPartFactory
, registerPlugin
<KxkbPart
>();)
32 K_EXPORT_PLUGIN(KxkbPartFactory("kxkb_part"))
34 KxkbPart::KxkbPart( QWidget
* parent
,
35 const QList
<QVariant
>& args
)
38 int controlType
= KxkbWidget::NO_MENU
;
39 /* if( args.count() > 0 && args[0].type() == QVariant::Int ) { //TODO: replace with string?
40 controlType = args[0].toInt();
41 kDebug() << "controlType" << controlType << "(" << args[0] << ")";
42 if( controlType <= 0 ) {
43 kError() << "Wrong type for KxkbPart control";
48 m_kxkbCore
= new KxkbCore( KxkbCore::KXKB_COMPONENT
);
49 if( m_kxkbCore
->newInstance() == 0 ) {
50 KxkbLabel
* kxkbWidget
= new KxkbLabel(controlType
, this);
51 m_kxkbCore
->setWidget(kxkbWidget
);
53 QHBoxLayout
*layout
= new QHBoxLayout(this);
54 layout
->setSpacing( KDialog::spacingHint() );
55 layout
->setMargin( 0 );
56 layout
->addWidget( kxkbWidget
->widget(), 0, Qt::AlignCenter
);
69 KxkbPart::setLayout(const QString
& layoutPair
)
71 return m_kxkbCore
->setLayout(layoutPair
);
75 KxkbPart::getCurrentLayout()
77 return m_kxkbCore
->getCurrentLayout();
81 KxkbPart::getLayoutsList()
83 return m_kxkbCore
->getLayoutsList();