1
/***************************************************************************
2
* Copyright (C) 2010 by Kai Dombrowe <just89@gmx.de> *
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 *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18
***************************************************************************/
22
#include "pluginpage.h"
25
#include <joschycore/manager.h>
29
#include <kiconloader.h>
33
#include <QtGui/QListWidgetItem>
36
Q_DECLARE_METATYPE(Joschy::PluginInfo);
37
PluginPage::PluginPage(QWidget *parent)
43
connect(providerList, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChanged(int)));
45
registerField("Provider*", nameLine);
50
Joschy::PluginInfo PluginPage::plugin() const
53
QListWidgetItem *item = providerList->item(providerList->currentRow());
56
return item->data(Qt::UserRole+1).value<Joschy::PluginInfo>();
62
void PluginPage::initializePage()
65
providerList->clear();
66
foreach (const Joschy::PluginInfo &info, Joschy::Manager::self()->availableProvider()) {
67
QListWidgetItem *item = new QListWidgetItem();
68
item->setText(info.name());
69
item->setIcon(KIcon(info.icon()));
70
item->setData(Qt::UserRole+1, QVariant::fromValue(info));
72
providerList->addItem(item);
74
providerList->setCurrentRow(0);
80
void PluginPage::currentRowChanged(int currentRow)
83
QListWidgetItem *item = providerList->item(currentRow);
88
const Joschy::PluginInfo info = item->data(Qt::UserRole+1).value<Joschy::PluginInfo>();
89
nameLine->setText(info.name());
90
descriptionLine->setText(info.description());
91
versionLine->setText(info.version());
93
setField("Provider", info.name());
98
#include "pluginpage.moc"